@zipify/wysiwyg 4.1.0 → 4.2.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/.editorconfig +1 -1
  2. package/.eslintignore +1 -0
  3. package/.eslintrc.js +63 -4
  4. package/.github/actions/lint-css/action.yaml +2 -2
  5. package/.github/actions/lint-js/action.yaml +7 -7
  6. package/.github/actions/setup/action.yaml +6 -12
  7. package/.github/actions/unit-tests/action.yaml +2 -2
  8. package/.github/dependabot.yaml +12 -12
  9. package/.github/workflows/frontend-ci.yaml +58 -56
  10. package/config/build/cli.config.js +15 -12
  11. package/config/build/{example.config.mjs → example.config.ts} +4 -11
  12. package/config/build/{lib.config.mjs → lib.config.ts} +9 -14
  13. package/config/build/settings.js +9 -3
  14. package/dist/cli.js +17 -2
  15. package/dist/types/Wysiwyg.vue.d.ts +176 -0
  16. package/dist/types/cli/NodeDomParser.d.ts +7 -0
  17. package/dist/types/cli/commands/Command.d.ts +9 -0
  18. package/dist/types/cli/commands/ToJsonCommand.d.ts +18 -0
  19. package/dist/types/cli/commands/VersionCommand.d.ts +5 -0
  20. package/dist/types/cli/commands/index.d.ts +2 -0
  21. package/dist/types/cli/index.d.ts +1 -0
  22. package/dist/types/components/base/Button.vue.d.ts +19 -0
  23. package/dist/types/components/base/ButtonToggle.vue.d.ts +19 -0
  24. package/dist/types/components/base/Checkbox.vue.d.ts +10 -0
  25. package/dist/types/components/base/FieldLabel.vue.d.ts +12 -0
  26. package/dist/types/components/base/Icon.vue.d.ts +11 -0
  27. package/dist/types/components/base/Modal.vue.d.ts +28 -0
  28. package/dist/types/components/base/ModalFloating.vue.d.ts +20 -0
  29. package/dist/types/components/base/NumberField.vue.d.ts +22 -0
  30. package/dist/types/components/base/Range.vue.d.ts +16 -0
  31. package/dist/types/components/base/ScrollView.vue.d.ts +7 -0
  32. package/dist/types/components/base/TextField.vue.d.ts +14 -0
  33. package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +18 -0
  34. package/dist/types/components/base/colorPicker/composables/index.d.ts +2 -0
  35. package/dist/types/components/base/colorPicker/composables/usePickerApi.d.ts +14 -0
  36. package/dist/types/components/base/colorPicker/composables/usePickerHotkeys.d.ts +5 -0
  37. package/dist/types/components/base/colorPicker/index.d.ts +1 -0
  38. package/dist/types/components/base/composables/index.d.ts +8 -0
  39. package/dist/types/components/base/composables/useActivatedListener.d.ts +7 -0
  40. package/dist/types/components/base/composables/useDeselectionLock.d.ts +4 -0
  41. package/dist/types/components/base/composables/useElementRef.d.ts +1 -0
  42. package/dist/types/components/base/composables/useModalToggler.d.ts +9 -0
  43. package/dist/types/components/base/composables/useNumberValue.d.ts +12 -0
  44. package/dist/types/components/base/composables/useScrollView.d.ts +6 -0
  45. package/dist/types/components/base/composables/useTempValue.d.ts +4 -0
  46. package/dist/types/components/base/composables/useValidator.d.ts +7 -0
  47. package/dist/types/components/base/dropdown/Dropdown.vue.d.ts +22 -0
  48. package/dist/types/components/base/dropdown/DropdownActivator.vue.d.ts +17 -0
  49. package/dist/types/components/base/dropdown/DropdownDivider.vue.d.ts +2 -0
  50. package/dist/types/components/base/dropdown/DropdownGroup.vue.d.ts +14 -0
  51. package/dist/types/components/base/dropdown/DropdownMenu.vue.d.ts +14 -0
  52. package/dist/types/components/base/dropdown/DropdownOption.vue.d.ts +12 -0
  53. package/dist/types/components/base/dropdown/composables/index.d.ts +2 -0
  54. package/dist/types/components/base/dropdown/composables/useActiveOptionManager.d.ts +11 -0
  55. package/dist/types/components/base/dropdown/composables/useDropdownEntityTitle.d.ts +1 -0
  56. package/dist/types/components/base/dropdown/index.d.ts +1 -0
  57. package/dist/types/components/base/dropdown/injectionTokens.d.ts +5 -0
  58. package/dist/types/components/base/index.d.ts +3 -0
  59. package/dist/types/components/index.d.ts +1 -0
  60. package/dist/types/components/toolbar/Toolbar.vue.d.ts +17 -0
  61. package/dist/types/components/toolbar/ToolbarFloating.vue.d.ts +14 -0
  62. package/dist/types/components/toolbar/base/ToolbarDivider.vue.d.ts +32 -0
  63. package/dist/types/components/toolbar/base/ToolbarGroup.vue.d.ts +2 -0
  64. package/dist/types/components/toolbar/base/ToolbarRow.vue.d.ts +2 -0
  65. package/dist/types/components/toolbar/base/index.d.ts +1 -0
  66. package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +4 -0
  67. package/dist/types/components/toolbar/controls/BackgroundColorControl.vue.d.ts +2 -0
  68. package/dist/types/components/toolbar/controls/CaseStyleControl.vue.d.ts +2 -0
  69. package/dist/types/components/toolbar/controls/FontColorControl.vue.d.ts +2 -0
  70. package/dist/types/components/toolbar/controls/FontFamilyControl.vue.d.ts +2 -0
  71. package/dist/types/components/toolbar/controls/FontSizeControl.vue.d.ts +2 -0
  72. package/dist/types/components/toolbar/controls/FontWeightControl.vue.d.ts +2 -0
  73. package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +2 -0
  74. package/dist/types/components/toolbar/controls/LineHeightControl.vue.d.ts +2 -0
  75. package/dist/types/components/toolbar/controls/ListControl.vue.d.ts +2 -0
  76. package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +2 -0
  77. package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +2 -0
  78. package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +2 -0
  79. package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +2 -0
  80. package/dist/types/components/toolbar/controls/composables/index.d.ts +1 -0
  81. package/dist/types/components/toolbar/controls/composables/useRecentFonts.d.ts +7 -0
  82. package/dist/types/components/toolbar/controls/index.d.ts +2 -0
  83. package/dist/types/components/toolbar/controls/link/LinkControl.vue.d.ts +2 -0
  84. package/dist/types/components/toolbar/controls/link/LinkControlHeader.vue.d.ts +4 -0
  85. package/dist/types/components/toolbar/controls/link/composables/index.d.ts +1 -0
  86. package/dist/types/components/toolbar/controls/link/composables/useLink.d.ts +22 -0
  87. package/dist/types/components/toolbar/controls/link/destination/LinkControlDestination.vue.d.ts +10 -0
  88. package/dist/types/components/toolbar/controls/link/destination/LinkControlPageBlock.vue.d.ts +8 -0
  89. package/dist/types/components/toolbar/controls/link/destination/LinkControlUrl.vue.d.ts +12 -0
  90. package/dist/types/components/toolbar/controls/link/destination/index.d.ts +1 -0
  91. package/dist/types/components/toolbar/controls/link/index.d.ts +1 -0
  92. package/dist/types/components/toolbar/controls/stylePreset/StylePresetControl.vue.d.ts +2 -0
  93. package/dist/types/components/toolbar/controls/stylePreset/StylePresetOption.vue.d.ts +22 -0
  94. package/dist/types/components/toolbar/controls/stylePreset/index.d.ts +1 -0
  95. package/dist/types/components/toolbar/index.d.ts +1 -0
  96. package/dist/types/components/toolbar/layouts/ToolbarDesktop.vue.d.ts +7 -0
  97. package/dist/types/components/toolbar/layouts/ToolbarMobile.vue.d.ts +2 -0
  98. package/dist/types/components/toolbar/layouts/ToolbarPopup.vue.d.ts +7 -0
  99. package/dist/types/components/toolbar/layouts/index.d.ts +1 -0
  100. package/dist/types/composables/index.d.ts +2 -0
  101. package/dist/types/composables/useEditor.d.ts +15 -0
  102. package/dist/types/directives/index.d.ts +2 -0
  103. package/dist/types/directives/outClick.d.ts +9 -0
  104. package/dist/types/directives/tooltip.d.ts +4 -0
  105. package/{lib/entryLib.js → dist/types/entryLib.d.ts} +1 -1
  106. package/dist/types/enums/Alignments.d.ts +7 -0
  107. package/dist/types/enums/CaseStyles.d.ts +5 -0
  108. package/dist/types/enums/Devices.d.ts +7 -0
  109. package/dist/types/enums/LinkDestinations.d.ts +4 -0
  110. package/dist/types/enums/LinkTargets.d.ts +4 -0
  111. package/dist/types/enums/ListTypes.d.ts +10 -0
  112. package/dist/types/enums/MarkGroups.d.ts +4 -0
  113. package/dist/types/enums/NodeTypes.d.ts +9 -0
  114. package/dist/types/enums/TextSettings.d.ts +19 -0
  115. package/dist/types/enums/index.d.ts +9 -0
  116. package/dist/types/extensions/Alignment.d.ts +2 -0
  117. package/dist/types/extensions/BackgroundColor.d.ts +2 -0
  118. package/dist/types/extensions/CaseStyle.d.ts +2 -0
  119. package/dist/types/extensions/DeviceManager.d.ts +2 -0
  120. package/dist/types/extensions/FontColor.d.ts +2 -0
  121. package/dist/types/extensions/FontFamily.d.ts +4 -0
  122. package/dist/types/extensions/FontSize.d.ts +5 -0
  123. package/dist/types/extensions/FontStyle.d.ts +2 -0
  124. package/dist/types/extensions/FontWeight.d.ts +2 -0
  125. package/dist/types/extensions/LineHeight.d.ts +2 -0
  126. package/dist/types/extensions/Link.d.ts +1 -0
  127. package/dist/types/extensions/Margin.d.ts +2 -0
  128. package/dist/types/extensions/StylePreset.d.ts +2 -0
  129. package/dist/types/extensions/Superscript.d.ts +2 -0
  130. package/dist/types/extensions/TextDecoration.d.ts +2 -0
  131. package/dist/types/extensions/core/Document.d.ts +1 -0
  132. package/dist/types/extensions/core/Heading.d.ts +6 -0
  133. package/dist/types/extensions/core/NodeProcessor.d.ts +2 -0
  134. package/dist/types/extensions/core/Paragraph.d.ts +5 -0
  135. package/dist/types/extensions/core/SelectionProcessor.d.ts +4 -0
  136. package/dist/types/extensions/core/TextProcessor.d.ts +2 -0
  137. package/dist/types/extensions/core/index.d.ts +2 -0
  138. package/dist/types/extensions/index.d.ts +1 -0
  139. package/dist/types/extensions/list/List.d.ts +5 -0
  140. package/dist/types/extensions/list/ListItem.d.ts +5 -0
  141. package/dist/types/extensions/list/index.d.ts +1 -0
  142. package/dist/types/extensions/proseMirror/PasteLinkPlugin.d.ts +8 -0
  143. package/dist/types/extensions/proseMirror/PastePlugin.d.ts +22 -0
  144. package/dist/types/extensions/proseMirror/PlaceholderPlugin.d.ts +12 -0
  145. package/dist/types/extensions/proseMirror/ProseMirrorPlugin.d.ts +9 -0
  146. package/dist/types/extensions/proseMirror/index.d.ts +3 -0
  147. package/dist/types/extensions/steps/SetDocAttr.d.ts +19 -0
  148. package/dist/types/extensions/steps/index.d.ts +1 -0
  149. package/dist/types/injectionTokens.d.ts +8 -0
  150. package/dist/types/models/Font.d.ts +17 -0
  151. package/dist/types/models/index.d.ts +2 -0
  152. package/dist/types/regExps.d.ts +6 -0
  153. package/dist/types/services/ContentSerializer.d.ts +15 -0
  154. package/dist/types/services/ContextWindow.d.ts +8 -0
  155. package/dist/types/services/FavoriteColors.d.ts +8 -0
  156. package/dist/types/services/HtmlToJsonParser.d.ts +6 -0
  157. package/dist/types/services/JsonSerializer.d.ts +4 -0
  158. package/dist/types/services/NodeFactory.d.ts +128 -0
  159. package/dist/types/services/NodeSelector.d.ts +9 -0
  160. package/dist/types/services/Storage.d.ts +10 -0
  161. package/dist/types/services/StylePresetRenderer.d.ts +15 -0
  162. package/dist/types/services/index.d.ts +10 -0
  163. package/dist/types/services/normalizer/BaseNormalizer.d.ts +7 -0
  164. package/dist/types/services/normalizer/BrowserDomParser.d.ts +5 -0
  165. package/dist/types/services/normalizer/ContentNormalizer.d.ts +8 -0
  166. package/dist/types/services/normalizer/HtmlNormalizer.d.ts +41 -0
  167. package/dist/types/services/normalizer/JsonNormalizer.d.ts +14 -0
  168. package/dist/types/services/normalizer/index.d.ts +1 -0
  169. package/dist/types/utils/capitalize.d.ts +1 -0
  170. package/dist/types/utils/convertAlignment.d.ts +1 -0
  171. package/dist/types/utils/convertColor.d.ts +1 -0
  172. package/dist/types/utils/convertFontSize.d.ts +1 -0
  173. package/dist/types/utils/convertLineHeight.d.ts +1 -0
  174. package/dist/types/utils/copyMark.d.ts +1 -0
  175. package/dist/types/utils/createCommand.d.ts +1 -0
  176. package/dist/types/utils/createKeyboardShortcut.d.ts +3 -0
  177. package/dist/types/utils/findMarkByType.d.ts +1 -0
  178. package/dist/types/utils/importIcon.d.ts +1 -0
  179. package/{lib/utils/index.js → dist/types/utils/index.d.ts} +1 -0
  180. package/dist/types/utils/isMarkAppliedToParent.d.ts +1 -0
  181. package/dist/types/utils/isNodeFullySelected.d.ts +1 -0
  182. package/dist/types/utils/isWysiwygContent.d.ts +7 -0
  183. package/dist/types/utils/renderInlineSetting.d.ts +4 -0
  184. package/dist/types/utils/resolvePositionOffset.d.ts +1 -0
  185. package/dist/types/utils/resolveTextPosition.d.ts +4 -0
  186. package/dist/wysiwyg.d.ts +1 -0
  187. package/dist/wysiwyg.mjs +194 -152
  188. package/example/ExampleApp.vue +1 -1
  189. package/example/{example.js → example.ts} +1 -1
  190. package/example/index.html +1 -1
  191. package/jest.config.js +20 -5
  192. package/lib/Wysiwyg.vue +16 -12
  193. package/lib/components/base/__tests__/Modal.test.js +2 -2
  194. package/lib/composables/index.ts +2 -0
  195. package/lib/composables/{useEditor.js → useEditor.ts} +24 -7
  196. package/lib/entryLib.ts +6 -0
  197. package/lib/extensions/StylePreset.js +3 -3
  198. package/lib/models/{Font.js → Font.ts} +19 -8
  199. package/lib/models/index.ts +2 -0
  200. package/lib/utils/importIcon.js +1 -1
  201. package/lib/utils/index.ts +17 -0
  202. package/lib/utils/isWysiwygContent.ts +18 -0
  203. package/package.json +47 -32
  204. package/tsconfig.json +32 -0
  205. package/tsconfig.types.json +22 -0
  206. package/lib/composables/index.js +0 -1
  207. package/lib/models/index.js +0 -1
  208. package/lib/utils/isWysiwygContent.js +0 -12
  209. /package/lib/{entryCli.js → entryCli.ts} +0 -0
  210. /package/lib/models/__tests__/{Font.test.js → Font.test.ts} +0 -0
package/dist/cli.js CHANGED
@@ -1,4 +1,19 @@
1
- "use strict";var t=require("events"),e=require("child_process"),n=require("path"),r=require("fs"),o=require("process"),i=require("jsdom"),s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l={exports:{}},c={},u={};let h=class extends Error{constructor(t,e,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}};u.CommanderError=h,u.InvalidArgumentError=class extends h{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};const{InvalidArgumentError:p}=u;c.Argument=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?e.concat(t):[t]}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new p(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,e):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},c.humanReadableArgName=function(t){const e=t.name()+(!0===t.variadic?"...":"");return t.required?"<"+e+">":"["+e+"]"};var d={},f={};const{humanReadableArgName:m}=c;f.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(t){const e=t.commands.filter((t=>!t._hidden));if(t._hasImplicitHelpCommand()){const[,n,r]=t._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),o=t.createCommand(n).helpOption(!1);o.description(t._helpCommandDescription),r&&o.arguments(r),e.push(o)}return this.sortSubcommands&&e.sort(((t,e)=>t.name().localeCompare(e.name()))),e}compareOptions(t,e){const n=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return n(t).localeCompare(n(e))}visibleOptions(t){const e=t.options.filter((t=>!t.hidden)),n=t._hasHelpOption&&t._helpShortFlag&&!t._findOption(t._helpShortFlag),r=t._hasHelpOption&&!t._findOption(t._helpLongFlag);if(n||r){let o;o=n?r?t.createOption(t._helpFlags,t._helpDescription):t.createOption(t._helpShortFlag,t._helpDescription):t.createOption(t._helpLongFlag,t._helpDescription),e.push(o)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const e=[];for(let n=t.parent;n;n=n.parent){const t=n.options.filter((t=>!t.hidden));e.push(...t)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach((e=>{e.description=e.description||t._argsDescription[e.name()]||""})),t.registeredArguments.find((t=>t.description))?t.registeredArguments:[]}subcommandTerm(t){const e=t.registeredArguments.map((t=>m(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce(((t,n)=>Math.max(t,e.subcommandTerm(n).length)),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce(((t,n)=>Math.max(t,e.optionTerm(n).length)),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce(((t,n)=>Math.max(t,e.optionTerm(n).length)),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce(((t,n)=>Math.max(t,e.argumentTerm(n).length)),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let n="";for(let e=t.parent;e;e=e.parent)n=e.name()+" "+n;return n+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`),void 0!==t.defaultValue){(t.required||t.optional||t.isBoolean()&&"boolean"==typeof t.defaultValue)&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}return void 0!==t.presetArg&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),void 0!==t.envVar&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){const e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`),void 0!==t.defaultValue&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){const n=`(${e.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,e){const n=e.padWidth(t,e),r=e.helpWidth||80;function o(t,o){if(o){const i=`${t.padEnd(n+2)}${o}`;return e.wrap(i,r-2,n+2)}return t}function i(t){return t.join("\n").replace(/^/gm," ".repeat(2))}let s=[`Usage: ${e.commandUsage(t)}`,""];const a=e.commandDescription(t);a.length>0&&(s=s.concat([e.wrap(a,r,0),""]));const l=e.visibleArguments(t).map((t=>o(e.argumentTerm(t),e.argumentDescription(t))));l.length>0&&(s=s.concat(["Arguments:",i(l),""]));const c=e.visibleOptions(t).map((t=>o(e.optionTerm(t),e.optionDescription(t))));if(c.length>0&&(s=s.concat(["Options:",i(c),""])),this.showGlobalOptions){const n=e.visibleGlobalOptions(t).map((t=>o(e.optionTerm(t),e.optionDescription(t))));n.length>0&&(s=s.concat(["Global Options:",i(n),""]))}const u=e.visibleCommands(t).map((t=>o(e.subcommandTerm(t),e.subcommandDescription(t))));return u.length>0&&(s=s.concat(["Commands:",i(u),""])),s.join("\n")}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}wrap(t,e,n,r=40){const o=new RegExp("[\\n][ \\f\\t\\v   -    \ufeff]+");if(t.match(o))return t;const i=e-n;if(i<r)return t;const s=t.slice(0,n),a=t.slice(n).replace("\r\n","\n"),l=" ".repeat(n),c="\\s​",u=new RegExp(`\n|.{1,${i-1}}([${c}]|$)|[^${c}]+?([${c}]|$)`,"g");return s+(a.match(u)||[]).map(((t,e)=>"\n"===t?"":(e>0?l:"")+t.trimEnd())).join("\n")}};var g={};const{InvalidArgumentError:y}=u;function v(t){let e,n;const r=t.split(/[ |,]+/);return r.length>1&&!/^[[<]/.test(r[1])&&(e=r.shift()),n=r.shift(),!e&&/^-[^-]$/.test(n)&&(e=n,n=void 0),{shortFlag:e,longFlag:n}}g.Option=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;const n=v(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return"string"==typeof t&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?e.concat(t):[t]}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new y(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,e):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce(((t,e)=>t+e[0].toUpperCase()+e.slice(1)))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},g.splitOptionFlags=v,g.DualOptions=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach((t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)})),this.negativeOptions.forEach(((t,e)=>{this.positiveOptions.has(e)&&this.dualOptions.add(e)}))}valueFromOption(t,e){const n=e.attributeName();if(!this.dualOptions.has(n))return!0;const r=this.negativeOptions.get(n).presetArg,o=void 0!==r&&r;return e.negate===(o===t)}};var b={};const _=3;b.suggestSimilar=function(t,e){if(!e||0===e.length)return"";e=Array.from(new Set(e));const n=t.startsWith("--");n&&(t=t.slice(2),e=e.map((t=>t.slice(2))));let r=[],o=_;return e.forEach((e=>{if(e.length<=1)return;const n=function(t,e){if(Math.abs(t.length-e.length)>_)return Math.max(t.length,e.length);const n=[];for(let e=0;e<=t.length;e++)n[e]=[e];for(let t=0;t<=e.length;t++)n[0][t]=t;for(let r=1;r<=e.length;r++)for(let o=1;o<=t.length;o++){let i=1;i=t[o-1]===e[r-1]?0:1,n[o][r]=Math.min(n[o-1][r]+1,n[o][r-1]+1,n[o-1][r-1]+i),o>1&&r>1&&t[o-1]===e[r-2]&&t[o-2]===e[r-1]&&(n[o][r]=Math.min(n[o][r],n[o-2][r-2]+1))}return n[t.length][e.length]}(t,e),i=Math.max(t.length,e.length);(i-n)/i>.4&&(n<o?(o=n,r=[e]):n===o&&r.push(e))})),r.sort(((t,e)=>t.localeCompare(e))),n&&(r=r.map((t=>`--${t}`))),r.length>1?`\n(Did you mean one of ${r.join(", ")}?)`:1===r.length?`\n(Did you mean ${r[0]}?)`:""};const w=t.EventEmitter,k=e,x=n,S=r,E=o,{Argument:C,humanReadableArgName:O}=c,{CommanderError:A}=u,{Help:M}=f,{Option:T,splitOptionFlags:N,DualOptions:I}=g,{suggestSimilar:R}=b;function D(t,e){t._hasHelpOption&&e.find((e=>e===t._helpLongFlag||e===t._helpShortFlag))&&(t.outputHelp(),t._exit(0,"commander.helpDisplayed","(outputHelp)"))}function L(t){return t.map((t=>{if(!t.startsWith("--inspect"))return t;let e,n,r="127.0.0.1",o="9229";return null!==(n=t.match(/^(--inspect(-brk)?)$/))?e=n[1]:null!==(n=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(e=n[1],/^\d+$/.test(n[3])?o=n[3]:r=n[3]):null!==(n=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(e=n[1],r=n[3],o=n[4]),e&&"0"!==o?`${e}=${r}:${parseInt(o)+1}`:t}))}d.Command=class t extends w{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>E.stdout.write(t),writeErr:t=>E.stderr.write(t),getOutHelpWidth:()=>E.stdout.isTTY?E.stdout.columns:void 0,getErrHelpWidth:()=>E.stderr.isTTY?E.stderr.columns:void 0,outputError:(t,e)=>e(t)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._hasHelpOption=t._hasHelpOption,this._helpFlags=t._helpFlags,this._helpDescription=t._helpDescription,this._helpShortFlag=t._helpShortFlag,this._helpLongFlag=t._helpLongFlag,this._helpCommandName=t._helpCommandName,this._helpCommandnameAndArgs=t._helpCommandnameAndArgs,this._helpCommandDescription=t._helpCommandDescription,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){const t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,n){let r=e,o=n;"object"==typeof r&&null!==r&&(o=r,r=null),o=o||{};const[,i,s]=t.match(/([^ ]+) *(.*)/),a=this.createCommand(i);return r&&(a.description(r),a._executableHandler=!0),o.isDefault&&(this._defaultCommandName=a._name),a._hidden=!(!o.noHelp&&!o.hidden),a._executableFile=o.executableFile||null,s&&a.arguments(s),this.commands.push(a),a.parent=this,a.copyInheritedSettings(this),r?this:a}createCommand(e){return new t(e)}createHelp(){return Object.assign(new M,this.configureHelp())}configureHelp(t){return void 0===t?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return void 0===t?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return"string"!=typeof t&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(e=e||{}).isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this.commands.push(t),t.parent=this,this}createArgument(t,e){return new C(t,e)}argument(t,e,n,r){const o=this.createArgument(t,e);return"function"==typeof n?o.default(r).argParser(n):o.default(n),this.addArgument(o),this}arguments(t){return t.trim().split(/ +/).forEach((t=>{this.argument(t)})),this}addArgument(t){const e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&void 0!==t.defaultValue&&void 0===t.parseArg)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}addHelpCommand(t,e){return!1===t?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,"string"==typeof t&&(this._helpCommandName=t.split(" ")[0],this._helpCommandnameAndArgs=t),this._helpCommandDescription=e||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return void 0===this._addImplicitHelpCommand?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(t,e){const n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return this._exitCallback=t||(t=>{if("commander.executeSubCommandAsync"!==t.code)throw t}),this}_exit(t,e,n){this._exitCallback&&this._exitCallback(new A(t,e,n)),E.exit(t)}action(t){return this._actionHandler=e=>{const n=this.registeredArguments.length,r=e.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),t.apply(this,r)},this}createOption(t,e){return new T(t,e)}_callParseArg(t,e,n,r){try{return t.parseArg(e,n)}catch(t){if("commander.invalidArgument"===t.code){const e=`${r} ${t.message}`;this.error(e,{exitCode:t.exitCode,code:t.code})}throw t}}addOption(t){const e=t.name(),n=t.attributeName();if(t.negate){const e=t.long.replace(/^--no-/,"--");this._findOption(e)||this.setOptionValueWithSource(n,void 0===t.defaultValue||t.defaultValue,"default")}else void 0!==t.defaultValue&&this.setOptionValueWithSource(n,t.defaultValue,"default");this.options.push(t);const r=(e,r,o)=>{null==e&&void 0!==t.presetArg&&(e=t.presetArg);const i=this.getOptionValue(n);null!==e&&t.parseArg?e=this._callParseArg(t,e,i,r):null!==e&&t.variadic&&(e=t._concatValue(e,i)),null==e&&(e=!t.negate&&(!(!t.isBoolean()&&!t.optional)||"")),this.setOptionValueWithSource(n,e,o)};return this.on("option:"+e,(e=>{const n=`error: option '${t.flags}' argument '${e}' is invalid.`;r(e,n,"cli")})),t.envVar&&this.on("optionEnv:"+e,(e=>{const n=`error: option '${t.flags}' value '${e}' from env '${t.envVar}' is invalid.`;r(e,n,"env")})),this}_optionEx(t,e,n,r,o){if("object"==typeof e&&e instanceof T)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(e,n);if(i.makeOptionMandatory(!!t.mandatory),"function"==typeof r)i.default(o).argParser(r);else if(r instanceof RegExp){const t=r;r=(e,n)=>{const r=t.exec(e);return r?r[0]:n},i.default(o).argParser(r)}else i.default(r);return this.addOption(i)}option(t,e,n,r){return this._optionEx({},t,e,n,r)}requiredOption(t,e,n,r){return this._optionEx({mandatory:!0},t,e,n,r)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){if(this._passThroughOptions=!!t,this.parent&&t&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,n){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach((n=>{void 0!==n.getOptionValueSource(t)&&(e=n.getOptionValueSource(t))})),e}_prepareUserArgs(t,e){if(void 0!==t&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");let n;switch(e=e||{},void 0===t&&(t=E.argv,E.versions&&E.versions.electron&&(e.from="electron")),this.rawArgs=t.slice(),e.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":E.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,e){const n=this._prepareUserArgs(t,e);return this._parseCommand([],n),this}async parseAsync(t,e){const n=this._prepareUserArgs(t,e);return await this._parseCommand([],n),this}_executeSubCommand(t,e){e=e.slice();let n=!1;const r=[".js",".ts",".tsx",".mjs",".cjs"];function o(t,e){const n=x.resolve(t,e);if(S.existsSync(n))return n;if(r.includes(x.extname(e)))return;const o=r.find((t=>S.existsSync(`${n}${t}`)));return o?`${n}${o}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i,s=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let t;try{t=S.realpathSync(this._scriptPath)}catch(e){t=this._scriptPath}a=x.resolve(x.dirname(t),a)}if(a){let e=o(a,s);if(!e&&!t._executableFile&&this._scriptPath){const n=x.basename(this._scriptPath,x.extname(this._scriptPath));n!==this._name&&(e=o(a,`${n}-${t._name}`))}s=e||s}if(n=r.includes(x.extname(s)),"win32"!==E.platform?n?(e.unshift(s),e=L(E.execArgv).concat(e),i=k.spawn(E.argv[0],e,{stdio:"inherit"})):i=k.spawn(s,e,{stdio:"inherit"}):(e.unshift(s),e=L(E.execArgv).concat(e),i=k.spawn(E.execPath,e,{stdio:"inherit"})),!i.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((t=>{E.on(t,(()=>{!1===i.killed&&null===i.exitCode&&i.kill(t)}))}))}const l=this._exitCallback;l?i.on("close",(()=>{l(new A(E.exitCode||0,"commander.executeSubCommandAsync","(close)"))})):i.on("close",E.exit.bind(E)),i.on("error",(e=>{if("ENOENT"===e.code){const e=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",n=`'${s}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${e}`;throw new Error(n)}if("EACCES"===e.code)throw new Error(`'${s}' not executable`);if(l){const t=new A(1,"commander.executeSubCommandAsync","(error)");t.nestedError=e,l(t)}else E.exit(1)})),this.runningCommand=i}_dispatchSubcommand(t,e,n){const r=this._findCommand(t);let o;return r||this.help({error:!0}),o=this._chainOrCallSubCommandHook(o,r,"preSubcommand"),o=this._chainOrCall(o,(()=>{if(!r._executableHandler)return r._parseCommand(e,n);this._executeSubCommand(r,e.concat(n))})),o}_dispatchHelpCommand(t){t||this.help();const e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,e)=>{t.required&&null==this.args[e]&&this.missingArgument(t.name())})),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const t=(t,e,n)=>{let r=e;if(null!==e&&t.parseArg){const o=`error: command-argument value '${e}' is invalid for argument '${t.name()}'.`;r=this._callParseArg(t,e,n,o)}return r};this._checkNumberOfArguments();const e=[];this.registeredArguments.forEach(((n,r)=>{let o=n.defaultValue;n.variadic?r<this.args.length?(o=this.args.slice(r),n.parseArg&&(o=o.reduce(((e,r)=>t(n,r,e)),n.defaultValue))):void 0===o&&(o=[]):r<this.args.length&&(o=this.args[r],n.parseArg&&(o=t(n,o,n.defaultValue))),e[r]=o})),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&"function"==typeof t.then?t.then((()=>e())):e()}_chainOrCallHooks(t,e){let n=t;const r=[];return this._getCommandAndAncestors().reverse().filter((t=>void 0!==t._lifeCycleHooks[e])).forEach((t=>{t._lifeCycleHooks[e].forEach((e=>{r.push({hookedCommand:t,callback:e})}))})),"postAction"===e&&r.reverse(),r.forEach((t=>{n=this._chainOrCall(n,(()=>t.callback(t.hookedCommand,this)))})),n}_chainOrCallSubCommandHook(t,e,n){let r=t;return void 0!==this._lifeCycleHooks[n]&&this._lifeCycleHooks[n].forEach((t=>{r=this._chainOrCall(r,(()=>t(this,e)))})),r}_parseCommand(t,e){const n=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),e=n.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._hasImplicitHelpCommand()&&t[0]===this._helpCommandName)return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return D(this,e),this._dispatchSubcommand(this._defaultCommandName,t,e);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),D(this,n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){let n;return r(),this._processArguments(),n=this._chainOrCallHooks(n,"preAction"),n=this._chainOrCall(n,(()=>this._actionHandler(this.processedArgs))),this.parent&&(n=this._chainOrCall(n,(()=>{this.parent.emit(o,t,e)}))),n=this._chainOrCallHooks(n,"postAction"),n}if(this.parent&&this.parent.listenerCount(o))r(),this._processArguments(),this.parent.emit(o,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(t){if(t)return this.commands.find((e=>e._name===t||e._aliases.includes(t)))}_findOption(t){return this.options.find((e=>e.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((e=>{e.mandatory&&void 0===t.getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const e=t.attributeName();return void 0!==this.getOptionValue(e)&&"default"!==this.getOptionValueSource(e)})),e=t.filter((t=>t.conflictsWith.length>0));e.forEach((e=>{const n=t.find((t=>e.conflictsWith.includes(t.attributeName())));n&&this._conflictingOption(e,n)}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const e=[],n=[];let r=e;const o=t.slice();function i(t){return t.length>1&&"-"===t[0]}let s=null;for(;o.length;){const t=o.shift();if("--"===t){r===n&&r.push(t),r.push(...o);break}if(!s||i(t)){if(s=null,i(t)){const e=this._findOption(t);if(e){if(e.required){const t=o.shift();void 0===t&&this.optionMissingArgument(e),this.emit(`option:${e.name()}`,t)}else if(e.optional){let t=null;o.length>0&&!i(o[0])&&(t=o.shift()),this.emit(`option:${e.name()}`,t)}else this.emit(`option:${e.name()}`);s=e.variadic?e:null;continue}}if(t.length>2&&"-"===t[0]&&"-"!==t[1]){const e=this._findOption(`-${t[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,t.slice(2)):(this.emit(`option:${e.name()}`),o.unshift(`-${t.slice(2)}`));continue}}if(/^--[^=]+=/.test(t)){const e=t.indexOf("="),n=this._findOption(t.slice(0,e));if(n&&(n.required||n.optional)){this.emit(`option:${n.name()}`,t.slice(e+1));continue}}if(i(t)&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&0===e.length&&0===n.length){if(this._findCommand(t)){e.push(t),o.length>0&&n.push(...o);break}if(t===this._helpCommandName&&this._hasImplicitHelpCommand()){e.push(t),o.length>0&&e.push(...o);break}if(this._defaultCommandName){n.push(t),o.length>0&&n.push(...o);break}}if(this._passThroughOptions){r.push(t),o.length>0&&r.push(...o);break}r.push(t)}else this.emit(`option:${s.name()}`,t)}return{operands:e,unknown:n}}opts(){if(this._storeOptionsAsProperties){const t={},e=this.options.length;for(let n=0;n<e;n++){const e=this.options[n].attributeName();t[e]=e===this._versionOptionName?this._version:this[e]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,e)=>Object.assign(t,e.opts())),{})}error(t,e){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const n=e||{},r=n.exitCode||1,o=n.code||"commander.error";this._exit(r,o,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in E.env){const e=t.attributeName();(void 0===this.getOptionValue(e)||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,E.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}}))}_parseOptionsImplied(){const t=new I(this.options),e=t=>void 0!==this.getOptionValue(t)&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((n=>void 0!==n.implied&&e(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n))).forEach((t=>{Object.keys(t.implied).filter((t=>!e(t))).forEach((e=>{this.setOptionValueWithSource(e,t.implied[e],"implied")}))}))}missingArgument(t){const e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){const e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){const n=t=>{const e=t.attributeName(),n=this.getOptionValue(e),r=this.options.find((t=>t.negate&&e===t.attributeName())),o=this.options.find((t=>!t.negate&&e===t.attributeName()));return r&&(void 0===r.presetArg&&!1===n||void 0!==r.presetArg&&n===r.presetArg)?r:o||t},r=t=>{const e=n(t),r=e.attributeName();return"env"===this.getOptionValueSource(r)?`environment variable '${e.envVar}'`:`option '${e.flags}'`},o=`error: ${r(t)} cannot be used with ${r(e)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],r=this;do{const t=r.createHelp().visibleOptions(r).filter((t=>t.long)).map((t=>t.long));n=n.concat(t),r=r.parent}while(r&&!r._enablePositionalOptions);e=R(t,n)}const n=`error: unknown option '${t}'${e}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const e=this.registeredArguments.length,n=1===e?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${n} but got ${t.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let e="";if(this._showSuggestionAfterError){const n=[];this.createHelp().visibleCommands(this).forEach((t=>{n.push(t.name()),t.alias()&&n.push(t.alias())})),e=R(t,n)}const n=`error: unknown command '${t}'${e}`;this.error(n,{code:"commander.unknownCommand"})}version(t,e,n){if(void 0===t)return this._version;this._version=t,e=e||"-V, --version",n=n||"output the version number";const r=this.createOption(e,n);return this._versionOptionName=r.attributeName(),this.options.push(r),this.on("option:"+r.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`),this._exit(0,"commander.version",t)})),this}description(t,e){return void 0===t&&void 0===e?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return void 0===t?this._summary:(this._summary=t,this)}alias(t){if(void 0===t)return this._aliases[0];let e=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");return e._aliases.push(t),this}aliases(t){return void 0===t?this._aliases:(t.forEach((t=>this.alias(t))),this)}usage(t){if(void 0===t){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>O(t)));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=t,this}name(t){return void 0===t?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=x.basename(t,x.extname(t)),this}executableDir(t){return void 0===t?this._executableDir:(this._executableDir=t,this)}helpInformation(t){const e=this.createHelp();return void 0===e.helpWidth&&(e.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),e.formatHelp(this,e)}_getHelpContext(t){const e={error:!!(t=t||{}).error};let n;return n=e.error?t=>this._outputConfiguration.writeErr(t):t=>this._outputConfiguration.writeOut(t),e.write=t.write||n,e.command=this,e}outputHelp(t){let e;"function"==typeof t&&(e=t,t=void 0);const n=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",n))),this.emit("beforeHelp",n);let r=this.helpInformation(n);if(e&&(r=e(r),"string"!=typeof r&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._helpLongFlag&&this.emit(this._helpLongFlag),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",n)))}helpOption(t,e){if("boolean"==typeof t)return this._hasHelpOption=t,this;this._helpFlags=t||this._helpFlags,this._helpDescription=e||this._helpDescription;const n=N(this._helpFlags);return this._helpShortFlag=n.shortFlag,this._helpLongFlag=n.longFlag,this}help(t){this.outputHelp(t);let e=E.exitCode||0;0===e&&t&&"function"!=typeof t&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){const n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${n.join("', '")}'`);const r=`${t}Help`;return this.on(r,(t=>{let n;n="function"==typeof e?e({error:t.error,command:t.command}):e,n&&t.write(`${n}\n`)})),this}},function(t,e){const{Argument:n}=c,{Command:r}=d,{CommanderError:o,InvalidArgumentError:i}=u,{Help:s}=f,{Option:a}=g;(e=t.exports=new r).program=e,e.Command=r,e.Option=a,e.Argument=n,e.Help=s,e.CommanderError=o,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}(l,l.exports);var $=a(l.exports);const{program:P,createCommand:z,createArgument:j,createOption:F,CommanderError:H,InvalidArgumentError:B,InvalidOptionArgumentError:V,Command:W,Argument:q,Option:U,Help:K}=$;function J(t,e){const n=Object.create(null),r=t.split(",");for(let t=0;t<r.length;t++)n[r[t]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const G="production"!==process.env.NODE_ENV?Object.freeze({}):{};"production"===process.env.NODE_ENV||Object.freeze([]);const Y=()=>{},X=t=>111===t.charCodeAt(0)&&110===t.charCodeAt(1)&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Z=Object.assign,Q=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},tt=Object.prototype.hasOwnProperty,et=(t,e)=>tt.call(t,e),nt=Array.isArray,rt=t=>"[object Map]"===ht(t),ot=t=>"[object Set]"===ht(t),it=t=>"function"==typeof t,st=t=>"string"==typeof t,at=t=>"symbol"==typeof t,lt=t=>null!==t&&"object"==typeof t,ct=t=>(lt(t)||it(t))&&it(t.then)&&it(t.catch),ut=Object.prototype.toString,ht=t=>ut.call(t),pt=t=>ht(t).slice(8,-1),dt=t=>"[object Object]"===ht(t),ft=t=>st(t)&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,mt=(t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))})((t=>t.charAt(0).toUpperCase()+t.slice(1))),gt=(t,e)=>!Object.is(t,e),yt=(t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})};let vt;const bt=()=>vt||(vt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function _t(t){if(nt(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],o=st(r)?St(r):_t(r);if(o)for(const t in o)e[t]=o[t]}return e}if(st(t)||lt(t))return t}const wt=/;(?![^(]*\))/g,kt=/:([^]+)/,xt=/\/\*[^]*?\*\//g;function St(t){const e={};return t.replace(xt,"").split(wt).forEach((t=>{if(t){const n=t.split(kt);n.length>1&&(e[n[0].trim()]=n[1].trim())}})),e}function Et(t){let e="";if(st(t))e=t;else if(nt(t))for(let n=0;n<t.length;n++){const r=Et(t[n]);r&&(e+=r+" ")}else if(lt(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function Ct(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let Ot;const At=t=>{const e=new Set(t);return e.w=0,e.n=0,e},Mt=t=>(t.w&Rt)>0,Tt=t=>(t.n&Rt)>0,Nt=new WeakMap;let It=0,Rt=1;const Dt=30;let Lt;const $t=Symbol("production"!==process.env.NODE_ENV?"iterate":""),Pt=Symbol("production"!==process.env.NODE_ENV?"Map key iterate":"");class zt{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,function(t,e=Ot){e&&e.active&&e.effects.push(t)}(this,n)}run(){if(!this.active)return this.fn();let t=Lt,e=Ft;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=Lt,Lt=this,Ft=!0,Rt=1<<++It,It<=Dt?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=Rt})(this):jt(this),this.fn()}finally{It<=Dt&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let r=0;r<e.length;r++){const o=e[r];Mt(o)&&!Tt(o)?o.delete(t):e[n++]=o,o.w&=~Rt,o.n&=~Rt}e.length=n}})(this),Rt=1<<--It,Lt=this.parent,Ft=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){Lt===this?this.deferStop=!0:this.active&&(jt(this),this.onStop&&this.onStop(),this.active=!1)}}function jt(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let Ft=!0;const Ht=[];function Bt(){Ht.push(Ft),Ft=!1}function Vt(){const t=Ht.pop();Ft=void 0===t||t}function Wt(t,e,n){if(Ft&&Lt){let r=Nt.get(t);r||Nt.set(t,r=new Map);let o=r.get(n);o||r.set(n,o=At());qt(o,"production"!==process.env.NODE_ENV?{effect:Lt,target:t,type:e,key:n}:void 0)}}function qt(t,e){let n=!1;It<=Dt?Tt(t)||(t.n|=Rt,n=!Mt(t)):n=!t.has(Lt),n&&(t.add(Lt),Lt.deps.push(t),"production"!==process.env.NODE_ENV&&Lt.onTrack&&Lt.onTrack(Z({effect:Lt},e)))}function Ut(t,e,n,r,o,i){const s=Nt.get(t);if(!s)return;let a=[];if("clear"===e)a=[...s.values()];else if("length"===n&&nt(t)){const t=Number(r);s.forEach(((e,n)=>{("length"===n||!at(n)&&n>=t)&&a.push(e)}))}else switch(void 0!==n&&a.push(s.get(n)),e){case"add":nt(t)?ft(n)&&a.push(s.get("length")):(a.push(s.get($t)),rt(t)&&a.push(s.get(Pt)));break;case"delete":nt(t)||(a.push(s.get($t)),rt(t)&&a.push(s.get(Pt)));break;case"set":rt(t)&&a.push(s.get($t))}const l="production"!==process.env.NODE_ENV?{target:t,type:e,key:n,newValue:r,oldValue:o,oldTarget:i}:void 0;if(1===a.length)a[0]&&("production"!==process.env.NODE_ENV?Kt(a[0],l):Kt(a[0]));else{const t=[];for(const e of a)e&&t.push(...e);"production"!==process.env.NODE_ENV?Kt(At(t),l):Kt(At(t))}}function Kt(t,e){const n=nt(t)?t:[...t];for(const t of n)t.computed&&Jt(t,e);for(const t of n)t.computed||Jt(t,e)}function Jt(t,e){(t!==Lt||t.allowRecurse)&&("production"!==process.env.NODE_ENV&&t.onTrigger&&t.onTrigger(Z({effect:t},e)),t.scheduler?t.scheduler():t.run())}const Gt=J("__proto__,__v_isRef,__isVue"),Yt=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(at)),Xt=Zt();function Zt(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Fe(this);for(let t=0,e=this.length;t<e;t++)Wt(n,"get",t+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(Fe)):r}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){Bt();const n=Fe(this)[e].apply(this,t);return Vt(),n}})),t}function Qt(t){const e=Fe(this);return Wt(e,"has",t),e.hasOwnProperty(t)}class te{constructor(t=!1,e=!1){this._isReadonly=t,this._shallow=e}get(t,e,n){const r=this._isReadonly,o=this._shallow;if("__v_isReactive"===e)return!r;if("__v_isReadonly"===e)return r;if("__v_isShallow"===e)return o;if("__v_raw"===e)return n===(r?o?Ne:Te:o?Me:Ae).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(n)?t:void 0;const i=nt(t);if(!r){if(i&&et(Xt,e))return Reflect.get(Xt,e,n);if("hasOwnProperty"===e)return Qt}const s=Reflect.get(t,e,n);return(at(e)?Yt.has(e):Gt(e))?s:(r||Wt(t,"get",e),o?s:qe(s)?i&&ft(e)?s:s.value:lt(s)?r?Re(s):Ie(s):s)}}class ee extends te{constructor(t=!1){super(!1,t)}set(t,e,n,r){let o=t[e];if(Pe(o)&&qe(o)&&!qe(n))return!1;if(!this._shallow&&(ze(n)||Pe(n)||(o=Fe(o),n=Fe(n)),!nt(t)&&qe(o)&&!qe(n)))return o.value=n,!0;const i=nt(t)&&ft(e)?Number(e)<t.length:et(t,e),s=Reflect.set(t,e,n,r);return t===Fe(r)&&(i?gt(n,o)&&Ut(t,"set",e,n,o):Ut(t,"add",e,n)),s}deleteProperty(t,e){const n=et(t,e),r=t[e],o=Reflect.deleteProperty(t,e);return o&&n&&Ut(t,"delete",e,void 0,r),o}has(t,e){const n=Reflect.has(t,e);return at(e)&&Yt.has(e)||Wt(t,"has",e),n}ownKeys(t){return Wt(t,"iterate",nt(t)?"length":$t),Reflect.ownKeys(t)}}class ne extends te{constructor(t=!1){super(!0,t)}set(t,e){return"production"!==process.env.NODE_ENV&&Ct(`Set operation on key "${String(e)}" failed: target is readonly.`,t),!0}deleteProperty(t,e){return"production"!==process.env.NODE_ENV&&Ct(`Delete operation on key "${String(e)}" failed: target is readonly.`,t),!0}}const re=new ee,oe=new ne,ie=new ne(!0),se=t=>t,ae=t=>Reflect.getPrototypeOf(t);function le(t,e,n=!1,r=!1){const o=Fe(t=t.__v_raw),i=Fe(e);n||(gt(e,i)&&Wt(o,"get",e),Wt(o,"get",i));const{has:s}=ae(o),a=r?se:n?Be:He;return s.call(o,e)?a(t.get(e)):s.call(o,i)?a(t.get(i)):void(t!==o&&t.get(e))}function ce(t,e=!1){const n=this.__v_raw,r=Fe(n),o=Fe(t);return e||(gt(t,o)&&Wt(r,"has",t),Wt(r,"has",o)),t===o?n.has(t):n.has(t)||n.has(o)}function ue(t,e=!1){return t=t.__v_raw,!e&&Wt(Fe(t),"iterate",$t),Reflect.get(t,"size",t)}function he(t){t=Fe(t);const e=Fe(this);return ae(e).has.call(e,t)||(e.add(t),Ut(e,"add",t,t)),this}function pe(t,e){e=Fe(e);const n=Fe(this),{has:r,get:o}=ae(n);let i=r.call(n,t);i?"production"!==process.env.NODE_ENV&&Oe(n,r,t):(t=Fe(t),i=r.call(n,t));const s=o.call(n,t);return n.set(t,e),i?gt(e,s)&&Ut(n,"set",t,e,s):Ut(n,"add",t,e),this}function de(t){const e=Fe(this),{has:n,get:r}=ae(e);let o=n.call(e,t);o?"production"!==process.env.NODE_ENV&&Oe(e,n,t):(t=Fe(t),o=n.call(e,t));const i=r?r.call(e,t):void 0,s=e.delete(t);return o&&Ut(e,"delete",t,void 0,i),s}function fe(){const t=Fe(this),e=0!==t.size,n="production"!==process.env.NODE_ENV?rt(t)?new Map(t):new Set(t):void 0,r=t.clear();return e&&Ut(t,"clear",void 0,void 0,n),r}function me(t,e){return function(n,r){const o=this,i=o.__v_raw,s=Fe(i),a=e?se:t?Be:He;return!t&&Wt(s,"iterate",$t),i.forEach(((t,e)=>n.call(r,a(t),a(e),o)))}}function ge(t,e,n){return function(...r){const o=this.__v_raw,i=Fe(o),s=rt(i),a="entries"===t||t===Symbol.iterator&&s,l="keys"===t&&s,c=o[t](...r),u=n?se:e?Be:He;return!e&&Wt(i,"iterate",l?Pt:$t),{next(){const{value:t,done:e}=c.next();return e?{value:t,done:e}:{value:a?[u(t[0]),u(t[1])]:u(t),done:e}},[Symbol.iterator](){return this}}}}function ye(t){return function(...e){if("production"!==process.env.NODE_ENV){const n=e[0]?`on key "${e[0]}" `:"";console.warn(`${mt(t)} operation ${n}failed: target is readonly.`,Fe(this))}return"delete"!==t&&("clear"===t?void 0:this)}}function ve(){const t={get(t){return le(this,t)},get size(){return ue(this)},has:ce,add:he,set:pe,delete:de,clear:fe,forEach:me(!1,!1)},e={get(t){return le(this,t,!1,!0)},get size(){return ue(this)},has:ce,add:he,set:pe,delete:de,clear:fe,forEach:me(!1,!0)},n={get(t){return le(this,t,!0)},get size(){return ue(this,!0)},has(t){return ce.call(this,t,!0)},add:ye("add"),set:ye("set"),delete:ye("delete"),clear:ye("clear"),forEach:me(!0,!1)},r={get(t){return le(this,t,!0,!0)},get size(){return ue(this,!0)},has(t){return ce.call(this,t,!0)},add:ye("add"),set:ye("set"),delete:ye("delete"),clear:ye("clear"),forEach:me(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((o=>{t[o]=ge(o,!1,!1),n[o]=ge(o,!0,!1),e[o]=ge(o,!1,!0),r[o]=ge(o,!0,!0)})),[t,n,e,r]}const[be,_e,we,ke]=ve();function xe(t,e){const n=e?t?ke:we:t?_e:be;return(e,r,o)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(et(n,r)&&r in e?n:e,r,o)}const Se={get:xe(!1,!1)},Ee={get:xe(!0,!1)},Ce={get:xe(!0,!0)};function Oe(t,e,n){const r=Fe(n);if(r!==n&&e.call(t,r)){const e=pt(t);console.warn(`Reactive ${e} contains both the raw and reactive versions of the same object${"Map"===e?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Ae=new WeakMap,Me=new WeakMap,Te=new WeakMap,Ne=new WeakMap;function Ie(t){return Pe(t)?t:Le(t,!1,re,Se,Ae)}function Re(t){return Le(t,!0,oe,Ee,Te)}function De(t){return Le(t,!0,ie,Ce,Ne)}function Le(t,e,n,r,o){if(!lt(t))return"production"!==process.env.NODE_ENV&&console.warn(`value cannot be made reactive: ${String(t)}`),t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=o.get(t);if(i)return i;const s=(a=t).__v_skip||!Object.isExtensible(a)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(pt(a));var a;if(0===s)return t;const l=new Proxy(t,2===s?r:n);return o.set(t,l),l}function $e(t){return Pe(t)?$e(t.__v_raw):!(!t||!t.__v_isReactive)}function Pe(t){return!(!t||!t.__v_isReadonly)}function ze(t){return!(!t||!t.__v_isShallow)}function je(t){return $e(t)||Pe(t)}function Fe(t){const e=t&&t.__v_raw;return e?Fe(e):t}const He=t=>lt(t)?Ie(t):t,Be=t=>lt(t)?Re(t):t;function Ve(t){Ft&&Lt&&(t=Fe(t),"production"!==process.env.NODE_ENV?qt(t.dep||(t.dep=At()),{target:t,type:"get",key:"value"}):qt(t.dep||(t.dep=At())))}function We(t,e){const n=(t=Fe(t)).dep;n&&("production"!==process.env.NODE_ENV?Kt(n,{target:t,type:"set",key:"value",newValue:e}):Kt(n))}function qe(t){return!(!t||!0!==t.__v_isRef)}function Ue(t){return function(t,e){if(qe(t))return t;return new Ke(t,e)}(t,!1)}class Ke{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Fe(t),this._value=e?t:He(t)}get value(){return Ve(this),this._value}set value(t){const e=this.__v_isShallow||ze(t)||Pe(t);t=e?t:Fe(t),gt(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:He(t),We(this,t))}}function Je(t){return qe(t)?t.value:t}const Ge={get:(t,e,n)=>Je(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const o=t[e];return qe(o)&&!qe(n)?(o.value=n,!0):Reflect.set(t,e,n,r)}};class Ye{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return t=Fe(this._object),e=this._key,null==(n=Nt.get(t))?void 0:n.get(e);var t,e,n}}class Xe{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Ze(t,e,n){return qe(t)?t:it(t)?new Xe(t):lt(t)&&arguments.length>1?function(t,e,n){const r=t[e];return qe(r)?r:new Ye(t,e,n)}(t,e,n):Ue(t)}class Qe{constructor(t,e,n,r){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new zt(t,(()=>{this._dirty||(this._dirty=!0,We(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=n}get value(){const t=Fe(this);return Ve(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}const tn=[];function en(t,...e){if("production"===process.env.NODE_ENV)return;Bt();const n=tn.length?tn[tn.length-1].component:null,r=n&&n.appContext.config.warnHandler,o=function(){let t=tn[tn.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}();if(r)sn(r,n,11,[t+e.join(""),n&&n.proxy,o.map((({vnode:t})=>`at <${wr(n,t.type)}>`)).join("\n"),o]);else{const n=[`[Vue warn]: ${t}`,...e];o.length&&n.push("\n",...function(t){const e=[];return t.forEach(((t,n)=>{e.push(...0===n?[]:["\n"],...function({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=!!t.component&&null==t.component.parent,o=` at <${wr(t.component,t.type,r)}`,i=">"+n;return t.props?[o,...nn(t.props),i]:[o+i]}(t))})),e}(o)),console.warn(...n)}Vt()}function nn(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach((n=>{e.push(...rn(n,t[n]))})),n.length>3&&e.push(" ..."),e}function rn(t,e,n){return st(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):"number"==typeof e||"boolean"==typeof e||null==e?n?e:[`${t}=${e}`]:qe(e)?(e=rn(t,Fe(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):it(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=Fe(e),n?e:[`${t}=`,e])}const on={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"};function sn(t,e,n,r){let o;try{o=r?t(...r):t()}catch(t){ln(t,e,n)}return o}function an(t,e,n,r){if(it(t)){const o=sn(t,e,n,r);return o&&ct(o)&&o.catch((t=>{ln(t,e,n)})),o}const o=[];for(let i=0;i<t.length;i++)o.push(an(t[i],e,n,r));return o}function ln(t,e,n,r=!0){const o=e?e.vnode:null;if(e){let r=e.parent;const o=e.proxy,i="production"!==process.env.NODE_ENV?on[n]:n;for(;r;){const e=r.ec;if(e)for(let n=0;n<e.length;n++)if(!1===e[n](t,o,i))return;r=r.parent}const s=e.appContext.config.errorHandler;if(s)return void sn(s,null,10,[t,o,i])}!function(t,e,n,r=!0){if("production"!==process.env.NODE_ENV){const i=on[e];if(n&&(o=n,tn.push(o)),en("Unhandled error"+(i?` during execution of ${i}`:"")),n&&tn.pop(),r)throw t;console.error(t)}else console.error(t);var o}(t,n,o,r)}let cn=!1,un=!1;const hn=[];let pn=0;const dn=[];let fn=null,mn=0;const gn=Promise.resolve();let yn=null;const vn=100;function bn(t){const e=yn||gn;return t?e.then(this?t.bind(this):t):e}function _n(t){hn.length&&hn.includes(t,cn&&t.allowRecurse?pn+1:pn)||(null==t.id?hn.push(t):hn.splice(function(t){let e=pn+1,n=hn.length;for(;e<n;){const r=e+n>>>1,o=hn[r],i=xn(o);i<t||i===t&&o.pre?e=r+1:n=r}return e}(t.id),0,t),wn())}function wn(){cn||un||(un=!0,yn=gn.then(En))}function kn(t){nt(t)?dn.push(...t):fn&&fn.includes(t,t.allowRecurse?mn+1:mn)||dn.push(t),wn()}const xn=t=>null==t.id?1/0:t.id,Sn=(t,e)=>{const n=xn(t)-xn(e);if(0===n){if(t.pre&&!e.pre)return-1;if(e.pre&&!t.pre)return 1}return n};function En(t){un=!1,cn=!0,"production"!==process.env.NODE_ENV&&(t=t||new Map),hn.sort(Sn);const e="production"!==process.env.NODE_ENV?e=>Cn(t,e):Y;try{for(pn=0;pn<hn.length;pn++){const t=hn[pn];if(t&&!1!==t.active){if("production"!==process.env.NODE_ENV&&e(t))continue;sn(t,null,14)}}}finally{pn=0,hn.length=0,function(t){if(dn.length){const e=[...new Set(dn)];if(dn.length=0,fn)return void fn.push(...e);for(fn=e,"production"!==process.env.NODE_ENV&&(t=t||new Map),fn.sort(((t,e)=>xn(t)-xn(e))),mn=0;mn<fn.length;mn++)"production"!==process.env.NODE_ENV&&Cn(t,fn[mn])||fn[mn]();fn=null,mn=0}}(t),cn=!1,yn=null,(hn.length||dn.length)&&En(t)}}function Cn(t,e){if(t.has(e)){const n=t.get(e);if(n>vn){const t=e.ownerInstance,n=t&&_r(t.type);return en(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`),!0}t.set(e,n+1)}else t.set(e,1)}const On=new Set;"production"!==process.env.NODE_ENV&&(bt().__VUE_HMR_RUNTIME__={createRecord:Nn((function(t,e){if(An.has(t))return!1;return An.set(t,{initialDef:Mn(e),instances:new Set}),!0})),rerender:Nn((function(t,e){const n=An.get(t);if(!n)return;n.initialDef.render=e,[...n.instances].forEach((t=>{e&&(t.render=e,Mn(t.type).render=e),t.renderCache=[],t.update()}))})),reload:Nn((function(t,e){const n=An.get(t);if(!n)return;e=Mn(e),Tn(n.initialDef,e);const r=[...n.instances];for(const t of r){const r=Mn(t.type);On.has(r)||(r!==n.initialDef&&Tn(r,e),On.add(r)),t.appContext.propsCache.delete(t.type),t.appContext.emitsCache.delete(t.type),t.appContext.optionsCache.delete(t.type),t.ceReload?(On.add(r),t.ceReload(e.styles),On.delete(r)):t.parent?_n(t.parent.update):t.appContext.reload?t.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required.")}kn((()=>{for(const t of r)On.delete(Mn(t.type))}))}))});const An=new Map;function Mn(t){return kr(t)?t.__vccOpts:t}function Tn(t,e){Z(t,e);for(const n in t)"__file"===n||n in e||delete t[n]}function Nn(t){return(e,n)=>{try{return t(e,n)}catch(t){console.error(t),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let In=null,Rn=null;const Dn=Symbol.for("v-ndc");const Ln={};function $n(t,e,{immediate:n,deep:r,flush:o,onTrack:i,onTrigger:s}=G){var a;"production"===process.env.NODE_ENV||e||(void 0!==n&&en('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==r&&en('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'));const l=t=>{en("Invalid watch source: ",t,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},c=Ot===(null==(a=fr)?void 0:a.scope)?fr:null;let u,h,p=!1,d=!1;if(qe(t)?(u=()=>t.value,p=ze(t)):$e(t)?(u=()=>t,r=!0):nt(t)?(d=!0,p=t.some((t=>$e(t)||ze(t))),u=()=>t.map((t=>qe(t)?t.value:$e(t)?zn(t):it(t)?sn(t,c,2):void("production"!==process.env.NODE_ENV&&l(t))))):it(t)?u=e?()=>sn(t,c,2):()=>{if(!c||!c.isUnmounted)return h&&h(),an(t,c,3,[f])}:(u=Y,"production"!==process.env.NODE_ENV&&l(t)),e&&r){const t=u;u=()=>zn(t())}let f=t=>{h=v.onStop=()=>{sn(t,c,4),h=v.onStop=void 0}},m=d?new Array(t.length).fill(Ln):Ln;const g=()=>{if(v.active)if(e){const t=v.run();(r||p||(d?t.some(((t,e)=>gt(t,m[e]))):gt(t,m)))&&(h&&h(),an(e,c,3,[t,m===Ln?void 0:d&&m[0]===Ln?[]:m,f]),m=t)}else v.run()};let y;g.allowRecurse=!!e,"sync"===o?y=g:"post"===o?y=()=>Zn(g,c&&c.suspense):(g.pre=!0,c&&(g.id=c.uid),y=()=>_n(g));const v=new zt(u,y);"production"!==process.env.NODE_ENV&&(v.onTrack=i,v.onTrigger=s),e?n?g():m=v.run():"post"===o?Zn(v.run.bind(v),c&&c.suspense):v.run();return()=>{v.stop(),c&&c.scope&&Q(c.scope.effects,v)}}function Pn(t,e,n){const r=this.proxy,o=st(t)?t.includes(".")?function(t,e){const n=e.split(".");return()=>{let e=t;for(let t=0;t<n.length&&e;t++)e=e[n[t]];return e}}(r,t):()=>r[t]:t.bind(r,r);let i;it(e)?i=e:(i=e.handler,n=e);const s=fr;gr(this);const a=$n(o,i.bind(r),n);return s?gr(s):yr(),a}function zn(t,e){if(!lt(t)||t.__v_skip)return t;if((e=e||new Set).has(t))return t;if(e.add(t),qe(t))zn(t.value,e);else if(nt(t))for(let n=0;n<t.length;n++)zn(t[n],e);else if(ot(t)||rt(t))t.forEach((t=>{zn(t,e)}));else if(dt(t))for(const n in t)zn(t[n],e);return t}const jn=t=>t?4&t.vnode.shapeFlag?function(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy((n=t.exposed,yt(n,"__v_skip",!0),$e(e=n)?e:new Proxy(e,Ge)),{get:(e,n)=>n in e?e[n]:n in Fn?Fn[n](t):void 0,has:(t,e)=>e in t||e in Fn}));var e;var n}(t)||t.proxy:jn(t.parent):null,Fn=Z(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>"production"!==process.env.NODE_ENV?De(t.props):t.props,$attrs:t=>"production"!==process.env.NODE_ENV?De(t.attrs):t.attrs,$slots:t=>"production"!==process.env.NODE_ENV?De(t.slots):t.slots,$refs:t=>"production"!==process.env.NODE_ENV?De(t.refs):t.refs,$parent:t=>jn(t.parent),$root:t=>jn(t.root),$emit:t=>t.emit,$options:t=>__VUE_OPTIONS_API__?function(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=t.appContext,a=i.get(e);let l;a?l=a:o.length||n||r?(l={},o.length&&o.forEach((t=>qn(l,t,s,!0))),qn(l,e,s)):l=e;lt(e)&&i.set(e,l);return l}(t):t.type,$forceUpdate:t=>t.f||(t.f=()=>_n(t.update)),$nextTick:t=>t.n||(t.n=bn.bind(t.proxy)),$watch:t=>__VUE_OPTIONS_API__?Pn.bind(t):Y}),Hn=(t,e)=>t!==G&&!t.__isScriptSetup&&et(t,e),Bn={get({_:t},e){const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=t;if("production"!==process.env.NODE_ENV&&"__isVue"===e)return!0;let c;if("$"!==e[0]){const a=s[e];if(void 0!==a)switch(a){case 1:return r[e];case 2:return o[e];case 4:return n[e];case 3:return i[e]}else{if(Hn(r,e))return s[e]=1,r[e];if(o!==G&&et(o,e))return s[e]=2,o[e];if((c=t.propsOptions[0])&&et(c,e))return s[e]=3,i[e];if(n!==G&&et(n,e))return s[e]=4,n[e];__VUE_OPTIONS_API__&&!Wn||(s[e]=0)}}const u=Fn[e];let h,p;return u?("$attrs"===e?(Wt(t,"get",e),process.env.NODE_ENV):"production"!==process.env.NODE_ENV&&"$slots"===e&&Wt(t,"get",e),u(t)):(h=a.__cssModules)&&(h=h[e])?h:n!==G&&et(n,e)?(s[e]=4,n[e]):(p=l.config.globalProperties,et(p,e)?p[e]:void("production"===process.env.NODE_ENV||!In||st(e)&&0===e.indexOf("__v")||(o!==G&&(t=>"_"===t||"$"===t)(e[0])&&et(o,e)?en(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):t===In&&en(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))))},set({_:t},e,n){const{data:r,setupState:o,ctx:i}=t;return Hn(o,e)?(o[e]=n,!0):"production"!==process.env.NODE_ENV&&o.__isScriptSetup&&et(o,e)?(en(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):r!==G&&et(r,e)?(r[e]=n,!0):et(t.props,e)?("production"!==process.env.NODE_ENV&&en(`Attempting to mutate prop "${e}". Props are readonly.`),!1):"$"===e[0]&&e.slice(1)in t?("production"!==process.env.NODE_ENV&&en(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):("production"!==process.env.NODE_ENV&&e in t.appContext.config.globalProperties?Object.defineProperty(i,e,{enumerable:!0,configurable:!0,value:n}):i[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:o,propsOptions:i}},s){let a;return!!n[s]||t!==G&&et(t,s)||Hn(e,s)||(a=i[0])&&et(a,s)||et(r,s)||et(Fn,s)||et(o.config.globalProperties,s)},defineProperty(t,e,n){return null!=n.get?t._.accessCache[e]=0:et(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Vn(t){return nt(t)?t.reduce(((t,e)=>(t[e]=null,t)),{}):t}"production"!==process.env.NODE_ENV&&(Bn.ownKeys=t=>(en("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(t)));let Wn=!0;function qn(t,e,n,r=!1){const{mixins:o,extends:i}=e;i&&qn(t,i,n,!0),o&&o.forEach((e=>qn(t,e,n,!0)));for(const o in e)if(r&&"expose"===o)"production"!==process.env.NODE_ENV&&en('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const r=Un[o]||n&&n[o];t[o]=r?r(t[o],e[o]):e[o]}return t}const Un={data:Kn,props:Xn,emits:Xn,methods:Yn,computed:Yn,beforeCreate:Gn,created:Gn,beforeMount:Gn,mounted:Gn,beforeUpdate:Gn,updated:Gn,beforeDestroy:Gn,beforeUnmount:Gn,destroyed:Gn,unmounted:Gn,activated:Gn,deactivated:Gn,errorCaptured:Gn,serverPrefetch:Gn,components:Yn,directives:Yn,watch:function(t,e){if(!t)return e;if(!e)return t;const n=Z(Object.create(null),t);for(const r in e)n[r]=Gn(t[r],e[r]);return n},provide:Kn,inject:function(t,e){return Yn(Jn(t),Jn(e))}};function Kn(t,e){return e?t?function(){return Z(it(t)?t.call(this,this):t,it(e)?e.call(this,this):e)}:e:t}function Jn(t){if(nt(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Gn(t,e){return t?[...new Set([].concat(t,e))]:e}function Yn(t,e){return t?Z(Object.create(null),t,e):e}function Xn(t,e){return t?nt(t)&&nt(e)?[...new Set([...t,...e])]:Z(Object.create(null),Vn(t),Vn(null!=e?e:{})):e}const Zn=function(t,e){e&&e.pendingBranch?nt(t)?e.effects.push(...t):e.effects.push(t):kn(t)},Qn=Symbol.for("v-fgt"),tr=Symbol.for("v-txt"),er=Symbol.for("v-cmt");let nr=null;const rr="__vInternal",or=({key:t})=>null!=t?t:null,ir=({ref:t,ref_key:e,ref_for:n})=>("number"==typeof t&&(t=""+t),null!=t?st(t)||qe(t)||it(t)?{i:In,r:t,k:e,f:!!n}:t:null);const sr="production"!==process.env.NODE_ENV?(...t)=>ar(...t):ar;function ar(t,e=null,n=null,r=0,o=null,i=!1){if(t&&t!==Dn||("production"===process.env.NODE_ENV||t||en(`Invalid vnode type when creating vnode: ${t}.`),t=er),(s=t)&&!0===s.__v_isVNode){const r=lr(t,e,!0);return n&&hr(r,n),!i&&nr&&(6&r.shapeFlag?nr[nr.indexOf(t)]=r:nr.push(r)),r.patchFlag|=-2,r}var s;if(kr(t)&&(t=t.__vccOpts),e){e=function(t){return t?je(t)||rr in t?Z({},t):t:null}(e);let{class:t,style:n}=e;t&&!st(t)&&(e.class=Et(t)),lt(n)&&(je(n)&&!nt(n)&&(n=Z({},n)),e.style=_t(n))}const a=st(t)?1:(t=>t.__isSuspense)(t)?128:(t=>t.__isTeleport)(t)?64:lt(t)?4:it(t)?2:0;return"production"!==process.env.NODE_ENV&&4&a&&je(t)&&en("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.","\nComponent that was made reactive: ",t=Fe(t)),function(t,e=null,n=null,r=0,o=null,i=(t===Qn?0:1),s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&or(e),ref:e&&ir(e),scopeId:Rn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:In};return a?(hr(l,n),128&i&&t.normalize(l)):n&&(l.shapeFlag|=st(n)?8:16),"production"!==process.env.NODE_ENV&&l.key!=l.key&&en("VNode created with invalid key (NaN). VNode type:",l.type),!s&&nr&&(l.patchFlag>0||6&i)&&32!==l.patchFlag&&nr.push(l),l}(t,e,n,r,o,a,i,!0)}function lr(t,e,n=!1){const{props:r,ref:o,patchFlag:i,children:s}=t,a=e?function(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const t in r)if("class"===t)e.class!==r.class&&(e.class=Et([e.class,r.class]));else if("style"===t)e.style=_t([e.style,r.style]);else if(X(t)){const n=e[t],o=r[t];!o||n===o||nt(n)&&n.includes(o)||(e[t]=n?[].concat(n,o):o)}else""!==t&&(e[t]=r[t])}return e}(r||{},e):r;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&or(a),ref:e&&e.ref?n&&o?nt(o)?o.concat(ir(e)):[o,ir(e)]:ir(e):o,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:"production"!==process.env.NODE_ENV&&-1===i&&nt(s)?s.map(cr):s,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Qn?-1===i?16:16|i:i,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&lr(t.ssContent),ssFallback:t.ssFallback&&lr(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function cr(t){const e=lr(t);return nt(t.children)&&(e.children=t.children.map(cr)),e}function ur(t=" ",e=0){return sr(tr,null,t,e)}function hr(t,e){let n=0;const{shapeFlag:r}=t;if(null==e)e=null;else if(nt(e))n=16;else if("object"==typeof e){if(65&r){const n=e.default;return void(n&&(n._c&&(n._d=!1),hr(t,n()),n._c&&(n._d=!0)))}{n=32;const r=e._;r||rr in e?3===r&&In&&(1===In.slots._?e._=1:(e._=2,t.patchFlag|=1024)):e._ctx=In}}else it(e)?(e={default:e,_ctx:In},n=32):(e=String(e),64&r?(n=16,e=[ur(e)]):n=8);t.children=e,t.shapeFlag|=n}let pr,dr,fr=null,mr="__VUE_INSTANCE_SETTERS__";(dr=bt()[mr])||(dr=bt()[mr]=[]),dr.push((t=>fr=t)),pr=t=>{dr.length>1?dr.forEach((e=>e(t))):dr[0](t)};const gr=t=>{pr(t),t.scope.on()},yr=()=>{fr&&fr.scope.off(),pr(null)};const vr=/(?:^|[-_])(\w)/g,br=t=>t.replace(vr,(t=>t.toUpperCase())).replace(/[-_]/g,"");function _r(t,e=!0){return it(t)?t.displayName||t.name:t.name||e&&t.__name}function wr(t,e,n=!1){let r=_r(e);if(!r&&e.__file){const t=e.__file.match(/([^/\\]+)\.\w+$/);t&&(r=t[1])}if(!r&&t&&t.parent){const n=t=>{for(const n in t)if(t[n]===e)return n};r=n(t.components||t.parent.type.components)||n(t.appContext.components)}return r?br(r):n?"App":"Anonymous"}function kr(t){return it(t)&&"__vccOpts"in t}const xr=(t,e)=>function(t,e,n=!1){let r,o;const i=it(t);i?(r=t,o="production"!==process.env.NODE_ENV?()=>{console.warn("Write operation failed: computed value is readonly")}:Y):(r=t.get,o=t.set);const s=new Qe(r,o,i||!o,n);return"production"!==process.env.NODE_ENV&&e&&!n&&(s.effect.onTrack=e.onTrack,s.effect.onTrigger=e.onTrigger),s}(t,e,false);function Sr(t){return!(!t||!t.__v_isShallow)}function Er(t){this.content=t}function Cr(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let t=0;o.text[t]==i.text[t];t++)n++;return n}if(o.content.size||i.content.size){let t=Cr(o.content,i.content,n+1);if(null!=t)return t}n+=o.nodeSize}else n+=o.nodeSize}}function Or(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let t=0,e=Math.min(s.text.length,a.text.length);for(;t<e&&s.text[s.text.length-t-1]==a.text[a.text.length-t-1];)t++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let t=Or(s.content,a.content,n-1,r-1);if(t)return t}n-=l,r-=l}else n-=l,r-=l}}"production"!==process.env.NODE_ENV&&function(){if("production"===process.env.NODE_ENV||"undefined"==typeof window)return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},o={header:e=>lt(e)?e.__isVue?["div",t,"VueInstance"]:qe(e)?["div",{},["span",t,u(e)],"<",a(e.value),">"]:$e(e)?["div",{},["span",t,Sr(e)?"ShallowReactive":"Reactive"],"<",a(e),">"+(Pe(e)?" (readonly)":"")]:Pe(e)?["div",{},["span",t,Sr(e)?"ShallowReadonly":"Readonly"],"<",a(e),">"]:null:null,hasBody:t=>t&&t.__isVue,body(t){if(t&&t.__isVue)return["div",{},...i(t.$)]}};function i(t){const e=[];t.type.props&&t.props&&e.push(s("props",Fe(t.props))),t.setupState!==G&&e.push(s("setup",t.setupState)),t.data!==G&&e.push(s("data",Fe(t.data)));const n=l(t,"computed");n&&e.push(s("computed",n));const o=l(t,"inject");return o&&e.push(s("injected",o)),e.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:t}]]),e}function s(t,e){return e=Z({},e),Object.keys(e).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},t],["div",{style:"padding-left:1.25em"},...Object.keys(e).map((t=>["div",{},["span",r,t+": "],a(e[t],!1)]))]]:["span",{}]}function a(t,o=!0){return"number"==typeof t?["span",e,t]:"string"==typeof t?["span",n,JSON.stringify(t)]:"boolean"==typeof t?["span",r,t]:lt(t)?["object",{object:o?Fe(t):t}]:["span",n,String(t)]}function l(t,e){const n=t.type;if(it(n))return;const r={};for(const o in t.ctx)c(n,o,e)&&(r[o]=t.ctx[o]);return r}function c(t,e,n){const r=t[n];return!!(nt(r)&&r.includes(e)||lt(r)&&e in r)||!(!t.extends||!c(t.extends,e,n))||!(!t.mixins||!t.mixins.some((t=>c(t,e,n))))||void 0}function u(t){return Sr(t)?"ShallowRef":t.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(o):window.devtoolsFormatters=[o]}(),Er.prototype={constructor:Er,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return-1==o?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Er(i)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new Er(n)},addToStart:function(t,e){return new Er([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Er(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(-1==i?o.length:i,0,e,n),new Er(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=Er.from(t)).size?new Er(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=Er.from(t)).size?new Er(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Er.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},Er.from=function(t){if(t instanceof Er)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Er(e)};class Ar{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,n,r=0,o){for(let i=0,s=0;s<e;i++){let a=this.content[i],l=s+a.nodeSize;if(l>t&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,t-o),Math.min(a.content.size,e-o),n,r+o)}s=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let o="",i=!0;return this.nodesBetween(t,e,((s,a)=>{s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf?(r?o+="function"==typeof r?r(s):r:s.type.spec.leafText&&(o+=s.type.spec.leafText(s)),i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new Ar(r,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],r=0;if(e>t)for(let o=0,i=0;i<e;o++){let s=this.content[o],a=i+s.nodeSize;a>t&&((i<t||a>e)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Ar(n,r)}cutByIndex(t,e){return t==e?Ar.empty:0==t&&e==this.content.length?this:new Ar(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new Ar(r,o)}addToStart(t){return new Ar([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Ar(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,e=0){return Cr(this,t,e)}findDiffEnd(t,e=this.size,n=t.size){return Or(this,t,e,n)}findIndex(t,e=-1){if(0==t)return Tr(0,t);if(t==this.size)return Tr(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?Tr(n+1,o):Tr(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return Ar.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ar(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Ar.empty;let e,n=0;for(let r=0;r<t.length;r++){let o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new Ar(e||t,n)}static from(t){if(!t)return Ar.empty;if(t instanceof Ar)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Ar([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ar.empty=new Ar([],0);const Mr={index:0,offset:0};function Tr(t,e){return Mr.index=t,Mr.offset=e,Mr}function Nr(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!Nr(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!Nr(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}let Ir=class t{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Nr(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);return n.create(e.attrs)}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort(((t,e)=>t.type.rank-e.type.rank)),n}};Ir.none=[];class Rr extends Error{}class Dr{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=$r(this.content,t+this.openStart,e);return n&&new Dr(n,this.openStart,this.openEnd)}removeBetween(t,e){return new Dr(Lr(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return Dr.empty;let n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new Dr(Ar.fromJSON(t,e.content),n,r)}static maxOpen(t,e=!0){let n=0,r=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)r++;return new Dr(t,n,r)}}function Lr(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Lr(i.content,e-o-1,n-o-1)))}function $r(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=$r(s.content,e-i-1,n);return a&&t.replaceChild(o,s.copy(a))}function Pr(t,e,n){if(n.openStart>t.depth)throw new Rr("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Rr("Inconsistent open depths");return zr(t,e,n,0)}function zr(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=zr(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){let{start:o,end:s}=function(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let t=n-1;t>=0;t--)r=e.node(t).copy(Ar.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return Vr(i,Wr(t,o,s,e,r))}{let r=t.parent,o=r.content;return Vr(r,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}}return Vr(i,qr(t,e,r))}function jr(t,e){if(!e.type.compatibleContent(t.type))throw new Rr("Cannot join "+e.type.name+" onto "+t.type.name)}function Fr(t,e,n){let r=t.node(n);return jr(r,e.node(n)),r}function Hr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Br(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Hr(t.nodeAfter,r),i++));for(let t=i;t<s;t++)Hr(o.child(t),r);e&&e.depth==n&&e.textOffset&&Hr(e.nodeBefore,r)}function Vr(t,e){return t.type.checkContent(e),t.copy(e)}function Wr(t,e,n,r,o){let i=t.depth>o&&Fr(t,e,o+1),s=r.depth>o&&Fr(n,r,o+1),a=[];return Br(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(jr(i,s),Hr(Vr(i,Wr(t,e,n,r,o+1)),a)):(i&&Hr(Vr(i,qr(t,e,o+1)),a),Br(e,n,o,a),s&&Hr(Vr(s,qr(n,r,o+1)),a)),Br(r,null,o,a),new Ar(a)}function qr(t,e,n){let r=[];if(Br(null,t,n,r),t.depth>n){Hr(Vr(Fr(t,e,n+1),qr(t,e,n+1)),r)}return Br(e,null,n,r),new Ar(r)}Dr.empty=new Dr(Ar.empty,0,0);class Ur{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return Ir.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new Yr(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,o=e;for(let e=t;;){let{index:t,offset:i}=e.content.findIndex(o),s=o-i;if(n.push(e,t,r+i),!s)break;if(e=e.child(t),e.isText)break;o=s-1,r+=i+1}return new Ur(e,n,o)}static resolveCached(t,e){for(let n=0;n<Kr.length;n++){let r=Kr[n];if(r.pos==e&&r.doc==t)return r}let n=Kr[Jr]=Ur.resolve(t,e);return Jr=(Jr+1)%Gr,n}}let Kr=[],Jr=0,Gr=12;class Yr{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Xr=Object.create(null);let Zr=class t{constructor(t,e,n,r=Ir.none){this.type=t,this.attrs=e,this.marks=r,this.content=n||Ar.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&Nr(this.attrs,e||t.defaultAttrs||Xr)&&Ir.sameSet(this.marks,n||Ir.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.content,e)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return Dr.empty;let r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new Dr(a,r.depth-i,o.depth-i)}replace(t,e,n){return Pr(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return Ur.resolveCached(this,t)}resolveNoCache(t){return Ur.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),to(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=Ar.empty,r=0,o=n.childCount){let i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(let t=r;t<o;t++)if(!this.type.allowsMarks(n.child(t).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=Ir.none;for(let e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!Ir.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let r=Ar.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)}};Zr.prototype.text=void 0;class Qr extends Zr{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):to(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Qr(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Qr(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function to(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class eo{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new no(t,e);if(null==n.next)return eo.empty;let r=ro(n);n.next&&n.err("Unexpected trailing text");let o=function(t){let e=Object.create(null);return n(co(t,0));function n(r){let o=[];r.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<o.length;t++)o[t][0]==e&&(r=o[t][1]);co(t,n).forEach((t=>{r||o.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)}))}))}));let i=e[r.join(",")]=new eo(r.indexOf(t.length-1)>-1);for(let t=0;t<o.length;t++){let r=o[t][1].sort(lo);i.next.push({type:o[t][0],next:e[r.join(",")]||n(r)})}return i}}(function(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((t=>t.to=e))}function i(t,e){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(i(n,e))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(e,s),o(i(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(i(t.expr,e),s),o(i(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(e)].concat(i(t.expr,e));if("range"==t.type){let s=e;for(let e=0;e<t.min;e++){let e=n();o(i(t.expr,s),e),s=e}if(-1==t.max)o(i(t.expr,s),s);else for(let e=t.min;e<t.max;e++){let e=n();r(s,e),o(i(t.expr,s),e),s=e}return[r(s)]}if("name"==t.type)return[r(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(t.exprs[r],e);if(r==t.exprs.length-1)return s;o(s,e=n())}}}(r));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],o=!t.validEnd,i=[];for(let e=0;e<t.next.length;e++){let{type:n,next:s}=t.next[e];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(t,n);if(a&&(!e||a.validEnd))return Ar.from(s.map((t=>t.createAndFill())));for(let t=0;t<i.next.length;t++){let{type:e,next:n}=i.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let t=o(n,s.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<o.next.length;t++){let{type:i,next:s}=o.next[t];i.isLeaf||i.hasRequiredAttrs()||i.name in e||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),e[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map(((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let n=0;n<e.next.length;n++)r+=(n?", ":"")+e.next[n].type.name+"->"+t.indexOf(e.next[n].next);return r})).join("\n")}}eo.empty=new eo(!0);class no{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function ro(t){let e=[];do{e.push(oo(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function oo(t){let e=[];do{e.push(io(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function io(t){let e=function(t){if(t.eat("(")){let e=ro(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let t in n){let r=n[t];r.groups.indexOf(e)>-1&&o.push(r)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=ao(t,e)}return e}function so(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function ao(t,e){let n=so(t),r=n;return t.eat(",")&&(r="}"!=t.next?so(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function lo(t,e){return e-t}function co(t,e){let n=[];return function e(r){let o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(let t=0;t<o.length;t++){let{term:r,to:i}=o[t];r||-1!=n.indexOf(i)||e(i)}}(e),n.sort(lo)}function uo(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function ho(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(void 0===o){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=e.default}n[r]=o}return n}function po(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new mo(t[n]);return e}let fo=class t{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=po(n.attrs),this.defaultAttrs=uo(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==eo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:ho(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Zr(this,this.computeAttrs(t),Ar.from(e),Ir.setFrom(n))}createChecked(t=null,e,n){return e=Ar.from(e),this.checkContent(e),new Zr(this,this.computeAttrs(t),e,Ir.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),(e=Ar.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let r=this.contentMatch.matchFragment(e),o=r&&r.fillBefore(Ar.empty,!0);return o?new Zr(this,t,e.append(o),Ir.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:Ir.none:t}static compile(e,n){let r=Object.create(null);e.forEach(((e,o)=>r[e]=new t(e,n,o)));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let t in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class mo{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class go{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=po(r.attrs),this.excluded=null;let o=uo(this.attrs);this.instance=o?new Ir(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Ir(this,ho(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach(((t,o)=>n[t]=new go(t,r++,e,o))),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}excludes(t){return this.excluded.indexOf(t)>-1}}class yo{constructor(t){this.cached=Object.create(null);let e=this.spec={};for(let n in t)e[n]=t[n];e.nodes=Er.from(t.nodes),e.marks=Er.from(t.marks||{}),this.nodes=fo.compile(this.spec.nodes,this),this.marks=go.compile(this.spec.marks,this);let n=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],r=e.spec.content||"",o=e.spec.marks;e.contentMatch=n[r]||(n[r]=eo.parse(r,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.markSet="_"==o?null:o?vo(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:vo(this,n.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof fo))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new Qr(n,n.defaultAttrs,t,Ir.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return Zr.fromJSON(this,t)}markFromJSON(t){return Ir.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function vo(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let e in t.marks){let r=t.marks[e];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}let bo=class t{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((t=>{t.tag?this.tags.push(t):t.style&&this.styles.push(t)})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new Eo(this,e,!1);return n.addAll(t,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new Eo(this,e,!0);return n.addAll(t,e.from,e.to),Dr.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Co(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(t)||r.context&&!n.matchesContext(r.context)||i.length>t.length&&(61!=i.charCodeAt(t.length)||i.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let e in t.marks){let r=t.marks[e].spec.parseDOM;r&&r.forEach((t=>{n(t=Oo(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let r=t.nodes[e].spec.parseDOM;r&&r.forEach((t=>{n(t=Oo(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}};const _o={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},wo={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ko={ol:!0,ul:!0};function xo(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class So{constructor(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ir.none,this.stashMarks=[],this.match=i||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(Ar.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=Ar.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(Ar.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}popFromStashMark(t){for(let e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]}applyPending(t){for(let e=0,n=this.pendingMarks;e<n.length;e++){let r=n[e];(this.type?this.type.allowsMarkType(r.type):Ao(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!_o.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Eo{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0;let r,o=e.topNode,i=xo(null,e.preserveWhitespace,0)|(n?4:0);r=o?new So(o.type,o.attrs,Ir.none,Ir.none,!0,e.topMatch||o.type.contentMatch,i):new So(n?null:t.schema.topNodeType,null,Ir.none,Ir.none,!0,null,i),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){let e=t.getAttribute("style");if(e){let n=this.readStyles(function(t){let e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e));if(!n)return;let[r,o]=n,i=this.top;for(let t=0;t<o.length;t++)this.removePendingMark(o[t],i);for(let t=0;t<r.length;t++)this.addPendingMark(r[t]);this.addElement(t);for(let t=0;t<r.length;t++)this.removePendingMark(r[t],i);for(let t=0;t<o.length;t++)this.addPendingMark(o[t])}else this.addElement(t)}}addTextNode(t){let e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)}addElement(t,e){let n,r=t.nodeName.toLowerCase();ko.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&ko.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:wo.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);let e,n=this.top,i=this.needsBlock;if(_o.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),e=!0,n.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),e&&this.sync(n),this.needsBlock=i}else this.addElementByRule(t,o,!1===o.consuming?n:void 0)}leafFallback(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))}ignoreFallback(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(t){let e=Ir.none,n=Ir.none;t:for(let r=0;r<t.length;r+=2)for(let o;;){let i=this.parser.matchStyle(t[r],t[r+1],this,o);if(!i)continue t;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.forEach((t=>{i.clearMark(t)&&(n=t.addToSet(n))})):e=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(e),!1!==i.consuming)break;o=i}return[e,n]}addElementByRule(t,e,n){let r,o,i;if(e.node)o=this.parser.schema.nodes[e.node],o.isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs||null,e.preserveWhitespace);else{i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i)}let s=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t)));else{let n=t;"string"==typeof e.contentElement?n=t.querySelector(e.contentElement):"function"==typeof e.contentElement?n=e.contentElement(t):e.contentElement&&(n=e.contentElement),this.findAround(t,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(t,e,n){let r=e||0;for(let o=e?t.childNodes[e]:t.firstChild,i=null==n?null:t.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(t,r),this.addDOM(o);this.findAtPoint(t,r)}findPlace(t){let e,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(let t=0;t<e.length;t++)this.enterInner(e[t],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(t)){this.closeExtra();let e=this.top;e.applyPending(t.type),e.match&&(e.match=e.match.matchType(t.type));let n=e.activeMarks;for(let r=0;r<t.marks.length;r++)e.type&&!e.type.allowsMarkType(t.marks[r].type)||(n=t.marks[r].addToSet(n));return e.content.push(t.mark(n)),!0}return!1}enter(t,e,n){let r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r}enterInner(t,e=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let i=xo(t,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new So(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)){e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(t,s)=>{for(;t>=0;t--){let a=e[t];if(""==a){if(t==e.length-1||0==t)continue;for(;s>=o;s--)if(i(t-1,s))return!0;return!1}{let t=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!t||t.name!=a&&-1==t.groups.indexOf(a))return!1;s--}}return!0};return i(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}addPendingMark(t){let e=function(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,e){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);let e=r.popFromStashMark(t);e&&r.type&&r.type.allowsMarkType(e.type)&&(r.activeMarks=e.addToSet(r.activeMarks))}if(r==e)break}}}function Co(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Oo(t){let e={};for(let n in t)e[n]=t[n];return e}function Ao(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=t=>{i.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:o}=t.edge(n);if(r==e)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Mo{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=No(e).createDocumentFragment());let r=n,o=[];return t.forEach((t=>{if(o.length||t.marks.length){let n=0,i=0;for(;n<o.length&&i<t.marks.length;){let e=t.marks[i];if(this.marks[e.type.name]){if(!e.eq(o[n][0])||!1===e.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<t.marks.length;){let n=t.marks[i++],s=this.serializeMark(n,t.isInline,e);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(t,e))})),n}serializeNodeInner(t,e){let{dom:n,contentDOM:r}=Mo.renderSpec(No(e),this.nodes[t.type.name](t));if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&&Mo.renderSpec(No(n),r(t,e))}static renderSpec(t,e,n=null){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let r,o=e[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?t.createElementNS(n,o):t.createElement(o),a=e[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){l=2;for(let t in a)if(null!=a[t]){let e=t.indexOf(" ");e>0?s.setAttributeNS(t.slice(0,e),t.slice(e+1),a[t]):s.setAttribute(t,a[t])}}for(let o=l;o<e.length;o++){let i=e[o];if(0===i){if(o<e.length-1||o>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:e,contentDOM:o}=Mo.renderSpec(t,i,n);if(s.appendChild(e),o){if(r)throw new RangeError("Multiple content holes");r=o}}}return{dom:s,contentDOM:r}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Mo(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=To(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return To(t.marks)}}function To(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function No(t){return t.document||window.document}const Io=Math.pow(2,16);function Ro(t){return 65535&t}class Do{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Lo{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&Lo.empty)return Lo.empty}recover(t){let e=0,n=Ro(t);if(!this.inverted)for(let t=0;t<n;t++)e+=this.ranges[3*t+2]-this.ranges[3*t+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/Io}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;let l=this.ranges[s+o],c=this.ranges[s+i],u=a+l;if(t<=u){let o=a+r+((l?t==a?-1:t==u?1:e:e)<0?0:c);if(n)return o;let i=t==(e<0?a:u)?null:s/3+(t-a)*Io,h=t==a?2:t==u?1:4;return(e<0?t!=a:t!=u)&&(h|=8),new Do(o,h,i)}r+=c-l}return n?t+r:new Do(t+r,0,null)}touches(t,e){let n=0,r=Ro(e),o=this.inverted?2:1,i=this.inverted?1:2;for(let e=0;e<this.ranges.length;e+=3){let s=this.ranges[e]-(this.inverted?n:0);if(s>t)break;let a=this.ranges[e+o];if(t<=s+a&&e==3*r)return!0;n+=this.ranges[e+i]-a}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+e],c=this.ranges[r+n];t(s,s+l,a,a+c),o+=c-l}}invert(){return new Lo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?Lo.empty:new Lo(t<0?[0,-t,0]:[0,0,t])}}Lo.empty=new Lo([]);class $o{constructor(t=[],e,n=0,r=t.length){this.maps=t,this.mirror=e,this.from=n,this.to=r}slice(t=0,e=this.maps.length){return new $o(this.maps,this.mirror,t,e)}copy(){return new $o(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,n=this.maps.length;e<t.maps.length;e++){let r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:void 0)}}invert(){let t=new $o;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this.maps[n].mapResult(t,e);if(null!=o.recover){let e=this.getMirror(n);if(null!=e&&e>n&&e<this.to){n=e,t=this.maps[e].recover(o.recover);continue}}r|=o.delInfo,t=o.pos}return n?t:new Do(t,r,null)}}const Po=Object.create(null);class zo{getMap(){return Lo.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Po[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Po)throw new RangeError("Duplicate use of step JSON ID "+t);return Po[t]=e,e.prototype.jsonID=t,e}}class jo{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new jo(t,null)}static fail(t){return new jo(null,t)}static fromReplace(t,e,n,r){try{return jo.ok(t.replace(e,n,r))}catch(t){if(t instanceof Rr)return jo.fail(t.message);throw t}}}function Fo(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Fo(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return Ar.fromArray(r)}class Ho extends zo{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new Dr(Fo(e.content,((t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),r),e.openStart,e.openEnd);return jo.fromReplace(t,this.from,this.to,o)}invert(){return new Bo(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Ho(e.pos,n.pos,this.mark)}merge(t){return t instanceof Ho&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Ho(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ho(e.from,e.to,t.markFromJSON(e.mark))}}zo.jsonID("addMark",Ho);class Bo extends zo{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new Dr(Fo(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return jo.fromReplace(t,this.from,this.to,n)}invert(){return new Ho(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Bo(e.pos,n.pos,this.mark)}merge(t){return t instanceof Bo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Bo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Bo(e.from,e.to,t.markFromJSON(e.mark))}}zo.jsonID("removeMark",Bo);class Vo extends zo{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return jo.fromReplace(t,this.pos,this.pos+1,new Dr(Ar.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;n<e.marks.length;n++)if(!e.marks[n].isInSet(t))return new Vo(this.pos,e.marks[n]);return new Vo(this.pos,this.mark)}}return new Wo(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Vo(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vo(e.pos,t.markFromJSON(e.mark))}}zo.jsonID("addNodeMark",Vo);class Wo extends zo{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return jo.fromReplace(t,this.pos,this.pos+1,new Dr(Ar.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new Vo(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Wo(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wo(e.pos,t.markFromJSON(e.mark))}}zo.jsonID("removeNodeMark",Wo);class qo extends zo{constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}apply(t){return this.structure&&Ko(t,this.from,this.to)?jo.fail("Structure replace would overwrite content"):jo.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Lo([this.from,this.to-this.from,this.slice.size])}invert(t){return new qo(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deletedAcross&&n.deletedAcross?null:new qo(e.pos,Math.max(e.pos,n.pos),this.slice)}merge(t){if(!(t instanceof qo)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?Dr.empty:new Dr(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new qo(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?Dr.empty:new Dr(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new qo(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new qo(e.from,e.to,Dr.fromJSON(t,e.slice),!!e.structure)}}zo.jsonID("replace",qo);class Uo extends zo{constructor(t,e,n,r,o,i,s=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(t){if(this.structure&&(Ko(t,this.from,this.gapFrom)||Ko(t,this.gapTo,this.to)))return jo.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return jo.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?jo.fromReplace(t,this.from,this.to,n):jo.fail("Content does not fit in gap")}getMap(){return new Lo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Uo(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return e.deletedAcross&&n.deletedAcross||r<e.pos||o>n.pos?null:new Uo(e.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Uo(e.from,e.to,e.gapFrom,e.gapTo,Dr.fromJSON(t,e.slice),e.insert,!!e.structure)}}function Ko(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let t=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,o--}}return!1}function Jo(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Go(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Jo(r,o,i))break}return null}function Yo(t,e,n=null,r=t){let o=function(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let t=r;a&&t<o;t++)a=a.matchType(n.child(t).type);return a&&a.validEnd?s:null}(r,e);return i?o.map(Xo).concat({type:e,attrs:n}).concat(i.map(Xo)):null}function Xo(t){return{type:t,attrs:null}}function Zo(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let t=o.depth-1,e=n-2;t>i;t--,e--){let n=o.node(t),i=o.index(t);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[e]||n;if(a!=n&&(s=s.replaceChild(0,a.type.create(a.attrs))),!n.canReplace(i+1,n.childCount)||!a.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Qo(t,e){let n=t.resolve(e),r=n.index();return ti(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ti(t,e){return!(!t||!e||t.isLeaf||!t.canAppend(e))}function ei(t,e,n=-1){let r=t.resolve(e);for(let t=r.depth;;t--){let o,i,s=r.index(t);if(t==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(t+1),s++,i=r.node(t).maybeChild(s)):(o=r.node(t).maybeChild(s-1),i=r.node(t+1)),o&&!o.isTextblock&&ti(o,i)&&r.node(t).canReplace(s,s+1))return e;if(0==t)break;e=n<0?r.before(t):r.after(t)}}function ni(t,e,n=e,r=Dr.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return ri(o,i,r)?new qo(e,n,r):new oi(o,i,r).fit()}function ri(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}zo.jsonID("replaceAround",Uo);class oi{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=Ar.empty;for(let e=0;e<=t.depth;e++){let n=t.node(e);this.frontier.push({type:n.type,match:n.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=Ar.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new Dr(o,i,s);return t>-1?new Uo(n.pos,t,this.$to.pos,this.$to.end(),a,e):a.size||n.pos!=this.$to.pos?new qo(n.pos,r.pos,a):null}findFittable(){for(let t=1;t<=2;t++)for(let e=this.unplaced.openStart;e>=0;e--){let n,r=null;e?(r=ai(this.unplaced.content,e-1).firstChild,n=r.content):n=this.unplaced.content;let o=n.firstChild;for(let n=this.depth;n>=0;n--){let i,{type:s,match:a}=this.frontier[n],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Ar.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:e,frontierDepth:n,parent:r,inject:l};if(2==t&&o&&(i=a.findWrapping(o.type)))return{sliceDepth:e,frontierDepth:n,parent:r,wrap:i};if(r&&a.matchType(r.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=ai(t,e);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new Dr(t,e+1,Math.max(n,r.size+e>=t.size-n?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=ai(t,e);if(r.childCount<=1&&e>0){let o=t.size-e<=e+r.size;this.unplaced=new Dr(ii(t,e-1,1),e-1,o?e-1:n)}else this.unplaced=new Dr(ii(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:r,wrap:o}){for(;this.depth>e;)this.closeFrontierNode();if(o)for(let t=0;t<o.length;t++)this.openFrontierNode(o[t]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-t,l=0,c=[],{match:u,type:h}=this.frontier[e];if(r){for(let t=0;t<r.childCount;t++)c.push(r.child(t));u=u.matchFragment(r)}let p=s.size+t-(i.content.size-i.openEnd);for(;l<s.childCount;){let t=s.child(l),e=u.matchType(t.type);if(!e)break;l++,(l>1||0==a||t.content.size)&&(u=e,c.push(li(t.mark(h.allowedMarks(t.marks)),1==l?a:0,l==s.childCount?p:-1)))}let d=l==s.childCount;d||(p=-1),this.placed=si(this.placed,e,Ar.from(c)),this.frontier[e].match=u,d&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=s;t<p;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),e=t.content}this.unplaced=d?0==t?Dr.empty:new Dr(ii(i.content,t-1,1),t-1,p<0?i.openEnd:t-1):new Dr(ii(i.content,t,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!ci(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:r}=this.frontier[e],o=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),i=ci(t,e,r,n,o);if(i){for(let n=e-1;n>=0;n--){let{match:e,type:r}=this.frontier[n],o=ci(t,n,r,e,!0);if(!o||o.childCount)continue t}return{depth:e,fit:i,move:o?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=si(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),r=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,r)}return t}openFrontierNode(t,e=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=si(this.placed,this.depth,Ar.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(Ar.empty,!0);t.childCount&&(this.placed=si(this.placed,this.frontier.length,t))}}function ii(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ii(t.firstChild.content,e-1,n)))}function si(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(si(t.lastChild.content,e-1,n)))}function ai(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function li(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,li(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ar.empty,!0)))),t.copy(r)}function ci(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function ui(t){return t.spec.defining||t.spec.definingForContent}function hi(t,e,n,r,o){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(hi(o.content,e+1,n,r,o)))}if(e>r){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(Ar.empty,!0))}return t}function pi(t,e){let n=[];for(let r=Math.min(t.depth,e.depth);r>=0;r--){let o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(o==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==o-1)&&n.push(r)}return n}class di extends zo{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at attribute step's position");let n=Object.create(null);for(let t in e.attrs)n[t]=e.attrs[t];n[this.attr]=this.value;let r=e.type.create(n,null,e.marks);return jo.fromReplace(t,this.pos,this.pos+1,new Dr(Ar.from(r),0,e.isLeaf?0:1))}getMap(){return Lo.empty}invert(t){return new di(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new di(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new di(e.pos,e.attr,e.value)}}zo.jsonID("attr",di);let fi=class extends Error{};fi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},(fi.prototype=Object.create(Error.prototype)).constructor=fi,fi.prototype.name="TransformError";class mi{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new $o}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new fi(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=Dr.empty){let r=ni(this.doc,t,e,n);return r&&this.step(r),this}replaceWith(t,e,n){return this.replace(t,e,new Dr(Ar.from(n),0,0))}delete(t,e){return this.replace(t,e,Dr.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return function(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(ri(o,i,r))return t.step(new qo(e,n,r));let s=pi(o,t.doc.resolve(n));0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let t=o.depth,e=o.pos-1;t>0;t--,e--){let n=o.node(t).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(t)>-1?a=t:o.before(t)==e&&s.splice(1,0,-t)}let l=s.indexOf(a),c=[],u=r.openStart;for(let t=r.content,e=0;;e++){let n=t.firstChild;if(c.push(n),e==r.openStart)break;t=n.content}for(let t=u-1;t>=0;t--){let e=c[t].type,n=ui(e);if(n&&o.node(l).type!=e)u=t;else if(n||!e.isTextblock)break}for(let e=r.openStart;e>=0;e--){let a=(e+u+1)%(r.openStart+1),h=c[a];if(h)for(let e=0;e<s.length;e++){let c=s[(e+l)%s.length],u=!0;c<0&&(u=!1,c=-c);let p=o.node(c-1),d=o.index(c-1);if(p.canReplaceWith(d,d,h.type,h.marks))return t.replace(o.before(c),u?i.after(c):n,new Dr(hi(r.content,0,r.openStart,a),a,r.openEnd))}}let h=t.steps.length;for(let a=s.length-1;a>=0&&(t.replace(e,n,r),!(t.steps.length>h));a--){let t=s[a];t<0||(e=o.before(t),n=i.after(t))}}(this,t,e,n),this}replaceRangeWith(t,e,n){return function(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=function(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(let t=r.depth-1;t>=0;t--){let e=r.index(t);if(r.node(t).canReplaceWith(e,e,n))return r.before(t+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let t=r.depth-1;t>=0;t--){let e=r.indexAfter(t);if(r.node(t).canReplaceWith(e,e,n))return r.after(t+1);if(e<r.node(t).childCount)return null}return null}(t.doc,e,r.type);null!=o&&(e=n=o)}t.replaceRange(e,n,new Dr(Ar.from(r),0,0))}(this,t,e,n),this}deleteRange(t,e){return function(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=pi(r,o);for(let e=0;e<i.length;e++){let n=i[e],s=e==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return t.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return t.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i)return t.delete(r.before(i),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return function(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=Ar.empty,h=0;for(let t=i,e=!1;t>n;t--)e||r.index(t)>0?(e=!0,u=Ar.from(r.node(t).copy(u)),h++):l--;let p=Ar.empty,d=0;for(let t=i,e=!1;t>n;t--)e||o.after(t+1)<o.end(t)?(e=!0,p=Ar.from(o.node(t).copy(p)),d++):c++;t.step(new Uo(l,c,s,a,new Dr(u.append(p),h,d),u.size-h,!0))}(this,t,e),this}join(t,e=1){return function(t,e,n){let r=new qo(e-n,e+n,Dr.empty,!0);t.step(r)}(this,t,e),this}wrap(t,e){return function(t,e,n){let r=Ar.empty;for(let t=n.length-1;t>=0;t--){if(r.size){let e=n[t].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ar.from(n[t].type.create(n[t].attrs,r))}let o=e.start,i=e.end;t.step(new Uo(o,i,o,i,new Dr(r,0,0),n.length,!0))}(this,t,e),this}setBlockType(t,e=t,n,r=null){return function(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,((e,n)=>{if(e.isTextblock&&!e.hasMarkup(r,o)&&function(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(t.doc,t.mapping.slice(i).map(n),r)){t.clearIncompatible(t.mapping.slice(i).map(n,1),r);let s=t.mapping.slice(i),a=s.map(n,1),l=s.map(n+e.nodeSize,1);return t.step(new Uo(a,l,a+1,l-1,new Dr(Ar.from(r.create(o,null,e.marks)),0,0),1,!0)),!1}}))}(this,t,e,n,r),this}setNodeMarkup(t,e,n=null,r=[]){return function(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Uo(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Dr(Ar.from(s),0,0),1,!0))}(this,t,e,n,r),this}setNodeAttribute(t,e,n){return this.step(new di(t,e,n)),this}addNodeMark(t,e){return this.step(new Vo(t,e)),this}removeNodeMark(t,e){if(!(e instanceof Ir)){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(n.marks)))return this}return this.step(new Wo(t,e)),this}split(t,e=1,n){return function(t,e,n=1,r){let o=t.doc.resolve(e),i=Ar.empty,s=Ar.empty;for(let t=o.depth,e=o.depth-n,a=n-1;t>e;t--,a--){i=Ar.from(o.node(t).copy(i));let e=r&&r[a];s=Ar.from(e?e.type.create(e.attrs,s):o.node(t).copy(s))}t.step(new qo(e,e,new Dr(i.append(s),n,n),!0))}(this,t,e,n),this}addMark(t,e,n){return function(t,e,n,r){let o,i,s=[],a=[];t.doc.nodesBetween(e,n,((t,l,c)=>{if(!t.isInline)return;let u=t.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,e),h=Math.min(l+t.nodeSize,n),p=r.addToSet(u);for(let t=0;t<u.length;t++)u[t].isInSet(p)||(o&&o.to==c&&o.mark.eq(u[t])?o.to=h:s.push(o=new Bo(c,h,u[t])));i&&i.to==c?i.to=h:a.push(i=new Ho(c,h,r))}})),s.forEach((e=>t.step(e))),a.forEach((e=>t.step(e)))}(this,t,e,n),this}removeMark(t,e,n){return function(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,((t,s)=>{if(!t.isInline)return;i++;let a=null;if(r instanceof go){let e,n=t.marks;for(;e=r.isInSet(n);)(a||(a=[])).push(e),n=e.removeFromSet(n)}else r?r.isInSet(t.marks)&&(a=[r]):a=t.marks;if(a&&a.length){let r=Math.min(s+t.nodeSize,n);for(let t=0;t<a.length;t++){let n,l=a[t];for(let t=0;t<o.length;t++){let e=o[t];e.step==i-1&&l.eq(o[t].style)&&(n=e)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,e),to:r,step:i})}}})),o.forEach((e=>t.step(new Bo(e.from,e.to,e.style))))}(this,t,e,n),this}clearIncompatible(t,e,n){return function(t,e,n,r=n.contentMatch){let o=t.doc.nodeAt(e),i=[],s=e+1;for(let e=0;e<o.childCount;e++){let a=o.child(e),l=s+a.nodeSize,c=r.matchType(a.type);if(c){r=c;for(let e=0;e<a.marks.length;e++)n.allowsMarkType(a.marks[e].type)||t.step(new Bo(s,l,a.marks[e]))}else i.push(new qo(s,l,Dr.empty));s=l}if(!r.validEnd){let e=r.fillBefore(Ar.empty,!0);t.replace(s,s,new Dr(e,0,0))}for(let e=i.length-1;e>=0;e--)t.step(i[e])}(this,t,e,n),this}}const gi=Object.create(null);class yi{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new vi(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=Dr.empty){let n=e.content.lastChild,r=null;for(let t=0;t<e.openEnd;t++)r=n,n=n.lastChild;let o=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=t.mapping.slice(o);t.replaceRange(c.map(a.pos),c.map(l.pos),s?Dr.empty:e),0==s&&Ai(t,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=t.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?t.deleteRange(l,c):(t.replaceRangeWith(l,c,e),Ai(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new wi(t):Oi(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let r=t.depth-1;r>=0;r--){let o=e<0?Oi(t.node(0),t.node(r),t.before(r+1),t.index(r),e,n):Oi(t.node(0),t.node(r),t.after(r+1),t.index(r)+1,e,n);if(o)return o}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Ei(t.node(0))}static atStart(t){return Oi(t,t,0,0,1)||new Ei(t)}static atEnd(t){return Oi(t,t,t.content.size,t.childCount,-1)||new Ei(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=gi[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in gi)throw new RangeError("Duplicate use of selection JSON ID "+t);return gi[t]=e,e.prototype.jsonID=t,e}getBookmark(){return wi.between(this.$anchor,this.$head).getBookmark()}}yi.prototype.visible=!0;class vi{constructor(t,e){this.$from=t,this.$to=e}}let bi=!1;function _i(t){bi||t.parent.inlineContent||(bi=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class wi extends yi{constructor(t,e=t){_i(t),_i(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return yi.near(n);let r=t.resolve(e.map(this.anchor));return new wi(r.parent.inlineContent?r:n,n)}replace(t,e=Dr.empty){if(super.replace(t,e),e==Dr.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof wi&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ki(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new wi(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(t,e,n){let r=t.pos-e.pos;if(n&&!r||(n=r>=0?1:-1),!e.parent.inlineContent){let t=yi.findFrom(e,n,!0)||yi.findFrom(e,-n,!0);if(!t)return yi.near(e,n);e=t.$head}return t.parent.inlineContent||(0==r||(t=(yi.findFrom(t,-n,!0)||yi.findFrom(t,n,!0)).$anchor).pos<e.pos!=r<0)&&(t=e),new wi(t,e)}}yi.jsonID("text",wi);class ki{constructor(t,e){this.anchor=t,this.head=e}map(t){return new ki(t.map(this.anchor),t.map(this.head))}resolve(t){return wi.between(t.resolve(this.anchor),t.resolve(this.head))}}class xi extends yi{constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}map(t,e){let{deleted:n,pos:r}=e.mapResult(this.anchor),o=t.resolve(r);return n?yi.near(o):new xi(o)}content(){return new Dr(Ar.from(this.node),0,0)}eq(t){return t instanceof xi&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Si(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new xi(t.resolve(e.anchor))}static create(t,e){return new xi(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}xi.prototype.visible=!1,yi.jsonID("node",xi);class Si{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:n}=t.mapResult(this.anchor);return e?new ki(n,n):new Si(n)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&xi.isSelectable(n)?new xi(e):yi.near(e)}}class Ei extends yi{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=Dr.empty){if(e==Dr.empty){t.delete(0,t.doc.content.size);let e=yi.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new Ei(t)}map(t){return new Ei(t)}eq(t){return t instanceof Ei}getBookmark(){return Ci}}yi.jsonID("all",Ei);const Ci={map(){return this},resolve:t=>new Ei(t)};function Oi(t,e,n,r,o,i=!1){if(e.inlineContent)return wi.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let r=e.child(s);if(r.isAtom){if(!i&&xi.isSelectable(r))return xi.create(t,n-(o<0?r.nodeSize:0))}else{let e=Oi(t,r,n+o,o<0?r.childCount:0,o,i);if(e)return e}n+=r.nodeSize*o}return null}function Ai(t,e,n){let r=t.steps.length-1;if(r<e)return;let o,i=t.steps[r];(i instanceof qo||i instanceof Uo)&&(t.mapping.maps[r].forEach(((t,e,n,r)=>{null==o&&(o=r)})),t.setSelection(yi.near(t.doc.resolve(o),n)))}function Mi(t,e){return e&&t?t.bind(e):t}class Ti{constructor(t,e,n){this.name=t,this.init=Mi(e.init,n),this.apply=Mi(e.apply,n)}}function Ni(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=Ni(o,e,{})),n[r]=o}return n}new Ti("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new Ti("selection",{init:(t,e)=>t.selection||yi.atStart(e.doc),apply:t=>t.selection}),new Ti("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,r)=>r.selection.$cursor?t.storedMarks:null}),new Ti("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e});class Ii{constructor(t){this.spec=t,this.props={},t.props&&Ni(t.props,this,this.props),this.key=t.key?t.key.key:Di("plugin")}getState(t){return t[this.key]}}const Ri=Object.create(null);function Di(t){return t in Ri?t+"$"+ ++Ri[t]:(Ri[t]=0,t+"$")}class Li{constructor(t="key"){this.key=Di(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const $i=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},Pi=function(t,e,n,r){return n&&(ji(t,e,n,r,-1)||ji(t,e,n,r,1))},zi=/^(img|br|input|textarea|hr)$/i;function ji(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Fi(t))){let n=t.parentNode;if(!n||1!=n.nodeType||Hi(t)||zi.test(t.nodeName)||"false"==t.contentEditable)return!1;e=$i(t)+(o<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?Fi(t):0}}}function Fi(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Hi(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Bi=function(t){return t.focusNode&&Pi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Vi(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Wi="undefined"!=typeof navigator?navigator:null,qi="undefined"!=typeof document?document:null,Ui=Wi&&Wi.userAgent||"",Ki=/Edge\/(\d+)/.exec(Ui),Ji=/MSIE \d/.exec(Ui),Gi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ui),Yi=!!(Ji||Gi||Ki),Xi=Ji?document.documentMode:Gi?+Gi[1]:Ki?+Ki[1]:0,Zi=!Yi&&/gecko\/(\d+)/i.test(Ui);Zi&&(/Firefox\/(\d+)/.exec(Ui)||[0,0])[1];const Qi=!Yi&&/Chrome\/(\d+)/.exec(Ui),ts=!!Qi,es=Qi?+Qi[1]:0,ns=!Yi&&!!Wi&&/Apple Computer/.test(Wi.vendor),rs=ns&&(/Mobile\/\w+/.test(Ui)||!!Wi&&Wi.maxTouchPoints>2),is=rs||!!Wi&&/Mac/.test(Wi.platform),ss=/Android \d/.test(Ui),as=!!qi&&"webkitFontSmoothing"in qi.documentElement.style,ls=as?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cs(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(Bi(n)){for(a=c;o&&!o.node;)o=o.parent;let t=o.node;if(o&&t.isAtom&&xi.isSelectable(t)&&o.parent&&(!t.isInline||!function(t,e,n){for(let r=0==e,o=e==Fi(t);r||o;){if(t==n)return!0;let e=$i(t);if(!(t=t.parentNode))return!1;r=r&&0==e,o=o&&e==Fi(t)}}(n.focusNode,n.focusOffset,o.dom))){let t=o.posBefore;l=new xi(s==t?c:r.resolve(t))}}else{let e=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(e<0)return null;a=r.resolve(e)}if(!l){l=ys(t,a,c,"pointer"==e||t.state.selection.head<c.pos&&!i?1:-1)}return l}function us(t){return t.editable?t.hasFocus():function(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function hs(t,e=!1){let n=t.state.selection;if(function(t,e){if(e instanceof xi){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(gs(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else gs(t)}(t,n),us(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ts){let e=t.domSelectionRange(),n=t.domObserver.currentSelection;if(e.anchorNode&&n.anchorNode&&Pi(e.anchorNode,e.anchorOffset,n.anchorNode,n.anchorOffset))return t.input.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,$i(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Yi&&Xi<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{let r,o,{anchor:i,head:s}=n;!ps||n instanceof wi||(n.$from.parent.inlineContent||(r=ds(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=ds(t,n.to))),t.docView.setSelection(i,s,t.root,e),ps&&(r&&ms(r),o&&ms(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{us(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const ps=ns||ts&&es<63;function ds(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(ns&&o&&"false"==o.contentEditable)return fs(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return fs(o);if(i)return fs(i)}}function fs(t){return t.contentEditable="true",ns&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ms(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function gs(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ys(t,e,n,r){return t.someProp("createSelectionBetween",(r=>r(t,e,n)))||wi.between(e,n,r)}function vs(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&yi.findFrom(i,e)}function bs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _s(t,e,n){let r=t.state.selection;if(!(r instanceof wi)){if(r instanceof xi&&r.node.isInline)return bs(t,new wi(e>0?r.$to:r.$from));{let n=vs(t.state,e);return!!n&&bs(t,n)}}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){let n=vs(t.state,e);return!!(n&&n instanceof xi)&&bs(t,n)}if(!(is&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=e<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=t.docView.descAt(s))&&!n.contentDOM)&&(xi.isSelectable(i)?bs(t,new xi(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):!!as&&bs(t,new wi(t.state.doc.resolve(e<0?s:s+i.nodeSize))))}}function ws(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function ks(t){let e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function xs(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Zi&&1==n.nodeType&&r<ws(n)&&ks(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let t=n.childNodes[r-1];if(ks(t))o=n,i=--r;else{if(3!=t.nodeType)break;n=t,r=n.nodeValue.length}}}else{if(Es(n))break;{let e=n.previousSibling;for(;e&&ks(e);)o=n.parentNode,i=$i(e),e=e.previousSibling;if(e)n=e,r=ws(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Cs(t,n,r):o&&Cs(t,o,i)}function Ss(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=ws(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!ks(n.childNodes[r]))break;o=n,i=++r}else{if(Es(n))break;{let e=n.nextSibling;for(;e&&ks(e);)o=e.parentNode,i=$i(e)+1,e=e.nextSibling;if(e)n=e,r=0,s=ws(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}o&&Cs(t,o,i)}function Es(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Cs(t,e,n){let r=t.domSelection();if(Bi(r)){let t=document.createRange();t.setEnd(e,n),t.setStart(e,n),r.removeAllRanges(),r.addRange(t)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout((()=>{t.state==o&&hs(t)}),50)}function Os(t,e,n){let r=t.state.selection;if(r instanceof wi&&!r.empty||n.indexOf("s")>-1)return!1;if(is&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=vs(t.state,e);if(n&&n instanceof xi)return bs(t,n)}if(!o.parent.inlineContent){let n=e<0?o:i,s=r instanceof Ei?yi.near(n,e):yi.findFrom(n,e);return!!s&&bs(t,s)}return!1}function As(t,e){if(!(t.state.selection instanceof wi))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=t.state.tr;return e<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),t.dispatch(r),!0}return!1}function Ms(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Ts(t,e){let n=e.keyCode,r=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||is&&72==n&&"c"==r?As(t,-1)||xs(t):46==n||is&&68==n&&"c"==r?As(t,1)||Ss(t):13==n||27==n||(37==n||is&&66==n&&"c"==r?_s(t,-1,r)||xs(t):39==n||is&&70==n&&"c"==r?_s(t,1,r)||Ss(t):38==n||is&&80==n&&"c"==r?Os(t,-1,r)||xs(t):40==n||is&&78==n&&"c"==r?function(t){if(!ns||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;Ms(t,n,"true"),setTimeout((()=>Ms(t,n,"false")),20)}return!1}(t)||Os(t,1,r)||Ss(t):r==(is?"m":"c")&&(66==n||73==n||89==n||90==n))}function Ns(t,e){t.someProp("transformCopied",(n=>{e=n(e,t)}));let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let t=r.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),r=t.content}let s=t.someProp("clipboardSerializer")||Mo.fromSchema(t.state.schema),a=Hs(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,h=0;for(;u&&1==u.nodeType&&(c=js[u.nodeName.toLowerCase()]);){for(let t=c.length-1;t>=0;t--){let e=a.createElement(c[t]);for(;l.firstChild;)e.appendChild(l.firstChild);l.appendChild(e),h++}u=l.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${o} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:l,text:t.someProp("clipboardTextSerializer",(n=>n(e,t)))||e.content.textBetween(0,e.content.size,"\n\n")}}function Is(t,e,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!e)return null;let l=e&&(r||a||!n);if(l){if(t.someProp("transformPastedText",(n=>{e=n(e,a||r,t)})),a)return e?new Dr(Ar.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):Dr.empty;let n=t.someProp("clipboardTextParser",(n=>n(e,o,r,t)));if(n)s=n;else{let n=o.marks(),{schema:r}=t.state,s=Mo.fromSchema(r);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=i.appendChild(document.createElement("p"));t&&e.appendChild(s.serializeNode(r.text(t,n)))}))}}else t.someProp("transformPastedHTML",(e=>{n=e(n,t)})),i=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,r=Hs().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&js[o[1].toLowerCase()])&&(t=n.map((t=>"<"+t+">")).join("")+t+n.map((t=>"</"+t+">")).reverse().join(""));if(r.innerHTML=t,n)for(let t=0;t<n.length;t++)r=r.querySelector(n[t])||r;return r}(n),as&&function(t){let e=t.querySelectorAll(ts?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let t=+u[3];t>0;t--){let t=i.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;i=t}if(!s){let e=t.someProp("clipboardParser")||t.someProp("domParser")||bo.fromSchema(t.state.schema);s=e.parseSlice(i,{preserveWhitespace:!(!l&&!u),context:o,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||Rs.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(u)s=function(t,e){if(!t.size)return t;let n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}let{content:o,openStart:i,openEnd:s}=t;for(let t=n.length-2;t>=0;t-=2){let e=r.nodes[n[t]];if(!e||e.hasRequiredAttrs())break;o=Ar.from(e.create(n[t+1],o)),i++,s++}return new Dr(o,i,s)}(zs(s,+u[1],+u[2]),u[4]);else if(s=Dr.maxOpen(function(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r,o=e.node(n).contentMatchAt(e.index(n)),i=[];if(t.forEach((t=>{if(!i)return;let e,n=o.findWrapping(t.type);if(!n)return i=null;if(e=i.length&&r.length&&Ls(n,r,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=$s(i[i.length-1],r.length));let e=Ds(t,n);i.push(e),o=o.matchType(e.type),r=n}})),i)return Ar.from(i)}return t}(s.content,o),!0),s.openStart||s.openEnd){let t=0,e=0;for(let e=s.content.firstChild;t<s.openStart&&!e.type.spec.isolating;t++,e=e.firstChild);for(let t=s.content.lastChild;e<s.openEnd&&!t.type.spec.isolating;e++,t=t.lastChild);s=zs(s,t,e)}return t.someProp("transformPasted",(e=>{s=e(s,t)})),s}const Rs=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ds(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ar.from(t));return t}function Ls(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Ls(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(Ar.from(Ds(n,t,o+1))))}}function $s(t,e){if(0==e)return t;let n=t.content.replaceChild(t.childCount-1,$s(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Ar.empty,!0);return t.copy(n.append(r))}function Ps(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return o<r-1&&(a=Ps(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,t.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Ar.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function zs(t,e,n){return e<t.openStart&&(t=new Dr(Ps(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Dr(Ps(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const js={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Fs=null;function Hs(){return Fs||(Fs=document.implementation.createHTMLDocument("title"))}const Bs={},Vs={};function Ws(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function qs(t){return{left:t.clientX,top:t.clientY}}function Us(t,e,n,r,o){if(-1==r)return!1;let i=t.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(t.someProp(e,(e=>r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function Ks(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Js(t,e,n,r,o){return Us(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(n=>n(t,e,r)))||(o?function(t,e){if(-1==e)return!1;let n,r,o=t.state.selection;o instanceof xi&&(n=o.node);let i=t.state.doc.resolve(e);for(let t=i.depth+1;t>0;t--){let e=t>i.depth?i.nodeAfter:i.node(t);if(xi.isSelectable(e)){r=n&&o.$from.depth>0&&t>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(t);break}}return null!=r&&(Ks(t,xi.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&xi.isSelectable(r))&&(Ks(t,new xi(n),"pointer"),!0)}(t,n))}function Gs(t,e,n,r){return Us(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(n=>n(t,e,r)))}function Ys(t,e,n,r){return Us(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(n=>n(t,e,r)))||function(t,e,n){if(0!=n.button)return!1;let r=t.state.doc;if(-1==e)return!!r.inlineContent&&(Ks(t,wi.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(e);for(let e=o.depth+1;e>0;e--){let n=e>o.depth?o.nodeAfter:o.node(e),i=o.before(e);if(n.inlineContent)Ks(t,wi.create(r,i+1,i+1+n.content.size),"pointer");else{if(!xi.isSelectable(n))continue;Ks(t,xi.create(r,i),"pointer")}return!0}}(t,n,r)}function Xs(t){return oa(t)}Vs.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!ta(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!ss||!ts||13!=n.keyCode))if(229!=n.keyCode&&t.domObserver.forceFlush(),!rs||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",(e=>e(t,n)))||Ts(t,n)?n.preventDefault():Ws(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,Vi(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},Vs.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},Vs.keypress=(t,e)=>{let n=e;if(ta(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||is&&n.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,n))))return void n.preventDefault();let r=t.state.selection;if(!(r instanceof wi&&r.$from.sameParent(r.$to))){let e=String.fromCharCode(n.charCode);t.someProp("handleTextInput",(n=>n(t,r.$from.pos,r.$to.pos,e)))||t.dispatch(t.state.tr.insertText(e).scrollIntoView()),n.preventDefault()}};const Zs=is?"metaKey":"ctrlKey";Bs.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Xs(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&function(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(n,t.input.lastClick)&&!n[Zs]&&("singleClick"==t.input.lastClick.type?i="doubleClick":"doubleClick"==t.input.lastClick.type&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(qs(n));s&&("singleClick"==i?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Qs(t,s,n,!!r)):("doubleClick"==i?Gs:Ys)(t,s.pos,s.inside,n)?n.preventDefault():Ws(t,"pointer"))};class Qs{constructor(t,e,n,r){let o,i;if(this.view=t,this.pos=e,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[Zs],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{let n=t.state.doc.resolve(e.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?t.docView.nearestDesc(s,!0):null;this.target=a?a.dom:null;let{selection:l}=t.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof xi&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Zi||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ws(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>hs(this.view))),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(qs(t))),this.updateAllowDefault(t),this.allowDefault||!e?Ws(this.view,"pointer"):Js(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||ns&&this.mightDrag&&!this.mightDrag.node.isAtom||ts&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Ks(this.view,yi.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Ws(this.view,"pointer")}move(t){this.updateAllowDefault(t),Ws(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function ta(t,e){return!!t.composing||!!(ns&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}Bs.touchstart=t=>{t.input.lastTouch=Date.now(),Xs(t),Ws(t,"pointer")},Bs.touchmove=t=>{t.input.lastTouch=Date.now(),Ws(t,"pointer")},Bs.contextmenu=t=>Xs(t);const ea=ss?5e3:-1;function na(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>oa(t)),e))}function ra(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function oa(t,e=!1){if(!(ss&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ra(t),e||t.docView&&t.docView.dirty){let e=cs(t);return e&&!e.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(e)):t.updateState(t.state),!0}return!1}}Vs.compositionstart=Vs.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))))t.markCursor=t.state.storedMarks||n.marks(),oa(t,!0),t.markCursor=null;else if(oa(t),Zi&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,r=e.focusOffset;n&&1==n.nodeType&&0!=r;){let e=r<0?n.lastChild:n.childNodes[r-1];if(!e)break;if(3==e.nodeType){t.domSelection().collapse(e,e.nodeValue.length);break}n=e,r=-1}}t.input.composing=!0}na(t,ea)},Vs.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,na(t,20))};const ia=Yi&&Xi<15||rs&&ls<604;function sa(t,e,n,r){let o=Is(t,e,n,t.input.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,r,o||Dr.empty))))return!0;if(!o)return!1;let i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.input.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Bs.copy=Vs.cut=(t,e)=>{let n=e,r=t.state.selection,o="cut"==n.type;if(r.empty)return;let i=ia?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ns(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Vs.paste=(t,e)=>{let n=e;if(t.composing&&!ss)return;let r=ia?null:n.clipboardData;r&&sa(t,r.getData("text/plain"),r.getData("text/html"),n)?n.preventDefault():function(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sa(t,r.value,null,e):sa(t,r.textContent,r.innerHTML,e)}),50)}(t,n)};class aa{constructor(t,e){this.slice=t,this.move=e}}const la=is?"altKey":"ctrlKey";Bs.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(qs(n));if(i&&i.pos>=o.from&&i.pos<=(o instanceof xi?o.to-1:o.to));else if(r&&r.mightDrag)t.dispatch(t.state.tr.setSelection(xi.create(t.state.doc,r.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&t.dispatch(t.state.tr.setSelection(xi.create(t.state.doc,e.posBefore)))}let s=t.state.selection.content(),{dom:a,text:l}=Ns(t,s);n.dataTransfer.clearData(),n.dataTransfer.setData(ia?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",ia||n.dataTransfer.setData("text/plain",l),t.dragging=new aa(s,!n[la])},Bs.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},Vs.dragover=Vs.dragenter=(t,e)=>e.preventDefault(),Vs.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(qs(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",(e=>{s=e(s,t)})):s=Is(t,n.dataTransfer.getData(ia?"Text":"text/plain"),ia?null:n.dataTransfer.getData("text/html"),!1,i);let a=!(!r||n[la]);if(t.someProp("handleDrop",(e=>e(t,n,s||Dr.empty,a))))return void n.preventDefault();if(!s)return;n.preventDefault();let l=s?function(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let t=0;t<n.openStart;t++)o=o.firstChild.content;for(let t=1;t<=(0==n.openStart&&n.size?2:1);t++)for(let e=r.depth;e>=0;e--){let n=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,i=r.index(e)+(n>0?1:0),s=r.node(e),a=!1;if(1==t)a=s.canReplace(i,i,o);else{let t=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=t&&s.canReplaceWith(i,i,t[0])}if(a)return 0==n?r.pos:n<0?r.before(e+1):r.after(e+1)}return null}(t.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);let c=t.state.tr;a&&c.deleteSelection();let u=c.mapping.map(l),h=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,p=c.doc;if(h?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let d=c.doc.resolve(u);if(h&&xi.isSelectable(s.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new xi(d));else{let e=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((t,n,r,o)=>e=o)),c.setSelection(ys(t,d,c.doc.resolve(e)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Bs.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&hs(t)}),20))},Bs.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Bs.beforeinput=(t,e)=>{if(ts&&ss&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,Vi(8,"Backspace")))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let t in Vs)Bs[t]=Vs[t];function ca(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ua{constructor(t,e){this.toDOM=t,this.spec=e||ma,this.side=this.spec.side||0}map(t,e,n,r){let{pos:o,deleted:i}=t.mapResult(e.from+r,this.side<0?-1:1);return i?null:new da(o-n,o-n,this)}valid(){return!0}eq(t){return this==t||t instanceof ua&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ca(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ha{constructor(t,e){this.attrs=t,this.spec=e||ma}map(t,e,n,r){let o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new da(o,i,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof ha&&ca(this.attrs,t.attrs)&&ca(this.spec,t.spec)}static is(t){return t.type instanceof ha}destroy(){}}class pa{constructor(t,e){this.attrs=t,this.spec=e||ma}map(t,e,n,r){let o=t.mapResult(e.from+r,1);if(o.deleted)return null;let i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new da(o.pos-n,i.pos-n,this)}valid(t,e){let n,{index:r,offset:o}=t.content.findIndex(e.from);return o==e.from&&!(n=t.child(r)).isText&&o+n.nodeSize==e.to}eq(t){return this==t||t instanceof pa&&ca(this.attrs,t.attrs)&&ca(this.spec,t.spec)}destroy(){}}class da{constructor(t,e,n){this.from=t,this.to=e,this.type=n}copy(t,e){return new da(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,n){return this.type.map(t,this,e,n)}static widget(t,e,n){return new da(t,t,new ua(e,n))}static inline(t,e,n,r){return new da(t,e,new ha(n,r))}static node(t,e,n,r){return new da(t,e,new pa(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof ha}}const fa=[],ma={};class ga{constructor(t,e){this.local=t.length?t:fa,this.children=e.length?e:fa}static create(t,e){return e.length?ka(e,t,0,ma):ya}find(t,e,n){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r}findInner(t,e,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<e&&this.children[i+1]>t){let s=this.children[i]+1;this.children[i+2].findInner(t-s,e-s,n,r+s,o)}}map(t,e,n){return this==ya||0==t.maps.length?this:this.mapInner(t,e,0,0,n||ma)}mapInner(t,e,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){let a=t.slice();for(let t=0,e=i;t<n.maps.length;t++){let r=0;n.maps[t].forEach(((t,n,i,s)=>{let l=s-i-(n-t);for(let s=0;s<a.length;s+=3){let c=a[s+1];if(c<0||t>c+e-r)continue;let u=a[s]+e-r;n>=u?a[s+1]=t<=u?-2:-1:i>=o&&l&&(a[s]+=l,a[s+1]+=l)}r+=l})),e=n.maps[t].map(e,-1)}let l=!1;for(let e=0;e<a.length;e+=3)if(a[e+1]<0){if(-2==a[e+1]){l=!0,a[e+1]=-1;continue}let c=n.map(t[e]+i),u=c-o;if(u<0||u>=r.content.size){l=!0;continue}let h=n.map(t[e+1]+i,-1)-o,{index:p,offset:d}=r.content.findIndex(u),f=r.maybeChild(p);if(f&&d==u&&d+f.nodeSize==h){let r=a[e+2].mapInner(n,f,c+1,t[e]+i+1,s);r!=ya?(a[e]=u,a[e+1]=h,a[e+2]=r):(a[e+1]=-2,l=!0)}else l=!0}if(l){let l=function(t,e,n,r,o,i,s){function a(t,e){for(let i=0;i<t.local.length;i++){let a=t.local[i].map(r,o,e);a?n.push(a):s.onRemove&&s.onRemove(t.local[i].spec)}for(let n=0;n<t.children.length;n+=3)a(t.children[n+2],t.children[n]+e+1)}for(let n=0;n<t.length;n+=3)-1==t[n+1]&&a(t[n+2],e[n]+i+1);return n}(a,t,e,n,o,i,s),c=ka(l,r,0,s);e=c.local;for(let t=0;t<a.length;t+=3)a[t+1]<0&&(a.splice(t,3),t-=3);for(let t=0,e=0;t<c.children.length;t+=3){let n=c.children[t];for(;e<a.length&&a[e]<n;)e+=3;a.splice(e,0,c.children[t],c.children[t+1],c.children[t+2])}}return new ga(e.sort(xa),a)}(this.children,i||[],t,e,n,r,o):i?new ga(i.sort(xa),fa):ya}add(t,e){return e.length?this==ya?ga.create(t,e):this.addInner(t,e,0):this}addInner(t,e,n){let r,o=0;t.forEach(((t,i)=>{let s,a=i+n;if(s=_a(e,t,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(t,s,a+1):r.splice(o,0,i,i+t.nodeSize,ka(s,t,a+1,ma)),o+=3}}));let i=ba(o?wa(e):e,-n);for(let e=0;e<i.length;e++)i[e].type.valid(t,i[e])||i.splice(e--,1);return new ga(i.length?this.local.concat(i).sort(xa):this.local,r||this.children)}remove(t){return 0==t.length||this==ya?this:this.removeInner(t,0)}removeInner(t,e){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+e,s=n[r+1]+e;for(let e,n=0;n<t.length;n++)(e=t[n])&&e.from>i&&e.to<s&&(t[n]=null,(o||(o=[])).push(e));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=ya?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<t.length;o++)if(n=t[o])for(let t=0;t<r.length;t++)r[t].eq(n,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ga(r,n):ya}forChild(t,e){if(this==ya)return this;if(e.isLeaf)return ga.empty;let n,r;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(n=this.children[e+2]);break}let o=t+1,i=o+e.content.size;for(let t=0;t<this.local.length;t++){let e=this.local[t];if(e.from<i&&e.to>o&&e.type instanceof ha){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let t=new ga(r.sort(xa),fa);return n?new va([t,n]):t}return n||ya}eq(t){if(this==t)return!0;if(!(t instanceof ga)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return Sa(this.localsInner(t))}localsInner(t){if(this==ya)return fa;if(t.inlineContent||!this.local.some(ha.is))return this.local;let e=[];for(let t=0;t<this.local.length;t++)this.local[t].type instanceof ha||e.push(this.local[t]);return e}}ga.empty=new ga([],[]),ga.removeOverlap=Sa;const ya=ga.empty;class va{constructor(t){this.members=t}map(t,e){const n=this.members.map((n=>n.map(t,e,ma)));return va.from(n)}forChild(t,e){if(e.isLeaf)return ga.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(t,e);o!=ya&&(o instanceof va?n=n.concat(o.members):n.push(o))}return va.from(n)}eq(t){if(!(t instanceof va)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(let t=0;t<o.length;t++)e.push(o[t])}else e=o}return e?Sa(n?e:e.sort(xa)):fa}static from(t){switch(t.length){case 0:return ya;case 1:return t[0];default:return new va(t.every((t=>t instanceof ga))?t:t.reduce(((t,e)=>t.concat(e instanceof ga?e:e.members)),[]))}}}function ba(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new da(o.from+e,o.to+e,o.type))}return n}function _a(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let e,i=0;i<t.length;i++)(e=t[i])&&e.from>n&&e.to<r&&((o||(o=[])).push(e),t[i]=null);return o}function wa(t){let e=[];for(let n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function ka(t,e,n,r){let o=[],i=!1;e.forEach(((e,s)=>{let a=_a(t,e,s+n);if(a){i=!0;let t=ka(a,e,n+s+1,r);t!=ya&&o.push(s,s+e.nodeSize,t)}}));let s=ba(i?wa(t):t,-n).sort(xa);for(let t=0;t<s.length;t++)s[t].type.valid(e,s[t])||(r.onRemove&&r.onRemove(s[t].spec),s.splice(t--,1));return s.length||o.length?new ga(s,o):ya}function xa(t,e){return t.from-e.from||t.to-e.to}function Sa(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ea(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ea(e,o+1,i.copy(r.to,i.to)))}}return e}function Ea(t,e,n){for(;e<t.length&&xa(n,t[e])>0;)e++;t.splice(e,0,n)}for(var Ca={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Oa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Aa="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ma="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ta="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Na=Ma||Aa&&+Aa[1]<57,Ia=0;Ia<10;Ia++)Ca[48+Ia]=Ca[96+Ia]=String(Ia);for(Ia=1;Ia<=24;Ia++)Ca[Ia+111]="F"+Ia;for(Ia=65;Ia<=90;Ia++)Ca[Ia]=String.fromCharCode(Ia+32),Oa[Ia]=String.fromCharCode(Ia);for(var Ra in Ca)Oa.hasOwnProperty(Ra)||(Oa[Ra]=Ca[Ra]);const Da="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function La(t){let e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let t=0;t<i.length-1;t++){let s=i[t];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);Da?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function $a(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function Pa(t){let e=function(t){let e=Object.create(null);for(let n in t)e[La(n)]=t[n];return e}(t);return function(t,n){let r,o=function(t){var e=!(Na&&(t.ctrlKey||t.altKey||t.metaKey)||Ta&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Oa:Ca)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),i=1==o.length&&" "!=o,s=e[$a(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=Ca[n.keyCode])&&r!=o){let o=e[$a(r,n,!0)];if(o&&o(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){let r=e[$a(o,n,!0)];if(r&&r(t.state,t.dispatch,t))return!0}return!1}}function za(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function ja(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Fa(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function Ha(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ba(t,e,n){let r,o,i=e.nodeBefore,s=e.nodeAfter;if(i.type.spec.isolating||s.type.spec.isolating)return!1;if(function(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(i,i+1)||!o.isTextblock&&!Qo(t.doc,e.pos)||(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&o.matchType(r[0]||s.type).validEnd){if(n){let o=e.pos+s.nodeSize,a=Ar.empty;for(let t=r.length-1;t>=0;t--)a=Ar.from(r[t].create(null,a));a=Ar.from(i.copy(a));let l=t.tr.step(new Uo(e.pos-1,o,e.pos,o,new Dr(a,1,0),r.length,!0)),c=o+2*r.length;Qo(l.doc,c)&&l.join(c),n(l.scrollIntoView())}return!0}let l=yi.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&Go(c);if(null!=u&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(a&&za(s,"start",!0)&&za(i,"end")){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let a=s,l=1;for(;!a.isTextblock;a=a.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,a.content)){if(n){let r=Ar.empty;for(let t=o.length-1;t>=0;t--)r=Ar.from(o[t].copy(r));n(t.tr.step(new Uo(e.pos-o.length,e.pos+s.nodeSize,e.pos+l,e.pos+s.nodeSize-l,new Dr(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Va(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(e.tr.setSelection(wi.create(e.doc,t<0?o.start(i):o.end(i)))),!0)}}const Wa=Va(-1),qa=Va(1);function Ua(t,e=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)o=!0;else{let e=n.doc.resolve(i),r=e.index();o=e.parent.canReplaceWith(r,r+1,t)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,t,e)}r(o.scrollIntoView())}return!0}}function Ka(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=!1,l=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&0==s.startIndex){if(0==o.index(s.depth-1))return!1;let t=n.doc.resolve(s.start-2);l=new Yr(t,t,s.depth),s.endIndex<s.parent.childCount&&(s=new Yr(o,n.doc.resolve(i.end(s.depth)),s.depth)),a=!0}let c=Yo(l,t,e,s);return!!c&&(r&&r(function(t,e,n,r,o){let i=Ar.empty;for(let t=n.length-1;t>=0;t--)i=Ar.from(n[t].type.create(n[t].attrs,i));t.step(new Uo(e.start-(r?2:0),e.end,e.start,e.end,new Dr(i,0,0),n.length,!0));let s=0;for(let t=0;t<n.length;t++)n[t].type==o&&(s=t+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let n=e.startIndex,r=e.endIndex,o=!0;n<r;n++,o=!1)!o&&Zo(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(n).nodeSize;return t}(n.tr,s,c,a,t).scrollIntoView()),!0)}}function Ja(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,(e=>e.childCount>0&&e.firstChild.type==t));return!!i&&(!n||(r.node(i.depth-1).type==t?function(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Uo(i-1,s,i,s,new Dr(Ar.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Yr(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Go(r);if(null==a)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;Qo(o.doc,l)&&o.join(l);return e(o.scrollIntoView()),!0}(e,n,t,i):function(t,e,n){let r=t.tr,o=n.parent;for(let t=n.end,e=n.endIndex-1,i=n.startIndex;e>i;e--)t-=o.child(e).nodeSize,r.delete(t-1,t+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?Ar.empty:Ar.from(o))))return!1;let h=i.pos,p=h+s.nodeSize;return r.step(new Uo(h-(a?1:0),p+(l?1:0),h+1,p-1,new Dr((a?Ar.empty:Ar.from(o.copy(Ar.empty))).append(l?Ar.empty:Ar.from(o.copy(Ar.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}(e,n,i)))}}function Ga(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class Ya{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map((([t,e])=>[t,(...t)=>{const n=e(...t)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,l=t||o.tr,c={...Object.fromEntries(Object.entries(n).map((([t,n])=>[t,(...t)=>{const r=this.buildProps(l,e),o=n(...t)(r);return s.push(o),c}]))),run:()=>(a||!e||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every((t=>!0===t)))};return c}createCan(t){const{rawCommands:e,state:n}=this,r=t||n.tr,o=this.buildProps(r,false),i=Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)({...o,dispatch:void 0})])));return{...i,chain:()=>this.createChain(r,false)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:Ga({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map((([t,e])=>[t,(...t)=>e(...t)(s)])))}};return s}}function Xa(t,e,n){if(void 0===t.config[e]&&t.parent)return Xa(t.parent,e,n);if("function"==typeof t.config[e]){return t.config[e].bind({...n,parent:t.parent?Xa(t.parent,e,n):null})}return t.config[e]}function Za(t){return{baseExtensions:t.filter((t=>"extension"===t.type)),nodeExtensions:t.filter((t=>"node"===t.type)),markExtensions:t.filter((t=>"mark"===t.type))}}function Qa(t){const e=[],{nodeExtensions:n,markExtensions:r}=Za(t),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach((t=>{const n=Xa(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage});if(!n)return;n().forEach((t=>{t.types.forEach((n=>{Object.entries(t.attributes).forEach((([t,r])=>{e.push({type:n,name:t,attribute:{...i,...r}})}))}))}))})),o.forEach((t=>{const n={name:t.name,options:t.options,storage:t.storage},r=Xa(t,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach((([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,e.push({type:t.name,name:n,attribute:o})}))})),e}function tl(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function el(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const n={...t};return Object.entries(e).forEach((([t,e])=>{if(n[t])if("class"===t){const r=e?e.split(" "):[],o=n[t]?n[t].split(" "):[],i=r.filter((t=>!o.includes(t)));n[t]=[...o,...i].join(" ")}else n[t]="style"===t?[n[t],e].join("; "):e;else n[t]=e})),n}),{})}function nl(t,e){return e.filter((t=>t.attribute.rendered)).map((e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]})).reduce(((t,e)=>el(t,e)),{})}function rl(t,e=void 0,...n){return function(t){return"function"==typeof t}(t)?e?t.bind(e)(...n):t(...n):t}function ol(t,e){return t.style?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===r)return!1;const o=e.reduce(((t,e)=>{const r=e.attribute.parseHTML?e.attribute.parseHTML(n):function(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}(n.getAttribute(e.name));return null==r?t:{...t,[e.name]:r}}),{});return{...r,...o}}}}function il(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>("attrs"!==t||!function(t={}){return 0===Object.keys(t).length&&t.constructor===Object}(e))&&null!=e)))}function sl(t,e){var n;const r=Qa(t),{nodeExtensions:o,markExtensions:i}=Za(t),s=null===(n=o.find((t=>Xa(t,"topNode"))))||void 0===n?void 0:n.name,a=Object.fromEntries(o.map((n=>{const o=r.filter((t=>t.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:e},s=il({...t.reduce(((t,e)=>{const r=Xa(e,"extendNodeSchema",i);return{...t,...r?r(n):{}}}),{}),content:rl(Xa(n,"content",i)),marks:rl(Xa(n,"marks",i)),group:rl(Xa(n,"group",i)),inline:rl(Xa(n,"inline",i)),atom:rl(Xa(n,"atom",i)),selectable:rl(Xa(n,"selectable",i)),draggable:rl(Xa(n,"draggable",i)),code:rl(Xa(n,"code",i)),defining:rl(Xa(n,"defining",i)),isolating:rl(Xa(n,"isolating",i)),attrs:Object.fromEntries(o.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=rl(Xa(n,"parseHTML",i));a&&(s.parseDOM=a.map((t=>ol(t,o))));const l=Xa(n,"renderHTML",i);l&&(s.toDOM=t=>l({node:t,HTMLAttributes:nl(t,o)}));const c=Xa(n,"renderText",i);return c&&(s.toText=c),[n.name,s]}))),l=Object.fromEntries(i.map((n=>{const o=r.filter((t=>t.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:e},s=il({...t.reduce(((t,e)=>{const r=Xa(e,"extendMarkSchema",i);return{...t,...r?r(n):{}}}),{}),inclusive:rl(Xa(n,"inclusive",i)),excludes:rl(Xa(n,"excludes",i)),group:rl(Xa(n,"group",i)),spanning:rl(Xa(n,"spanning",i)),code:rl(Xa(n,"code",i)),attrs:Object.fromEntries(o.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=rl(Xa(n,"parseHTML",i));a&&(s.parseDOM=a.map((t=>ol(t,o))));const l=Xa(n,"renderHTML",i);return l&&(s.toDOM=t=>l({mark:t,HTMLAttributes:nl(t,o)})),[n.name,s]})));return new yo({topNode:s,nodes:a,marks:l})}function al(t,e){return e.nodes[t]||e.marks[t]||null}function ll(t,e){return Array.isArray(e)?e.some((e=>("string"==typeof e?e:e.name)===t.name)):e}const cl=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,((t,e,o,i)=>{var s,a;const l=(null===(a=(s=t.type.spec).toText)||void 0===a?void 0:a.call(s,{node:t,pos:e,parent:o,index:i}))||t.textContent||"%leaf%";n+=l.slice(0,Math.max(0,r-e))})),n};function ul(t){return"[object RegExp]"===Object.prototype.toString.call(t)}class hl{constructor(t){this.find=t.find,this.handler=t.handler}}const pl=(t,e)=>{if(ul(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function dl(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null===(e=c.nodeBefore||c.nodeAfter)||void 0===e?void 0:e.marks.find((t=>t.type.spec.code))))return!1;let u=!1;const h=cl(c)+i;return s.forEach((t=>{if(u)return;const e=pl(h,t.find);if(!e)return;const s=l.state.tr,c=Ga({state:l.state,transaction:s}),p={from:r-(e[0].length-i.length),to:o},{commands:d,chain:f,can:m}=new Ya({editor:n,state:c});null!==t.handler({state:c,range:p,match:e,commands:d,chain:f,can:m})&&s.steps.length&&(s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),u=!0)})),u}function fl(t){const{editor:e,rules:n}=t,r=new Ii({state:{init:()=>null,apply(t,e){const n=t.getMeta(r);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:(t,o,i,s)=>dl({editor:e,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:t=>(setTimeout((()=>{const{$cursor:o}=t.state.selection;o&&dl({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})})),!1)},handleKeyDown(t,o){if("Enter"!==o.key)return!1;const{$cursor:i}=t.state.selection;return!!i&&dl({editor:e,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}class ml{constructor(t){this.find=t.find,this.handler=t.handler}}const gl=(t,e)=>{if(ul(e))return[...t.matchAll(e)];const n=e(t);return n?n.map((e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n})):[]};function yl(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=new ClipboardEvent("paste"),a=new DragEvent("drop");const l=n.map((t=>new Ii({view(t){const e=e=>{var n;r=(null===(n=t.dom.parentElement)||void 0===n?void 0:n.contains(e.target))?t.dom.parentElement:null};return window.addEventListener("dragstart",e),{destroy(){window.removeEventListener("dragstart",e)}}},props:{handleDOMEvents:{drop:(t,e)=>(i=r===t.dom.parentElement,a=e,!1),paste:(t,e)=>{var n;const r=null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html");return s=e,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(n,r,l)=>{const c=n[0],u="paste"===c.getMeta("uiEvent")&&!o,h="drop"===c.getMeta("uiEvent")&&!i;if(!u&&!h)return;const p=r.doc.content.findDiffStart(l.doc.content),d=r.doc.content.findDiffEnd(l.doc.content);if("number"!=typeof p||!d||p===d.b)return;const f=l.tr,m=Ga({state:l,transaction:f}),g=function(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Ya({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,o,((t,e)=>{if(!t.isTextblock||t.type.spec.code)return;const p=Math.max(r,e),d=Math.min(o,e+t.content.size),f=t.textBetween(p-e,d-e,void 0,"");gl(f,i.find).forEach((t=>{if(void 0===t.index)return;const e=p+t.index+1,r=e+t[0].length,o={from:n.tr.mapping.map(e),to:n.tr.mapping.map(r)},d=i.handler({state:n,range:o,match:t,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});h.push(d)}))})),h.every((t=>null!==t))}({editor:e,state:m,from:Math.max(p-1,0),to:d.b-1,rule:t,pasteEvent:s,dropEvent:a});return g&&f.steps.length?(a=new DragEvent("drop"),s=new ClipboardEvent("paste"),f):void 0}})));return l}class vl{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=vl.resolve(t),this.schema=sl(this.extensions,e),this.extensions.forEach((t=>{var e;this.editor.extensionStorage[t.name]=t.storage;const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:al(t.name,this.schema)};if("mark"===t.type){(null===(e=rl(Xa(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name)}const r=Xa(t,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);const o=Xa(t,"onCreate",n);o&&this.editor.on("create",o);const i=Xa(t,"onUpdate",n);i&&this.editor.on("update",i);const s=Xa(t,"onSelectionUpdate",n);s&&this.editor.on("selectionUpdate",s);const a=Xa(t,"onTransaction",n);a&&this.editor.on("transaction",a);const l=Xa(t,"onFocus",n);l&&this.editor.on("focus",l);const c=Xa(t,"onBlur",n);c&&this.editor.on("blur",c);const u=Xa(t,"onDestroy",n);u&&this.editor.on("destroy",u)}))}static resolve(t){const e=vl.sort(vl.flatten(t)),n=function(t){const e=t.filter(((e,n)=>t.indexOf(e)!==n));return[...new Set(e)]}(e.map((t=>t.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((t=>`'${t}'`)).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map((t=>{const e=Xa(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...this.flatten(e())]:t})).flat(10)}static sort(t){return t.sort(((t,e)=>{const n=Xa(t,"priority")||100,r=Xa(e,"priority")||100;return n>r?-1:n<r?1:0}))}get commands(){return this.extensions.reduce(((t,e)=>{const n=Xa(e,"addCommands",{name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:al(e.name,this.schema)});return n?{...t,...n()}:t}),{})}get plugins(){const{editor:t}=this,e=vl.sort([...this.extensions].reverse()),n=[],r=[],o=e.map((e=>{const o={name:e.name,options:e.options,storage:e.storage,editor:t,type:al(e.name,this.schema)},i=[],s=Xa(e,"addKeyboardShortcuts",o);let a={};if("mark"===e.type&&e.config.exitable&&(a.ArrowRight=()=>Kl.handleExit({editor:t,mark:e})),s){const e=Object.fromEntries(Object.entries(s()).map((([e,n])=>[e,()=>n({editor:t})])));a={...a,...e}}const l=new Ii({props:{handleKeyDown:Pa(a)}});i.push(l);const c=Xa(e,"addInputRules",o);ll(e,t.options.enableInputRules)&&c&&n.push(...c());const u=Xa(e,"addPasteRules",o);ll(e,t.options.enablePasteRules)&&u&&r.push(...u());const h=Xa(e,"addProseMirrorPlugins",o);if(h){const t=h();i.push(...t)}return i})).flat();return[fl({editor:t,rules:n}),...yl({editor:t,rules:r}),...o]}get attributes(){return Qa(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Za(this.extensions);return Object.fromEntries(e.filter((t=>!!Xa(t,"addNodeView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),r={name:e.name,options:e.options,storage:e.storage,editor:t,type:tl(e.name,this.schema)},o=Xa(e,"addNodeView",r);if(!o)return[];return[e.name,(r,i,s,a)=>{const l=nl(r,n);return o()({editor:t,node:r,getPos:s,decorations:a,HTMLAttributes:l,extension:e})}]})))}}function bl(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&(t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype)}function _l(t,e){const n={...t};return bl(t)&&bl(e)&&Object.keys(e).forEach((r=>{bl(e[r])?r in t?n[r]=_l(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})})),n}class wl{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=rl(Xa(this,"addOptions",{name:this.name}))),this.storage=rl(Xa(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new wl(t)}configure(t={}){const e=this.extend();return e.options=_l(this.options,t),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new wl(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=rl(Xa(e,"addOptions",{name:e.name})),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}}wl.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Ii({key:new Li("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map((t=>t.$from.pos))),a=Math.max(...i.map((t=>t.$to.pos))),l=function(t){return Object.fromEntries(Object.entries(t.nodes).filter((([,t])=>t.spec.toText)).map((([t,e])=>[t,e.spec.toText])))}(n);return function(t,e,n){const{from:r,to:o}=e,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="",l=!0;return t.nodesBetween(r,o,((t,n,c,u)=>{var h;const p=null==s?void 0:s[t.type.name];p?(t.isBlock&&!l&&(a+=i,l=!0),c&&(a+=p({node:t,pos:n,parent:c,index:u,range:e}))):t.isText?(a+=null===(h=null==t?void 0:t.text)||void 0===h?void 0:h.slice(Math.max(r,n)-n,o-n),l=!1):t.isBlock&&!l&&(a+=i,l=!0)})),a}(r,{from:s,to:a},{textSerializers:l})}}})]}});function kl(t,e,n={strict:!0}){const r=Object.keys(e);return!r.length||r.every((r=>n.strict?e[r]===t[r]:ul(e[r])?e[r].test(t[r]):e[r]===t[r]))}function xl(t,e,n={}){return t.find((t=>t.type===e&&kl(t.attrs,n)))}function Sl(t,e,n={}){return!!xl(t,e,n)}function El(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&0!==r.offset&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const o=xl([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(xl([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&Sl([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Cl(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function Ol(t){return t instanceof wi}function Al(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Ml(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Tl(t){const e=`<body>${t}</body>`;return(new window.DOMParser).parseFromString(e,"text/html").body}function Nl(t,e,n){if(n={slice:!0,parseOptions:{},...n},"object"==typeof t&&null!==t)try{return Array.isArray(t)&&t.length>0?Ar.fromArray(t.map((t=>e.nodeFromJSON(t)))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),Nl("",e,n)}if("string"==typeof t){const r=bo.fromSchema(e);return n.slice?r.parseSlice(Tl(t),n.parseOptions).content:r.parse(Tl(t),n.parseOptions)}return Nl("",e,n)}function Il(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function Rl(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?tl(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,((t,e)=>{if(t.isText)return;const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);a.push({node:t,from:n,to:i})}));const l=o-r,c=a.filter((t=>!s||s.name===t.node.type.name)).filter((t=>kl(t.node.attrs,n,{strict:!1})));if(i)return!!c.length;return c.reduce(((t,e)=>t+e.to-e.from),0)>=l}function Dl(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Ll(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{})}function $l(t,e){const n=Cl(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,(t=>{s.push(...t.marks)}));const a=s.find((t=>t.type.name===n.name));return a?{...a.attrs}:{}}function Pl(t){return e=>function(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}(e.$from,t)}function zl(t,e){const n=Dl("string"==typeof e?e:e.name,t.schema);return"node"===n?function(t,e){const n=tl(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,(t=>{i.push(t)}));const s=i.reverse().find((t=>t.type.name===n.name));return s?{...s.attrs}:{}}(t,e):"mark"===n?$l(t,e):{}}function jl(t){const e=function(t,e=JSON.stringify){const n={};return t.filter((t=>{const r=e(t);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)}))}(t);return 1===e.length?e:e.filter(((t,n)=>{const r=e.filter(((t,e)=>e!==n));return!r.some((e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}))}function Fl(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach((e=>{const o=El(n.resolve(t-1),e.type);o&&r.push({mark:e,...o})})):n.nodesBetween(t,e,((t,e)=>{r.push(...t.marks.map((n=>({from:e,to:e+t.nodeSize,mark:n}))))})),r}function Hl(t,e,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const r=t.find((t=>t.type===e&&t.name===n));return!!r&&r.attribute.keepOnSplit})))}function Bl(t,e){const{nodeExtensions:n}=Za(e),r=n.find((e=>e.name===t));if(!r)return!1;const o=rl(Xa(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Vl(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter((t=>null==e?void 0:e.includes(t.type.name)));t.tr.ensureMarks(r)}}const Wl=(t,e)=>{const n=Pl((t=>t.type===e))(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=t.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Qo(t.doc,n.pos)||(t.join(n.pos),!0)},ql=(t,e)=>{const n=Pl((t=>t.type===e))(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=t.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Qo(t.doc,r)||(t.join(r),!0)};var Ul=Object.freeze({__proto__:null,blur:()=>({editor:t,view:e})=>(requestAnimationFrame((()=>{var n;t.isDestroyed||(e.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())})),!0),clearContent:(t=!1)=>({commands:e})=>e.setContent("",t),clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return!n||(o.forEach((({$from:n,$to:r})=>{t.doc.nodesBetween(n.pos,r.pos,((t,n)=>{if(t.type.isText)return;const{doc:r,mapping:o}=e,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+t.nodeSize)),a=i.blockRange(s);if(!a)return;const l=Go(a);if(t.type.isTextblock){const{defaultType:t}=i.parent.contentMatchAt(i.index());e.setNodeMarkup(a.start,t)}(l||0===l)&&e.lift(a,l)}))})),!0)},command:t=>e=>t(e),createParagraphNear:()=>({state:t,dispatch:e})=>((t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Ei||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ha(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=t.tr.insert(n,i.createAndFill());s.setSelection(wi.create(s.doc,n+1)),e(s.scrollIntoView())}return!0})(t,e),cut:(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new wi(r.doc.resolve(s-1))),!0},deleteCurrentNode:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let n=o.depth;n>0;n-=1){if(o.node(n).type===r.type){if(e){const e=o.before(n),r=o.after(n);t.delete(e,r).scrollIntoView()}return!0}}return!1},deleteNode:t=>({tr:e,state:n,dispatch:r})=>{const o=tl(t,n.schema),i=e.selection.$anchor;for(let t=i.depth;t>0;t-=1){if(i.node(t).type===o){if(r){const n=i.before(t),r=i.after(t);e.delete(n,r).scrollIntoView()}return!0}}return!1},deleteRange:t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},deleteSelection:()=>({state:t,dispatch:e})=>((t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0))(t,e),enter:()=>({commands:t})=>t.keyboardShortcut("Enter"),exitCode:()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Ha(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let r=n.after(),o=t.tr.replaceWith(r,r,s.createAndFill());o.setSelection(yi.near(o.doc.resolve(r),1)),e(o.scrollIntoView())}return!0})(t,e),extendMarkRange:(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Cl(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const t=El(l,i,e);if(t&&t.from<=c&&t.to>=u){const e=wi.create(s,t.from,t.to);n.setSelection(e)}}return!0},first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t<n.length;t+=1)if(n[t](e))return!0;return!1},focus:(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{Ml()&&r.dom.focus(),requestAnimationFrame((()=>{n.isDestroyed||(r.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())}))};if(r.hasFocus()&&null===t||!1===t)return!0;if(i&&null===t&&!Ol(n.state.selection))return s(),!0;const a=function(t,e=null){if(!e)return null;const n=yi.atStart(t),r=yi.atEnd(t);if("start"===e||!0===e)return n;if("end"===e)return r;const o=n.from,i=r.to;return"all"===e?wi.create(t,Al(0,o,i),Al(t.content.size,o,i)):wi.create(t,Al(e,o,i),Al(e,o,i))}(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},forEach:(t,e)=>n=>t.every(((t,r)=>e(t,{...n,index:r}))),insertContent:(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),insertContentAt:(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,...n};const o=Nl(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if("<>"===o.toString())return!0;let{from:s,to:a}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},l=!0,c=!0;if((o.toString().startsWith("<")?o:[o]).forEach((t=>{t.check(),l=!!l&&(t.isText&&0===t.marks.length),c=!!c&&t.isBlock})),s===a&&c){const{parent:t}=r.doc.resolve(s);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(s-=1,a+=1)}l?Array.isArray(e)?r.insertText(e.map((t=>t.text||"")).join(""),s,a):"object"==typeof e&&e&&e.text?r.insertText(e.text,s,a):r.insertText(e,s,a):r.replaceWith(s,a,o),n.updateSelection&&function(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof qo||o instanceof Uo))return;const i=t.mapping.maps[r];let s=0;i.forEach(((t,e,n,r)=>{0===s&&(s=r)})),t.setSelection(yi.near(t.doc.resolve(s),n))}(r,r.steps.length-1,-1)}return!0},joinUp:()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection,o=r instanceof xi;if(o){if(r.node.isTextblock||!Qo(t.doc,r.from))return!1;n=r.from}else if(n=ei(t.doc,r.from,-1),null==n)return!1;if(e){let r=t.tr.join(n);o&&r.setSelection(xi.create(r.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(r.scrollIntoView())}return!0})(t,e),joinDown:()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection;if(r instanceof xi){if(r.node.isTextblock||!Qo(t.doc,r.to))return!1;n=r.to}else if(n=ei(t.doc,r.to,1),null==n)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0})(t,e),joinBackward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let r=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}(t,n);if(!r)return!1;let o=ja(r);if(!o){let n=r.blockRange(),o=n&&Go(n);return null!=o&&(e&&e(t.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&Ba(t,o,e))return!0;if(0==r.parent.content.size&&(za(i,"end")||xi.isSelectable(i))){let n=ni(t.doc,r.before(),r.after(),Dr.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(za(i,"end")?yi.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):xi.create(r.doc,o.pos-i.nodeSize)),e(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),0))})(t,e),joinForward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let r=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}(t,n);if(!r)return!1;let o=Fa(r);if(!o)return!1;let i=o.nodeAfter;if(Ba(t,o,e))return!0;if(0==r.parent.content.size&&(za(i,"start")||xi.isSelectable(i))){let n=ni(t.doc,r.before(),r.after(),Dr.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(za(i,"start")?yi.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):xi.create(r.doc,r.mapping.map(o.pos))),e(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),0))})(t,e),joinItemBackward:()=>({tr:t,state:e,dispatch:n})=>{try{const r=ei(e.doc,e.selection.$from.pos,-1);return null!=r&&(t.join(r,2),n&&n(t),!0)}catch{return!1}},joinItemForward:()=>({state:t,dispatch:e,tr:n})=>{try{const r=ei(t.doc,t.selection.$from.pos,1);return null!=r&&(n.join(r,2),e&&e(n),!0)}catch(t){return!1}},keyboardShortcut:t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=function(t){const e=t.split(/-(?!$)/);let n,r,o,i,s=e[e.length-1];"Space"===s&&(s=" ");for(let t=0;t<e.length-1;t+=1){const s=e[t];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);Ml()||Il()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(t).split(/-(?!$)/),s=i.find((t=>!["Alt","Ctrl","Meta","Shift"].includes(t))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction((()=>{n.someProp("handleKeyDown",(t=>t(n,a)))}));return null==l||l.steps.forEach((t=>{const e=t.map(r.mapping);e&&o&&r.maybeStep(e)})),!0},lift:(t,e={})=>({state:n,dispatch:r})=>!!Rl(n,tl(t,n.schema),e)&&((t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&Go(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)})(n,r),liftEmptyBlock:()=>({state:t,dispatch:e})=>((t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Zo(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Go(r);return null!=o&&(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)})(t,e),liftListItem:t=>({state:e,dispatch:n})=>Ja(tl(t,e.schema))(e,n),newlineInCode:()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(e&&e(t.tr.insertText("\n").scrollIntoView()),0))})(t,e),resetAttributes:(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Dl("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=tl(t,r.schema)),"mark"===a&&(s=Cl(t,r.schema)),o&&n.selection.ranges.forEach((t=>{r.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,Ll(t.attrs,e)),s&&t.marks.length&&t.marks.forEach((o=>{s===o.type&&n.addMark(r,r+t.nodeSize,s.create(Ll(o.attrs,e)))}))}))})),!0)},scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),selectAll:()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),selectNodeBackward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ja(r)}let s=i&&i.nodeBefore;return!(!s||!xi.isSelectable(s)||(e&&e(t.tr.setSelection(xi.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),0))})(t,e),selectNodeForward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Fa(r)}let s=i&&i.nodeAfter;return!(!s||!xi.isSelectable(s)||(e&&e(t.tr.setSelection(xi.create(t.doc,i.pos)).scrollIntoView()),0))})(t,e),selectParentNode:()=>({state:t,dispatch:e})=>((t,e)=>{let n,{$from:r,to:o}=t.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),e&&e(t.tr.setSelection(xi.create(t.doc,n))),!0)})(t,e),selectTextblockEnd:()=>({state:t,dispatch:e})=>qa(t,e),selectTextblockStart:()=>({state:t,dispatch:e})=>Wa(t,e),setContent:(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,a=function(t,e,n={}){return Nl(t,e,{slice:!1,parseOptions:n})}(t,o.schema,n);return i&&r.replaceWith(0,s.content.size,a).setMeta("preventUpdate",!e),!0},setMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Cl(t,r.schema);if(o)if(s){const t=$l(r,l);n.addStoredMark(l.create({...t,...e}))}else a.forEach((t=>{const o=t.$from.pos,i=t.$to.pos;r.doc.nodesBetween(o,i,((t,r)=>{const s=Math.max(r,o),a=Math.min(r+t.nodeSize,i);t.marks.find((t=>t.type===l))?t.marks.forEach((t=>{l===t.type&&n.addMark(s,a,l.create({...t.attrs,...e}))})):n.addMark(s,a,l.create(e))}))}));return function(t,e,n){var r;const{selection:o}=e;let i=null;if(Ol(o)&&(i=o.$cursor),i){const e=null!==(r=t.storedMarks)&&void 0!==r?r:i.marks();return!!n.isInSet(e)||!e.some((t=>t.type.excludes(n)))}const{ranges:s}=o;return s.some((({$from:e,$to:r})=>{let o=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,r.pos,((t,e,r)=>{if(o)return!1;if(t.isInline){const e=!r||r.type.allowsMarkType(n),i=!!n.isInSet(t.marks)||!t.marks.some((t=>t.type.excludes(n)));o=e&&i}return!o})),o}))}(r,n,l)},setMeta:(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),setNode:(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=tl(t,n.schema);return i.isTextblock?o().command((({commands:t})=>!!Ua(i,e)(n)||t.clearNodes())).command((({state:t})=>Ua(i,e)(t,r))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=Al(t,0,n.content.size),o=xi.create(n,r);e.setSelection(o)}return!0},setTextSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,{from:r,to:o}="number"==typeof t?{from:t,to:t}:t,i=wi.atStart(n).from,s=wi.atEnd(n).to,a=Al(r,i,s),l=Al(o,i,s),c=wi.create(n,a,l);e.setSelection(c)}return!0},sinkListItem:t=>({state:e,dispatch:n})=>{const r=tl(t,e.schema);return(o=r,function(t,e){let{$from:n,$to:r}=t.selection,i=n.blockRange(r,(t=>t.childCount>0&&t.firstChild.type==o));if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(e){let n=l.lastChild&&l.lastChild.type==a.type,r=Ar.from(n?o.create():null),s=new Dr(Ar.from(o.create(null,Ar.from(a.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;e(t.tr.step(new Uo(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(e,n);var o},splitBlock:({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:a,$to:l}=i,c=Hl(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof xi&&i.node.isBlock)return!(!a.parentOffset||!Zo(s,a.pos))&&(r&&(t&&Vl(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const r=l.parentOffset===l.parent.content.size;i instanceof wi&&e.deleteSelection();const s=0===a.depth?void 0:function(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let u=r&&s?[{type:s,attrs:c}]:void 0,h=Zo(e.doc,e.mapping.map(a.pos),1,u);if(u||h||!Zo(e.doc,e.mapping.map(a.pos),1,s?[{type:s}]:void 0)||(h=!0,u=s?[{type:s,attrs:c}]:void 0),h&&(e.split(e.mapping.map(a.pos),1,u),s&&!r&&!a.parentOffset&&a.parent.type!==s)){const t=e.mapping.map(a.before()),n=e.doc.resolve(t);a.node(-1).canReplaceWith(n.index(),n.index()+1,s)&&e.setNodeMarkup(e.mapping.map(a.before()),s)}t&&Vl(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},splitListItem:t=>({tr:e,state:n,dispatch:r,editor:o})=>{var i;const s=tl(t,n.schema),{$from:a,$to:l}=n.selection,c=n.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==s)return!1;const h=o.extensionManager.attributes;if(0===a.parent.content.size&&a.node(-1).childCount===a.indexAfter(-1)){if(2===a.depth||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let t=Ar.empty;const n=a.index(-1)?1:a.index(-2)?2:3;for(let e=a.depth-n;e>=a.depth-3;e-=1)t=Ar.from(a.node(e).copy(t));const r=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,o=Hl(h,a.node().type.name,a.node().attrs),l=(null===(i=s.contentMatch.defaultType)||void 0===i?void 0:i.createAndFill(o))||void 0;t=t.append(Ar.from(s.createAndFill(null,l)||void 0));const c=a.before(a.depth-(n-1));e.replace(c,a.after(-r),new Dr(t,4-n,0));let u=-1;e.doc.nodesBetween(c,e.doc.content.size,((t,e)=>{if(u>-1)return!1;t.isTextblock&&0===t.content.size&&(u=e+1)})),u>-1&&e.setSelection(wi.near(e.doc.resolve(u))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,d=Hl(h,u.type.name,u.attrs),f=Hl(h,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);const m=p?[{type:s,attrs:d},{type:p,attrs:f}]:[{type:s,attrs:d}];if(!Zo(e.doc,a.pos,2))return!1;if(r){const{selection:t,storedMarks:i}=n,{splittableMarks:s}=o.extensionManager,l=i||t.$to.parentOffset&&t.$from.marks();if(e.split(a.pos,2,m).scrollIntoView(),!l||!r)return!0;const c=l.filter((t=>s.includes(t.type.name)));e.ensureMarks(c)}return!0},toggleList:(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:h,splittableMarks:p}=o.extensionManager,d=tl(t,s.schema),f=tl(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:v}=m,b=y.blockRange(v),_=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const w=Pl((t=>Bl(t.type.name,h)))(m);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===d)return c.liftListItem(f);if(Bl(w.node.type.name,h)&&d.validContent(w.node.content)&&a)return l().command((()=>(i.setNodeMarkup(w.pos,d),!0))).command((()=>Wl(i,d))).command((()=>ql(i,d))).run()}return n&&_&&a?l().command((()=>{const t=u().wrapInList(d,r),e=_.filter((t=>p.includes(t.type.name)));return i.ensureMarks(e),!!t||c.clearNodes()})).wrapInList(d,r).command((()=>Wl(i,d))).command((()=>ql(i,d))).run():l().command((()=>!!u().wrapInList(d,r)||c.clearNodes())).wrapInList(d,r).command((()=>Wl(i,d))).command((()=>ql(i,d))).run()},toggleMark:(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Cl(t,r.schema),a=function(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?Cl(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>!i||i.name===t.type.name)).find((t=>kl(t.attrs,n,{strict:!1})));let s=0;const a=[];if(o.forEach((({$from:e,$to:n})=>{const r=e.pos,o=n.pos;t.doc.nodesBetween(r,o,((t,e)=>{if(!t.isText&&!t.marks.length)return;const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);s+=i-n,a.push(...t.marks.map((t=>({mark:t,from:n,to:i}))))}))})),0===s)return!1;const l=a.filter((t=>!i||i.name===t.mark.type.name)).filter((t=>kl(t.mark.attrs,n,{strict:!1}))).reduce(((t,e)=>t+e.to-e.from),0),c=a.filter((t=>!i||t.mark.type!==i&&t.mark.type.excludes(i))).reduce(((t,e)=>t+e.to-e.from),0);return(l>0?l+c:l)>=s}(r,s,e);return a?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},toggleNode:(t,e,n={})=>({state:r,commands:o})=>{const i=tl(t,r.schema),s=tl(e,r.schema);return Rl(r,i,n)?o.setNode(s):o.setNode(i,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const o=tl(t,n.schema);return Rl(n,o,e)?r.lift(o):r.wrapIn(o,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const e=t.tr,n=i.transform;for(let t=n.steps.length-1;t>=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(i.text){const n=e.doc.resolve(i.from).marks();e.replaceWith(i.from,i.to,t.schema.text(i.text,n))}else e.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach((e=>{t.removeMark(e.$from.pos,e.$to.pos)})),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Cl(t,r.schema),{$from:c,empty:u,ranges:h}=a;if(!o)return!0;if(u&&s){let{from:t,to:e}=a;const r=null===(i=c.marks().find((t=>t.type===l)))||void 0===i?void 0:i.attrs,o=El(c,l,r);o&&(t=o.from,e=o.to),n.removeMark(t,e,l)}else h.forEach((t=>{n.removeMark(t.$from.pos,t.$to.pos,l)}));return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Dl("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=tl(t,r.schema)),"mark"===a&&(s=Cl(t,r.schema)),o&&n.selection.ranges.forEach((t=>{const o=t.$from.pos,a=t.$to.pos;r.doc.nodesBetween(o,a,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,{...t.attrs,...e}),s&&t.marks.length&&t.marks.forEach((i=>{if(s===i.type){const l=Math.max(r,o),c=Math.min(r+t.nodeSize,a);n.addMark(l,c,s.create({...i.attrs,...e}))}}))}))})),!0)},wrapIn:(t,e={})=>({state:n,dispatch:r})=>function(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&Yo(s,t,e);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(tl(t,n.schema),e)(n,r),wrapInList:(t,e={})=>({state:n,dispatch:r})=>Ka(tl(t,n.schema),e)(n,r)});wl.create({name:"commands",addCommands:()=>({...Ul})}),wl.create({name:"editable",addProseMirrorPlugins(){return[new Ii({key:new Li("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wl.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ii({key:new Li("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),wl.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.command((({tr:e})=>{const{selection:n,doc:r}=e,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock?e.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,u=i.pos-i.parentOffset,h=c&&1===l.parent.childCount?u===i.pos:yi.atStart(r).from===s;return!(!(o&&h&&a.type.isTextblock)||a.textContent.length)&&t.clearNodes()})),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()])),e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ml()||Il()?o:r},addProseMirrorPlugins(){return[new Ii({key:new Li("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some((t=>t.docChanged))&&!e.doc.eq(n.doc)))return;const{empty:r,from:o,to:i}=e.selection,s=yi.atStart(e.doc).from,a=yi.atEnd(e.doc).to;if(r||!(o===s&&i===a))return;if(!(0===n.doc.textBetween(0,n.doc.content.size," "," ").length))return;const l=n.tr,c=Ga({state:n,transaction:l}),{commands:u}=new Ya({editor:this.editor,state:c});return u.clearNodes(),l.steps.length?l:void 0}})]}}),wl.create({name:"tabindex",addProseMirrorPlugins(){return[new Ii({key:new Li("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Kl{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=rl(Xa(this,"addOptions",{name:this.name}))),this.storage=rl(Xa(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Kl(t)}configure(t={}){const e=this.extend();return e.options=_l(this.options,t),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new Kl(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=rl(Xa(e,"addOptions",{name:e.name})),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,r=t.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find((t=>(null==t?void 0:t.type.name)===e.name)))return!1;const i=o.find((t=>(null==t?void 0:t.type.name)===e.name));return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),t.view.dispatch(n),!0}return!1}}class Jl{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=rl(Xa(this,"addOptions",{name:this.name}))),this.storage=rl(Xa(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Jl(t)}configure(t={}){const e=this.extend();return e.options=_l(this.options,t),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new Jl(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=rl(Xa(e,"addOptions",{name:e.name})),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}}const Gl=Jl.create({name:"text",group:"inline"});var Yl=200,Xl=function(){};Xl.prototype.append=function(t){return t.length?(t=Xl.from(t),!this.length&&t||t.length<Yl&&this.leafAppend(t)||this.length<Yl&&t.leafPrepend(this)||this.appendInner(t)):this},Xl.prototype.prepend=function(t){return t.length?Xl.from(t).append(this):this},Xl.prototype.appendInner=function(t){return new Ql(this,t)},Xl.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Xl.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Xl.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Xl.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Xl.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Xl.from=function(t){return t instanceof Xl?t:t&&t.length?new Zl(t):Xl.empty};var Zl=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Yl)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Yl)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Xl);Xl.empty=new Zl([]);var Ql=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Xl),tc=Xl;class ec{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}e&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=t.tr,l=[],c=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(o,e+1),r=n.maps.length),r--,void c.push(t);if(n){c.push(new nc(t.map));let e,o=t.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(e=a.mapping.maps[a.mapping.maps.length-1],l.push(new nc(e,void 0,void 0,l.length+c.length))),r--,e&&n.appendMap(e,r)}else a.maybeStep(t.step);return t.selection?(i=n?t.selection.map(n.slice(r)):t.selection,s=new ec(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(t,e,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<t.steps.length;n++){let l,c=t.steps[n].invert(t.docs[n]),u=new nc(t.mapping.maps[n],c,e);(l=a&&a.merge(u))&&(u=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(u),e&&(i++,e=void 0),r||(a=u)}let l=i-n.depth;return l>oc&&(s=function(t,e){let n;return t.forEach(((t,r)=>{if(t.selection&&0==e--)return n=r,!1})),t.slice(n)}(s,l),i-=l),new ec(s.append(o),i)}remapping(t,e){let n=new $o;return this.items.forEach(((e,r)=>{let o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,o)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new ec(this.items.append(t.map((t=>new nc(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),r);let a=e;this.items.forEach((e=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(e.step){let i=t.steps[r].invert(t.docs[r]),c=e.selection&&e.selection.map(o.slice(a+1,r));c&&s++,n.push(new nc(l,i,c))}else n.push(new nc(l))}),r);let l=[];for(let t=e;t<i;t++)l.push(new nc(o.maps[t]));let c=this.items.slice(0,r).append(l).append(n),u=new ec(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=t)r.push(i),i.selection&&o++;else if(i.step){let t=i.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let a=i.selection&&i.selection.map(e.slice(n));a&&o++;let l,c=new nc(s.invert(),t,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--}),this.items.length,0),new ec(tc.from(r.reverse()),o)}}ec.empty=new ec(tc.empty,0);class nc{constructor(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new nc(e.getMap().invert(),e,this.selection)}}}class rc{constructor(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r}}const oc=20;function ic(t){let e=[];return t.forEach(((t,n,r,o)=>e.push(r,o))),e}function sc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function ac(t,e,n,r){let o=uc(e),i=hc.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(!s)return;let a=s.selection.resolve(s.transform.doc),l=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),c=new rc(r?l:s.remaining,r?s.remaining:l,null,0);n(s.transform.setSelection(a).setMeta(hc,{redo:r,historyState:c}).scrollIntoView())}let lc=!1,cc=null;function uc(t){let e=t.plugins;if(cc!=e){lc=!1,cc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){lc=!0;break}}return lc}const hc=new Li("history"),pc=new Li("closeHistory");function dc(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ii({key:hc,state:{init:()=>new rc(ec.empty,ec.empty,null,0),apply:(e,n,r)=>function(t,e,n,r){let o,i=n.getMeta(hc);if(i)return i.historyState;n.getMeta(pc)&&(t=new rc(t.done,t.undone,null,0));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(hc))return s.getMeta(hc).redo?new rc(t.done.addTransform(n,void 0,r,uc(e)),t.undone,ic(n.mapping.maps[n.steps.length-1]),t.prevTime):new rc(t.done,t.undone.addTransform(n,void 0,r,uc(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new rc(t.done.rebased(n,o),t.undone.rebased(n,o),sc(t.prevRanges,n.mapping),t.prevTime):new rc(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),sc(t.prevRanges,n.mapping),t.prevTime);{let o=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,r)=>{for(let o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),i=s?sc(t.prevRanges,n.mapping):ic(n.mapping.maps[n.steps.length-1]);return new rc(t.done.addTransform(n,o?e.selection.getBookmark():void 0,r,uc(e)),ec.empty,i,n.time)}}(n,r,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,r="historyUndo"==n?fc:"historyRedo"==n?mc:null;return!!r&&(e.preventDefault(),r(t.state,t.dispatch))}}}})}const fc=(t,e)=>{let n=hc.getState(t);return!(!n||0==n.done.eventCount)&&(e&&ac(n,t,e,!1),!0)},mc=(t,e)=>{let n=hc.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&ac(n,t,e,!0),!0)},gc=wl.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:e})=>fc(t,e),redo:()=>({state:t,dispatch:e})=>mc(t,e)}),addProseMirrorPlugins(){return[dc(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),yc=Object.freeze({COMMON:"common",DESKTOP:"desktop",TABLET:"tablet",MOBILE:"mobile",get values(){return[this.COMMON,this.MOBILE,this.TABLET,this.DESKTOP]}}),vc=Object.freeze({UPPERCASE:"uppercase",LOWERCASE:"lowercase",CAPITALIZE:"capitalize"}),bc=Object.freeze({LEFT:"left",CENTER:"center",RIGHT:"right",JUSTIFY:"justify",get values(){return[this.LEFT,this.CENTER,this.RIGHT,this.JUSTIFY]}}),_c=Object.freeze({DOCUMENT:"doc",PARAGRAPH:"paragraph",HEADING:"heading",LIST:"list",LIST_ITEM:"listItem",TEXT:"text",get blocks(){return[this.PARAGRAPH,this.LIST,this.HEADING]}}),wc=Object.freeze({DISC:"disc",CIRCLE:"circle",SQUARE:"square",DECIMAL:"decimal",ROMAN:"roman",LATIN:"latin",get values(){return[this.DISC,this.CIRCLE,this.SQUARE,this.DECIMAL,this.ROMAN,this.LATIN]},get ordered(){return[this.DECIMAL,this.ROMAN,this.LATIN]}}),kc=Object.freeze({ALIGNMENT:"alignment",BACKGROUND_COLOR:"background_color",FONT_COLOR:"font_color",FONT_FAMILY:"font_family",FONT_SIZE:"font_size",FONT_STYLE:"font_style",FONT_WEIGHT:"font_weight",LINE_HEIGHT:"line_height",TEXT_DECORATION:"text_decoration",SUPERSCRIPT:"superscript",MARGIN:"margin",LINK:"link",STYLE_PRESET:"style_preset",get attributes(){return[this.ALIGNMENT,this.LINE_HEIGHT,this.MARGIN]},get presetAttributes(){return[this.LINE_HEIGHT]},get inlineMarks(){return[this.TEXT_DECORATION,this.LINK,this.SUPERSCRIPT,this.BACKGROUND_COLOR]},get marks(){return[this.BACKGROUND_COLOR,this.FONT_COLOR,this.FONT_FAMILY,this.FONT_SIZE,this.FONT_STYLE,this.FONT_WEIGHT,this.TEXT_DECORATION,this.SUPERSCRIPT]}}),xc=Object.freeze({SETTINGS:"settings",ALL:"_"}),Sc=Object.freeze({BLANK:"_blank",SELF:"_self"}),Ec=Object.freeze({URL:"url",BLOCK:"block"});class Cc{static create(t,e){const n=new this(t,e||{});return new Ii({key:new Li(this.name),props:n._buildProps()})}constructor(t,e){this.options=e,this.editor=t}_buildProps(){const t=Object.entries(this.addProps()).map((([t,e])=>[t,e.bind(this)]));return Object.fromEntries(t)}addProps(){return{}}}class Oc extends Cc{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(t){if(t.includes("data-pm-slice")&&t.includes("zw-style"))return t;const e=Dp.build(t);return e.normalizeHTML(),this._removeDeprecatedStyles(e),e.normalizedHTML}_removeDeprecatedStyles(t){const e=t.dom.querySelectorAll('[style*="margin"]');for(const t of Array.from(e))t.style.removeProperty("margin"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-right"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("margin-left")}_handlePaste(t,e,n){const r=this._insertPastedContent(t,n).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return t.dispatch(r),!0}_insertPastedContent({state:t},e){return this._isFullBlockSelected(t)?t.tr.replaceSelectionWith(e.content,!1):t.tr.replaceSelection(e)}_isFullBlockSelected(t){const e=this._expandSelectionToBlocks(t),n=this._isMatchPosition(e.from,t.selection.from),r=this._isMatchPosition(e.to,t.selection.to);return n&&r}_expandSelectionToBlocks({selection:t,doc:e}){let n=t.from,r=t.to;return e.nodesBetween(n,r,((t,e,o)=>{o.type.name===_c.DOCUMENT&&(n=Math.min(n,e+1),r=Math.max(r,e+t.nodeSize-1))})),{from:n,to:r}}_isMatchPosition(t,e){return Math.abs(t-e)<5}}class Ac extends Cc{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:t}){const e=[];return this.editor.isEditable?t.childCount>1?void 0:(t.descendants(((t,n)=>{if(!t.childCount){const r=da.node(n,n+t.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});e.push(r)}return!1})),ga.create(t,e)):null}}const Mc="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Tc="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Nc=(t,e)=>{for(const n in e)t[n]=e[n];return t},Ic="numeric",Rc="ascii",Dc="alpha",Lc="asciinumeric",$c="alphanumeric",Pc="domain",zc="emoji",jc="scheme",Fc="slashscheme",Hc="whitespace";function Bc(t,e){return t in e||(e[t]=[]),e[t]}function Vc(t,e,n){e[Ic]&&(e[Lc]=!0,e[$c]=!0),e[Rc]&&(e[Lc]=!0,e[Dc]=!0),e[Lc]&&(e[$c]=!0),e[Dc]&&(e[$c]=!0),e[$c]&&(e[Pc]=!0),e[zc]&&(e[Pc]=!0);for(const r in e){const e=Bc(r,n);e.indexOf(t)<0&&e.push(t)}}function Wc(t){void 0===t&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}Wc.groups={},Wc.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let n=0;n<e.jr.length;n++){const r=e.jr[n][0],o=e.jr[n][1];if(o&&r.test(t))return o}return e.jd},has(t,e){return void 0===e&&(e=!1),e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){let o;return r=r||Wc.groups,e&&e.j?o=e:(o=new Wc(e),n&&r&&Vc(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let e=0;e<i-1;e++)o=o.tt(t[e]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Wc.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,a=o.go(t);if(a?(s=new Wc,Nc(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Wc,i){if(r)if(s.t&&"string"==typeof s.t){const t=Nc(function(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}(s.t,r),n);Vc(i,t,r)}else n&&Vc(i,n,r);s.t=i}return o.j[t]=s,s}};const qc=(t,e,n,r,o)=>t.ta(e,n,r,o),Uc=(t,e,n,r,o)=>t.tr(e,n,r,o),Kc=(t,e,n,r,o)=>t.ts(e,n,r,o),Jc=(t,e,n,r,o)=>t.tt(e,n,r,o),Gc="WORD",Yc="UWORD",Xc="LOCALHOST",Zc="TLD",Qc="UTLD",tu="SCHEME",eu="SLASH_SCHEME",nu="NUM",ru="WS",ou="NL",iu="OPENBRACE",su="OPENBRACKET",au="OPENANGLEBRACKET",lu="OPENPAREN",cu="CLOSEBRACE",uu="CLOSEBRACKET",hu="CLOSEANGLEBRACKET",pu="CLOSEPAREN",du="AMPERSAND",fu="APOSTROPHE",mu="ASTERISK",gu="AT",yu="BACKSLASH",vu="BACKTICK",bu="CARET",_u="COLON",wu="COMMA",ku="DOLLAR",xu="DOT",Su="EQUALS",Eu="EXCLAMATION",Cu="HYPHEN",Ou="PERCENT",Au="PIPE",Mu="PLUS",Tu="POUND",Nu="QUERY",Iu="QUOTE",Ru="SEMI",Du="SLASH",Lu="TILDE",$u="UNDERSCORE",Pu="EMOJI",zu="SYM";var ju=Object.freeze({__proto__:null,WORD:Gc,UWORD:Yc,LOCALHOST:Xc,TLD:Zc,UTLD:Qc,SCHEME:tu,SLASH_SCHEME:eu,NUM:nu,WS:ru,NL:ou,OPENBRACE:iu,OPENBRACKET:su,OPENANGLEBRACKET:au,OPENPAREN:lu,CLOSEBRACE:cu,CLOSEBRACKET:uu,CLOSEANGLEBRACKET:hu,CLOSEPAREN:pu,AMPERSAND:du,APOSTROPHE:fu,ASTERISK:mu,AT:gu,BACKSLASH:yu,BACKTICK:vu,CARET:bu,COLON:_u,COMMA:wu,DOLLAR:ku,DOT:xu,EQUALS:Su,EXCLAMATION:Eu,HYPHEN:Cu,PERCENT:Ou,PIPE:Au,PLUS:Mu,POUND:Tu,QUERY:Nu,QUOTE:Iu,SEMI:Ru,SLASH:Du,TILDE:Lu,UNDERSCORE:$u,EMOJI:Pu,SYM:zu});const Fu=/[a-z]/,Hu=/\p{L}/u,Bu=/\p{Emoji}/u,Vu=/\d/,Wu=/\s/,qu="\n",Uu="️",Ku="‍";let Ju=null,Gu=null;function Yu(t,e,n,r,o){let i;const s=e.length;for(let n=0;n<s-1;n++){const s=e[n];t.j[s]?i=t.j[s]:(i=new Wc(r),i.jr=o.slice(),t.j[s]=i),t=i}return i=new Wc(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function Xu(t){const e=[],n=[];let r=0;for(;r<t.length;){let o=0;for(;"0123456789".indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let e=parseInt(t.substring(r,r+o),10);e>0;e--)n.pop();r+=o}else n.push(t[r]),r++}return e}const Zu={defaultProtocol:"http",events:null,format:th,formatHref:th,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Qu(t,e){void 0===e&&(e=null);let n=Nc({},Zu);t&&(n=Nc(n,t instanceof Qu?t.o:t));const r=n.ignoreTags,o=[];for(let t=0;t<r.length;t++)o.push(r[t].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}function th(t){return t}function eh(t,e){this.t="token",this.v=t,this.tk=e}function nh(t,e){class n extends eh{constructor(e,n){super(e,n),this.t=t}}for(const t in e)n.prototype[t]=e[t];return n.t=t,n}Qu.prototype={o:Zu,ignoreTags:[],defaultRender:t=>t,check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=null!=e;let o=this.o[t];return o?("object"==typeof o?(o=n.t in o?o[n.t]:Zu[t],"function"==typeof o&&r&&(o=o(e,n))):"function"==typeof o&&r&&(o=o(e,n.t,n)),o):o},getObj(t,e,n){let r=this.o[t];return"function"==typeof r&&null!=e&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}},eh.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return void 0===t&&(t=Zu.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),h=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Nc(s,u),{tagName:o,attributes:s,content:i,eventListeners:h}}};const rh=nh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),oh=nh("text"),ih=nh("nl"),sh=nh("url",{isLink:!0,toHref(t){return void 0===t&&(t=Zu.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Xc&&t[1].t===_u}}),ah=t=>new Wc(t);function lh(t,e,n){const r=n[0].s,o=n[n.length-1].e;return new t(e.slice(r,o),n)}const ch="undefined"!=typeof console&&console&&console.warn||(()=>{}),uh={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function hh(t,e){if(void 0===e&&(e=!1),uh.initialized&&ch(`linkifyjs: already initialized - will not register custom scheme "${t}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error('linkifyjs: incorrect scheme format.\n 1. Must only contain digits, lowercase ASCII letters or "-"\n 2. Cannot start or end with "-"\n 3. "-" cannot repeat');uh.customSchemes.push([t,e])}function ph(){uh.scanner=function(t){void 0===t&&(t=[]);const e={};Wc.groups=e;const n=new Wc;null==Ju&&(Ju=Xu(Mc)),null==Gu&&(Gu=Xu(Tc)),Jc(n,"'",fu),Jc(n,"{",iu),Jc(n,"[",su),Jc(n,"<",au),Jc(n,"(",lu),Jc(n,"}",cu),Jc(n,"]",uu),Jc(n,">",hu),Jc(n,")",pu),Jc(n,"&",du),Jc(n,"*",mu),Jc(n,"@",gu),Jc(n,"`",vu),Jc(n,"^",bu),Jc(n,":",_u),Jc(n,",",wu),Jc(n,"$",ku),Jc(n,".",xu),Jc(n,"=",Su),Jc(n,"!",Eu),Jc(n,"-",Cu),Jc(n,"%",Ou),Jc(n,"|",Au),Jc(n,"+",Mu),Jc(n,"#",Tu),Jc(n,"?",Nu),Jc(n,'"',Iu),Jc(n,"/",Du),Jc(n,";",Ru),Jc(n,"~",Lu),Jc(n,"_",$u),Jc(n,"\\",yu);const r=Uc(n,Vu,nu,{[Ic]:!0});Uc(r,Vu,r);const o=Uc(n,Fu,Gc,{[Rc]:!0});Uc(o,Fu,o);const i=Uc(n,Hu,Yc,{[Dc]:!0});Uc(i,Fu),Uc(i,Hu,i);const s=Uc(n,Wu,ru,{[Hc]:!0});Jc(n,qu,ou,{[Hc]:!0}),Jc(s,qu),Uc(s,Wu,s);const a=Uc(n,Bu,Pu,{[zc]:!0});Uc(a,Bu,a),Jc(a,Uu,a);const l=Jc(a,Ku);Uc(l,Bu,a);const c=[[Fu,o]],u=[[Fu,null],[Hu,i]];for(let t=0;t<Ju.length;t++)Yu(n,Ju[t],Zc,Gc,c);for(let t=0;t<Gu.length;t++)Yu(n,Gu[t],Qc,Yc,u);Vc(Zc,{tld:!0,ascii:!0},e),Vc(Qc,{utld:!0,alpha:!0},e),Yu(n,"file",tu,Gc,c),Yu(n,"mailto",tu,Gc,c),Yu(n,"http",eu,Gc,c),Yu(n,"https",eu,Gc,c),Yu(n,"ftp",eu,Gc,c),Yu(n,"ftps",eu,Gc,c),Vc(tu,{scheme:!0,ascii:!0},e),Vc(eu,{slashscheme:!0,ascii:!0},e),t=t.sort(((t,e)=>t[0]>e[0]?1:-1));for(let e=0;e<t.length;e++){const r=t[e][0],o=t[e][1]?{[jc]:!0}:{[Fc]:!0};r.indexOf("-")>=0?o[Pc]=!0:Fu.test(r)?Vu.test(r)?o[Lc]=!0:o[Rc]=!0:o[Ic]=!0,Kc(n,r,r,o)}return Kc(n,"localhost",Xc,{ascii:!0}),n.jd=new Wc(zu),{start:n,tokens:Nc({groups:e},ju)}}(uh.customSchemes);for(let t=0;t<uh.tokenQueue.length;t++)uh.tokenQueue[t][1]({scanner:uh.scanner});uh.parser=function(t){let{groups:e}=t;const n=e.domain.concat([du,mu,gu,yu,vu,bu,ku,Su,Cu,nu,Ou,Au,Mu,Tu,Du,zu,Lu,$u]),r=[fu,hu,cu,uu,pu,_u,wu,xu,Eu,au,iu,su,lu,Nu,Iu,Ru],o=[du,fu,mu,yu,vu,bu,cu,ku,Su,Cu,iu,Ou,Au,Mu,Tu,Nu,Du,zu,Lu,$u],i=ah(),s=Jc(i,Lu);qc(s,o,s),qc(s,e.domain,s);const a=ah(),l=ah(),c=ah();qc(i,e.domain,a),qc(i,e.scheme,l),qc(i,e.slashscheme,c),qc(a,o,s),qc(a,e.domain,a);const u=Jc(a,gu);Jc(s,gu,u),Jc(l,gu,u),Jc(c,gu,u);const h=Jc(s,xu);qc(h,o,s),qc(h,e.domain,s);const p=ah();qc(u,e.domain,p),qc(p,e.domain,p);const d=Jc(p,xu);qc(d,e.domain,p);const f=ah(rh);qc(d,e.tld,f),qc(d,e.utld,f),Jc(u,Xc,f);const m=Jc(p,Cu);qc(m,e.domain,p),qc(f,e.domain,p),Jc(f,xu,d),Jc(f,Cu,m);const g=Jc(f,_u);qc(g,e.numeric,rh);const y=Jc(a,Cu),v=Jc(a,xu);qc(y,e.domain,a),qc(v,o,s),qc(v,e.domain,a);const b=ah(sh);qc(v,e.tld,b),qc(v,e.utld,b),qc(b,e.domain,a),qc(b,o,s),Jc(b,xu,v),Jc(b,Cu,y),Jc(b,gu,u);const _=Jc(b,_u),w=ah(sh);qc(_,e.numeric,w);const k=ah(sh),x=ah();qc(k,n,k),qc(k,r,x),qc(x,n,k),qc(x,r,x),Jc(b,Du,k),Jc(w,Du,k);const S=Jc(l,_u),E=Jc(c,_u),C=Jc(E,Du),O=Jc(C,Du);qc(l,e.domain,a),Jc(l,xu,v),Jc(l,Cu,y),qc(c,e.domain,a),Jc(c,xu,v),Jc(c,Cu,y),qc(S,e.domain,k),Jc(S,Du,k),qc(O,e.domain,k),qc(O,n,k),Jc(O,Du,k);const A=Jc(k,iu),M=Jc(k,su),T=Jc(k,au),N=Jc(k,lu);Jc(x,iu,A),Jc(x,su,M),Jc(x,au,T),Jc(x,lu,N),Jc(A,cu,k),Jc(M,uu,k),Jc(T,hu,k),Jc(N,pu,k),Jc(A,cu,k);const I=ah(sh),R=ah(sh),D=ah(sh),L=ah(sh);qc(A,n,I),qc(M,n,R),qc(T,n,D),qc(N,n,L);const $=ah(),P=ah(),z=ah(),j=ah();return qc(A,r),qc(M,r),qc(T,r),qc(N,r),qc(I,n,I),qc(R,n,R),qc(D,n,D),qc(L,n,L),qc(I,r,I),qc(R,r,R),qc(D,r,D),qc(L,r,L),qc($,n,$),qc(P,n,R),qc(z,n,D),qc(j,n,L),qc($,r,$),qc(P,r,P),qc(z,r,z),qc(j,r,j),Jc(R,uu,k),Jc(D,hu,k),Jc(L,pu,k),Jc(I,cu,k),Jc(P,uu,k),Jc(z,hu,k),Jc(j,pu,k),Jc($,pu,k),Jc(i,Xc,b),Jc(i,ou,ih),{start:i,tokens:ju}}(uh.scanner.tokens);for(let t=0;t<uh.pluginQueue.length;t++)uh.pluginQueue[t][1]({scanner:uh.scanner,parser:uh.parser});uh.initialized=!0}function dh(t){return uh.initialized||ph(),function(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,c=null,u=0,h=null,p=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(p=0,h=a):p>=0&&p++,o++,u++;if(p<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(lh(oh,e,s)),s=[]),o-=p,u-=p;const t=h.t,r=n.slice(o-u,o);i.push(lh(t,e,r))}}return s.length>0&&i.push(lh(oh,e,s)),i}(uh.parser.start,t,function(t,e){const n=function(t){const e=[],n=t.length;let r=0;for(;r<n;){let o,i=t.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}(e.replace(/[A-Z]/g,(t=>t.toLowerCase()))),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,l=null,c=0,u=null,h=-1,p=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(h=0,p=0,u=a):h>=0&&(h+=n[s].length,p++),c+=n[s].length,i+=n[s].length,s++;i-=h,s-=p,c-=h,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}(uh.scanner.start,t))}function fh(t,e,n){if(void 0===e&&(e=null),void 0===n&&(n=null),e&&"object"==typeof e){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Qu(n),o=dh(t),i=[];for(let t=0;t<o.length;t++){const n=o[t];!n.isLink||e&&n.t!==e||i.push(n.toFormattedObject(r))}return i}class mh extends Cc{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(t,e,n){if(t.state.selection.empty)return!1;const r=n.content.textBetween(0,n.content.size).trim(),o=function(t,e){void 0===e&&(e=null);const n=dh(t);return 1===n.length&&n[0].isLink&&(!e||n[0].t===e)}(r);if(!r||!o)return!1;const i=this._createLinkAttrs(r,n.content);return this.editor.commands.applyLink(i),!0}_createLinkAttrs(t,e){const n=jp.query(e,{typeName:_c.TEXT,mark:{typeName:kc.LINK},getMark:{typeName:kc.LINK}});return n?.attrs||{href:t}}}function gh(t){return(...e)=>n=>t(n,...e)}function yh(t){const e=Object.entries(t).reduce(((t,[e,n])=>{if(!n)return t;return`${t}--zw-${e.replace(/_/g,"-")}:${n};`}),"");return e?{style:e}:null}function vh(t){const e=yh(t);return["span",e?{...e,class:"zw-style"}:{},0]}function bh(t,...e){return({editor:n})=>(n.commands[t](...e),!0)}var _h=Object.defineProperty,wh=(t,e,n)=>(((t,e,n)=>{e in t?_h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);const kh=Object.freeze({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"}),xh="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",Sh=`[\\s|\\(]+(${xh})[,|\\s]+(${xh})[,|\\s]+(${xh})\\s*\\)?`,Eh=`[\\s|\\(]+(${xh})[,|\\s]+(${xh})[,|\\s]+(${xh})[,|\\s]+(${xh})\\s*\\)?`,Ch=Object.freeze({CSS_UNIT:new RegExp(xh),RGB:new RegExp(`rgb${Sh}`),RGBA:new RegExp(`rgba${Eh}`),HSL:new RegExp(`hsl${Sh}`),HSLA:new RegExp(`hsla${Eh}`),HSV:new RegExp(`hsv${Sh}`),HSVA:new RegExp(`hsva${Eh}`),HEX3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,HEX6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,HEX4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,HEX8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}),Oh=Object.freeze({WINDOW:Symbol("window")});function Ah(t,e){let n=!1;return function(){n||(t.apply(this,arguments),n=!0,setTimeout((function(){n=!1}),e))}}function Mh(t){return t>1||t<-1?t/100:t}const Th=t=>Number.parseFloat(t.toFixed(5).substr(0,5));function Nh(t){const e=function(t,e=1){const n=[];let r=0;for(;r<t.length;)n.push(t.substr(r,e)),r+=e;return n}(t.slice(1),2).map((t=>parseInt(t,16))),n=void 0!==e[3]?Math.round(e[3]/255*100)/100:1;return{r:e[0],g:e[1],b:e[2],a:n}}function Ih(t){const{h:e,s:n,v:r,a:o}=t,i=t=>{const o=(t+e/60)%6;return r-r*n*Math.max(Math.min(o,4-o,1),0)},s=[i(5),i(3),i(1)].map((t=>Math.round(255*t)));return{r:s[0],g:s[1],b:s[2],a:o}}function Rh(t){if(!t)return{h:0,s:1,v:1,a:1};const e=t.r/255,n=t.g/255,r=t.b/255,o=Math.max(e,n,r),i=Math.min(e,n,r);let s=0;o!==i&&(o===e?s=60*(0+(n-r)/(o-i)):o===n?s=60*(2+(r-e)/(o-i)):o===r&&(s=60*(4+(e-n)/(o-i)))),s<0&&(s+=360);const a=[s,0===o?0:(o-i)/o,o],l=Th(a[1]),c=Th(a[2]);return{h:Math.floor(a[0]),s:l,v:c,a:t.a}}function Dh(t){const e=Rh(Nh(t));const n=function(t){const{h:e,s:n,v:r,a:o}=t,i=r-r*n/2,s=1===i||0===i?0:(r-i)/Math.min(i,1-i);return{h:e,s:Th(s),l:Th(i),a:o}}(e),r=Nh(t);return{alpha:e.a,hex:t.substr(0,7),hexa:t,hsla:n,hsva:e,hue:e.h,rgba:r}}function Lh(t,e,n="0"){return t+n.repeat(Math.max(0,e-t.length))}function $h(t){return Dh(function(t){let e=t;return e.startsWith("#")&&(e=e.slice(1)),e=e.replace(/([^0-9a-f])/gi,"F"),3!==e.length&&4!==e.length||(e=e.split("").map((t=>t+t)).join("")),e=6===e.length?Lh(e,8,"F"):Lh(Lh(e,6),8,"F"),`#${e}`.toUpperCase().substr(0,9)}(t))}const Ph=class t{static create(e){if(!e)return t.fromBlack();let n=e.replace(/^\s+/,"").replace(/\s+$/,"").toLowerCase();if(kh[n])n=kh[n];else if(n===this.TRANSPARENT)return t.fromTransparent();const r=Ch.RGB.exec(n)||Ch.RGBA.exec(n);if(r){const e=void 0===r[4]?1:r[4];return t.fromRgba({r:Number.parseInt(r[1]),g:Number.parseInt(r[2]),b:Number.parseInt(r[3]),a:Number.parseFloat(e)})}const o=Ch.HSL.exec(n)||Ch.HSLA.exec(n);if(o){const e=void 0===o[4]?1:o[4];return t.fromHsla({h:Number.parseInt(o[1]),s:Number.parseFloat(o[2]),l:Number.parseFloat(o[3]),a:Number.parseFloat(e)})}const i=Ch.HSV.exec(n)||Ch.HSVA.exec(n);if(i){const e=void 0===i[4]?1:i[4];return t.fromHsva({h:Number.parseInt(i[1]),s:Number.parseFloat(i[2]),v:Number.parseFloat(i[3]),a:Number.parseFloat(e)})}return Ch.HEX8.exec(n)||Ch.HEX6.exec(n)||Ch.HEX4.exec(n)||Ch.HEX3.exec(n)?t.fromHex(n):t.fromBlack()}static fromHex(e){const{rgba:n}=$h(e);return new t(n)}static fromRgba({r:e,g:n,b:r,a:o}){const i=Mh(o);return new t({r:e,g:n,b:r,a:i})}static fromHsla({h:e,s:n,l:r,a:o}){const i=Mh(n),s=Mh(r),a=Mh(o);return t.fromHsva(function(t){const{h:e,s:n,l:r,a:o}=t,i=r+n*Math.min(r,1-r);return{h:e,s:Th(0===i?0:2-2*r/i),v:Th(i),a:o}}({h:e,s:i,l:s,a:a}))}static fromHsva({h:e,s:n,v:r,a:o}){const i=Ih({h:e,s:Mh(n),v:Mh(r),a:Mh(o)});return new t(i)}static fromTransparent(){return new t({r:0,g:0,b:0,a:0})}static fromWhite(){return new t({r:255,g:255,b:255,a:1})}static fromBlack(){return new t({r:0,g:0,b:0,a:1})}static isTransparent(e){return t.create(e).isTransparent()}static isDark(e){return t.create(e).isDark()}constructor(t){this._rgba=t,this._hsva=this._calcHsva(),this._alpha=t.a}get hex(){return this.toHexString()}get r(){return this._rgba.r}get b(){return this._rgba.b}get g(){return this._rgba.g}get h(){return this._hsva.h}get s(){return this._hsva.s}get v(){return this._hsva.v}get alpha(){return this._alpha}setAlpha(t){return this._alpha=t,this}toHexString(){return function(t){const e=t=>{const e=Math.round(t).toString(16);return("00".substr(0,2-e.length)+e).toUpperCase()};return`#${[e(t.r),e(t.g),e(t.b)].join("")}`}({r:this.r,g:this.g,b:this.b,a:this.alpha})}toRgbaString(){const t=`${Math.floor(100*this.alpha)}%`;return`rgba(${[this.r,this.g,this.b,t].join(", ")})`}get rgba(){return this._rgba}updateRgb(t){this._rgba={...this._rgba,...t},this._hsva=this._calcHsva()}get hsva(){return this._hsva}updateHsv(t){this._hsva={...this._hsva,...t},this._rgba=this._calcRgba()}isTransparent(){return 0===this.alpha}isDark(){return this.getBrightness()<128}getBrightness(){return(299*this.rgba.r+587*this.rgba.g+114*this.rgba.b)/1e3}_calcHsva(){return Rh(this.rgba)}_calcRgba(){return Ih(this.hsva)}};wh(Ph,"TRANSPARENT","transparent"),wh(Ph,"NONE","none");let zh=Ph;Oh.WINDOW;function jh(t){const e=zh.create(t);return 1===e.alpha?e.toHexString():e.toRgbaString()}function Fh(t,e){if(!t.includes("em"))return parseInt(t);const n=Lp.getComputedStyle(e).fontSize,r=parseFloat(t)*parseFloat(n);return Math.round(r)}function Hh(t,e,n){if(!t.includes("px"))return t;const r=function(t,e){return(t.firstElementChild||t).style.fontSize||Lp.getComputedStyle(e).fontSize}(e,n),o=Fh(r,n);return o?(parseInt(t)/o).toFixed(2):null}Oh.WINDOW,Oh.WINDOW,Ah(((t,e)=>{t(e)}),20);const Bh={start:bc.LEFT,end:bc.RIGHT};const Vh=(t,e,n,r)=>({from:Math.max(r,t.pos),to:Math.min(r+n.nodeSize,e.pos)});function Wh(t,e){return t.resolve(e).depth+1}const qh=(t,e)=>t.eq(e);var Uh,Kh,Jh={exports:{}};
1
+ "use strict";var t=require("events"),e=require("child_process"),n=require("path"),r=require("fs"),o=require("process"),i=require("jsdom"),s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a={},l={},c={};let u=class extends Error{constructor(t,e,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}};c.CommanderError=u,c.InvalidArgumentError=class extends u{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};const{InvalidArgumentError:h}=c;l.Argument=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?e.concat(t):[t]}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new h(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,e):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},l.humanReadableArgName=function(t){const e=t.name()+(!0===t.variadic?"...":"");return t.required?"<"+e+">":"["+e+"]"};var p={},d={};const{humanReadableArgName:f}=l;d.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(t){const e=t.commands.filter((t=>!t._hidden)),n=t._getHelpCommand();return n&&!n._hidden&&e.push(n),this.sortSubcommands&&e.sort(((t,e)=>t.name().localeCompare(e.name()))),e}compareOptions(t,e){const n=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return n(t).localeCompare(n(e))}visibleOptions(t){const e=t.options.filter((t=>!t.hidden)),n=t._getHelpOption();if(n&&!n.hidden){const r=n.short&&t._findOption(n.short),o=n.long&&t._findOption(n.long);r||o?n.long&&!o?e.push(t.createOption(n.long,n.description)):n.short&&!r&&e.push(t.createOption(n.short,n.description)):e.push(n)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const e=[];for(let n=t.parent;n;n=n.parent){const t=n.options.filter((t=>!t.hidden));e.push(...t)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach((e=>{e.description=e.description||t._argsDescription[e.name()]||""})),t.registeredArguments.find((t=>t.description))?t.registeredArguments:[]}subcommandTerm(t){const e=t.registeredArguments.map((t=>f(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce(((t,n)=>Math.max(t,e.subcommandTerm(n).length)),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce(((t,n)=>Math.max(t,e.optionTerm(n).length)),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce(((t,n)=>Math.max(t,e.optionTerm(n).length)),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce(((t,n)=>Math.max(t,e.argumentTerm(n).length)),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let n="";for(let e=t.parent;e;e=e.parent)n=e.name()+" "+n;return n+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`),void 0!==t.defaultValue){(t.required||t.optional||t.isBoolean()&&"boolean"==typeof t.defaultValue)&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}return void 0!==t.presetArg&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),void 0!==t.envVar&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){const e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`),void 0!==t.defaultValue&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){const n=`(${e.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,e){const n=e.padWidth(t,e),r=e.helpWidth||80;function o(t,o){if(o){const i=`${t.padEnd(n+2)}${o}`;return e.wrap(i,r-2,n+2)}return t}function i(t){return t.join("\n").replace(/^/gm," ".repeat(2))}let s=[`Usage: ${e.commandUsage(t)}`,""];const a=e.commandDescription(t);a.length>0&&(s=s.concat([e.wrap(a,r,0),""]));const l=e.visibleArguments(t).map((t=>o(e.argumentTerm(t),e.argumentDescription(t))));l.length>0&&(s=s.concat(["Arguments:",i(l),""]));const c=e.visibleOptions(t).map((t=>o(e.optionTerm(t),e.optionDescription(t))));if(c.length>0&&(s=s.concat(["Options:",i(c),""])),this.showGlobalOptions){const n=e.visibleGlobalOptions(t).map((t=>o(e.optionTerm(t),e.optionDescription(t))));n.length>0&&(s=s.concat(["Global Options:",i(n),""]))}const u=e.visibleCommands(t).map((t=>o(e.subcommandTerm(t),e.subcommandDescription(t))));return u.length>0&&(s=s.concat(["Commands:",i(u),""])),s.join("\n")}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}wrap(t,e,n,r=40){const o=new RegExp("[\\n][ \\f\\t\\v   -    \ufeff]+");if(t.match(o))return t;const i=e-n;if(i<r)return t;const s=t.slice(0,n),a=t.slice(n).replace("\r\n","\n"),l=" ".repeat(n),c="\\s​",u=new RegExp(`\n|.{1,${i-1}}([${c}]|$)|[^${c}]+?([${c}]|$)`,"g");return s+(a.match(u)||[]).map(((t,e)=>"\n"===t?"":(e>0?l:"")+t.trimEnd())).join("\n")}};var m={};const{InvalidArgumentError:g}=c;m.Option=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;const n=function(t){let e,n;const r=t.split(/[ |,]+/);r.length>1&&!/^[[<]/.test(r[1])&&(e=r.shift());n=r.shift(),!e&&/^-[^-]$/.test(n)&&(e=n,n=void 0);return{shortFlag:e,longFlag:n}}(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return"string"==typeof t&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?e.concat(t):[t]}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new g(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,e):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce(((t,e)=>t+e[0].toUpperCase()+e.slice(1)))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},m.DualOptions=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach((t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)})),this.negativeOptions.forEach(((t,e)=>{this.positiveOptions.has(e)&&this.dualOptions.add(e)}))}valueFromOption(t,e){const n=e.attributeName();if(!this.dualOptions.has(n))return!0;const r=this.negativeOptions.get(n).presetArg,o=void 0!==r&&r;return e.negate===(o===t)}};var y={};const v=3;y.suggestSimilar=function(t,e){if(!e||0===e.length)return"";e=Array.from(new Set(e));const n=t.startsWith("--");n&&(t=t.slice(2),e=e.map((t=>t.slice(2))));let r=[],o=v;return e.forEach((e=>{if(e.length<=1)return;const n=function(t,e){if(Math.abs(t.length-e.length)>v)return Math.max(t.length,e.length);const n=[];for(let e=0;e<=t.length;e++)n[e]=[e];for(let t=0;t<=e.length;t++)n[0][t]=t;for(let r=1;r<=e.length;r++)for(let o=1;o<=t.length;o++){let i=1;i=t[o-1]===e[r-1]?0:1,n[o][r]=Math.min(n[o-1][r]+1,n[o][r-1]+1,n[o-1][r-1]+i),o>1&&r>1&&t[o-1]===e[r-2]&&t[o-2]===e[r-1]&&(n[o][r]=Math.min(n[o][r],n[o-2][r-2]+1))}return n[t.length][e.length]}(t,e),i=Math.max(t.length,e.length);(i-n)/i>.4&&(n<o?(o=n,r=[e]):n===o&&r.push(e))})),r.sort(((t,e)=>t.localeCompare(e))),n&&(r=r.map((t=>`--${t}`))),r.length>1?`\n(Did you mean one of ${r.join(", ")}?)`:1===r.length?`\n(Did you mean ${r[0]}?)`:""};const b=t.EventEmitter,_=e,w=n,k=r,x=o,{Argument:S,humanReadableArgName:E}=l,{CommanderError:O}=c,{Help:C}=d,{Option:A,DualOptions:M}=m,{suggestSimilar:T}=y;function N(t){return t.map((t=>{if(!t.startsWith("--inspect"))return t;let e,n,r="127.0.0.1",o="9229";return null!==(n=t.match(/^(--inspect(-brk)?)$/))?e=n[1]:null!==(n=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(e=n[1],/^\d+$/.test(n[3])?o=n[3]:r=n[3]):null!==(n=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(e=n[1],r=n[3],o=n[4]),e&&"0"!==o?`${e}=${r}:${parseInt(o)+1}`:t}))}p.Command=class t extends b{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>x.stdout.write(t),writeErr:t=>x.stderr.write(t),getOutHelpWidth:()=>x.stdout.isTTY?x.stdout.columns:void 0,getErrHelpWidth:()=>x.stderr.isTTY?x.stderr.columns:void 0,outputError:(t,e)=>e(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){const t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,n){let r=e,o=n;"object"==typeof r&&null!==r&&(o=r,r=null),o=o||{};const[,i,s]=t.match(/([^ ]+) *(.*)/),a=this.createCommand(i);return r&&(a.description(r),a._executableHandler=!0),o.isDefault&&(this._defaultCommandName=a._name),a._hidden=!(!o.noHelp&&!o.hidden),a._executableFile=o.executableFile||null,s&&a.arguments(s),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),r?this:a}createCommand(e){return new t(e)}createHelp(){return Object.assign(new C,this.configureHelp())}configureHelp(t){return void 0===t?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return void 0===t?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return"string"!=typeof t&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(e=e||{}).isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new S(t,e)}argument(t,e,n,r){const o=this.createArgument(t,e);return"function"==typeof n?o.default(r).argParser(n):o.default(n),this.addArgument(o),this}arguments(t){return t.trim().split(/ +/).forEach((t=>{this.argument(t)})),this}addArgument(t){const e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&void 0!==t.defaultValue&&void 0===t.parseArg)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if("boolean"==typeof t)return this._addImplicitHelpCommand=t,this;t=t??"help [command]";const[,n,r]=t.match(/([^ ]+) *(.*)/),o=e??"display help for command",i=this.createCommand(n);return i.helpOption(!1),r&&i.arguments(r),o&&i.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=i,this}addHelpCommand(t,e){return"object"!=typeof t?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){const n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return this._exitCallback=t||(t=>{if("commander.executeSubCommandAsync"!==t.code)throw t}),this}_exit(t,e,n){this._exitCallback&&this._exitCallback(new O(t,e,n)),x.exit(t)}action(t){return this._actionHandler=e=>{const n=this.registeredArguments.length,r=e.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),t.apply(this,r)},this}createOption(t,e){return new A(t,e)}_callParseArg(t,e,n,r){try{return t.parseArg(e,n)}catch(t){if("commander.invalidArgument"===t.code){const e=`${r} ${t.message}`;this.error(e,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){const e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){const n=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'\n- already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){const e=t=>[t.name()].concat(t.aliases()),n=e(t).find((t=>this._findCommand(t)));if(n){const r=e(this._findCommand(n)).join("|"),o=e(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${r}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);const e=t.name(),n=t.attributeName();if(t.negate){const e=t.long.replace(/^--no-/,"--");this._findOption(e)||this.setOptionValueWithSource(n,void 0===t.defaultValue||t.defaultValue,"default")}else void 0!==t.defaultValue&&this.setOptionValueWithSource(n,t.defaultValue,"default");const r=(e,r,o)=>{null==e&&void 0!==t.presetArg&&(e=t.presetArg);const i=this.getOptionValue(n);null!==e&&t.parseArg?e=this._callParseArg(t,e,i,r):null!==e&&t.variadic&&(e=t._concatValue(e,i)),null==e&&(e=!t.negate&&(!(!t.isBoolean()&&!t.optional)||"")),this.setOptionValueWithSource(n,e,o)};return this.on("option:"+e,(e=>{const n=`error: option '${t.flags}' argument '${e}' is invalid.`;r(e,n,"cli")})),t.envVar&&this.on("optionEnv:"+e,(e=>{const n=`error: option '${t.flags}' value '${e}' from env '${t.envVar}' is invalid.`;r(e,n,"env")})),this}_optionEx(t,e,n,r,o){if("object"==typeof e&&e instanceof A)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(e,n);if(i.makeOptionMandatory(!!t.mandatory),"function"==typeof r)i.default(o).argParser(r);else if(r instanceof RegExp){const t=r;r=(e,n)=>{const r=t.exec(e);return r?r[0]:n},i.default(o).argParser(r)}else i.default(r);return this.addOption(i)}option(t,e,n,r){return this._optionEx({},t,e,n,r)}requiredOption(t,e,n,r){return this._optionEx({mandatory:!0},t,e,n,r)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,n){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach((n=>{void 0!==n.getOptionValueSource(t)&&(e=n.getOptionValueSource(t))})),e}_prepareUserArgs(t,e){if(void 0!==t&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");let n;switch(e=e||{},void 0===t&&(t=x.argv,x.versions&&x.versions.electron&&(e.from="electron")),this.rawArgs=t.slice(),e.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":x.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,e){const n=this._prepareUserArgs(t,e);return this._parseCommand([],n),this}async parseAsync(t,e){const n=this._prepareUserArgs(t,e);return await this._parseCommand([],n),this}_executeSubCommand(t,e){e=e.slice();let n=!1;const r=[".js",".ts",".tsx",".mjs",".cjs"];function o(t,e){const n=w.resolve(t,e);if(k.existsSync(n))return n;if(r.includes(w.extname(e)))return;const o=r.find((t=>k.existsSync(`${n}${t}`)));return o?`${n}${o}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i,s=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let t;try{t=k.realpathSync(this._scriptPath)}catch(e){t=this._scriptPath}a=w.resolve(w.dirname(t),a)}if(a){let e=o(a,s);if(!e&&!t._executableFile&&this._scriptPath){const n=w.basename(this._scriptPath,w.extname(this._scriptPath));n!==this._name&&(e=o(a,`${n}-${t._name}`))}s=e||s}if(n=r.includes(w.extname(s)),"win32"!==x.platform?n?(e.unshift(s),e=N(x.execArgv).concat(e),i=_.spawn(x.argv[0],e,{stdio:"inherit"})):i=_.spawn(s,e,{stdio:"inherit"}):(e.unshift(s),e=N(x.execArgv).concat(e),i=_.spawn(x.execPath,e,{stdio:"inherit"})),!i.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((t=>{x.on(t,(()=>{!1===i.killed&&null===i.exitCode&&i.kill(t)}))}))}const l=this._exitCallback;i.on("close",((t,e)=>{t=t??1,l?l(new O(t,"commander.executeSubCommandAsync","(close)")):x.exit(t)})),i.on("error",(e=>{if("ENOENT"===e.code){const e=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",n=`'${s}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${e}`;throw new Error(n)}if("EACCES"===e.code)throw new Error(`'${s}' not executable`);if(l){const t=new O(1,"commander.executeSubCommandAsync","(error)");t.nestedError=e,l(t)}else x.exit(1)})),this.runningCommand=i}_dispatchSubcommand(t,e,n){const r=this._findCommand(t);let o;return r||this.help({error:!0}),o=this._chainOrCallSubCommandHook(o,r,"preSubcommand"),o=this._chainOrCall(o,(()=>{if(!r._executableHandler)return r._parseCommand(e,n);this._executeSubCommand(r,e.concat(n))})),o}_dispatchHelpCommand(t){t||this.help();const e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,e)=>{t.required&&null==this.args[e]&&this.missingArgument(t.name())})),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const t=(t,e,n)=>{let r=e;if(null!==e&&t.parseArg){const o=`error: command-argument value '${e}' is invalid for argument '${t.name()}'.`;r=this._callParseArg(t,e,n,o)}return r};this._checkNumberOfArguments();const e=[];this.registeredArguments.forEach(((n,r)=>{let o=n.defaultValue;n.variadic?r<this.args.length?(o=this.args.slice(r),n.parseArg&&(o=o.reduce(((e,r)=>t(n,r,e)),n.defaultValue))):void 0===o&&(o=[]):r<this.args.length&&(o=this.args[r],n.parseArg&&(o=t(n,o,n.defaultValue))),e[r]=o})),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&"function"==typeof t.then?t.then((()=>e())):e()}_chainOrCallHooks(t,e){let n=t;const r=[];return this._getCommandAndAncestors().reverse().filter((t=>void 0!==t._lifeCycleHooks[e])).forEach((t=>{t._lifeCycleHooks[e].forEach((e=>{r.push({hookedCommand:t,callback:e})}))})),"postAction"===e&&r.reverse(),r.forEach((t=>{n=this._chainOrCall(n,(()=>t.callback(t.hookedCommand,this)))})),n}_chainOrCallSubCommandHook(t,e,n){let r=t;return void 0!==this._lifeCycleHooks[n]&&this._lifeCycleHooks[n].forEach((t=>{r=this._chainOrCall(r,(()=>t(this,e)))})),r}_parseCommand(t,e){const n=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),e=n.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){let n;return r(),this._processArguments(),n=this._chainOrCallHooks(n,"preAction"),n=this._chainOrCall(n,(()=>this._actionHandler(this.processedArgs))),this.parent&&(n=this._chainOrCall(n,(()=>{this.parent.emit(o,t,e)}))),n=this._chainOrCallHooks(n,"postAction"),n}if(this.parent&&this.parent.listenerCount(o))r(),this._processArguments(),this.parent.emit(o,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(t){if(t)return this.commands.find((e=>e._name===t||e._aliases.includes(t)))}_findOption(t){return this.options.find((e=>e.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((e=>{e.mandatory&&void 0===t.getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const e=t.attributeName();return void 0!==this.getOptionValue(e)&&"default"!==this.getOptionValueSource(e)})),e=t.filter((t=>t.conflictsWith.length>0));e.forEach((e=>{const n=t.find((t=>e.conflictsWith.includes(t.attributeName())));n&&this._conflictingOption(e,n)}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const e=[],n=[];let r=e;const o=t.slice();function i(t){return t.length>1&&"-"===t[0]}let s=null;for(;o.length;){const t=o.shift();if("--"===t){r===n&&r.push(t),r.push(...o);break}if(!s||i(t)){if(s=null,i(t)){const e=this._findOption(t);if(e){if(e.required){const t=o.shift();void 0===t&&this.optionMissingArgument(e),this.emit(`option:${e.name()}`,t)}else if(e.optional){let t=null;o.length>0&&!i(o[0])&&(t=o.shift()),this.emit(`option:${e.name()}`,t)}else this.emit(`option:${e.name()}`);s=e.variadic?e:null;continue}}if(t.length>2&&"-"===t[0]&&"-"!==t[1]){const e=this._findOption(`-${t[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,t.slice(2)):(this.emit(`option:${e.name()}`),o.unshift(`-${t.slice(2)}`));continue}}if(/^--[^=]+=/.test(t)){const e=t.indexOf("="),n=this._findOption(t.slice(0,e));if(n&&(n.required||n.optional)){this.emit(`option:${n.name()}`,t.slice(e+1));continue}}if(i(t)&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&0===e.length&&0===n.length){if(this._findCommand(t)){e.push(t),o.length>0&&n.push(...o);break}if(this._getHelpCommand()&&t===this._getHelpCommand().name()){e.push(t),o.length>0&&e.push(...o);break}if(this._defaultCommandName){n.push(t),o.length>0&&n.push(...o);break}}if(this._passThroughOptions){r.push(t),o.length>0&&r.push(...o);break}r.push(t)}else this.emit(`option:${s.name()}`,t)}return{operands:e,unknown:n}}opts(){if(this._storeOptionsAsProperties){const t={},e=this.options.length;for(let n=0;n<e;n++){const e=this.options[n].attributeName();t[e]=e===this._versionOptionName?this._version:this[e]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,e)=>Object.assign(t,e.opts())),{})}error(t,e){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const n=e||{},r=n.exitCode||1,o=n.code||"commander.error";this._exit(r,o,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in x.env){const e=t.attributeName();(void 0===this.getOptionValue(e)||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,x.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}}))}_parseOptionsImplied(){const t=new M(this.options),e=t=>void 0!==this.getOptionValue(t)&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((n=>void 0!==n.implied&&e(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n))).forEach((t=>{Object.keys(t.implied).filter((t=>!e(t))).forEach((e=>{this.setOptionValueWithSource(e,t.implied[e],"implied")}))}))}missingArgument(t){const e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){const e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){const n=t=>{const e=t.attributeName(),n=this.getOptionValue(e),r=this.options.find((t=>t.negate&&e===t.attributeName())),o=this.options.find((t=>!t.negate&&e===t.attributeName()));return r&&(void 0===r.presetArg&&!1===n||void 0!==r.presetArg&&n===r.presetArg)?r:o||t},r=t=>{const e=n(t),r=e.attributeName();return"env"===this.getOptionValueSource(r)?`environment variable '${e.envVar}'`:`option '${e.flags}'`},o=`error: ${r(t)} cannot be used with ${r(e)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],r=this;do{const t=r.createHelp().visibleOptions(r).filter((t=>t.long)).map((t=>t.long));n=n.concat(t),r=r.parent}while(r&&!r._enablePositionalOptions);e=T(t,n)}const n=`error: unknown option '${t}'${e}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const e=this.registeredArguments.length,n=1===e?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${n} but got ${t.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let e="";if(this._showSuggestionAfterError){const n=[];this.createHelp().visibleCommands(this).forEach((t=>{n.push(t.name()),t.alias()&&n.push(t.alias())})),e=T(t,n)}const n=`error: unknown command '${t}'${e}`;this.error(n,{code:"commander.unknownCommand"})}version(t,e,n){if(void 0===t)return this._version;this._version=t,e=e||"-V, --version",n=n||"output the version number";const r=this.createOption(e,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`),this._exit(0,"commander.version",t)})),this}description(t,e){return void 0===t&&void 0===e?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return void 0===t?this._summary:(this._summary=t,this)}alias(t){if(void 0===t)return this._aliases[0];let e=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");const n=this.parent?._findCommand(t);if(n){const e=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${e}'`)}return e._aliases.push(t),this}aliases(t){return void 0===t?this._aliases:(t.forEach((t=>this.alias(t))),this)}usage(t){if(void 0===t){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>E(t)));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=t,this}name(t){return void 0===t?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=w.basename(t,w.extname(t)),this}executableDir(t){return void 0===t?this._executableDir:(this._executableDir=t,this)}helpInformation(t){const e=this.createHelp();return void 0===e.helpWidth&&(e.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),e.formatHelp(this,e)}_getHelpContext(t){const e={error:!!(t=t||{}).error};let n;return n=e.error?t=>this._outputConfiguration.writeErr(t):t=>this._outputConfiguration.writeOut(t),e.write=t.write||n,e.command=this,e}outputHelp(t){let e;"function"==typeof t&&(e=t,t=void 0);const n=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",n))),this.emit("beforeHelp",n);let r=this.helpInformation(n);if(e&&(r=e(r),"string"!=typeof r&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",n)))}helpOption(t,e){return"boolean"==typeof t?(this._helpOption=t?this._helpOption??void 0:null,this):(t=t??"-h, --help",e=e??"display help for command",this._helpOption=this.createOption(t,e),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let e=x.exitCode||0;0===e&&t&&"function"!=typeof t&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){const n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${n.join("', '")}'`);const r=`${t}Help`;return this.on(r,(t=>{let n;n="function"==typeof e?e({error:t.error,command:t.command}):e,n&&t.write(`${n}\n`)})),this}_outputHelpIfRequested(t){const e=this._getHelpOption();e&&t.find((t=>e.is(t)))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};const{Argument:I}=l,{Command:R}=p,{CommanderError:L,InvalidArgumentError:D}=c,{Help:$}=d,{Option:P}=m;a.program=new R,a.createCommand=t=>new R(t),a.createOption=(t,e)=>new P(t,e),a.createArgument=(t,e)=>new I(t,e),a.Command=R,a.Option=P,a.Argument=I,a.Help=$,a.CommanderError=L,a.InvalidArgumentError=D,a.InvalidOptionArgumentError=D;const{program:z,createCommand:j,createArgument:F,createOption:H,CommanderError:B,InvalidArgumentError:V,InvalidOptionArgumentError:W,Command:q,Argument:U,Option:K,Help:J}=a;
2
+ /**
3
+ * @vue/shared v3.4.21
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/function G(t,e){const n=new Set(t.split(","));return e?t=>n.has(t.toLowerCase()):t=>n.has(t)}const Y="production"!==process.env.NODE_ENV?Object.freeze({}):{};"production"===process.env.NODE_ENV||Object.freeze([]);const X=()=>{},Z=t=>111===t.charCodeAt(0)&&110===t.charCodeAt(1)&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Q=Object.assign,tt=Object.prototype.hasOwnProperty,et=(t,e)=>tt.call(t,e),nt=Array.isArray,rt=t=>"[object Map]"===ht(t),ot=t=>"[object Set]"===ht(t),it=t=>"function"==typeof t,st=t=>"string"==typeof t,at=t=>"symbol"==typeof t,lt=t=>null!==t&&"object"==typeof t,ct=t=>(lt(t)||it(t))&&it(t.then)&&it(t.catch),ut=Object.prototype.toString,ht=t=>ut.call(t),pt=t=>ht(t).slice(8,-1),dt=t=>"[object Object]"===ht(t),ft=t=>st(t)&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,mt=(t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))})((t=>t.charAt(0).toUpperCase()+t.slice(1))),gt=(t,e)=>!Object.is(t,e),yt=(t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})};let vt;const bt=()=>vt||(vt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function _t(t){if(nt(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],o=st(r)?St(r):_t(r);if(o)for(const t in o)e[t]=o[t]}return e}if(st(t)||lt(t))return t}const wt=/;(?![^(]*\))/g,kt=/:([^]+)/,xt=/\/\*[^]*?\*\//g;function St(t){const e={};return t.replace(xt,"").split(wt).forEach((t=>{if(t){const n=t.split(kt);n.length>1&&(e[n[0].trim()]=n[1].trim())}})),e}function Et(t){let e="";if(st(t))e=t;else if(nt(t))for(let n=0;n<t.length;n++){const r=Et(t[n]);r&&(e+=r+" ")}else if(lt(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}
7
+ /**
8
+ * @vue/reactivity v3.4.21
9
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
10
+ * @license MIT
11
+ **/function Ot(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let Ct;class At{constructor(t,e,n,r){this.fn=t,this.trigger=e,this.scheduler=n,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,function(t,e){e&&e.active&&e.effects.push(t)}(this,r)}get dirty(){if(2===this._dirtyLevel||3===this._dirtyLevel){this._dirtyLevel=1,$t();for(let t=0;t<this._depsLength;t++){const e=this.deps[t];if(e.computed&&(Mt(e.computed),this._dirtyLevel>=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),Pt()}return this._dirtyLevel>=4}set dirty(t){this._dirtyLevel=t?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=Rt,e=Ct;try{return Rt=!0,Ct=this,this._runnings++,Tt(this),this.fn()}finally{Nt(this),this._runnings--,Ct=e,Rt=t}}stop(){var t;this.active&&(Tt(this),Nt(this),null==(t=this.onStop)||t.call(this),this.active=!1)}}function Mt(t){return t.value}function Tt(t){t._trackId++,t._depsLength=0}function Nt(t){if(t.deps.length>t._depsLength){for(let e=t._depsLength;e<t.deps.length;e++)It(t.deps[e],t);t.deps.length=t._depsLength}}function It(t,e){const n=t.get(e);void 0!==n&&e._trackId!==n&&(t.delete(e),0===t.size&&t.cleanup())}let Rt=!0,Lt=0;const Dt=[];function $t(){Dt.push(Rt),Rt=!1}function Pt(){const t=Dt.pop();Rt=void 0===t||t}function zt(){Lt++}function jt(){for(Lt--;!Lt&&Ht.length;)Ht.shift()()}function Ft(t,e,n){var r;if(e.get(t)!==t._trackId){e.set(t,t._trackId);const o=t.deps[t._depsLength];o!==e?(o&&It(o,t),t.deps[t._depsLength++]=e):t._depsLength++,"production"!==process.env.NODE_ENV&&(null==(r=t.onTrack)||r.call(t,Q({effect:t},n)))}}const Ht=[];function Bt(t,e,n){var r;zt();for(const o of t.keys()){let i;o._dirtyLevel<e&&(null!=i?i:i=t.get(o)===o._trackId)&&(o._shouldSchedule||(o._shouldSchedule=0===o._dirtyLevel),o._dirtyLevel=e),o._shouldSchedule&&(null!=i?i:i=t.get(o)===o._trackId)&&("production"!==process.env.NODE_ENV&&(null==(r=o.onTrigger)||r.call(o,Q({effect:o},n))),o.trigger(),o._runnings&&!o.allowRecurse||2===o._dirtyLevel||(o._shouldSchedule=!1,o.scheduler&&Ht.push(o.scheduler)))}jt()}const Vt=(t,e)=>{const n=new Map;return n.cleanup=t,n.computed=e,n},Wt=new WeakMap,qt=Symbol("production"!==process.env.NODE_ENV?"iterate":""),Ut=Symbol("production"!==process.env.NODE_ENV?"Map key iterate":"");function Kt(t,e,n){if(Rt&&Ct){let r=Wt.get(t);r||Wt.set(t,r=new Map);let o=r.get(n);o||r.set(n,o=Vt((()=>r.delete(n)))),Ft(Ct,o,"production"!==process.env.NODE_ENV?{target:t,type:e,key:n}:void 0)}}function Jt(t,e,n,r,o,i){const s=Wt.get(t);if(!s)return;let a=[];if("clear"===e)a=[...s.values()];else if("length"===n&&nt(t)){const t=Number(r);s.forEach(((e,n)=>{("length"===n||!at(n)&&n>=t)&&a.push(e)}))}else switch(void 0!==n&&a.push(s.get(n)),e){case"add":nt(t)?ft(n)&&a.push(s.get("length")):(a.push(s.get(qt)),rt(t)&&a.push(s.get(Ut)));break;case"delete":nt(t)||(a.push(s.get(qt)),rt(t)&&a.push(s.get(Ut)));break;case"set":rt(t)&&a.push(s.get(qt))}zt();for(const s of a)s&&Bt(s,4,"production"!==process.env.NODE_ENV?{target:t,type:e,key:n,newValue:r,oldValue:o,oldTarget:i}:void 0);jt()}const Gt=G("__proto__,__v_isRef,__isVue"),Yt=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(at)),Xt=Zt();function Zt(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Fe(this);for(let t=0,e=this.length;t<e;t++)Kt(n,"get",t+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(Fe)):r}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){$t(),zt();const n=Fe(this)[e].apply(this,t);return jt(),Pt(),n}})),t}function Qt(t){const e=Fe(this);return Kt(e,"has",t),e.hasOwnProperty(t)}class te{constructor(t=!1,e=!1){this._isReadonly=t,this._isShallow=e}get(t,e,n){const r=this._isReadonly,o=this._isShallow;if("__v_isReactive"===e)return!r;if("__v_isReadonly"===e)return r;if("__v_isShallow"===e)return o;if("__v_raw"===e)return n===(r?o?Ne:Te:o?Me:Ae).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(n)?t:void 0;const i=nt(t);if(!r){if(i&&et(Xt,e))return Reflect.get(Xt,e,n);if("hasOwnProperty"===e)return Qt}const s=Reflect.get(t,e,n);return(at(e)?Yt.has(e):Gt(e))?s:(r||Kt(t,"get",e),o?s:Ue(s)?i&&ft(e)?s:s.value:lt(s)?r?Re(s):Ie(s):s)}}class ee extends te{constructor(t=!1){super(!1,t)}set(t,e,n,r){let o=t[e];if(!this._isShallow){const e=Pe(o);if(ze(n)||Pe(n)||(o=Fe(o),n=Fe(n)),!nt(t)&&Ue(o)&&!Ue(n))return!e&&(o.value=n,!0)}const i=nt(t)&&ft(e)?Number(e)<t.length:et(t,e),s=Reflect.set(t,e,n,r);return t===Fe(r)&&(i?gt(n,o)&&Jt(t,"set",e,n,o):Jt(t,"add",e,n)),s}deleteProperty(t,e){const n=et(t,e),r=t[e],o=Reflect.deleteProperty(t,e);return o&&n&&Jt(t,"delete",e,void 0,r),o}has(t,e){const n=Reflect.has(t,e);return at(e)&&Yt.has(e)||Kt(t,"has",e),n}ownKeys(t){return Kt(t,"iterate",nt(t)?"length":qt),Reflect.ownKeys(t)}}class ne extends te{constructor(t=!1){super(!0,t)}set(t,e){return"production"!==process.env.NODE_ENV&&Ot(`Set operation on key "${String(e)}" failed: target is readonly.`,t),!0}deleteProperty(t,e){return"production"!==process.env.NODE_ENV&&Ot(`Delete operation on key "${String(e)}" failed: target is readonly.`,t),!0}}const re=new ee,oe=new ne,ie=new ne(!0),se=t=>t,ae=t=>Reflect.getPrototypeOf(t);function le(t,e,n=!1,r=!1){const o=Fe(t=t.__v_raw),i=Fe(e);n||(gt(e,i)&&Kt(o,"get",e),Kt(o,"get",i));const{has:s}=ae(o),a=r?se:n?Be:He;return s.call(o,e)?a(t.get(e)):s.call(o,i)?a(t.get(i)):void(t!==o&&t.get(e))}function ce(t,e=!1){const n=this.__v_raw,r=Fe(n),o=Fe(t);return e||(gt(t,o)&&Kt(r,"has",t),Kt(r,"has",o)),t===o?n.has(t):n.has(t)||n.has(o)}function ue(t,e=!1){return t=t.__v_raw,!e&&Kt(Fe(t),"iterate",qt),Reflect.get(t,"size",t)}function he(t){t=Fe(t);const e=Fe(this);return ae(e).has.call(e,t)||(e.add(t),Jt(e,"add",t,t)),this}function pe(t,e){e=Fe(e);const n=Fe(this),{has:r,get:o}=ae(n);let i=r.call(n,t);i?"production"!==process.env.NODE_ENV&&Ce(n,r,t):(t=Fe(t),i=r.call(n,t));const s=o.call(n,t);return n.set(t,e),i?gt(e,s)&&Jt(n,"set",t,e,s):Jt(n,"add",t,e),this}function de(t){const e=Fe(this),{has:n,get:r}=ae(e);let o=n.call(e,t);o?"production"!==process.env.NODE_ENV&&Ce(e,n,t):(t=Fe(t),o=n.call(e,t));const i=r?r.call(e,t):void 0,s=e.delete(t);return o&&Jt(e,"delete",t,void 0,i),s}function fe(){const t=Fe(this),e=0!==t.size,n="production"!==process.env.NODE_ENV?rt(t)?new Map(t):new Set(t):void 0,r=t.clear();return e&&Jt(t,"clear",void 0,void 0,n),r}function me(t,e){return function(n,r){const o=this,i=o.__v_raw,s=Fe(i),a=e?se:t?Be:He;return!t&&Kt(s,"iterate",qt),i.forEach(((t,e)=>n.call(r,a(t),a(e),o)))}}function ge(t,e,n){return function(...r){const o=this.__v_raw,i=Fe(o),s=rt(i),a="entries"===t||t===Symbol.iterator&&s,l="keys"===t&&s,c=o[t](...r),u=n?se:e?Be:He;return!e&&Kt(i,"iterate",l?Ut:qt),{next(){const{value:t,done:e}=c.next();return e?{value:t,done:e}:{value:a?[u(t[0]),u(t[1])]:u(t),done:e}},[Symbol.iterator](){return this}}}}function ye(t){return function(...e){if("production"!==process.env.NODE_ENV){const n=e[0]?`on key "${e[0]}" `:"";Ot(`${mt(t)} operation ${n}failed: target is readonly.`,Fe(this))}return"delete"!==t&&("clear"===t?void 0:this)}}function ve(){const t={get(t){return le(this,t)},get size(){return ue(this)},has:ce,add:he,set:pe,delete:de,clear:fe,forEach:me(!1,!1)},e={get(t){return le(this,t,!1,!0)},get size(){return ue(this)},has:ce,add:he,set:pe,delete:de,clear:fe,forEach:me(!1,!0)},n={get(t){return le(this,t,!0)},get size(){return ue(this,!0)},has(t){return ce.call(this,t,!0)},add:ye("add"),set:ye("set"),delete:ye("delete"),clear:ye("clear"),forEach:me(!0,!1)},r={get(t){return le(this,t,!0,!0)},get size(){return ue(this,!0)},has(t){return ce.call(this,t,!0)},add:ye("add"),set:ye("set"),delete:ye("delete"),clear:ye("clear"),forEach:me(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((o=>{t[o]=ge(o,!1,!1),n[o]=ge(o,!0,!1),e[o]=ge(o,!1,!0),r[o]=ge(o,!0,!0)})),[t,n,e,r]}const[be,_e,we,ke]=ve();function xe(t,e){const n=e?t?ke:we:t?_e:be;return(e,r,o)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(et(n,r)&&r in e?n:e,r,o)}const Se={get:xe(!1,!1)},Ee={get:xe(!0,!1)},Oe={get:xe(!0,!0)};function Ce(t,e,n){const r=Fe(n);if(r!==n&&e.call(t,r)){const e=pt(t);Ot(`Reactive ${e} contains both the raw and reactive versions of the same object${"Map"===e?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Ae=new WeakMap,Me=new WeakMap,Te=new WeakMap,Ne=new WeakMap;function Ie(t){return Pe(t)?t:De(t,!1,re,Se,Ae)}function Re(t){return De(t,!0,oe,Ee,Te)}function Le(t){return De(t,!0,ie,Oe,Ne)}function De(t,e,n,r,o){if(!lt(t))return"production"!==process.env.NODE_ENV&&Ot(`value cannot be made reactive: ${String(t)}`),t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=o.get(t);if(i)return i;const s=(a=t).__v_skip||!Object.isExtensible(a)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(pt(a));var a;if(0===s)return t;const l=new Proxy(t,2===s?r:n);return o.set(t,l),l}function $e(t){return Pe(t)?$e(t.__v_raw):!(!t||!t.__v_isReactive)}function Pe(t){return!(!t||!t.__v_isReadonly)}function ze(t){return!(!t||!t.__v_isShallow)}function je(t){return $e(t)||Pe(t)}function Fe(t){const e=t&&t.__v_raw;return e?Fe(e):t}const He=t=>lt(t)?Ie(t):t,Be=t=>lt(t)?Re(t):t;class Ve{constructor(t,e,n,r){this.getter=t,this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new At((()=>t(this._value)),(()=>qe(this,2===this.effect._dirtyLevel?2:3))),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=n}get value(){const t=Fe(this);return t._cacheable&&!t.effect.dirty||!gt(t._value,t._value=t.effect.run())||qe(t,4),We(t),t.effect._dirtyLevel>=2&&("production"!==process.env.NODE_ENV&&this._warnRecursive&&Ot("Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free","\n\ngetter: ",this.getter),qe(t,2)),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function We(t){var e;Rt&&Ct&&(t=Fe(t),Ft(Ct,null!=(e=t.dep)?e:t.dep=Vt((()=>t.dep=void 0),t instanceof Ve?t:void 0),"production"!==process.env.NODE_ENV?{target:t,type:"get",key:"value"}:void 0))}function qe(t,e=4,n){const r=(t=Fe(t)).dep;r&&Bt(r,e,"production"!==process.env.NODE_ENV?{target:t,type:"set",key:"value",newValue:n}:void 0)}function Ue(t){return!(!t||!0!==t.__v_isRef)}function Ke(t){return function(t,e){if(Ue(t))return t;return new Je(t,e)}(t,!1)}class Je{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Fe(t),this._value=e?t:He(t)}get value(){return We(this),this._value}set value(t){const e=this.__v_isShallow||ze(t)||Pe(t);t=e?t:Fe(t),gt(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:He(t),qe(this,4,t))}}function Ge(t){return Ue(t)?t.value:t}const Ye={get:(t,e,n)=>Ge(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const o=t[e];return Ue(o)&&!Ue(n)?(o.value=n,!0):Reflect.set(t,e,n,r)}};class Xe{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return t=Fe(this._object),e=this._key,null==(n=Wt.get(t))?void 0:n.get(e);var t,e,n}}class Ze{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Qe(t,e,n){return Ue(t)?t:it(t)?new Ze(t):lt(t)&&arguments.length>1?function(t,e,n){const r=t[e];return Ue(r)?r:new Xe(t,e,n)}
12
+ /**
13
+ * @vue/runtime-core v3.4.21
14
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
15
+ * @license MIT
16
+ **/(t,e,n):Ke(t)}const tn=[];function en(t,...e){$t();const n=tn.length?tn[tn.length-1].component:null,r=n&&n.appContext.config.warnHandler,o=function(){let t=tn[tn.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}();if(r)sn(r,n,11,[t+e.map((t=>{var e,n;return null!=(n=null==(e=t.toString)?void 0:e.call(t))?n:JSON.stringify(t)})).join(""),n&&n.proxy,o.map((({vnode:t})=>`at <${kr(n,t.type)}>`)).join("\n"),o]);else{const n=[`[Vue warn]: ${t}`,...e];o.length&&n.push("\n",...function(t){const e=[];return t.forEach(((t,n)=>{e.push(...0===n?[]:["\n"],...function({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=!!t.component&&null==t.component.parent,o=` at <${kr(t.component,t.type,r)}`,i=">"+n;return t.props?[o,...nn(t.props),i]:[o+i]}(t))})),e}(o)),console.warn(...n)}Pt()}function nn(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach((n=>{e.push(...rn(n,t[n]))})),n.length>3&&e.push(" ..."),e}function rn(t,e,n){return st(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):"number"==typeof e||"boolean"==typeof e||null==e?n?e:[`${t}=${e}`]:Ue(e)?(e=rn(t,Fe(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):it(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=Fe(e),n?e:[`${t}=`,e])}const on={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."};function sn(t,e,n,r){try{return r?t(...r):t()}catch(t){ln(t,e,n)}}function an(t,e,n,r){if(it(t)){const o=sn(t,e,n,r);return o&&ct(o)&&o.catch((t=>{ln(t,e,n)})),o}const o=[];for(let i=0;i<t.length;i++)o.push(an(t[i],e,n,r));return o}function ln(t,e,n,r=!0){const o=e?e.vnode:null;if(e){let r=e.parent;const o=e.proxy,i="production"!==process.env.NODE_ENV?on[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const e=r.ec;if(e)for(let n=0;n<e.length;n++)if(!1===e[n](t,o,i))return;r=r.parent}const s=e.appContext.config.errorHandler;if(s)return void sn(s,null,10,[t,o,i])}!function(t,e,n,r=!0){if("production"!==process.env.NODE_ENV){const i=on[e];if(n&&(o=n,tn.push(o)),en("Unhandled error"+(i?` during execution of ${i}`:"")),n&&tn.pop(),r)throw t;console.error(t)}else console.error(t);var o}(t,n,o,r)}let cn=!1,un=!1;const hn=[];let pn=0;const dn=[];let fn=null,mn=0;const gn=Promise.resolve();let yn=null;const vn=100;function bn(t){const e=yn||gn;return t?e.then(this?t.bind(this):t):e}function _n(t){hn.length&&hn.includes(t,cn&&t.allowRecurse?pn+1:pn)||(null==t.id?hn.push(t):hn.splice(function(t){let e=pn+1,n=hn.length;for(;e<n;){const r=e+n>>>1,o=hn[r],i=xn(o);i<t||i===t&&o.pre?e=r+1:n=r}return e}(t.id),0,t),wn())}function wn(){cn||un||(un=!0,yn=gn.then(En))}function kn(t){nt(t)?dn.push(...t):fn&&fn.includes(t,t.allowRecurse?mn+1:mn)||dn.push(t),wn()}const xn=t=>null==t.id?1/0:t.id,Sn=(t,e)=>{const n=xn(t)-xn(e);if(0===n){if(t.pre&&!e.pre)return-1;if(e.pre&&!t.pre)return 1}return n};function En(t){un=!1,cn=!0,"production"!==process.env.NODE_ENV&&(t=t||new Map),hn.sort(Sn);const e="production"!==process.env.NODE_ENV?e=>On(t,e):X;try{for(pn=0;pn<hn.length;pn++){const t=hn[pn];if(t&&!1!==t.active){if("production"!==process.env.NODE_ENV&&e(t))continue;sn(t,null,14)}}}finally{pn=0,hn.length=0,function(t){if(dn.length){const e=[...new Set(dn)].sort(((t,e)=>xn(t)-xn(e)));if(dn.length=0,fn)return void fn.push(...e);for(fn=e,"production"!==process.env.NODE_ENV&&(t=t||new Map),mn=0;mn<fn.length;mn++)"production"!==process.env.NODE_ENV&&On(t,fn[mn])||fn[mn]();fn=null,mn=0}}(t),cn=!1,yn=null,(hn.length||dn.length)&&En(t)}}function On(t,e){if(t.has(e)){const n=t.get(e);if(n>vn){const t=e.ownerInstance,n=t&&wr(t.type);return ln(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}t.set(e,n+1)}else t.set(e,1)}const Cn=new Set;"production"!==process.env.NODE_ENV&&(bt().__VUE_HMR_RUNTIME__={createRecord:Nn((function(t,e){if(An.has(t))return!1;return An.set(t,{initialDef:Mn(e),instances:new Set}),!0})),rerender:Nn((function(t,e){const n=An.get(t);if(!n)return;n.initialDef.render=e,[...n.instances].forEach((t=>{e&&(t.render=e,Mn(t.type).render=e),t.renderCache=[],t.effect.dirty=!0,t.update()}))})),reload:Nn((function(t,e){const n=An.get(t);if(!n)return;e=Mn(e),Tn(n.initialDef,e);const r=[...n.instances];for(const t of r){const r=Mn(t.type);Cn.has(r)||(r!==n.initialDef&&Tn(r,e),Cn.add(r)),t.appContext.propsCache.delete(t.type),t.appContext.emitsCache.delete(t.type),t.appContext.optionsCache.delete(t.type),t.ceReload?(Cn.add(r),t.ceReload(e.styles),Cn.delete(r)):t.parent?(t.parent.effect.dirty=!0,_n(t.parent.update)):t.appContext.reload?t.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required.")}kn((()=>{for(const t of r)Cn.delete(Mn(t.type))}))}))});const An=new Map;function Mn(t){return xr(t)?t.__vccOpts:t}function Tn(t,e){Q(t,e);for(const n in t)"__file"===n||n in e||delete t[n]}function Nn(t){return(e,n)=>{try{return t(e,n)}catch(t){console.error(t),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let In=null,Rn=null;const Ln=Symbol.for("v-ndc");const Dn=Symbol.for("v-scx"),$n=()=>{{const t=function(t,e,n=!1){const r=mr||In;if(r||tr){const o=r?null==r.parent?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:tr._context.provides;if(o&&t in o)return o[t];if(arguments.length>1)return n&&it(e)?e.call(r&&r.proxy):e;"production"!==process.env.NODE_ENV&&en(`injection "${String(t)}" not found.`)}else"production"!==process.env.NODE_ENV&&en("inject() can only be used inside setup() or functional components.")}(Dn);return t||"production"!==process.env.NODE_ENV&&en("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),t}},Pn={};function zn(t,e,{immediate:n,deep:r,flush:o,once:i,onTrack:s,onTrigger:a}=Y){if(e&&i){const t=e;e=(...e)=>{t(...e),w()}}"production"!==process.env.NODE_ENV&&void 0!==r&&"number"==typeof r&&en('watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.'),"production"===process.env.NODE_ENV||e||(void 0!==n&&en('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==r&&en('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==i&&en('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const l=t=>{en("Invalid watch source: ",t,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},c=mr,u=t=>!0===r?t:Fn(t,!1===r?1:void 0);let h,p,d=!1,f=!1;if(Ue(t)?(h=()=>t.value,d=ze(t)):$e(t)?(h=()=>u(t),d=!0):nt(t)?(f=!0,d=t.some((t=>$e(t)||ze(t))),h=()=>t.map((t=>Ue(t)?t.value:$e(t)?u(t):it(t)?sn(t,c,2):void("production"!==process.env.NODE_ENV&&l(t))))):it(t)?h=e?()=>sn(t,c,2):()=>(p&&p(),an(t,c,3,[g])):(h=X,"production"!==process.env.NODE_ENV&&l(t)),e&&r){const t=h;h=()=>Fn(t())}let m,g=t=>{p=_.onStop=()=>{sn(t,c,4),p=_.onStop=void 0}};if(vr){if(g=X,e?n&&an(e,c,3,[h(),f?[]:void 0,g]):h(),"sync"!==o)return X;{const t=$n();m=t.__watcherHandles||(t.__watcherHandles=[])}}let y=f?new Array(t.length).fill(Pn):Pn;const v=()=>{if(_.active&&_.dirty)if(e){const t=_.run();(r||d||(f?t.some(((t,e)=>gt(t,y[e]))):gt(t,y)))&&(p&&p(),an(e,c,3,[t,y===Pn?void 0:f&&y[0]===Pn?[]:y,g]),y=t)}else _.run()};let b;v.allowRecurse=!!e,"sync"===o?b=v:"post"===o?b=()=>er(v,c&&c.suspense):(v.pre=!0,c&&(v.id=c.uid),b=()=>_n(v));const _=new At(h,X,b),w=()=>{_.stop()};return"production"!==process.env.NODE_ENV&&(_.onTrack=s,_.onTrigger=a),e?n?v():y=_.run():"post"===o?er(_.run.bind(_),c&&c.suspense):_.run(),m&&m.push(w),w}function jn(t,e,n){const r=this.proxy,o=st(t)?t.includes(".")?function(t,e){const n=e.split(".");return()=>{let e=t;for(let t=0;t<n.length&&e;t++)e=e[n[t]];return e}}(r,t):()=>r[t]:t.bind(r,r);let i;it(e)?i=e:(i=e.handler,n=e);const s=yr(this),a=zn(o,i.bind(r),n);return s(),a}function Fn(t,e,n=0,r){if(!lt(t)||t.__v_skip)return t;if(e&&e>0){if(n>=e)return t;n++}if((r=r||new Set).has(t))return t;if(r.add(t),Ue(t))Fn(t.value,e,n,r);else if(nt(t))for(let o=0;o<t.length;o++)Fn(t[o],e,n,r);else if(ot(t)||rt(t))t.forEach((t=>{Fn(t,e,n,r)}));else if(dt(t))for(const o in t)Fn(t[o],e,n,r);return t}const Hn=t=>t?4&t.vnode.shapeFlag?function(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy((n=t.exposed,Object.isExtensible(n)&&yt(n,"__v_skip",!0),$e(e=n)?e:new Proxy(e,Ye)),{get:(e,n)=>n in e?e[n]:n in Bn?Bn[n](t):void 0,has:(t,e)=>e in t||e in Bn}));var e;var n}(t)||t.proxy:Hn(t.parent):null,Bn=Q(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>"production"!==process.env.NODE_ENV?Le(t.props):t.props,$attrs:t=>"production"!==process.env.NODE_ENV?Le(t.attrs):t.attrs,$slots:t=>"production"!==process.env.NODE_ENV?Le(t.slots):t.slots,$refs:t=>"production"!==process.env.NODE_ENV?Le(t.refs):t.refs,$parent:t=>Hn(t.parent),$root:t=>Hn(t.root),$emit:t=>t.emit,$options:t=>__VUE_OPTIONS_API__?function(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=t.appContext,a=i.get(e);let l;a?l=a:o.length||n||r?(l={},o.length&&o.forEach((t=>Kn(l,t,s,!0))),Kn(l,e,s)):l=e;lt(e)&&i.set(e,l);return l}(t):t.type,$forceUpdate:t=>t.f||(t.f=()=>{t.effect.dirty=!0,_n(t.update)}),$nextTick:t=>t.n||(t.n=bn.bind(t.proxy)),$watch:t=>__VUE_OPTIONS_API__?jn.bind(t):X}),Vn=(t,e)=>t!==Y&&!t.__isScriptSetup&&et(t,e),Wn={get({_:t},e){const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=t;if("production"!==process.env.NODE_ENV&&"__isVue"===e)return!0;let c;if("$"!==e[0]){const a=s[e];if(void 0!==a)switch(a){case 1:return r[e];case 2:return o[e];case 4:return n[e];case 3:return i[e]}else{if(Vn(r,e))return s[e]=1,r[e];if(o!==Y&&et(o,e))return s[e]=2,o[e];if((c=t.propsOptions[0])&&et(c,e))return s[e]=3,i[e];if(n!==Y&&et(n,e))return s[e]=4,n[e];__VUE_OPTIONS_API__&&!Un||(s[e]=0)}}const u=Bn[e];let h,p;return u?("$attrs"===e?(Kt(t,"get",e),process.env.NODE_ENV):"production"!==process.env.NODE_ENV&&"$slots"===e&&Kt(t,"get",e),u(t)):(h=a.__cssModules)&&(h=h[e])?h:n!==Y&&et(n,e)?(s[e]=4,n[e]):(p=l.config.globalProperties,et(p,e)?p[e]:void("production"===process.env.NODE_ENV||!In||st(e)&&0===e.indexOf("__v")||(o!==Y&&(t=>"_"===t||"$"===t)(e[0])&&et(o,e)?en(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):t===In&&en(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))))},set({_:t},e,n){const{data:r,setupState:o,ctx:i}=t;return Vn(o,e)?(o[e]=n,!0):"production"!==process.env.NODE_ENV&&o.__isScriptSetup&&et(o,e)?(en(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):r!==Y&&et(r,e)?(r[e]=n,!0):et(t.props,e)?("production"!==process.env.NODE_ENV&&en(`Attempting to mutate prop "${e}". Props are readonly.`),!1):"$"===e[0]&&e.slice(1)in t?("production"!==process.env.NODE_ENV&&en(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):("production"!==process.env.NODE_ENV&&e in t.appContext.config.globalProperties?Object.defineProperty(i,e,{enumerable:!0,configurable:!0,value:n}):i[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:o,propsOptions:i}},s){let a;return!!n[s]||t!==Y&&et(t,s)||Vn(e,s)||(a=i[0])&&et(a,s)||et(r,s)||et(Bn,s)||et(o.config.globalProperties,s)},defineProperty(t,e,n){return null!=n.get?t._.accessCache[e]=0:et(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function qn(t){return nt(t)?t.reduce(((t,e)=>(t[e]=null,t)),{}):t}"production"!==process.env.NODE_ENV&&(Wn.ownKeys=t=>(en("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(t)));let Un=!0;function Kn(t,e,n,r=!1){const{mixins:o,extends:i}=e;i&&Kn(t,i,n,!0),o&&o.forEach((e=>Kn(t,e,n,!0)));for(const o in e)if(r&&"expose"===o)"production"!==process.env.NODE_ENV&&en('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const r=Jn[o]||n&&n[o];t[o]=r?r(t[o],e[o]):e[o]}return t}const Jn={data:Gn,props:Qn,emits:Qn,methods:Zn,computed:Zn,beforeCreate:Xn,created:Xn,beforeMount:Xn,mounted:Xn,beforeUpdate:Xn,updated:Xn,beforeDestroy:Xn,beforeUnmount:Xn,destroyed:Xn,unmounted:Xn,activated:Xn,deactivated:Xn,errorCaptured:Xn,serverPrefetch:Xn,components:Zn,directives:Zn,watch:function(t,e){if(!t)return e;if(!e)return t;const n=Q(Object.create(null),t);for(const r in e)n[r]=Xn(t[r],e[r]);return n},provide:Gn,inject:function(t,e){return Zn(Yn(t),Yn(e))}};function Gn(t,e){return e?t?function(){return Q(it(t)?t.call(this,this):t,it(e)?e.call(this,this):e)}:e:t}function Yn(t){if(nt(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Xn(t,e){return t?[...new Set([].concat(t,e))]:e}function Zn(t,e){return t?Q(Object.create(null),t,e):e}function Qn(t,e){return t?nt(t)&&nt(e)?[...new Set([...t,...e])]:Q(Object.create(null),qn(t),qn(null!=e?e:{})):e}let tr=null;const er=function(t,e){e&&e.pendingBranch?nt(t)?e.effects.push(...t):e.effects.push(t):kn(t)},nr=Symbol.for("v-fgt"),rr=Symbol.for("v-txt"),or=Symbol.for("v-cmt");let ir=null;const sr="__vInternal",ar=({key:t})=>null!=t?t:null,lr=({ref:t,ref_key:e,ref_for:n})=>("number"==typeof t&&(t=""+t),null!=t?st(t)||Ue(t)||it(t)?{i:In,r:t,k:e,f:!!n}:t:null);const cr="production"!==process.env.NODE_ENV?(...t)=>ur(...t):ur;function ur(t,e=null,n=null,r=0,o=null,i=!1){if(t&&t!==Ln||("production"===process.env.NODE_ENV||t||en(`Invalid vnode type when creating vnode: ${t}.`),t=or),(s=t)&&!0===s.__v_isVNode){const r=hr(t,e,!0);return n&&fr(r,n),!i&&ir&&(6&r.shapeFlag?ir[ir.indexOf(t)]=r:ir.push(r)),r.patchFlag|=-2,r}var s;if(xr(t)&&(t=t.__vccOpts),e){e=function(t){return t?je(t)||sr in t?Q({},t):t:null}(e);let{class:t,style:n}=e;t&&!st(t)&&(e.class=Et(t)),lt(n)&&(je(n)&&!nt(n)&&(n=Q({},n)),e.style=_t(n))}const a=st(t)?1:(t=>t.__isSuspense)(t)?128:(t=>t.__isTeleport)(t)?64:lt(t)?4:it(t)?2:0;return"production"!==process.env.NODE_ENV&&4&a&&je(t)&&en("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.","\nComponent that was made reactive: ",t=Fe(t)),function(t,e=null,n=null,r=0,o=null,i=(t===nr?0:1),s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&ar(e),ref:e&&lr(e),scopeId:Rn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:In};return a?(fr(l,n),128&i&&t.normalize(l)):n&&(l.shapeFlag|=st(n)?8:16),"production"!==process.env.NODE_ENV&&l.key!=l.key&&en("VNode created with invalid key (NaN). VNode type:",l.type),!s&&ir&&(l.patchFlag>0||6&i)&&32!==l.patchFlag&&ir.push(l),l}(t,e,n,r,o,a,i,!0)}function hr(t,e,n=!1){const{props:r,ref:o,patchFlag:i,children:s}=t,a=e?function(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const t in r)if("class"===t)e.class!==r.class&&(e.class=Et([e.class,r.class]));else if("style"===t)e.style=_t([e.style,r.style]);else if(Z(t)){const n=e[t],o=r[t];!o||n===o||nt(n)&&n.includes(o)||(e[t]=n?[].concat(n,o):o)}else""!==t&&(e[t]=r[t])}return e}(r||{},e):r;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&ar(a),ref:e&&e.ref?n&&o?nt(o)?o.concat(lr(e)):[o,lr(e)]:lr(e):o,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:"production"!==process.env.NODE_ENV&&-1===i&&nt(s)?s.map(pr):s,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==nr?-1===i?16:16|i:i,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&hr(t.ssContent),ssFallback:t.ssFallback&&hr(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function pr(t){const e=hr(t);return nt(t.children)&&(e.children=t.children.map(pr)),e}function dr(t=" ",e=0){return cr(rr,null,t,e)}function fr(t,e){let n=0;const{shapeFlag:r}=t;if(null==e)e=null;else if(nt(e))n=16;else if("object"==typeof e){if(65&r){const n=e.default;return void(n&&(n._c&&(n._d=!1),fr(t,n()),n._c&&(n._d=!0)))}{n=32;const r=e._;r||sr in e?3===r&&In&&(1===In.slots._?e._=1:(e._=2,t.patchFlag|=1024)):e._ctx=In}}else it(e)?(e={default:e,_ctx:In},n=32):(e=String(e),64&r?(n=16,e=[dr(e)]):n=8);t.children=e,t.shapeFlag|=n}let mr=null;let gr;{const t=bt(),e=(e,n)=>{let r;return(r=t[e])||(r=t[e]=[]),r.push(n),t=>{r.length>1?r.forEach((e=>e(t))):r[0](t)}};gr=e("__VUE_INSTANCE_SETTERS__",(t=>mr=t)),e("__VUE_SSR_SETTERS__",(t=>vr=t))}const yr=t=>{const e=mr;return gr(t),t.scope.on(),()=>{t.scope.off(),gr(e)}};let vr=!1;const br=/(?:^|[-_])(\w)/g,_r=t=>t.replace(br,(t=>t.toUpperCase())).replace(/[-_]/g,"");function wr(t,e=!0){return it(t)?t.displayName||t.name:t.name||e&&t.__name}function kr(t,e,n=!1){let r=wr(e);if(!r&&e.__file){const t=e.__file.match(/([^/\\]+)\.\w+$/);t&&(r=t[1])}if(!r&&t&&t.parent){const n=t=>{for(const n in t)if(t[n]===e)return n};r=n(t.components||t.parent.type.components)||n(t.appContext.components)}return r?_r(r):n?"App":"Anonymous"}function xr(t){return it(t)&&"__vccOpts"in t}const Sr=(t,e)=>{const n=function(t,e,n=!1){let r,o;const i=it(t);i?(r=t,o="production"!==process.env.NODE_ENV?()=>{Ot("Write operation failed: computed value is readonly")}:X):(r=t.get,o=t.set);const s=new Ve(r,o,i||!o,n);return"production"!==process.env.NODE_ENV&&e&&!n&&(s.effect.onTrack=e.onTrack,s.effect.onTrigger=e.onTrigger),s}(t,e,vr);if("production"!==process.env.NODE_ENV){const t=mr||In;t&&t.appContext.config.warnRecursiveComputed&&(n._warnRecursive=!0)}return n};function Er(t){this.content=t}function Or(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let t=0;o.text[t]==i.text[t];t++)n++;return n}if(o.content.size||i.content.size){let t=Or(o.content,i.content,n+1);if(null!=t)return t}n+=o.nodeSize}else n+=o.nodeSize}}function Cr(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let t=0,e=Math.min(s.text.length,a.text.length);for(;t<e&&s.text[s.text.length-t-1]==a.text[a.text.length-t-1];)t++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let t=Cr(s.content,a.content,n-1,r-1);if(t)return t}n-=l,r-=l}else n-=l,r-=l}}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV,"production"!==process.env.NODE_ENV&&function(){if("production"===process.env.NODE_ENV||"undefined"==typeof window)return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},o={header:e=>lt(e)?e.__isVue?["div",t,"VueInstance"]:Ue(e)?["div",{},["span",t,u(e)],"<",a(e.value),">"]:$e(e)?["div",{},["span",t,ze(e)?"ShallowReactive":"Reactive"],"<",a(e),">"+(Pe(e)?" (readonly)":"")]:Pe(e)?["div",{},["span",t,ze(e)?"ShallowReadonly":"Readonly"],"<",a(e),">"]:null:null,hasBody:t=>t&&t.__isVue,body(t){if(t&&t.__isVue)return["div",{},...i(t.$)]}};function i(t){const e=[];t.type.props&&t.props&&e.push(s("props",Fe(t.props))),t.setupState!==Y&&e.push(s("setup",t.setupState)),t.data!==Y&&e.push(s("data",Fe(t.data)));const n=l(t,"computed");n&&e.push(s("computed",n));const o=l(t,"inject");return o&&e.push(s("injected",o)),e.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:t}]]),e}function s(t,e){return e=Q({},e),Object.keys(e).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},t],["div",{style:"padding-left:1.25em"},...Object.keys(e).map((t=>["div",{},["span",r,t+": "],a(e[t],!1)]))]]:["span",{}]}function a(t,o=!0){return"number"==typeof t?["span",e,t]:"string"==typeof t?["span",n,JSON.stringify(t)]:"boolean"==typeof t?["span",r,t]:lt(t)?["object",{object:o?Fe(t):t}]:["span",n,String(t)]}function l(t,e){const n=t.type;if(it(n))return;const r={};for(const o in t.ctx)c(n,o,e)&&(r[o]=t.ctx[o]);return r}function c(t,e,n){const r=t[n];return!!(nt(r)&&r.includes(e)||lt(r)&&e in r)||!(!t.extends||!c(t.extends,e,n))||!(!t.mixins||!t.mixins.some((t=>c(t,e,n))))||void 0}function u(t){return ze(t)?"ShallowRef":t.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(o):window.devtoolsFormatters=[o]}(),Er.prototype={constructor:Er,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return-1==o?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Er(i)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new Er(n)},addToStart:function(t,e){return new Er([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Er(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(-1==i?o.length:i,0,e,n),new Er(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=Er.from(t)).size?new Er(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=Er.from(t)).size?new Er(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Er.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},Er.from=function(t){if(t instanceof Er)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Er(e)};class Ar{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,n,r=0,o){for(let i=0,s=0;s<e;i++){let a=this.content[i],l=s+a.nodeSize;if(l>t&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,t-o),Math.min(a.content.size,e-o),n,r+o)}s=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let o="",i=!0;return this.nodesBetween(t,e,((s,a)=>{s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf?(r?o+="function"==typeof r?r(s):r:s.type.spec.leafText&&(o+=s.type.spec.leafText(s)),i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new Ar(r,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],r=0;if(e>t)for(let o=0,i=0;i<e;o++){let s=this.content[o],a=i+s.nodeSize;a>t&&((i<t||a>e)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Ar(n,r)}cutByIndex(t,e){return t==e?Ar.empty:0==t&&e==this.content.length?this:new Ar(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new Ar(r,o)}addToStart(t){return new Ar([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Ar(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,e=0){return Or(this,t,e)}findDiffEnd(t,e=this.size,n=t.size){return Cr(this,t,e,n)}findIndex(t,e=-1){if(0==t)return Tr(0,t);if(t==this.size)return Tr(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?Tr(n+1,o):Tr(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return Ar.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ar(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Ar.empty;let e,n=0;for(let r=0;r<t.length;r++){let o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new Ar(e||t,n)}static from(t){if(!t)return Ar.empty;if(t instanceof Ar)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Ar([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ar.empty=new Ar([],0);const Mr={index:0,offset:0};function Tr(t,e){return Mr.index=t,Mr.offset=e,Mr}function Nr(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!Nr(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!Nr(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}let Ir=class t{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Nr(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);return n.create(e.attrs)}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort(((t,e)=>t.type.rank-e.type.rank)),n}};Ir.none=[];class Rr extends Error{}class Lr{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=$r(this.content,t+this.openStart,e);return n&&new Lr(n,this.openStart,this.openEnd)}removeBetween(t,e){return new Lr(Dr(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return Lr.empty;let n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new Lr(Ar.fromJSON(t,e.content),n,r)}static maxOpen(t,e=!0){let n=0,r=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)r++;return new Lr(t,n,r)}}function Dr(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Dr(i.content,e-o-1,n-o-1)))}function $r(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=$r(s.content,e-i-1,n);return a&&t.replaceChild(o,s.copy(a))}function Pr(t,e,n){if(n.openStart>t.depth)throw new Rr("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Rr("Inconsistent open depths");return zr(t,e,n,0)}function zr(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=zr(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){let{start:o,end:s}=function(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let t=n-1;t>=0;t--)r=e.node(t).copy(Ar.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return Vr(i,Wr(t,o,s,e,r))}{let r=t.parent,o=r.content;return Vr(r,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}}return Vr(i,qr(t,e,r))}function jr(t,e){if(!e.type.compatibleContent(t.type))throw new Rr("Cannot join "+e.type.name+" onto "+t.type.name)}function Fr(t,e,n){let r=t.node(n);return jr(r,e.node(n)),r}function Hr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Br(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Hr(t.nodeAfter,r),i++));for(let t=i;t<s;t++)Hr(o.child(t),r);e&&e.depth==n&&e.textOffset&&Hr(e.nodeBefore,r)}function Vr(t,e){return t.type.checkContent(e),t.copy(e)}function Wr(t,e,n,r,o){let i=t.depth>o&&Fr(t,e,o+1),s=r.depth>o&&Fr(n,r,o+1),a=[];return Br(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(jr(i,s),Hr(Vr(i,Wr(t,e,n,r,o+1)),a)):(i&&Hr(Vr(i,qr(t,e,o+1)),a),Br(e,n,o,a),s&&Hr(Vr(s,qr(n,r,o+1)),a)),Br(r,null,o,a),new Ar(a)}function qr(t,e,n){let r=[];if(Br(null,t,n,r),t.depth>n){Hr(Vr(Fr(t,e,n+1),qr(t,e,n+1)),r)}return Br(e,null,n,r),new Ar(r)}Lr.empty=new Lr(Ar.empty,0,0);class Ur{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return Ir.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new Yr(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,o=e;for(let e=t;;){let{index:t,offset:i}=e.content.findIndex(o),s=o-i;if(n.push(e,t,r+i),!s)break;if(e=e.child(t),e.isText)break;o=s-1,r+=i+1}return new Ur(e,n,o)}static resolveCached(t,e){for(let n=0;n<Kr.length;n++){let r=Kr[n];if(r.pos==e&&r.doc==t)return r}let n=Kr[Jr]=Ur.resolve(t,e);return Jr=(Jr+1)%Gr,n}}let Kr=[],Jr=0,Gr=12;class Yr{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Xr=Object.create(null);let Zr=class t{constructor(t,e,n,r=Ir.none){this.type=t,this.attrs=e,this.marks=r,this.content=n||Ar.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&Nr(this.attrs,e||t.defaultAttrs||Xr)&&Ir.sameSet(this.marks,n||Ir.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.content,e)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return Lr.empty;let r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new Lr(a,r.depth-i,o.depth-i)}replace(t,e,n){return Pr(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return Ur.resolveCached(this,t)}resolveNoCache(t){return Ur.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),to(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=Ar.empty,r=0,o=n.childCount){let i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(let t=r;t<o;t++)if(!this.type.allowsMarks(n.child(t).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=Ir.none;for(let e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!Ir.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let r=Ar.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)}};Zr.prototype.text=void 0;class Qr extends Zr{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):to(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Qr(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Qr(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function to(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class eo{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new no(t,e);if(null==n.next)return eo.empty;let r=ro(n);n.next&&n.err("Unexpected trailing text");let o=function(t){let e=Object.create(null);return n(co(t,0));function n(r){let o=[];r.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<o.length;t++)o[t][0]==e&&(r=o[t][1]);co(t,n).forEach((t=>{r||o.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)}))}))}));let i=e[r.join(",")]=new eo(r.indexOf(t.length-1)>-1);for(let t=0;t<o.length;t++){let r=o[t][1].sort(lo);i.next.push({type:o[t][0],next:e[r.join(",")]||n(r)})}return i}}(function(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((t=>t.to=e))}function i(t,e){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(i(n,e))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(e,s),o(i(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(i(t.expr,e),s),o(i(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(e)].concat(i(t.expr,e));if("range"==t.type){let s=e;for(let e=0;e<t.min;e++){let e=n();o(i(t.expr,s),e),s=e}if(-1==t.max)o(i(t.expr,s),s);else for(let e=t.min;e<t.max;e++){let e=n();r(s,e),o(i(t.expr,s),e),s=e}return[r(s)]}if("name"==t.type)return[r(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(t.exprs[r],e);if(r==t.exprs.length-1)return s;o(s,e=n())}}}(r));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],o=!t.validEnd,i=[];for(let e=0;e<t.next.length;e++){let{type:n,next:s}=t.next[e];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(t,n);if(a&&(!e||a.validEnd))return Ar.from(s.map((t=>t.createAndFill())));for(let t=0;t<i.next.length;t++){let{type:e,next:n}=i.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let t=o(n,s.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<o.next.length;t++){let{type:i,next:s}=o.next[t];i.isLeaf||i.hasRequiredAttrs()||i.name in e||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),e[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map(((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let n=0;n<e.next.length;n++)r+=(n?", ":"")+e.next[n].type.name+"->"+t.indexOf(e.next[n].next);return r})).join("\n")}}eo.empty=new eo(!0);class no{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function ro(t){let e=[];do{e.push(oo(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function oo(t){let e=[];do{e.push(io(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function io(t){let e=function(t){if(t.eat("(")){let e=ro(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let t in n){let r=n[t];r.groups.indexOf(e)>-1&&o.push(r)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=ao(t,e)}return e}function so(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function ao(t,e){let n=so(t),r=n;return t.eat(",")&&(r="}"!=t.next?so(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function lo(t,e){return e-t}function co(t,e){let n=[];return function e(r){let o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(let t=0;t<o.length;t++){let{term:r,to:i}=o[t];r||-1!=n.indexOf(i)||e(i)}}(e),n.sort(lo)}function uo(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function ho(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(void 0===o){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=e.default}n[r]=o}return n}function po(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new mo(t[n]);return e}let fo=class t{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=po(n.attrs),this.defaultAttrs=uo(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==eo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:ho(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Zr(this,this.computeAttrs(t),Ar.from(e),Ir.setFrom(n))}createChecked(t=null,e,n){return e=Ar.from(e),this.checkContent(e),new Zr(this,this.computeAttrs(t),e,Ir.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),(e=Ar.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let r=this.contentMatch.matchFragment(e),o=r&&r.fillBefore(Ar.empty,!0);return o?new Zr(this,t,e.append(o),Ir.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:Ir.none:t}static compile(e,n){let r=Object.create(null);e.forEach(((e,o)=>r[e]=new t(e,n,o)));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let t in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class mo{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class go{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=po(r.attrs),this.excluded=null;let o=uo(this.attrs);this.instance=o?new Ir(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Ir(this,ho(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach(((t,o)=>n[t]=new go(t,r++,e,o))),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}excludes(t){return this.excluded.indexOf(t)>-1}}class yo{constructor(t){this.cached=Object.create(null);let e=this.spec={};for(let n in t)e[n]=t[n];e.nodes=Er.from(t.nodes),e.marks=Er.from(t.marks||{}),this.nodes=fo.compile(this.spec.nodes,this),this.marks=go.compile(this.spec.marks,this);let n=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],r=e.spec.content||"",o=e.spec.marks;e.contentMatch=n[r]||(n[r]=eo.parse(r,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.markSet="_"==o?null:o?vo(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:vo(this,n.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof fo))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new Qr(n,n.defaultAttrs,t,Ir.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return Zr.fromJSON(this,t)}markFromJSON(t){return Ir.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function vo(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let e in t.marks){let r=t.marks[e];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}let bo=class t{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((t=>{t.tag?this.tags.push(t):t.style&&this.styles.push(t)})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new Eo(this,e,!1);return n.addAll(t,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new Eo(this,e,!0);return n.addAll(t,e.from,e.to),Lr.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Oo(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(t)||r.context&&!n.matchesContext(r.context)||i.length>t.length&&(61!=i.charCodeAt(t.length)||i.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let e in t.marks){let r=t.marks[e].spec.parseDOM;r&&r.forEach((t=>{n(t=Co(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let r=t.nodes[e].spec.parseDOM;r&&r.forEach((t=>{n(t=Co(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}};const _o={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},wo={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ko={ol:!0,ul:!0};function xo(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class So{constructor(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ir.none,this.stashMarks=[],this.match=i||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(Ar.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=Ar.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(Ar.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}popFromStashMark(t){for(let e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]}applyPending(t){for(let e=0,n=this.pendingMarks;e<n.length;e++){let r=n[e];(this.type?this.type.allowsMarkType(r.type):Ao(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!_o.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Eo{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0;let r,o=e.topNode,i=xo(null,e.preserveWhitespace,0)|(n?4:0);r=o?new So(o.type,o.attrs,Ir.none,Ir.none,!0,e.topMatch||o.type.contentMatch,i):new So(n?null:t.schema.topNodeType,null,Ir.none,Ir.none,!0,null,i),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){let e=t.getAttribute("style");if(e){let n=this.readStyles(function(t){let e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e));if(!n)return;let[r,o]=n,i=this.top;for(let t=0;t<o.length;t++)this.removePendingMark(o[t],i);for(let t=0;t<r.length;t++)this.addPendingMark(r[t]);this.addElement(t);for(let t=0;t<r.length;t++)this.removePendingMark(r[t],i);for(let t=0;t<o.length;t++)this.addPendingMark(o[t])}else this.addElement(t)}}addTextNode(t){let e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)}addElement(t,e){let n,r=t.nodeName.toLowerCase();ko.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&ko.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:wo.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);let e,n=this.top,i=this.needsBlock;if(_o.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),e=!0,n.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),e&&this.sync(n),this.needsBlock=i}else this.addElementByRule(t,o,!1===o.consuming?n:void 0)}leafFallback(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))}ignoreFallback(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(t){let e=Ir.none,n=Ir.none;t:for(let r=0;r<t.length;r+=2)for(let o;;){let i=this.parser.matchStyle(t[r],t[r+1],this,o);if(!i)continue t;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.forEach((t=>{i.clearMark(t)&&(n=t.addToSet(n))})):e=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(e),!1!==i.consuming)break;o=i}return[e,n]}addElementByRule(t,e,n){let r,o,i;if(e.node)o=this.parser.schema.nodes[e.node],o.isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs||null,e.preserveWhitespace);else{i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i)}let s=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t)));else{let n=t;"string"==typeof e.contentElement?n=t.querySelector(e.contentElement):"function"==typeof e.contentElement?n=e.contentElement(t):e.contentElement&&(n=e.contentElement),this.findAround(t,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(t,e,n){let r=e||0;for(let o=e?t.childNodes[e]:t.firstChild,i=null==n?null:t.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(t,r),this.addDOM(o);this.findAtPoint(t,r)}findPlace(t){let e,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(let t=0;t<e.length;t++)this.enterInner(e[t],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(t)){this.closeExtra();let e=this.top;e.applyPending(t.type),e.match&&(e.match=e.match.matchType(t.type));let n=e.activeMarks;for(let r=0;r<t.marks.length;r++)e.type&&!e.type.allowsMarkType(t.marks[r].type)||(n=t.marks[r].addToSet(n));return e.content.push(t.mark(n)),!0}return!1}enter(t,e,n){let r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r}enterInner(t,e=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let i=xo(t,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new So(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)){e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(t,s)=>{for(;t>=0;t--){let a=e[t];if(""==a){if(t==e.length-1||0==t)continue;for(;s>=o;s--)if(i(t-1,s))return!0;return!1}{let t=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!t||t.name!=a&&-1==t.groups.indexOf(a))return!1;s--}}return!0};return i(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}addPendingMark(t){let e=function(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,e){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);let e=r.popFromStashMark(t);e&&r.type&&r.type.allowsMarkType(e.type)&&(r.activeMarks=e.addToSet(r.activeMarks))}if(r==e)break}}}function Oo(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Co(t){let e={};for(let n in t)e[n]=t[n];return e}function Ao(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=t=>{i.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:o}=t.edge(n);if(r==e)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Mo{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=No(e).createDocumentFragment());let r=n,o=[];return t.forEach((t=>{if(o.length||t.marks.length){let n=0,i=0;for(;n<o.length&&i<t.marks.length;){let e=t.marks[i];if(this.marks[e.type.name]){if(!e.eq(o[n][0])||!1===e.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<t.marks.length;){let n=t.marks[i++],s=this.serializeMark(n,t.isInline,e);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(t,e))})),n}serializeNodeInner(t,e){let{dom:n,contentDOM:r}=Mo.renderSpec(No(e),this.nodes[t.type.name](t));if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&&Mo.renderSpec(No(n),r(t,e))}static renderSpec(t,e,n=null){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let r,o=e[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?t.createElementNS(n,o):t.createElement(o),a=e[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){l=2;for(let t in a)if(null!=a[t]){let e=t.indexOf(" ");e>0?s.setAttributeNS(t.slice(0,e),t.slice(e+1),a[t]):s.setAttribute(t,a[t])}}for(let o=l;o<e.length;o++){let i=e[o];if(0===i){if(o<e.length-1||o>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:e,contentDOM:o}=Mo.renderSpec(t,i,n);if(s.appendChild(e),o){if(r)throw new RangeError("Multiple content holes");r=o}}}return{dom:s,contentDOM:r}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Mo(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=To(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return To(t.marks)}}function To(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function No(t){return t.document||window.document}const Io=Math.pow(2,16);function Ro(t){return 65535&t}class Lo{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Do{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&Do.empty)return Do.empty}recover(t){let e=0,n=Ro(t);if(!this.inverted)for(let t=0;t<n;t++)e+=this.ranges[3*t+2]-this.ranges[3*t+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/Io}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;let l=this.ranges[s+o],c=this.ranges[s+i],u=a+l;if(t<=u){let o=a+r+((l?t==a?-1:t==u?1:e:e)<0?0:c);if(n)return o;let i=t==(e<0?a:u)?null:s/3+(t-a)*Io,h=t==a?2:t==u?1:4;return(e<0?t!=a:t!=u)&&(h|=8),new Lo(o,h,i)}r+=c-l}return n?t+r:new Lo(t+r,0,null)}touches(t,e){let n=0,r=Ro(e),o=this.inverted?2:1,i=this.inverted?1:2;for(let e=0;e<this.ranges.length;e+=3){let s=this.ranges[e]-(this.inverted?n:0);if(s>t)break;let a=this.ranges[e+o];if(t<=s+a&&e==3*r)return!0;n+=this.ranges[e+i]-a}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+e],c=this.ranges[r+n];t(s,s+l,a,a+c),o+=c-l}}invert(){return new Do(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?Do.empty:new Do(t<0?[0,-t,0]:[0,0,t])}}Do.empty=new Do([]);class $o{constructor(t=[],e,n=0,r=t.length){this.maps=t,this.mirror=e,this.from=n,this.to=r}slice(t=0,e=this.maps.length){return new $o(this.maps,this.mirror,t,e)}copy(){return new $o(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,n=this.maps.length;e<t.maps.length;e++){let r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:void 0)}}invert(){let t=new $o;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this.maps[n].mapResult(t,e);if(null!=o.recover){let e=this.getMirror(n);if(null!=e&&e>n&&e<this.to){n=e,t=this.maps[e].recover(o.recover);continue}}r|=o.delInfo,t=o.pos}return n?t:new Lo(t,r,null)}}const Po=Object.create(null);class zo{getMap(){return Do.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Po[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Po)throw new RangeError("Duplicate use of step JSON ID "+t);return Po[t]=e,e.prototype.jsonID=t,e}}class jo{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new jo(t,null)}static fail(t){return new jo(null,t)}static fromReplace(t,e,n,r){try{return jo.ok(t.replace(e,n,r))}catch(t){if(t instanceof Rr)return jo.fail(t.message);throw t}}}function Fo(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Fo(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return Ar.fromArray(r)}class Ho extends zo{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new Lr(Fo(e.content,((t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),r),e.openStart,e.openEnd);return jo.fromReplace(t,this.from,this.to,o)}invert(){return new Bo(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Ho(e.pos,n.pos,this.mark)}merge(t){return t instanceof Ho&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Ho(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ho(e.from,e.to,t.markFromJSON(e.mark))}}zo.jsonID("addMark",Ho);class Bo extends zo{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new Lr(Fo(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return jo.fromReplace(t,this.from,this.to,n)}invert(){return new Ho(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Bo(e.pos,n.pos,this.mark)}merge(t){return t instanceof Bo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Bo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Bo(e.from,e.to,t.markFromJSON(e.mark))}}zo.jsonID("removeMark",Bo);class Vo extends zo{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return jo.fromReplace(t,this.pos,this.pos+1,new Lr(Ar.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;n<e.marks.length;n++)if(!e.marks[n].isInSet(t))return new Vo(this.pos,e.marks[n]);return new Vo(this.pos,this.mark)}}return new Wo(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Vo(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vo(e.pos,t.markFromJSON(e.mark))}}zo.jsonID("addNodeMark",Vo);class Wo extends zo{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return jo.fromReplace(t,this.pos,this.pos+1,new Lr(Ar.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new Vo(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Wo(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wo(e.pos,t.markFromJSON(e.mark))}}zo.jsonID("removeNodeMark",Wo);class qo extends zo{constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}apply(t){return this.structure&&Ko(t,this.from,this.to)?jo.fail("Structure replace would overwrite content"):jo.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Do([this.from,this.to-this.from,this.slice.size])}invert(t){return new qo(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deletedAcross&&n.deletedAcross?null:new qo(e.pos,Math.max(e.pos,n.pos),this.slice)}merge(t){if(!(t instanceof qo)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?Lr.empty:new Lr(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new qo(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?Lr.empty:new Lr(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new qo(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new qo(e.from,e.to,Lr.fromJSON(t,e.slice),!!e.structure)}}zo.jsonID("replace",qo);class Uo extends zo{constructor(t,e,n,r,o,i,s=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(t){if(this.structure&&(Ko(t,this.from,this.gapFrom)||Ko(t,this.gapTo,this.to)))return jo.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return jo.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?jo.fromReplace(t,this.from,this.to,n):jo.fail("Content does not fit in gap")}getMap(){return new Do([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Uo(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return e.deletedAcross&&n.deletedAcross||r<e.pos||o>n.pos?null:new Uo(e.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Uo(e.from,e.to,e.gapFrom,e.gapTo,Lr.fromJSON(t,e.slice),e.insert,!!e.structure)}}function Ko(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let t=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,o--}}return!1}function Jo(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Go(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Jo(r,o,i))break}return null}function Yo(t,e,n=null,r=t){let o=function(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let t=r;a&&t<o;t++)a=a.matchType(n.child(t).type);return a&&a.validEnd?s:null}(r,e);return i?o.map(Xo).concat({type:e,attrs:n}).concat(i.map(Xo)):null}function Xo(t){return{type:t,attrs:null}}function Zo(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let t=o.depth-1,e=n-2;t>i;t--,e--){let n=o.node(t),i=o.index(t);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[e]||n;if(a!=n&&(s=s.replaceChild(0,a.type.create(a.attrs))),!n.canReplace(i+1,n.childCount)||!a.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Qo(t,e){let n=t.resolve(e),r=n.index();return ti(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ti(t,e){return!(!t||!e||t.isLeaf||!t.canAppend(e))}function ei(t,e,n=-1){let r=t.resolve(e);for(let t=r.depth;;t--){let o,i,s=r.index(t);if(t==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(t+1),s++,i=r.node(t).maybeChild(s)):(o=r.node(t).maybeChild(s-1),i=r.node(t+1)),o&&!o.isTextblock&&ti(o,i)&&r.node(t).canReplace(s,s+1))return e;if(0==t)break;e=n<0?r.before(t):r.after(t)}}function ni(t,e,n=e,r=Lr.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return ri(o,i,r)?new qo(e,n,r):new oi(o,i,r).fit()}function ri(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}zo.jsonID("replaceAround",Uo);class oi{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=Ar.empty;for(let e=0;e<=t.depth;e++){let n=t.node(e);this.frontier.push({type:n.type,match:n.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=Ar.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new Lr(o,i,s);return t>-1?new Uo(n.pos,t,this.$to.pos,this.$to.end(),a,e):a.size||n.pos!=this.$to.pos?new qo(n.pos,r.pos,a):null}findFittable(){for(let t=1;t<=2;t++)for(let e=this.unplaced.openStart;e>=0;e--){let n,r=null;e?(r=ai(this.unplaced.content,e-1).firstChild,n=r.content):n=this.unplaced.content;let o=n.firstChild;for(let n=this.depth;n>=0;n--){let i,{type:s,match:a}=this.frontier[n],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Ar.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:e,frontierDepth:n,parent:r,inject:l};if(2==t&&o&&(i=a.findWrapping(o.type)))return{sliceDepth:e,frontierDepth:n,parent:r,wrap:i};if(r&&a.matchType(r.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=ai(t,e);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new Lr(t,e+1,Math.max(n,r.size+e>=t.size-n?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=ai(t,e);if(r.childCount<=1&&e>0){let o=t.size-e<=e+r.size;this.unplaced=new Lr(ii(t,e-1,1),e-1,o?e-1:n)}else this.unplaced=new Lr(ii(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:r,wrap:o}){for(;this.depth>e;)this.closeFrontierNode();if(o)for(let t=0;t<o.length;t++)this.openFrontierNode(o[t]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-t,l=0,c=[],{match:u,type:h}=this.frontier[e];if(r){for(let t=0;t<r.childCount;t++)c.push(r.child(t));u=u.matchFragment(r)}let p=s.size+t-(i.content.size-i.openEnd);for(;l<s.childCount;){let t=s.child(l),e=u.matchType(t.type);if(!e)break;l++,(l>1||0==a||t.content.size)&&(u=e,c.push(li(t.mark(h.allowedMarks(t.marks)),1==l?a:0,l==s.childCount?p:-1)))}let d=l==s.childCount;d||(p=-1),this.placed=si(this.placed,e,Ar.from(c)),this.frontier[e].match=u,d&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=s;t<p;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),e=t.content}this.unplaced=d?0==t?Lr.empty:new Lr(ii(i.content,t-1,1),t-1,p<0?i.openEnd:t-1):new Lr(ii(i.content,t,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!ci(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:r}=this.frontier[e],o=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),i=ci(t,e,r,n,o);if(i){for(let n=e-1;n>=0;n--){let{match:e,type:r}=this.frontier[n],o=ci(t,n,r,e,!0);if(!o||o.childCount)continue t}return{depth:e,fit:i,move:o?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=si(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),r=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,r)}return t}openFrontierNode(t,e=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=si(this.placed,this.depth,Ar.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(Ar.empty,!0);t.childCount&&(this.placed=si(this.placed,this.frontier.length,t))}}function ii(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ii(t.firstChild.content,e-1,n)))}function si(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(si(t.lastChild.content,e-1,n)))}function ai(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function li(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,li(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ar.empty,!0)))),t.copy(r)}function ci(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function ui(t){return t.spec.defining||t.spec.definingForContent}function hi(t,e,n,r,o){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(hi(o.content,e+1,n,r,o)))}if(e>r){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(Ar.empty,!0))}return t}function pi(t,e){let n=[];for(let r=Math.min(t.depth,e.depth);r>=0;r--){let o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(o==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==o-1)&&n.push(r)}return n}class di extends zo{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at attribute step's position");let n=Object.create(null);for(let t in e.attrs)n[t]=e.attrs[t];n[this.attr]=this.value;let r=e.type.create(n,null,e.marks);return jo.fromReplace(t,this.pos,this.pos+1,new Lr(Ar.from(r),0,e.isLeaf?0:1))}getMap(){return Do.empty}invert(t){return new di(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new di(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new di(e.pos,e.attr,e.value)}}zo.jsonID("attr",di);let fi=class extends Error{};fi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},(fi.prototype=Object.create(Error.prototype)).constructor=fi,fi.prototype.name="TransformError";class mi{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new $o}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new fi(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=Lr.empty){let r=ni(this.doc,t,e,n);return r&&this.step(r),this}replaceWith(t,e,n){return this.replace(t,e,new Lr(Ar.from(n),0,0))}delete(t,e){return this.replace(t,e,Lr.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return function(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(ri(o,i,r))return t.step(new qo(e,n,r));let s=pi(o,t.doc.resolve(n));0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let t=o.depth,e=o.pos-1;t>0;t--,e--){let n=o.node(t).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(t)>-1?a=t:o.before(t)==e&&s.splice(1,0,-t)}let l=s.indexOf(a),c=[],u=r.openStart;for(let t=r.content,e=0;;e++){let n=t.firstChild;if(c.push(n),e==r.openStart)break;t=n.content}for(let t=u-1;t>=0;t--){let e=c[t].type,n=ui(e);if(n&&o.node(l).type!=e)u=t;else if(n||!e.isTextblock)break}for(let e=r.openStart;e>=0;e--){let a=(e+u+1)%(r.openStart+1),h=c[a];if(h)for(let e=0;e<s.length;e++){let c=s[(e+l)%s.length],u=!0;c<0&&(u=!1,c=-c);let p=o.node(c-1),d=o.index(c-1);if(p.canReplaceWith(d,d,h.type,h.marks))return t.replace(o.before(c),u?i.after(c):n,new Lr(hi(r.content,0,r.openStart,a),a,r.openEnd))}}let h=t.steps.length;for(let a=s.length-1;a>=0&&(t.replace(e,n,r),!(t.steps.length>h));a--){let t=s[a];t<0||(e=o.before(t),n=i.after(t))}}(this,t,e,n),this}replaceRangeWith(t,e,n){return function(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=function(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(let t=r.depth-1;t>=0;t--){let e=r.index(t);if(r.node(t).canReplaceWith(e,e,n))return r.before(t+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let t=r.depth-1;t>=0;t--){let e=r.indexAfter(t);if(r.node(t).canReplaceWith(e,e,n))return r.after(t+1);if(e<r.node(t).childCount)return null}return null}(t.doc,e,r.type);null!=o&&(e=n=o)}t.replaceRange(e,n,new Lr(Ar.from(r),0,0))}(this,t,e,n),this}deleteRange(t,e){return function(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=pi(r,o);for(let e=0;e<i.length;e++){let n=i[e],s=e==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return t.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return t.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i)return t.delete(r.before(i),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return function(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=Ar.empty,h=0;for(let t=i,e=!1;t>n;t--)e||r.index(t)>0?(e=!0,u=Ar.from(r.node(t).copy(u)),h++):l--;let p=Ar.empty,d=0;for(let t=i,e=!1;t>n;t--)e||o.after(t+1)<o.end(t)?(e=!0,p=Ar.from(o.node(t).copy(p)),d++):c++;t.step(new Uo(l,c,s,a,new Lr(u.append(p),h,d),u.size-h,!0))}(this,t,e),this}join(t,e=1){return function(t,e,n){let r=new qo(e-n,e+n,Lr.empty,!0);t.step(r)}(this,t,e),this}wrap(t,e){return function(t,e,n){let r=Ar.empty;for(let t=n.length-1;t>=0;t--){if(r.size){let e=n[t].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ar.from(n[t].type.create(n[t].attrs,r))}let o=e.start,i=e.end;t.step(new Uo(o,i,o,i,new Lr(r,0,0),n.length,!0))}(this,t,e),this}setBlockType(t,e=t,n,r=null){return function(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,((e,n)=>{if(e.isTextblock&&!e.hasMarkup(r,o)&&function(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(t.doc,t.mapping.slice(i).map(n),r)){t.clearIncompatible(t.mapping.slice(i).map(n,1),r);let s=t.mapping.slice(i),a=s.map(n,1),l=s.map(n+e.nodeSize,1);return t.step(new Uo(a,l,a+1,l-1,new Lr(Ar.from(r.create(o,null,e.marks)),0,0),1,!0)),!1}}))}(this,t,e,n,r),this}setNodeMarkup(t,e,n=null,r=[]){return function(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Uo(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Lr(Ar.from(s),0,0),1,!0))}(this,t,e,n,r),this}setNodeAttribute(t,e,n){return this.step(new di(t,e,n)),this}addNodeMark(t,e){return this.step(new Vo(t,e)),this}removeNodeMark(t,e){if(!(e instanceof Ir)){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(n.marks)))return this}return this.step(new Wo(t,e)),this}split(t,e=1,n){return function(t,e,n=1,r){let o=t.doc.resolve(e),i=Ar.empty,s=Ar.empty;for(let t=o.depth,e=o.depth-n,a=n-1;t>e;t--,a--){i=Ar.from(o.node(t).copy(i));let e=r&&r[a];s=Ar.from(e?e.type.create(e.attrs,s):o.node(t).copy(s))}t.step(new qo(e,e,new Lr(i.append(s),n,n),!0))}(this,t,e,n),this}addMark(t,e,n){return function(t,e,n,r){let o,i,s=[],a=[];t.doc.nodesBetween(e,n,((t,l,c)=>{if(!t.isInline)return;let u=t.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,e),h=Math.min(l+t.nodeSize,n),p=r.addToSet(u);for(let t=0;t<u.length;t++)u[t].isInSet(p)||(o&&o.to==c&&o.mark.eq(u[t])?o.to=h:s.push(o=new Bo(c,h,u[t])));i&&i.to==c?i.to=h:a.push(i=new Ho(c,h,r))}})),s.forEach((e=>t.step(e))),a.forEach((e=>t.step(e)))}(this,t,e,n),this}removeMark(t,e,n){return function(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,((t,s)=>{if(!t.isInline)return;i++;let a=null;if(r instanceof go){let e,n=t.marks;for(;e=r.isInSet(n);)(a||(a=[])).push(e),n=e.removeFromSet(n)}else r?r.isInSet(t.marks)&&(a=[r]):a=t.marks;if(a&&a.length){let r=Math.min(s+t.nodeSize,n);for(let t=0;t<a.length;t++){let n,l=a[t];for(let t=0;t<o.length;t++){let e=o[t];e.step==i-1&&l.eq(o[t].style)&&(n=e)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,e),to:r,step:i})}}})),o.forEach((e=>t.step(new Bo(e.from,e.to,e.style))))}(this,t,e,n),this}clearIncompatible(t,e,n){return function(t,e,n,r=n.contentMatch){let o=t.doc.nodeAt(e),i=[],s=e+1;for(let e=0;e<o.childCount;e++){let a=o.child(e),l=s+a.nodeSize,c=r.matchType(a.type);if(c){r=c;for(let e=0;e<a.marks.length;e++)n.allowsMarkType(a.marks[e].type)||t.step(new Bo(s,l,a.marks[e]))}else i.push(new qo(s,l,Lr.empty));s=l}if(!r.validEnd){let e=r.fillBefore(Ar.empty,!0);t.replace(s,s,new Lr(e,0,0))}for(let e=i.length-1;e>=0;e--)t.step(i[e])}(this,t,e,n),this}}const gi=Object.create(null);class yi{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new vi(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=Lr.empty){let n=e.content.lastChild,r=null;for(let t=0;t<e.openEnd;t++)r=n,n=n.lastChild;let o=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=t.mapping.slice(o);t.replaceRange(c.map(a.pos),c.map(l.pos),s?Lr.empty:e),0==s&&Ai(t,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=t.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?t.deleteRange(l,c):(t.replaceRangeWith(l,c,e),Ai(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new wi(t):Ci(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let r=t.depth-1;r>=0;r--){let o=e<0?Ci(t.node(0),t.node(r),t.before(r+1),t.index(r),e,n):Ci(t.node(0),t.node(r),t.after(r+1),t.index(r)+1,e,n);if(o)return o}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Ei(t.node(0))}static atStart(t){return Ci(t,t,0,0,1)||new Ei(t)}static atEnd(t){return Ci(t,t,t.content.size,t.childCount,-1)||new Ei(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=gi[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in gi)throw new RangeError("Duplicate use of selection JSON ID "+t);return gi[t]=e,e.prototype.jsonID=t,e}getBookmark(){return wi.between(this.$anchor,this.$head).getBookmark()}}yi.prototype.visible=!0;class vi{constructor(t,e){this.$from=t,this.$to=e}}let bi=!1;function _i(t){bi||t.parent.inlineContent||(bi=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class wi extends yi{constructor(t,e=t){_i(t),_i(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return yi.near(n);let r=t.resolve(e.map(this.anchor));return new wi(r.parent.inlineContent?r:n,n)}replace(t,e=Lr.empty){if(super.replace(t,e),e==Lr.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof wi&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ki(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new wi(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(t,e,n){let r=t.pos-e.pos;if(n&&!r||(n=r>=0?1:-1),!e.parent.inlineContent){let t=yi.findFrom(e,n,!0)||yi.findFrom(e,-n,!0);if(!t)return yi.near(e,n);e=t.$head}return t.parent.inlineContent||(0==r||(t=(yi.findFrom(t,-n,!0)||yi.findFrom(t,n,!0)).$anchor).pos<e.pos!=r<0)&&(t=e),new wi(t,e)}}yi.jsonID("text",wi);class ki{constructor(t,e){this.anchor=t,this.head=e}map(t){return new ki(t.map(this.anchor),t.map(this.head))}resolve(t){return wi.between(t.resolve(this.anchor),t.resolve(this.head))}}class xi extends yi{constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}map(t,e){let{deleted:n,pos:r}=e.mapResult(this.anchor),o=t.resolve(r);return n?yi.near(o):new xi(o)}content(){return new Lr(Ar.from(this.node),0,0)}eq(t){return t instanceof xi&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Si(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new xi(t.resolve(e.anchor))}static create(t,e){return new xi(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}xi.prototype.visible=!1,yi.jsonID("node",xi);class Si{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:n}=t.mapResult(this.anchor);return e?new ki(n,n):new Si(n)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&xi.isSelectable(n)?new xi(e):yi.near(e)}}class Ei extends yi{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=Lr.empty){if(e==Lr.empty){t.delete(0,t.doc.content.size);let e=yi.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new Ei(t)}map(t){return new Ei(t)}eq(t){return t instanceof Ei}getBookmark(){return Oi}}yi.jsonID("all",Ei);const Oi={map(){return this},resolve:t=>new Ei(t)};function Ci(t,e,n,r,o,i=!1){if(e.inlineContent)return wi.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let r=e.child(s);if(r.isAtom){if(!i&&xi.isSelectable(r))return xi.create(t,n-(o<0?r.nodeSize:0))}else{let e=Ci(t,r,n+o,o<0?r.childCount:0,o,i);if(e)return e}n+=r.nodeSize*o}return null}function Ai(t,e,n){let r=t.steps.length-1;if(r<e)return;let o,i=t.steps[r];(i instanceof qo||i instanceof Uo)&&(t.mapping.maps[r].forEach(((t,e,n,r)=>{null==o&&(o=r)})),t.setSelection(yi.near(t.doc.resolve(o),n)))}function Mi(t,e){return e&&t?t.bind(e):t}class Ti{constructor(t,e,n){this.name=t,this.init=Mi(e.init,n),this.apply=Mi(e.apply,n)}}function Ni(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=Ni(o,e,{})),n[r]=o}return n}new Ti("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new Ti("selection",{init:(t,e)=>t.selection||yi.atStart(e.doc),apply:t=>t.selection}),new Ti("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,r)=>r.selection.$cursor?t.storedMarks:null}),new Ti("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e});class Ii{constructor(t){this.spec=t,this.props={},t.props&&Ni(t.props,this,this.props),this.key=t.key?t.key.key:Li("plugin")}getState(t){return t[this.key]}}const Ri=Object.create(null);function Li(t){return t in Ri?t+"$"+ ++Ri[t]:(Ri[t]=0,t+"$")}class Di{constructor(t="key"){this.key=Li(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const $i=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},Pi=function(t,e,n,r){return n&&(ji(t,e,n,r,-1)||ji(t,e,n,r,1))},zi=/^(img|br|input|textarea|hr)$/i;function ji(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Fi(t))){let n=t.parentNode;if(!n||1!=n.nodeType||Hi(t)||zi.test(t.nodeName)||"false"==t.contentEditable)return!1;e=$i(t)+(o<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?Fi(t):0}}}function Fi(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Hi(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Bi=function(t){return t.focusNode&&Pi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Vi(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Wi="undefined"!=typeof navigator?navigator:null,qi="undefined"!=typeof document?document:null,Ui=Wi&&Wi.userAgent||"",Ki=/Edge\/(\d+)/.exec(Ui),Ji=/MSIE \d/.exec(Ui),Gi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ui),Yi=!!(Ji||Gi||Ki),Xi=Ji?document.documentMode:Gi?+Gi[1]:Ki?+Ki[1]:0,Zi=!Yi&&/gecko\/(\d+)/i.test(Ui);Zi&&(/Firefox\/(\d+)/.exec(Ui)||[0,0])[1];const Qi=!Yi&&/Chrome\/(\d+)/.exec(Ui),ts=!!Qi,es=Qi?+Qi[1]:0,ns=!Yi&&!!Wi&&/Apple Computer/.test(Wi.vendor),rs=ns&&(/Mobile\/\w+/.test(Ui)||!!Wi&&Wi.maxTouchPoints>2),is=rs||!!Wi&&/Mac/.test(Wi.platform),ss=/Android \d/.test(Ui),as=!!qi&&"webkitFontSmoothing"in qi.documentElement.style,ls=as?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cs(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(Bi(n)){for(a=c;o&&!o.node;)o=o.parent;let t=o.node;if(o&&t.isAtom&&xi.isSelectable(t)&&o.parent&&(!t.isInline||!function(t,e,n){for(let r=0==e,o=e==Fi(t);r||o;){if(t==n)return!0;let e=$i(t);if(!(t=t.parentNode))return!1;r=r&&0==e,o=o&&e==Fi(t)}}(n.focusNode,n.focusOffset,o.dom))){let t=o.posBefore;l=new xi(s==t?c:r.resolve(t))}}else{let e=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(e<0)return null;a=r.resolve(e)}if(!l){l=ys(t,a,c,"pointer"==e||t.state.selection.head<c.pos&&!i?1:-1)}return l}function us(t){return t.editable?t.hasFocus():function(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function hs(t,e=!1){let n=t.state.selection;if(function(t,e){if(e instanceof xi){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(gs(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else gs(t)}(t,n),us(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ts){let e=t.domSelectionRange(),n=t.domObserver.currentSelection;if(e.anchorNode&&n.anchorNode&&Pi(e.anchorNode,e.anchorOffset,n.anchorNode,n.anchorOffset))return t.input.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,$i(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Yi&&Xi<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{let r,o,{anchor:i,head:s}=n;!ps||n instanceof wi||(n.$from.parent.inlineContent||(r=ds(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=ds(t,n.to))),t.docView.setSelection(i,s,t.root,e),ps&&(r&&ms(r),o&&ms(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{us(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const ps=ns||ts&&es<63;function ds(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(ns&&o&&"false"==o.contentEditable)return fs(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return fs(o);if(i)return fs(i)}}function fs(t){return t.contentEditable="true",ns&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ms(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function gs(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ys(t,e,n,r){return t.someProp("createSelectionBetween",(r=>r(t,e,n)))||wi.between(e,n,r)}function vs(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&yi.findFrom(i,e)}function bs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _s(t,e,n){let r=t.state.selection;if(!(r instanceof wi)){if(r instanceof xi&&r.node.isInline)return bs(t,new wi(e>0?r.$to:r.$from));{let n=vs(t.state,e);return!!n&&bs(t,n)}}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){let n=vs(t.state,e);return!!(n&&n instanceof xi)&&bs(t,n)}if(!(is&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=e<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=t.docView.descAt(s))&&!n.contentDOM)&&(xi.isSelectable(i)?bs(t,new xi(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):!!as&&bs(t,new wi(t.state.doc.resolve(e<0?s:s+i.nodeSize))))}}function ws(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function ks(t){let e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function xs(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Zi&&1==n.nodeType&&r<ws(n)&&ks(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let t=n.childNodes[r-1];if(ks(t))o=n,i=--r;else{if(3!=t.nodeType)break;n=t,r=n.nodeValue.length}}}else{if(Es(n))break;{let e=n.previousSibling;for(;e&&ks(e);)o=n.parentNode,i=$i(e),e=e.previousSibling;if(e)n=e,r=ws(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Os(t,n,r):o&&Os(t,o,i)}function Ss(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=ws(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!ks(n.childNodes[r]))break;o=n,i=++r}else{if(Es(n))break;{let e=n.nextSibling;for(;e&&ks(e);)o=e.parentNode,i=$i(e)+1,e=e.nextSibling;if(e)n=e,r=0,s=ws(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}o&&Os(t,o,i)}function Es(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Os(t,e,n){let r=t.domSelection();if(Bi(r)){let t=document.createRange();t.setEnd(e,n),t.setStart(e,n),r.removeAllRanges(),r.addRange(t)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout((()=>{t.state==o&&hs(t)}),50)}function Cs(t,e,n){let r=t.state.selection;if(r instanceof wi&&!r.empty||n.indexOf("s")>-1)return!1;if(is&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=vs(t.state,e);if(n&&n instanceof xi)return bs(t,n)}if(!o.parent.inlineContent){let n=e<0?o:i,s=r instanceof Ei?yi.near(n,e):yi.findFrom(n,e);return!!s&&bs(t,s)}return!1}function As(t,e){if(!(t.state.selection instanceof wi))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=t.state.tr;return e<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),t.dispatch(r),!0}return!1}function Ms(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Ts(t,e){let n=e.keyCode,r=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||is&&72==n&&"c"==r?As(t,-1)||xs(t):46==n||is&&68==n&&"c"==r?As(t,1)||Ss(t):13==n||27==n||(37==n||is&&66==n&&"c"==r?_s(t,-1,r)||xs(t):39==n||is&&70==n&&"c"==r?_s(t,1,r)||Ss(t):38==n||is&&80==n&&"c"==r?Cs(t,-1,r)||xs(t):40==n||is&&78==n&&"c"==r?function(t){if(!ns||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;Ms(t,n,"true"),setTimeout((()=>Ms(t,n,"false")),20)}return!1}(t)||Cs(t,1,r)||Ss(t):r==(is?"m":"c")&&(66==n||73==n||89==n||90==n))}function Ns(t,e){t.someProp("transformCopied",(n=>{e=n(e,t)}));let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let t=r.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),r=t.content}let s=t.someProp("clipboardSerializer")||Mo.fromSchema(t.state.schema),a=Hs(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,h=0;for(;u&&1==u.nodeType&&(c=js[u.nodeName.toLowerCase()]);){for(let t=c.length-1;t>=0;t--){let e=a.createElement(c[t]);for(;l.firstChild;)e.appendChild(l.firstChild);l.appendChild(e),h++}u=l.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${o} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:l,text:t.someProp("clipboardTextSerializer",(n=>n(e,t)))||e.content.textBetween(0,e.content.size,"\n\n")}}function Is(t,e,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!e)return null;let l=e&&(r||a||!n);if(l){if(t.someProp("transformPastedText",(n=>{e=n(e,a||r,t)})),a)return e?new Lr(Ar.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):Lr.empty;let n=t.someProp("clipboardTextParser",(n=>n(e,o,r,t)));if(n)s=n;else{let n=o.marks(),{schema:r}=t.state,s=Mo.fromSchema(r);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=i.appendChild(document.createElement("p"));t&&e.appendChild(s.serializeNode(r.text(t,n)))}))}}else t.someProp("transformPastedHTML",(e=>{n=e(n,t)})),i=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,r=Hs().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&js[o[1].toLowerCase()])&&(t=n.map((t=>"<"+t+">")).join("")+t+n.map((t=>"</"+t+">")).reverse().join(""));if(r.innerHTML=t,n)for(let t=0;t<n.length;t++)r=r.querySelector(n[t])||r;return r}(n),as&&function(t){let e=t.querySelectorAll(ts?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let t=+u[3];t>0;t--){let t=i.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;i=t}if(!s){let e=t.someProp("clipboardParser")||t.someProp("domParser")||bo.fromSchema(t.state.schema);s=e.parseSlice(i,{preserveWhitespace:!(!l&&!u),context:o,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||Rs.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(u)s=function(t,e){if(!t.size)return t;let n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}let{content:o,openStart:i,openEnd:s}=t;for(let t=n.length-2;t>=0;t-=2){let e=r.nodes[n[t]];if(!e||e.hasRequiredAttrs())break;o=Ar.from(e.create(n[t+1],o)),i++,s++}return new Lr(o,i,s)}(zs(s,+u[1],+u[2]),u[4]);else if(s=Lr.maxOpen(function(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r,o=e.node(n).contentMatchAt(e.index(n)),i=[];if(t.forEach((t=>{if(!i)return;let e,n=o.findWrapping(t.type);if(!n)return i=null;if(e=i.length&&r.length&&Ds(n,r,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=$s(i[i.length-1],r.length));let e=Ls(t,n);i.push(e),o=o.matchType(e.type),r=n}})),i)return Ar.from(i)}return t}(s.content,o),!0),s.openStart||s.openEnd){let t=0,e=0;for(let e=s.content.firstChild;t<s.openStart&&!e.type.spec.isolating;t++,e=e.firstChild);for(let t=s.content.lastChild;e<s.openEnd&&!t.type.spec.isolating;e++,t=t.lastChild);s=zs(s,t,e)}return t.someProp("transformPasted",(e=>{s=e(s,t)})),s}const Rs=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ls(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ar.from(t));return t}function Ds(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Ds(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(Ar.from(Ls(n,t,o+1))))}}function $s(t,e){if(0==e)return t;let n=t.content.replaceChild(t.childCount-1,$s(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Ar.empty,!0);return t.copy(n.append(r))}function Ps(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return o<r-1&&(a=Ps(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,t.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Ar.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function zs(t,e,n){return e<t.openStart&&(t=new Lr(Ps(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Lr(Ps(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const js={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Fs=null;function Hs(){return Fs||(Fs=document.implementation.createHTMLDocument("title"))}const Bs={},Vs={};function Ws(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function qs(t){return{left:t.clientX,top:t.clientY}}function Us(t,e,n,r,o){if(-1==r)return!1;let i=t.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(t.someProp(e,(e=>r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function Ks(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Js(t,e,n,r,o){return Us(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(n=>n(t,e,r)))||(o?function(t,e){if(-1==e)return!1;let n,r,o=t.state.selection;o instanceof xi&&(n=o.node);let i=t.state.doc.resolve(e);for(let t=i.depth+1;t>0;t--){let e=t>i.depth?i.nodeAfter:i.node(t);if(xi.isSelectable(e)){r=n&&o.$from.depth>0&&t>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(t);break}}return null!=r&&(Ks(t,xi.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&xi.isSelectable(r))&&(Ks(t,new xi(n),"pointer"),!0)}(t,n))}function Gs(t,e,n,r){return Us(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(n=>n(t,e,r)))}function Ys(t,e,n,r){return Us(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(n=>n(t,e,r)))||function(t,e,n){if(0!=n.button)return!1;let r=t.state.doc;if(-1==e)return!!r.inlineContent&&(Ks(t,wi.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(e);for(let e=o.depth+1;e>0;e--){let n=e>o.depth?o.nodeAfter:o.node(e),i=o.before(e);if(n.inlineContent)Ks(t,wi.create(r,i+1,i+1+n.content.size),"pointer");else{if(!xi.isSelectable(n))continue;Ks(t,xi.create(r,i),"pointer")}return!0}}(t,n,r)}function Xs(t){return oa(t)}Vs.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!ta(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!ss||!ts||13!=n.keyCode))if(229!=n.keyCode&&t.domObserver.forceFlush(),!rs||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",(e=>e(t,n)))||Ts(t,n)?n.preventDefault():Ws(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,Vi(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},Vs.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},Vs.keypress=(t,e)=>{let n=e;if(ta(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||is&&n.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,n))))return void n.preventDefault();let r=t.state.selection;if(!(r instanceof wi&&r.$from.sameParent(r.$to))){let e=String.fromCharCode(n.charCode);t.someProp("handleTextInput",(n=>n(t,r.$from.pos,r.$to.pos,e)))||t.dispatch(t.state.tr.insertText(e).scrollIntoView()),n.preventDefault()}};const Zs=is?"metaKey":"ctrlKey";Bs.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Xs(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&function(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(n,t.input.lastClick)&&!n[Zs]&&("singleClick"==t.input.lastClick.type?i="doubleClick":"doubleClick"==t.input.lastClick.type&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(qs(n));s&&("singleClick"==i?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Qs(t,s,n,!!r)):("doubleClick"==i?Gs:Ys)(t,s.pos,s.inside,n)?n.preventDefault():Ws(t,"pointer"))};class Qs{constructor(t,e,n,r){let o,i;if(this.view=t,this.pos=e,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[Zs],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{let n=t.state.doc.resolve(e.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?t.docView.nearestDesc(s,!0):null;this.target=a?a.dom:null;let{selection:l}=t.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof xi&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Zi||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ws(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>hs(this.view))),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(qs(t))),this.updateAllowDefault(t),this.allowDefault||!e?Ws(this.view,"pointer"):Js(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||ns&&this.mightDrag&&!this.mightDrag.node.isAtom||ts&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Ks(this.view,yi.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Ws(this.view,"pointer")}move(t){this.updateAllowDefault(t),Ws(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function ta(t,e){return!!t.composing||!!(ns&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}Bs.touchstart=t=>{t.input.lastTouch=Date.now(),Xs(t),Ws(t,"pointer")},Bs.touchmove=t=>{t.input.lastTouch=Date.now(),Ws(t,"pointer")},Bs.contextmenu=t=>Xs(t);const ea=ss?5e3:-1;function na(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>oa(t)),e))}function ra(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function oa(t,e=!1){if(!(ss&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ra(t),e||t.docView&&t.docView.dirty){let e=cs(t);return e&&!e.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(e)):t.updateState(t.state),!0}return!1}}Vs.compositionstart=Vs.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))))t.markCursor=t.state.storedMarks||n.marks(),oa(t,!0),t.markCursor=null;else if(oa(t),Zi&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,r=e.focusOffset;n&&1==n.nodeType&&0!=r;){let e=r<0?n.lastChild:n.childNodes[r-1];if(!e)break;if(3==e.nodeType){t.domSelection().collapse(e,e.nodeValue.length);break}n=e,r=-1}}t.input.composing=!0}na(t,ea)},Vs.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,na(t,20))};const ia=Yi&&Xi<15||rs&&ls<604;function sa(t,e,n,r){let o=Is(t,e,n,t.input.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,r,o||Lr.empty))))return!0;if(!o)return!1;let i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.input.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Bs.copy=Vs.cut=(t,e)=>{let n=e,r=t.state.selection,o="cut"==n.type;if(r.empty)return;let i=ia?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ns(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Vs.paste=(t,e)=>{let n=e;if(t.composing&&!ss)return;let r=ia?null:n.clipboardData;r&&sa(t,r.getData("text/plain"),r.getData("text/html"),n)?n.preventDefault():function(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sa(t,r.value,null,e):sa(t,r.textContent,r.innerHTML,e)}),50)}(t,n)};class aa{constructor(t,e){this.slice=t,this.move=e}}const la=is?"altKey":"ctrlKey";Bs.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(qs(n));if(i&&i.pos>=o.from&&i.pos<=(o instanceof xi?o.to-1:o.to));else if(r&&r.mightDrag)t.dispatch(t.state.tr.setSelection(xi.create(t.state.doc,r.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&t.dispatch(t.state.tr.setSelection(xi.create(t.state.doc,e.posBefore)))}let s=t.state.selection.content(),{dom:a,text:l}=Ns(t,s);n.dataTransfer.clearData(),n.dataTransfer.setData(ia?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",ia||n.dataTransfer.setData("text/plain",l),t.dragging=new aa(s,!n[la])},Bs.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},Vs.dragover=Vs.dragenter=(t,e)=>e.preventDefault(),Vs.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(qs(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",(e=>{s=e(s,t)})):s=Is(t,n.dataTransfer.getData(ia?"Text":"text/plain"),ia?null:n.dataTransfer.getData("text/html"),!1,i);let a=!(!r||n[la]);if(t.someProp("handleDrop",(e=>e(t,n,s||Lr.empty,a))))return void n.preventDefault();if(!s)return;n.preventDefault();let l=s?function(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let t=0;t<n.openStart;t++)o=o.firstChild.content;for(let t=1;t<=(0==n.openStart&&n.size?2:1);t++)for(let e=r.depth;e>=0;e--){let n=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,i=r.index(e)+(n>0?1:0),s=r.node(e),a=!1;if(1==t)a=s.canReplace(i,i,o);else{let t=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=t&&s.canReplaceWith(i,i,t[0])}if(a)return 0==n?r.pos:n<0?r.before(e+1):r.after(e+1)}return null}(t.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);let c=t.state.tr;a&&c.deleteSelection();let u=c.mapping.map(l),h=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,p=c.doc;if(h?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let d=c.doc.resolve(u);if(h&&xi.isSelectable(s.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new xi(d));else{let e=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((t,n,r,o)=>e=o)),c.setSelection(ys(t,d,c.doc.resolve(e)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Bs.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&hs(t)}),20))},Bs.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Bs.beforeinput=(t,e)=>{if(ts&&ss&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,Vi(8,"Backspace")))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let t in Vs)Bs[t]=Vs[t];function ca(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ua{constructor(t,e){this.toDOM=t,this.spec=e||ma,this.side=this.spec.side||0}map(t,e,n,r){let{pos:o,deleted:i}=t.mapResult(e.from+r,this.side<0?-1:1);return i?null:new da(o-n,o-n,this)}valid(){return!0}eq(t){return this==t||t instanceof ua&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ca(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ha{constructor(t,e){this.attrs=t,this.spec=e||ma}map(t,e,n,r){let o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new da(o,i,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof ha&&ca(this.attrs,t.attrs)&&ca(this.spec,t.spec)}static is(t){return t.type instanceof ha}destroy(){}}class pa{constructor(t,e){this.attrs=t,this.spec=e||ma}map(t,e,n,r){let o=t.mapResult(e.from+r,1);if(o.deleted)return null;let i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new da(o.pos-n,i.pos-n,this)}valid(t,e){let n,{index:r,offset:o}=t.content.findIndex(e.from);return o==e.from&&!(n=t.child(r)).isText&&o+n.nodeSize==e.to}eq(t){return this==t||t instanceof pa&&ca(this.attrs,t.attrs)&&ca(this.spec,t.spec)}destroy(){}}class da{constructor(t,e,n){this.from=t,this.to=e,this.type=n}copy(t,e){return new da(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,n){return this.type.map(t,this,e,n)}static widget(t,e,n){return new da(t,t,new ua(e,n))}static inline(t,e,n,r){return new da(t,e,new ha(n,r))}static node(t,e,n,r){return new da(t,e,new pa(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof ha}}const fa=[],ma={};class ga{constructor(t,e){this.local=t.length?t:fa,this.children=e.length?e:fa}static create(t,e){return e.length?ka(e,t,0,ma):ya}find(t,e,n){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r}findInner(t,e,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<e&&this.children[i+1]>t){let s=this.children[i]+1;this.children[i+2].findInner(t-s,e-s,n,r+s,o)}}map(t,e,n){return this==ya||0==t.maps.length?this:this.mapInner(t,e,0,0,n||ma)}mapInner(t,e,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){let a=t.slice();for(let t=0,e=i;t<n.maps.length;t++){let r=0;n.maps[t].forEach(((t,n,i,s)=>{let l=s-i-(n-t);for(let s=0;s<a.length;s+=3){let c=a[s+1];if(c<0||t>c+e-r)continue;let u=a[s]+e-r;n>=u?a[s+1]=t<=u?-2:-1:i>=o&&l&&(a[s]+=l,a[s+1]+=l)}r+=l})),e=n.maps[t].map(e,-1)}let l=!1;for(let e=0;e<a.length;e+=3)if(a[e+1]<0){if(-2==a[e+1]){l=!0,a[e+1]=-1;continue}let c=n.map(t[e]+i),u=c-o;if(u<0||u>=r.content.size){l=!0;continue}let h=n.map(t[e+1]+i,-1)-o,{index:p,offset:d}=r.content.findIndex(u),f=r.maybeChild(p);if(f&&d==u&&d+f.nodeSize==h){let r=a[e+2].mapInner(n,f,c+1,t[e]+i+1,s);r!=ya?(a[e]=u,a[e+1]=h,a[e+2]=r):(a[e+1]=-2,l=!0)}else l=!0}if(l){let l=function(t,e,n,r,o,i,s){function a(t,e){for(let i=0;i<t.local.length;i++){let a=t.local[i].map(r,o,e);a?n.push(a):s.onRemove&&s.onRemove(t.local[i].spec)}for(let n=0;n<t.children.length;n+=3)a(t.children[n+2],t.children[n]+e+1)}for(let n=0;n<t.length;n+=3)-1==t[n+1]&&a(t[n+2],e[n]+i+1);return n}(a,t,e,n,o,i,s),c=ka(l,r,0,s);e=c.local;for(let t=0;t<a.length;t+=3)a[t+1]<0&&(a.splice(t,3),t-=3);for(let t=0,e=0;t<c.children.length;t+=3){let n=c.children[t];for(;e<a.length&&a[e]<n;)e+=3;a.splice(e,0,c.children[t],c.children[t+1],c.children[t+2])}}return new ga(e.sort(xa),a)}(this.children,i||[],t,e,n,r,o):i?new ga(i.sort(xa),fa):ya}add(t,e){return e.length?this==ya?ga.create(t,e):this.addInner(t,e,0):this}addInner(t,e,n){let r,o=0;t.forEach(((t,i)=>{let s,a=i+n;if(s=_a(e,t,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(t,s,a+1):r.splice(o,0,i,i+t.nodeSize,ka(s,t,a+1,ma)),o+=3}}));let i=ba(o?wa(e):e,-n);for(let e=0;e<i.length;e++)i[e].type.valid(t,i[e])||i.splice(e--,1);return new ga(i.length?this.local.concat(i).sort(xa):this.local,r||this.children)}remove(t){return 0==t.length||this==ya?this:this.removeInner(t,0)}removeInner(t,e){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+e,s=n[r+1]+e;for(let e,n=0;n<t.length;n++)(e=t[n])&&e.from>i&&e.to<s&&(t[n]=null,(o||(o=[])).push(e));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=ya?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<t.length;o++)if(n=t[o])for(let t=0;t<r.length;t++)r[t].eq(n,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ga(r,n):ya}forChild(t,e){if(this==ya)return this;if(e.isLeaf)return ga.empty;let n,r;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(n=this.children[e+2]);break}let o=t+1,i=o+e.content.size;for(let t=0;t<this.local.length;t++){let e=this.local[t];if(e.from<i&&e.to>o&&e.type instanceof ha){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let t=new ga(r.sort(xa),fa);return n?new va([t,n]):t}return n||ya}eq(t){if(this==t)return!0;if(!(t instanceof ga)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return Sa(this.localsInner(t))}localsInner(t){if(this==ya)return fa;if(t.inlineContent||!this.local.some(ha.is))return this.local;let e=[];for(let t=0;t<this.local.length;t++)this.local[t].type instanceof ha||e.push(this.local[t]);return e}}ga.empty=new ga([],[]),ga.removeOverlap=Sa;const ya=ga.empty;class va{constructor(t){this.members=t}map(t,e){const n=this.members.map((n=>n.map(t,e,ma)));return va.from(n)}forChild(t,e){if(e.isLeaf)return ga.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(t,e);o!=ya&&(o instanceof va?n=n.concat(o.members):n.push(o))}return va.from(n)}eq(t){if(!(t instanceof va)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(let t=0;t<o.length;t++)e.push(o[t])}else e=o}return e?Sa(n?e:e.sort(xa)):fa}static from(t){switch(t.length){case 0:return ya;case 1:return t[0];default:return new va(t.every((t=>t instanceof ga))?t:t.reduce(((t,e)=>t.concat(e instanceof ga?e:e.members)),[]))}}}function ba(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new da(o.from+e,o.to+e,o.type))}return n}function _a(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let e,i=0;i<t.length;i++)(e=t[i])&&e.from>n&&e.to<r&&((o||(o=[])).push(e),t[i]=null);return o}function wa(t){let e=[];for(let n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function ka(t,e,n,r){let o=[],i=!1;e.forEach(((e,s)=>{let a=_a(t,e,s+n);if(a){i=!0;let t=ka(a,e,n+s+1,r);t!=ya&&o.push(s,s+e.nodeSize,t)}}));let s=ba(i?wa(t):t,-n).sort(xa);for(let t=0;t<s.length;t++)s[t].type.valid(e,s[t])||(r.onRemove&&r.onRemove(s[t].spec),s.splice(t--,1));return s.length||o.length?new ga(s,o):ya}function xa(t,e){return t.from-e.from||t.to-e.to}function Sa(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ea(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ea(e,o+1,i.copy(r.to,i.to)))}}return e}function Ea(t,e,n){for(;e<t.length&&xa(n,t[e])>0;)e++;t.splice(e,0,n)}for(var Oa={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ca={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Aa="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ma="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ta="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Na=Ma||Aa&&+Aa[1]<57,Ia=0;Ia<10;Ia++)Oa[48+Ia]=Oa[96+Ia]=String(Ia);for(Ia=1;Ia<=24;Ia++)Oa[Ia+111]="F"+Ia;for(Ia=65;Ia<=90;Ia++)Oa[Ia]=String.fromCharCode(Ia+32),Ca[Ia]=String.fromCharCode(Ia);for(var Ra in Oa)Ca.hasOwnProperty(Ra)||(Ca[Ra]=Oa[Ra]);const La="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Da(t){let e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let t=0;t<i.length-1;t++){let s=i[t];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);La?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function $a(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function Pa(t){let e=function(t){let e=Object.create(null);for(let n in t)e[Da(n)]=t[n];return e}(t);return function(t,n){let r,o=function(t){var e=!(Na&&(t.ctrlKey||t.altKey||t.metaKey)||Ta&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Ca:Oa)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),i=1==o.length&&" "!=o,s=e[$a(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=Oa[n.keyCode])&&r!=o){let o=e[$a(r,n,!0)];if(o&&o(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){let r=e[$a(o,n,!0)];if(r&&r(t.state,t.dispatch,t))return!0}return!1}}function za(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function ja(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Fa(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function Ha(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ba(t,e,n){let r,o,i=e.nodeBefore,s=e.nodeAfter;if(i.type.spec.isolating||s.type.spec.isolating)return!1;if(function(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(i,i+1)||!o.isTextblock&&!Qo(t.doc,e.pos)||(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&o.matchType(r[0]||s.type).validEnd){if(n){let o=e.pos+s.nodeSize,a=Ar.empty;for(let t=r.length-1;t>=0;t--)a=Ar.from(r[t].create(null,a));a=Ar.from(i.copy(a));let l=t.tr.step(new Uo(e.pos-1,o,e.pos,o,new Lr(a,1,0),r.length,!0)),c=o+2*r.length;Qo(l.doc,c)&&l.join(c),n(l.scrollIntoView())}return!0}let l=yi.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&Go(c);if(null!=u&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(a&&za(s,"start",!0)&&za(i,"end")){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let a=s,l=1;for(;!a.isTextblock;a=a.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,a.content)){if(n){let r=Ar.empty;for(let t=o.length-1;t>=0;t--)r=Ar.from(o[t].copy(r));n(t.tr.step(new Uo(e.pos-o.length,e.pos+s.nodeSize,e.pos+l,e.pos+s.nodeSize-l,new Lr(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Va(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(e.tr.setSelection(wi.create(e.doc,t<0?o.start(i):o.end(i)))),!0)}}const Wa=Va(-1),qa=Va(1);function Ua(t,e=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)o=!0;else{let e=n.doc.resolve(i),r=e.index();o=e.parent.canReplaceWith(r,r+1,t)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,t,e)}r(o.scrollIntoView())}return!0}}function Ka(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=!1,l=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&0==s.startIndex){if(0==o.index(s.depth-1))return!1;let t=n.doc.resolve(s.start-2);l=new Yr(t,t,s.depth),s.endIndex<s.parent.childCount&&(s=new Yr(o,n.doc.resolve(i.end(s.depth)),s.depth)),a=!0}let c=Yo(l,t,e,s);return!!c&&(r&&r(function(t,e,n,r,o){let i=Ar.empty;for(let t=n.length-1;t>=0;t--)i=Ar.from(n[t].type.create(n[t].attrs,i));t.step(new Uo(e.start-(r?2:0),e.end,e.start,e.end,new Lr(i,0,0),n.length,!0));let s=0;for(let t=0;t<n.length;t++)n[t].type==o&&(s=t+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let n=e.startIndex,r=e.endIndex,o=!0;n<r;n++,o=!1)!o&&Zo(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(n).nodeSize;return t}(n.tr,s,c,a,t).scrollIntoView()),!0)}}function Ja(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,(e=>e.childCount>0&&e.firstChild.type==t));return!!i&&(!n||(r.node(i.depth-1).type==t?function(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Uo(i-1,s,i,s,new Lr(Ar.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Yr(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Go(r);if(null==a)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;Qo(o.doc,l)&&o.join(l);return e(o.scrollIntoView()),!0}(e,n,t,i):function(t,e,n){let r=t.tr,o=n.parent;for(let t=n.end,e=n.endIndex-1,i=n.startIndex;e>i;e--)t-=o.child(e).nodeSize,r.delete(t-1,t+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?Ar.empty:Ar.from(o))))return!1;let h=i.pos,p=h+s.nodeSize;return r.step(new Uo(h-(a?1:0),p+(l?1:0),h+1,p-1,new Lr((a?Ar.empty:Ar.from(o.copy(Ar.empty))).append(l?Ar.empty:Ar.from(o.copy(Ar.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}(e,n,i)))}}function Ga(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class Ya{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map((([t,e])=>[t,(...t)=>{const n=e(...t)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,l=t||o.tr,c={...Object.fromEntries(Object.entries(n).map((([t,n])=>[t,(...t)=>{const r=this.buildProps(l,e),o=n(...t)(r);return s.push(o),c}]))),run:()=>(a||!e||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every((t=>!0===t)))};return c}createCan(t){const{rawCommands:e,state:n}=this,r=t||n.tr,o=this.buildProps(r,false),i=Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)({...o,dispatch:void 0})])));return{...i,chain:()=>this.createChain(r,false)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:Ga({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map((([t,e])=>[t,(...t)=>e(...t)(s)])))}};return s}}function Xa(t,e,n){if(void 0===t.config[e]&&t.parent)return Xa(t.parent,e,n);if("function"==typeof t.config[e]){return t.config[e].bind({...n,parent:t.parent?Xa(t.parent,e,n):null})}return t.config[e]}function Za(t){return{baseExtensions:t.filter((t=>"extension"===t.type)),nodeExtensions:t.filter((t=>"node"===t.type)),markExtensions:t.filter((t=>"mark"===t.type))}}function Qa(t){const e=[],{nodeExtensions:n,markExtensions:r}=Za(t),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach((t=>{const n=Xa(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage});if(!n)return;n().forEach((t=>{t.types.forEach((n=>{Object.entries(t.attributes).forEach((([t,r])=>{e.push({type:n,name:t,attribute:{...i,...r}})}))}))}))})),o.forEach((t=>{const n={name:t.name,options:t.options,storage:t.storage},r=Xa(t,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach((([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,e.push({type:t.name,name:n,attribute:o})}))})),e}function tl(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function el(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const n={...t};return Object.entries(e).forEach((([t,e])=>{if(n[t])if("class"===t){const r=e?e.split(" "):[],o=n[t]?n[t].split(" "):[],i=r.filter((t=>!o.includes(t)));n[t]=[...o,...i].join(" ")}else n[t]="style"===t?[n[t],e].join("; "):e;else n[t]=e})),n}),{})}function nl(t,e){return e.filter((t=>t.attribute.rendered)).map((e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]})).reduce(((t,e)=>el(t,e)),{})}function rl(t,e=void 0,...n){return function(t){return"function"==typeof t}(t)?e?t.bind(e)(...n):t(...n):t}function ol(t,e){return t.style?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===r)return!1;const o=e.reduce(((t,e)=>{const r=e.attribute.parseHTML?e.attribute.parseHTML(n):function(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}(n.getAttribute(e.name));return null==r?t:{...t,[e.name]:r}}),{});return{...r,...o}}}}function il(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>("attrs"!==t||!function(t={}){return 0===Object.keys(t).length&&t.constructor===Object}(e))&&null!=e)))}function sl(t,e){var n;const r=Qa(t),{nodeExtensions:o,markExtensions:i}=Za(t),s=null===(n=o.find((t=>Xa(t,"topNode"))))||void 0===n?void 0:n.name,a=Object.fromEntries(o.map((n=>{const o=r.filter((t=>t.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:e},s=il({...t.reduce(((t,e)=>{const r=Xa(e,"extendNodeSchema",i);return{...t,...r?r(n):{}}}),{}),content:rl(Xa(n,"content",i)),marks:rl(Xa(n,"marks",i)),group:rl(Xa(n,"group",i)),inline:rl(Xa(n,"inline",i)),atom:rl(Xa(n,"atom",i)),selectable:rl(Xa(n,"selectable",i)),draggable:rl(Xa(n,"draggable",i)),code:rl(Xa(n,"code",i)),defining:rl(Xa(n,"defining",i)),isolating:rl(Xa(n,"isolating",i)),attrs:Object.fromEntries(o.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=rl(Xa(n,"parseHTML",i));a&&(s.parseDOM=a.map((t=>ol(t,o))));const l=Xa(n,"renderHTML",i);l&&(s.toDOM=t=>l({node:t,HTMLAttributes:nl(t,o)}));const c=Xa(n,"renderText",i);return c&&(s.toText=c),[n.name,s]}))),l=Object.fromEntries(i.map((n=>{const o=r.filter((t=>t.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:e},s=il({...t.reduce(((t,e)=>{const r=Xa(e,"extendMarkSchema",i);return{...t,...r?r(n):{}}}),{}),inclusive:rl(Xa(n,"inclusive",i)),excludes:rl(Xa(n,"excludes",i)),group:rl(Xa(n,"group",i)),spanning:rl(Xa(n,"spanning",i)),code:rl(Xa(n,"code",i)),attrs:Object.fromEntries(o.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=rl(Xa(n,"parseHTML",i));a&&(s.parseDOM=a.map((t=>ol(t,o))));const l=Xa(n,"renderHTML",i);return l&&(s.toDOM=t=>l({mark:t,HTMLAttributes:nl(t,o)})),[n.name,s]})));return new yo({topNode:s,nodes:a,marks:l})}function al(t,e){return e.nodes[t]||e.marks[t]||null}function ll(t,e){return Array.isArray(e)?e.some((e=>("string"==typeof e?e:e.name)===t.name)):e}const cl=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,((t,e,o,i)=>{var s,a;const l=(null===(a=(s=t.type.spec).toText)||void 0===a?void 0:a.call(s,{node:t,pos:e,parent:o,index:i}))||t.textContent||"%leaf%";n+=l.slice(0,Math.max(0,r-e))})),n};function ul(t){return"[object RegExp]"===Object.prototype.toString.call(t)}class hl{constructor(t){this.find=t.find,this.handler=t.handler}}const pl=(t,e)=>{if(ul(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function dl(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null===(e=c.nodeBefore||c.nodeAfter)||void 0===e?void 0:e.marks.find((t=>t.type.spec.code))))return!1;let u=!1;const h=cl(c)+i;return s.forEach((t=>{if(u)return;const e=pl(h,t.find);if(!e)return;const s=l.state.tr,c=Ga({state:l.state,transaction:s}),p={from:r-(e[0].length-i.length),to:o},{commands:d,chain:f,can:m}=new Ya({editor:n,state:c});null!==t.handler({state:c,range:p,match:e,commands:d,chain:f,can:m})&&s.steps.length&&(s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),u=!0)})),u}function fl(t){const{editor:e,rules:n}=t,r=new Ii({state:{init:()=>null,apply(t,e){const n=t.getMeta(r);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:(t,o,i,s)=>dl({editor:e,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:t=>(setTimeout((()=>{const{$cursor:o}=t.state.selection;o&&dl({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})})),!1)},handleKeyDown(t,o){if("Enter"!==o.key)return!1;const{$cursor:i}=t.state.selection;return!!i&&dl({editor:e,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}class ml{constructor(t){this.find=t.find,this.handler=t.handler}}const gl=(t,e)=>{if(ul(e))return[...t.matchAll(e)];const n=e(t);return n?n.map((e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n})):[]};function yl(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=new ClipboardEvent("paste"),a=new DragEvent("drop");const l=n.map((t=>new Ii({view(t){const e=e=>{var n;r=(null===(n=t.dom.parentElement)||void 0===n?void 0:n.contains(e.target))?t.dom.parentElement:null};return window.addEventListener("dragstart",e),{destroy(){window.removeEventListener("dragstart",e)}}},props:{handleDOMEvents:{drop:(t,e)=>(i=r===t.dom.parentElement,a=e,!1),paste:(t,e)=>{var n;const r=null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html");return s=e,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(n,r,l)=>{const c=n[0],u="paste"===c.getMeta("uiEvent")&&!o,h="drop"===c.getMeta("uiEvent")&&!i;if(!u&&!h)return;const p=r.doc.content.findDiffStart(l.doc.content),d=r.doc.content.findDiffEnd(l.doc.content);if("number"!=typeof p||!d||p===d.b)return;const f=l.tr,m=Ga({state:l,transaction:f}),g=function(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Ya({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,o,((t,e)=>{if(!t.isTextblock||t.type.spec.code)return;const p=Math.max(r,e),d=Math.min(o,e+t.content.size),f=t.textBetween(p-e,d-e,void 0,"");gl(f,i.find).forEach((t=>{if(void 0===t.index)return;const e=p+t.index+1,r=e+t[0].length,o={from:n.tr.mapping.map(e),to:n.tr.mapping.map(r)},d=i.handler({state:n,range:o,match:t,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});h.push(d)}))})),h.every((t=>null!==t))}({editor:e,state:m,from:Math.max(p-1,0),to:d.b-1,rule:t,pasteEvent:s,dropEvent:a});return g&&f.steps.length?(a=new DragEvent("drop"),s=new ClipboardEvent("paste"),f):void 0}})));return l}class vl{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=vl.resolve(t),this.schema=sl(this.extensions,e),this.extensions.forEach((t=>{var e;this.editor.extensionStorage[t.name]=t.storage;const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:al(t.name,this.schema)};if("mark"===t.type){(null===(e=rl(Xa(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name)}const r=Xa(t,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);const o=Xa(t,"onCreate",n);o&&this.editor.on("create",o);const i=Xa(t,"onUpdate",n);i&&this.editor.on("update",i);const s=Xa(t,"onSelectionUpdate",n);s&&this.editor.on("selectionUpdate",s);const a=Xa(t,"onTransaction",n);a&&this.editor.on("transaction",a);const l=Xa(t,"onFocus",n);l&&this.editor.on("focus",l);const c=Xa(t,"onBlur",n);c&&this.editor.on("blur",c);const u=Xa(t,"onDestroy",n);u&&this.editor.on("destroy",u)}))}static resolve(t){const e=vl.sort(vl.flatten(t)),n=function(t){const e=t.filter(((e,n)=>t.indexOf(e)!==n));return[...new Set(e)]}(e.map((t=>t.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((t=>`'${t}'`)).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map((t=>{const e=Xa(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...this.flatten(e())]:t})).flat(10)}static sort(t){return t.sort(((t,e)=>{const n=Xa(t,"priority")||100,r=Xa(e,"priority")||100;return n>r?-1:n<r?1:0}))}get commands(){return this.extensions.reduce(((t,e)=>{const n=Xa(e,"addCommands",{name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:al(e.name,this.schema)});return n?{...t,...n()}:t}),{})}get plugins(){const{editor:t}=this,e=vl.sort([...this.extensions].reverse()),n=[],r=[],o=e.map((e=>{const o={name:e.name,options:e.options,storage:e.storage,editor:t,type:al(e.name,this.schema)},i=[],s=Xa(e,"addKeyboardShortcuts",o);let a={};if("mark"===e.type&&e.config.exitable&&(a.ArrowRight=()=>Kl.handleExit({editor:t,mark:e})),s){const e=Object.fromEntries(Object.entries(s()).map((([e,n])=>[e,()=>n({editor:t})])));a={...a,...e}}const l=new Ii({props:{handleKeyDown:Pa(a)}});i.push(l);const c=Xa(e,"addInputRules",o);ll(e,t.options.enableInputRules)&&c&&n.push(...c());const u=Xa(e,"addPasteRules",o);ll(e,t.options.enablePasteRules)&&u&&r.push(...u());const h=Xa(e,"addProseMirrorPlugins",o);if(h){const t=h();i.push(...t)}return i})).flat();return[fl({editor:t,rules:n}),...yl({editor:t,rules:r}),...o]}get attributes(){return Qa(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Za(this.extensions);return Object.fromEntries(e.filter((t=>!!Xa(t,"addNodeView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),r={name:e.name,options:e.options,storage:e.storage,editor:t,type:tl(e.name,this.schema)},o=Xa(e,"addNodeView",r);if(!o)return[];return[e.name,(r,i,s,a)=>{const l=nl(r,n);return o()({editor:t,node:r,getPos:s,decorations:a,HTMLAttributes:l,extension:e})}]})))}}function bl(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&(t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype)}function _l(t,e){const n={...t};return bl(t)&&bl(e)&&Object.keys(e).forEach((r=>{bl(e[r])?r in t?n[r]=_l(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})})),n}class wl{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=rl(Xa(this,"addOptions",{name:this.name}))),this.storage=rl(Xa(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new wl(t)}configure(t={}){const e=this.extend();return e.options=_l(this.options,t),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new wl(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=rl(Xa(e,"addOptions",{name:e.name})),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}}wl.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Ii({key:new Di("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map((t=>t.$from.pos))),a=Math.max(...i.map((t=>t.$to.pos))),l=function(t){return Object.fromEntries(Object.entries(t.nodes).filter((([,t])=>t.spec.toText)).map((([t,e])=>[t,e.spec.toText])))}(n);return function(t,e,n){const{from:r,to:o}=e,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="",l=!0;return t.nodesBetween(r,o,((t,n,c,u)=>{var h;const p=null==s?void 0:s[t.type.name];p?(t.isBlock&&!l&&(a+=i,l=!0),c&&(a+=p({node:t,pos:n,parent:c,index:u,range:e}))):t.isText?(a+=null===(h=null==t?void 0:t.text)||void 0===h?void 0:h.slice(Math.max(r,n)-n,o-n),l=!1):t.isBlock&&!l&&(a+=i,l=!0)})),a}(r,{from:s,to:a},{textSerializers:l})}}})]}});function kl(t,e,n={strict:!0}){const r=Object.keys(e);return!r.length||r.every((r=>n.strict?e[r]===t[r]:ul(e[r])?e[r].test(t[r]):e[r]===t[r]))}function xl(t,e,n={}){return t.find((t=>t.type===e&&kl(t.attrs,n)))}function Sl(t,e,n={}){return!!xl(t,e,n)}function El(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&0!==r.offset&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const o=xl([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(xl([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&Sl([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Ol(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function Cl(t){return t instanceof wi}function Al(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Ml(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Tl(t){const e=`<body>${t}</body>`;return(new window.DOMParser).parseFromString(e,"text/html").body}function Nl(t,e,n){if(n={slice:!0,parseOptions:{},...n},"object"==typeof t&&null!==t)try{return Array.isArray(t)&&t.length>0?Ar.fromArray(t.map((t=>e.nodeFromJSON(t)))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),Nl("",e,n)}if("string"==typeof t){const r=bo.fromSchema(e);return n.slice?r.parseSlice(Tl(t),n.parseOptions).content:r.parse(Tl(t),n.parseOptions)}return Nl("",e,n)}function Il(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function Rl(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?tl(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,((t,e)=>{if(t.isText)return;const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);a.push({node:t,from:n,to:i})}));const l=o-r,c=a.filter((t=>!s||s.name===t.node.type.name)).filter((t=>kl(t.node.attrs,n,{strict:!1})));if(i)return!!c.length;return c.reduce(((t,e)=>t+e.to-e.from),0)>=l}function Ll(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Dl(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{})}function $l(t,e){const n=Ol(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,(t=>{s.push(...t.marks)}));const a=s.find((t=>t.type.name===n.name));return a?{...a.attrs}:{}}function Pl(t){return e=>function(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}(e.$from,t)}function zl(t,e){const n=Ll("string"==typeof e?e:e.name,t.schema);return"node"===n?function(t,e){const n=tl(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,(t=>{i.push(t)}));const s=i.reverse().find((t=>t.type.name===n.name));return s?{...s.attrs}:{}}(t,e):"mark"===n?$l(t,e):{}}function jl(t){const e=function(t,e=JSON.stringify){const n={};return t.filter((t=>{const r=e(t);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)}))}(t);return 1===e.length?e:e.filter(((t,n)=>{const r=e.filter(((t,e)=>e!==n));return!r.some((e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}))}function Fl(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach((e=>{const o=El(n.resolve(t-1),e.type);o&&r.push({mark:e,...o})})):n.nodesBetween(t,e,((t,e)=>{r.push(...t.marks.map((n=>({from:e,to:e+t.nodeSize,mark:n}))))})),r}function Hl(t,e,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const r=t.find((t=>t.type===e&&t.name===n));return!!r&&r.attribute.keepOnSplit})))}function Bl(t,e){const{nodeExtensions:n}=Za(e),r=n.find((e=>e.name===t));if(!r)return!1;const o=rl(Xa(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Vl(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter((t=>null==e?void 0:e.includes(t.type.name)));t.tr.ensureMarks(r)}}const Wl=(t,e)=>{const n=Pl((t=>t.type===e))(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=t.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Qo(t.doc,n.pos)||(t.join(n.pos),!0)},ql=(t,e)=>{const n=Pl((t=>t.type===e))(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=t.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Qo(t.doc,r)||(t.join(r),!0)};var Ul=Object.freeze({__proto__:null,blur:()=>({editor:t,view:e})=>(requestAnimationFrame((()=>{var n;t.isDestroyed||(e.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())})),!0),clearContent:(t=!1)=>({commands:e})=>e.setContent("",t),clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return!n||(o.forEach((({$from:n,$to:r})=>{t.doc.nodesBetween(n.pos,r.pos,((t,n)=>{if(t.type.isText)return;const{doc:r,mapping:o}=e,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+t.nodeSize)),a=i.blockRange(s);if(!a)return;const l=Go(a);if(t.type.isTextblock){const{defaultType:t}=i.parent.contentMatchAt(i.index());e.setNodeMarkup(a.start,t)}(l||0===l)&&e.lift(a,l)}))})),!0)},command:t=>e=>t(e),createParagraphNear:()=>({state:t,dispatch:e})=>((t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Ei||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ha(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=t.tr.insert(n,i.createAndFill());s.setSelection(wi.create(s.doc,n+1)),e(s.scrollIntoView())}return!0})(t,e),cut:(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new wi(r.doc.resolve(s-1))),!0},deleteCurrentNode:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let n=o.depth;n>0;n-=1){if(o.node(n).type===r.type){if(e){const e=o.before(n),r=o.after(n);t.delete(e,r).scrollIntoView()}return!0}}return!1},deleteNode:t=>({tr:e,state:n,dispatch:r})=>{const o=tl(t,n.schema),i=e.selection.$anchor;for(let t=i.depth;t>0;t-=1){if(i.node(t).type===o){if(r){const n=i.before(t),r=i.after(t);e.delete(n,r).scrollIntoView()}return!0}}return!1},deleteRange:t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},deleteSelection:()=>({state:t,dispatch:e})=>((t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0))(t,e),enter:()=>({commands:t})=>t.keyboardShortcut("Enter"),exitCode:()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Ha(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let r=n.after(),o=t.tr.replaceWith(r,r,s.createAndFill());o.setSelection(yi.near(o.doc.resolve(r),1)),e(o.scrollIntoView())}return!0})(t,e),extendMarkRange:(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Ol(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const t=El(l,i,e);if(t&&t.from<=c&&t.to>=u){const e=wi.create(s,t.from,t.to);n.setSelection(e)}}return!0},first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t<n.length;t+=1)if(n[t](e))return!0;return!1},focus:(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{Ml()&&r.dom.focus(),requestAnimationFrame((()=>{n.isDestroyed||(r.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())}))};if(r.hasFocus()&&null===t||!1===t)return!0;if(i&&null===t&&!Cl(n.state.selection))return s(),!0;const a=function(t,e=null){if(!e)return null;const n=yi.atStart(t),r=yi.atEnd(t);if("start"===e||!0===e)return n;if("end"===e)return r;const o=n.from,i=r.to;return"all"===e?wi.create(t,Al(0,o,i),Al(t.content.size,o,i)):wi.create(t,Al(e,o,i),Al(e,o,i))}(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},forEach:(t,e)=>n=>t.every(((t,r)=>e(t,{...n,index:r}))),insertContent:(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),insertContentAt:(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,...n};const o=Nl(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if("<>"===o.toString())return!0;let{from:s,to:a}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},l=!0,c=!0;if((o.toString().startsWith("<")?o:[o]).forEach((t=>{t.check(),l=!!l&&(t.isText&&0===t.marks.length),c=!!c&&t.isBlock})),s===a&&c){const{parent:t}=r.doc.resolve(s);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(s-=1,a+=1)}l?Array.isArray(e)?r.insertText(e.map((t=>t.text||"")).join(""),s,a):"object"==typeof e&&e&&e.text?r.insertText(e.text,s,a):r.insertText(e,s,a):r.replaceWith(s,a,o),n.updateSelection&&function(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof qo||o instanceof Uo))return;const i=t.mapping.maps[r];let s=0;i.forEach(((t,e,n,r)=>{0===s&&(s=r)})),t.setSelection(yi.near(t.doc.resolve(s),n))}(r,r.steps.length-1,-1)}return!0},joinUp:()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection,o=r instanceof xi;if(o){if(r.node.isTextblock||!Qo(t.doc,r.from))return!1;n=r.from}else if(n=ei(t.doc,r.from,-1),null==n)return!1;if(e){let r=t.tr.join(n);o&&r.setSelection(xi.create(r.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(r.scrollIntoView())}return!0})(t,e),joinDown:()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection;if(r instanceof xi){if(r.node.isTextblock||!Qo(t.doc,r.to))return!1;n=r.to}else if(n=ei(t.doc,r.to,1),null==n)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0})(t,e),joinBackward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let r=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}(t,n);if(!r)return!1;let o=ja(r);if(!o){let n=r.blockRange(),o=n&&Go(n);return null!=o&&(e&&e(t.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&Ba(t,o,e))return!0;if(0==r.parent.content.size&&(za(i,"end")||xi.isSelectable(i))){let n=ni(t.doc,r.before(),r.after(),Lr.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(za(i,"end")?yi.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):xi.create(r.doc,o.pos-i.nodeSize)),e(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),0))})(t,e),joinForward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let r=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}(t,n);if(!r)return!1;let o=Fa(r);if(!o)return!1;let i=o.nodeAfter;if(Ba(t,o,e))return!0;if(0==r.parent.content.size&&(za(i,"start")||xi.isSelectable(i))){let n=ni(t.doc,r.before(),r.after(),Lr.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(za(i,"start")?yi.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):xi.create(r.doc,r.mapping.map(o.pos))),e(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),0))})(t,e),joinItemBackward:()=>({tr:t,state:e,dispatch:n})=>{try{const r=ei(e.doc,e.selection.$from.pos,-1);return null!=r&&(t.join(r,2),n&&n(t),!0)}catch{return!1}},joinItemForward:()=>({state:t,dispatch:e,tr:n})=>{try{const r=ei(t.doc,t.selection.$from.pos,1);return null!=r&&(n.join(r,2),e&&e(n),!0)}catch(t){return!1}},keyboardShortcut:t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=function(t){const e=t.split(/-(?!$)/);let n,r,o,i,s=e[e.length-1];"Space"===s&&(s=" ");for(let t=0;t<e.length-1;t+=1){const s=e[t];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);Ml()||Il()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(t).split(/-(?!$)/),s=i.find((t=>!["Alt","Ctrl","Meta","Shift"].includes(t))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction((()=>{n.someProp("handleKeyDown",(t=>t(n,a)))}));return null==l||l.steps.forEach((t=>{const e=t.map(r.mapping);e&&o&&r.maybeStep(e)})),!0},lift:(t,e={})=>({state:n,dispatch:r})=>!!Rl(n,tl(t,n.schema),e)&&((t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&Go(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)})(n,r),liftEmptyBlock:()=>({state:t,dispatch:e})=>((t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Zo(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Go(r);return null!=o&&(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)})(t,e),liftListItem:t=>({state:e,dispatch:n})=>Ja(tl(t,e.schema))(e,n),newlineInCode:()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(e&&e(t.tr.insertText("\n").scrollIntoView()),0))})(t,e),resetAttributes:(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ll("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=tl(t,r.schema)),"mark"===a&&(s=Ol(t,r.schema)),o&&n.selection.ranges.forEach((t=>{r.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,Dl(t.attrs,e)),s&&t.marks.length&&t.marks.forEach((o=>{s===o.type&&n.addMark(r,r+t.nodeSize,s.create(Dl(o.attrs,e)))}))}))})),!0)},scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),selectAll:()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),selectNodeBackward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ja(r)}let s=i&&i.nodeBefore;return!(!s||!xi.isSelectable(s)||(e&&e(t.tr.setSelection(xi.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),0))})(t,e),selectNodeForward:()=>({state:t,dispatch:e})=>((t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Fa(r)}let s=i&&i.nodeAfter;return!(!s||!xi.isSelectable(s)||(e&&e(t.tr.setSelection(xi.create(t.doc,i.pos)).scrollIntoView()),0))})(t,e),selectParentNode:()=>({state:t,dispatch:e})=>((t,e)=>{let n,{$from:r,to:o}=t.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),e&&e(t.tr.setSelection(xi.create(t.doc,n))),!0)})(t,e),selectTextblockEnd:()=>({state:t,dispatch:e})=>qa(t,e),selectTextblockStart:()=>({state:t,dispatch:e})=>Wa(t,e),setContent:(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,a=function(t,e,n={}){return Nl(t,e,{slice:!1,parseOptions:n})}(t,o.schema,n);return i&&r.replaceWith(0,s.content.size,a).setMeta("preventUpdate",!e),!0},setMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Ol(t,r.schema);if(o)if(s){const t=$l(r,l);n.addStoredMark(l.create({...t,...e}))}else a.forEach((t=>{const o=t.$from.pos,i=t.$to.pos;r.doc.nodesBetween(o,i,((t,r)=>{const s=Math.max(r,o),a=Math.min(r+t.nodeSize,i);t.marks.find((t=>t.type===l))?t.marks.forEach((t=>{l===t.type&&n.addMark(s,a,l.create({...t.attrs,...e}))})):n.addMark(s,a,l.create(e))}))}));return function(t,e,n){var r;const{selection:o}=e;let i=null;if(Cl(o)&&(i=o.$cursor),i){const e=null!==(r=t.storedMarks)&&void 0!==r?r:i.marks();return!!n.isInSet(e)||!e.some((t=>t.type.excludes(n)))}const{ranges:s}=o;return s.some((({$from:e,$to:r})=>{let o=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,r.pos,((t,e,r)=>{if(o)return!1;if(t.isInline){const e=!r||r.type.allowsMarkType(n),i=!!n.isInSet(t.marks)||!t.marks.some((t=>t.type.excludes(n)));o=e&&i}return!o})),o}))}(r,n,l)},setMeta:(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),setNode:(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=tl(t,n.schema);return i.isTextblock?o().command((({commands:t})=>!!Ua(i,e)(n)||t.clearNodes())).command((({state:t})=>Ua(i,e)(t,r))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=Al(t,0,n.content.size),o=xi.create(n,r);e.setSelection(o)}return!0},setTextSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,{from:r,to:o}="number"==typeof t?{from:t,to:t}:t,i=wi.atStart(n).from,s=wi.atEnd(n).to,a=Al(r,i,s),l=Al(o,i,s),c=wi.create(n,a,l);e.setSelection(c)}return!0},sinkListItem:t=>({state:e,dispatch:n})=>{const r=tl(t,e.schema);return(o=r,function(t,e){let{$from:n,$to:r}=t.selection,i=n.blockRange(r,(t=>t.childCount>0&&t.firstChild.type==o));if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(e){let n=l.lastChild&&l.lastChild.type==a.type,r=Ar.from(n?o.create():null),s=new Lr(Ar.from(o.create(null,Ar.from(a.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;e(t.tr.step(new Uo(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(e,n);var o},splitBlock:({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:a,$to:l}=i,c=Hl(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof xi&&i.node.isBlock)return!(!a.parentOffset||!Zo(s,a.pos))&&(r&&(t&&Vl(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const r=l.parentOffset===l.parent.content.size;i instanceof wi&&e.deleteSelection();const s=0===a.depth?void 0:function(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let u=r&&s?[{type:s,attrs:c}]:void 0,h=Zo(e.doc,e.mapping.map(a.pos),1,u);if(u||h||!Zo(e.doc,e.mapping.map(a.pos),1,s?[{type:s}]:void 0)||(h=!0,u=s?[{type:s,attrs:c}]:void 0),h&&(e.split(e.mapping.map(a.pos),1,u),s&&!r&&!a.parentOffset&&a.parent.type!==s)){const t=e.mapping.map(a.before()),n=e.doc.resolve(t);a.node(-1).canReplaceWith(n.index(),n.index()+1,s)&&e.setNodeMarkup(e.mapping.map(a.before()),s)}t&&Vl(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},splitListItem:t=>({tr:e,state:n,dispatch:r,editor:o})=>{var i;const s=tl(t,n.schema),{$from:a,$to:l}=n.selection,c=n.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==s)return!1;const h=o.extensionManager.attributes;if(0===a.parent.content.size&&a.node(-1).childCount===a.indexAfter(-1)){if(2===a.depth||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let t=Ar.empty;const n=a.index(-1)?1:a.index(-2)?2:3;for(let e=a.depth-n;e>=a.depth-3;e-=1)t=Ar.from(a.node(e).copy(t));const r=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,o=Hl(h,a.node().type.name,a.node().attrs),l=(null===(i=s.contentMatch.defaultType)||void 0===i?void 0:i.createAndFill(o))||void 0;t=t.append(Ar.from(s.createAndFill(null,l)||void 0));const c=a.before(a.depth-(n-1));e.replace(c,a.after(-r),new Lr(t,4-n,0));let u=-1;e.doc.nodesBetween(c,e.doc.content.size,((t,e)=>{if(u>-1)return!1;t.isTextblock&&0===t.content.size&&(u=e+1)})),u>-1&&e.setSelection(wi.near(e.doc.resolve(u))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,d=Hl(h,u.type.name,u.attrs),f=Hl(h,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);const m=p?[{type:s,attrs:d},{type:p,attrs:f}]:[{type:s,attrs:d}];if(!Zo(e.doc,a.pos,2))return!1;if(r){const{selection:t,storedMarks:i}=n,{splittableMarks:s}=o.extensionManager,l=i||t.$to.parentOffset&&t.$from.marks();if(e.split(a.pos,2,m).scrollIntoView(),!l||!r)return!0;const c=l.filter((t=>s.includes(t.type.name)));e.ensureMarks(c)}return!0},toggleList:(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:h,splittableMarks:p}=o.extensionManager,d=tl(t,s.schema),f=tl(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:v}=m,b=y.blockRange(v),_=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const w=Pl((t=>Bl(t.type.name,h)))(m);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===d)return c.liftListItem(f);if(Bl(w.node.type.name,h)&&d.validContent(w.node.content)&&a)return l().command((()=>(i.setNodeMarkup(w.pos,d),!0))).command((()=>Wl(i,d))).command((()=>ql(i,d))).run()}return n&&_&&a?l().command((()=>{const t=u().wrapInList(d,r),e=_.filter((t=>p.includes(t.type.name)));return i.ensureMarks(e),!!t||c.clearNodes()})).wrapInList(d,r).command((()=>Wl(i,d))).command((()=>ql(i,d))).run():l().command((()=>!!u().wrapInList(d,r)||c.clearNodes())).wrapInList(d,r).command((()=>Wl(i,d))).command((()=>ql(i,d))).run()},toggleMark:(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Ol(t,r.schema),a=function(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?Ol(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>!i||i.name===t.type.name)).find((t=>kl(t.attrs,n,{strict:!1})));let s=0;const a=[];if(o.forEach((({$from:e,$to:n})=>{const r=e.pos,o=n.pos;t.doc.nodesBetween(r,o,((t,e)=>{if(!t.isText&&!t.marks.length)return;const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);s+=i-n,a.push(...t.marks.map((t=>({mark:t,from:n,to:i}))))}))})),0===s)return!1;const l=a.filter((t=>!i||i.name===t.mark.type.name)).filter((t=>kl(t.mark.attrs,n,{strict:!1}))).reduce(((t,e)=>t+e.to-e.from),0),c=a.filter((t=>!i||t.mark.type!==i&&t.mark.type.excludes(i))).reduce(((t,e)=>t+e.to-e.from),0);return(l>0?l+c:l)>=s}(r,s,e);return a?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},toggleNode:(t,e,n={})=>({state:r,commands:o})=>{const i=tl(t,r.schema),s=tl(e,r.schema);return Rl(r,i,n)?o.setNode(s):o.setNode(i,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const o=tl(t,n.schema);return Rl(n,o,e)?r.lift(o):r.wrapIn(o,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const e=t.tr,n=i.transform;for(let t=n.steps.length-1;t>=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(i.text){const n=e.doc.resolve(i.from).marks();e.replaceWith(i.from,i.to,t.schema.text(i.text,n))}else e.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach((e=>{t.removeMark(e.$from.pos,e.$to.pos)})),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Ol(t,r.schema),{$from:c,empty:u,ranges:h}=a;if(!o)return!0;if(u&&s){let{from:t,to:e}=a;const r=null===(i=c.marks().find((t=>t.type===l)))||void 0===i?void 0:i.attrs,o=El(c,l,r);o&&(t=o.from,e=o.to),n.removeMark(t,e,l)}else h.forEach((t=>{n.removeMark(t.$from.pos,t.$to.pos,l)}));return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ll("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=tl(t,r.schema)),"mark"===a&&(s=Ol(t,r.schema)),o&&n.selection.ranges.forEach((t=>{const o=t.$from.pos,a=t.$to.pos;r.doc.nodesBetween(o,a,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,{...t.attrs,...e}),s&&t.marks.length&&t.marks.forEach((i=>{if(s===i.type){const l=Math.max(r,o),c=Math.min(r+t.nodeSize,a);n.addMark(l,c,s.create({...i.attrs,...e}))}}))}))})),!0)},wrapIn:(t,e={})=>({state:n,dispatch:r})=>function(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&Yo(s,t,e);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(tl(t,n.schema),e)(n,r),wrapInList:(t,e={})=>({state:n,dispatch:r})=>Ka(tl(t,n.schema),e)(n,r)});wl.create({name:"commands",addCommands:()=>({...Ul})}),wl.create({name:"editable",addProseMirrorPlugins(){return[new Ii({key:new Di("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wl.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ii({key:new Di("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),wl.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.command((({tr:e})=>{const{selection:n,doc:r}=e,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock?e.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,u=i.pos-i.parentOffset,h=c&&1===l.parent.childCount?u===i.pos:yi.atStart(r).from===s;return!(!(o&&h&&a.type.isTextblock)||a.textContent.length)&&t.clearNodes()})),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()])),e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ml()||Il()?o:r},addProseMirrorPlugins(){return[new Ii({key:new Di("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some((t=>t.docChanged))&&!e.doc.eq(n.doc)))return;const{empty:r,from:o,to:i}=e.selection,s=yi.atStart(e.doc).from,a=yi.atEnd(e.doc).to;if(r||!(o===s&&i===a))return;if(!(0===n.doc.textBetween(0,n.doc.content.size," "," ").length))return;const l=n.tr,c=Ga({state:n,transaction:l}),{commands:u}=new Ya({editor:this.editor,state:c});return u.clearNodes(),l.steps.length?l:void 0}})]}}),wl.create({name:"tabindex",addProseMirrorPlugins(){return[new Ii({key:new Di("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Kl{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=rl(Xa(this,"addOptions",{name:this.name}))),this.storage=rl(Xa(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Kl(t)}configure(t={}){const e=this.extend();return e.options=_l(this.options,t),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new Kl(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=rl(Xa(e,"addOptions",{name:e.name})),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,r=t.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find((t=>(null==t?void 0:t.type.name)===e.name)))return!1;const i=o.find((t=>(null==t?void 0:t.type.name)===e.name));return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),t.view.dispatch(n),!0}return!1}}class Jl{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=rl(Xa(this,"addOptions",{name:this.name}))),this.storage=rl(Xa(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Jl(t)}configure(t={}){const e=this.extend();return e.options=_l(this.options,t),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new Jl(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=rl(Xa(e,"addOptions",{name:e.name})),e.storage=rl(Xa(e,"addStorage",{name:e.name,options:e.options})),e}}const Gl=Jl.create({name:"text",group:"inline"});var Yl=200,Xl=function(){};Xl.prototype.append=function(t){return t.length?(t=Xl.from(t),!this.length&&t||t.length<Yl&&this.leafAppend(t)||this.length<Yl&&t.leafPrepend(this)||this.appendInner(t)):this},Xl.prototype.prepend=function(t){return t.length?Xl.from(t).append(this):this},Xl.prototype.appendInner=function(t){return new Ql(this,t)},Xl.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Xl.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Xl.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Xl.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Xl.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Xl.from=function(t){return t instanceof Xl?t:t&&t.length?new Zl(t):Xl.empty};var Zl=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Yl)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Yl)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Xl);Xl.empty=new Zl([]);var Ql=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Xl),tc=Xl;class ec{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}e&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=t.tr,l=[],c=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(o,e+1),r=n.maps.length),r--,void c.push(t);if(n){c.push(new nc(t.map));let e,o=t.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(e=a.mapping.maps[a.mapping.maps.length-1],l.push(new nc(e,void 0,void 0,l.length+c.length))),r--,e&&n.appendMap(e,r)}else a.maybeStep(t.step);return t.selection?(i=n?t.selection.map(n.slice(r)):t.selection,s=new ec(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(t,e,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<t.steps.length;n++){let l,c=t.steps[n].invert(t.docs[n]),u=new nc(t.mapping.maps[n],c,e);(l=a&&a.merge(u))&&(u=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(u),e&&(i++,e=void 0),r||(a=u)}let l=i-n.depth;return l>oc&&(s=function(t,e){let n;return t.forEach(((t,r)=>{if(t.selection&&0==e--)return n=r,!1})),t.slice(n)}(s,l),i-=l),new ec(s.append(o),i)}remapping(t,e){let n=new $o;return this.items.forEach(((e,r)=>{let o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,o)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new ec(this.items.append(t.map((t=>new nc(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),r);let a=e;this.items.forEach((e=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(e.step){let i=t.steps[r].invert(t.docs[r]),c=e.selection&&e.selection.map(o.slice(a+1,r));c&&s++,n.push(new nc(l,i,c))}else n.push(new nc(l))}),r);let l=[];for(let t=e;t<i;t++)l.push(new nc(o.maps[t]));let c=this.items.slice(0,r).append(l).append(n),u=new ec(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=t)r.push(i),i.selection&&o++;else if(i.step){let t=i.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let a=i.selection&&i.selection.map(e.slice(n));a&&o++;let l,c=new nc(s.invert(),t,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--}),this.items.length,0),new ec(tc.from(r.reverse()),o)}}ec.empty=new ec(tc.empty,0);class nc{constructor(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new nc(e.getMap().invert(),e,this.selection)}}}class rc{constructor(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r}}const oc=20;function ic(t){let e=[];return t.forEach(((t,n,r,o)=>e.push(r,o))),e}function sc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function ac(t,e,n,r){let o=uc(e),i=hc.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(!s)return;let a=s.selection.resolve(s.transform.doc),l=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),c=new rc(r?l:s.remaining,r?s.remaining:l,null,0);n(s.transform.setSelection(a).setMeta(hc,{redo:r,historyState:c}).scrollIntoView())}let lc=!1,cc=null;function uc(t){let e=t.plugins;if(cc!=e){lc=!1,cc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){lc=!0;break}}return lc}const hc=new Di("history"),pc=new Di("closeHistory");function dc(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ii({key:hc,state:{init:()=>new rc(ec.empty,ec.empty,null,0),apply:(e,n,r)=>function(t,e,n,r){let o,i=n.getMeta(hc);if(i)return i.historyState;n.getMeta(pc)&&(t=new rc(t.done,t.undone,null,0));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(hc))return s.getMeta(hc).redo?new rc(t.done.addTransform(n,void 0,r,uc(e)),t.undone,ic(n.mapping.maps[n.steps.length-1]),t.prevTime):new rc(t.done,t.undone.addTransform(n,void 0,r,uc(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new rc(t.done.rebased(n,o),t.undone.rebased(n,o),sc(t.prevRanges,n.mapping),t.prevTime):new rc(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),sc(t.prevRanges,n.mapping),t.prevTime);{let o=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,r)=>{for(let o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),i=s?sc(t.prevRanges,n.mapping):ic(n.mapping.maps[n.steps.length-1]);return new rc(t.done.addTransform(n,o?e.selection.getBookmark():void 0,r,uc(e)),ec.empty,i,n.time)}}(n,r,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,r="historyUndo"==n?fc:"historyRedo"==n?mc:null;return!!r&&(e.preventDefault(),r(t.state,t.dispatch))}}}})}const fc=(t,e)=>{let n=hc.getState(t);return!(!n||0==n.done.eventCount)&&(e&&ac(n,t,e,!1),!0)},mc=(t,e)=>{let n=hc.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&ac(n,t,e,!0),!0)},gc=wl.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:e})=>fc(t,e),redo:()=>({state:t,dispatch:e})=>mc(t,e)}),addProseMirrorPlugins(){return[dc(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),yc=Object.freeze({COMMON:"common",DESKTOP:"desktop",TABLET:"tablet",MOBILE:"mobile",get values(){return[this.COMMON,this.MOBILE,this.TABLET,this.DESKTOP]}}),vc=Object.freeze({UPPERCASE:"uppercase",LOWERCASE:"lowercase",CAPITALIZE:"capitalize"}),bc=Object.freeze({LEFT:"left",CENTER:"center",RIGHT:"right",JUSTIFY:"justify",get values(){return[this.LEFT,this.CENTER,this.RIGHT,this.JUSTIFY]}}),_c=Object.freeze({DOCUMENT:"doc",PARAGRAPH:"paragraph",HEADING:"heading",LIST:"list",LIST_ITEM:"listItem",TEXT:"text",get blocks(){return[this.PARAGRAPH,this.LIST,this.HEADING]}}),wc=Object.freeze({DISC:"disc",CIRCLE:"circle",SQUARE:"square",DECIMAL:"decimal",ROMAN:"roman",LATIN:"latin",get values(){return[this.DISC,this.CIRCLE,this.SQUARE,this.DECIMAL,this.ROMAN,this.LATIN]},get ordered(){return[this.DECIMAL,this.ROMAN,this.LATIN]}}),kc=Object.freeze({ALIGNMENT:"alignment",BACKGROUND_COLOR:"background_color",FONT_COLOR:"font_color",FONT_FAMILY:"font_family",FONT_SIZE:"font_size",FONT_STYLE:"font_style",FONT_WEIGHT:"font_weight",LINE_HEIGHT:"line_height",TEXT_DECORATION:"text_decoration",SUPERSCRIPT:"superscript",MARGIN:"margin",LINK:"link",STYLE_PRESET:"style_preset",get attributes(){return[this.ALIGNMENT,this.LINE_HEIGHT,this.MARGIN]},get presetAttributes(){return[this.LINE_HEIGHT]},get inlineMarks(){return[this.TEXT_DECORATION,this.LINK,this.SUPERSCRIPT,this.BACKGROUND_COLOR]},get marks(){return[this.BACKGROUND_COLOR,this.FONT_COLOR,this.FONT_FAMILY,this.FONT_SIZE,this.FONT_STYLE,this.FONT_WEIGHT,this.TEXT_DECORATION,this.SUPERSCRIPT]}}),xc=Object.freeze({SETTINGS:"settings",ALL:"_"}),Sc=Object.freeze({BLANK:"_blank",SELF:"_self"}),Ec=Object.freeze({URL:"url",BLOCK:"block"});class Oc{static create(t,e){const n=new this(t,e||{});return new Ii({key:new Di(this.name),props:n._buildProps()})}constructor(t,e){this.options=e,this.editor=t}_buildProps(){const t=Object.entries(this.addProps()).map((([t,e])=>[t,e.bind(this)]));return Object.fromEntries(t)}addProps(){return{}}}class Cc extends Oc{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(t){if(t.includes("data-pm-slice")&&t.includes("zw-style"))return t;const e=Dp.build(t);return e.normalizeHTML(),this._removeDeprecatedStyles(e),e.normalizedHTML}_removeDeprecatedStyles(t){const e=t.dom.querySelectorAll('[style*="margin"]');for(const t of Array.from(e))t.style.removeProperty("margin"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-right"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("margin-left")}_handlePaste(t,e,n){const r=this._insertPastedContent(t,n).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return t.dispatch(r),!0}_insertPastedContent({state:t},e){return this._isFullBlockSelected(t)?t.tr.replaceSelectionWith(e.content,!1):t.tr.replaceSelection(e)}_isFullBlockSelected(t){const e=this._expandSelectionToBlocks(t),n=this._isMatchPosition(e.from,t.selection.from),r=this._isMatchPosition(e.to,t.selection.to);return n&&r}_expandSelectionToBlocks({selection:t,doc:e}){let n=t.from,r=t.to;return e.nodesBetween(n,r,((t,e,o)=>{o.type.name===_c.DOCUMENT&&(n=Math.min(n,e+1),r=Math.max(r,e+t.nodeSize-1))})),{from:n,to:r}}_isMatchPosition(t,e){return Math.abs(t-e)<5}}class Ac extends Oc{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:t}){const e=[];return this.editor.isEditable?t.childCount>1?void 0:(t.descendants(((t,n)=>{if(!t.childCount){const r=da.node(n,n+t.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});e.push(r)}return!1})),ga.create(t,e)):null}}const Mc="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Tc="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Nc=(t,e)=>{for(const n in e)t[n]=e[n];return t},Ic="numeric",Rc="ascii",Lc="alpha",Dc="asciinumeric",$c="alphanumeric",Pc="domain",zc="emoji",jc="scheme",Fc="slashscheme",Hc="whitespace";function Bc(t,e){return t in e||(e[t]=[]),e[t]}function Vc(t,e,n){e[Ic]&&(e[Dc]=!0,e[$c]=!0),e[Rc]&&(e[Dc]=!0,e[Lc]=!0),e[Dc]&&(e[$c]=!0),e[Lc]&&(e[$c]=!0),e[$c]&&(e[Pc]=!0),e[zc]&&(e[Pc]=!0);for(const r in e){const e=Bc(r,n);e.indexOf(t)<0&&e.push(t)}}function Wc(t){void 0===t&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}Wc.groups={},Wc.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let n=0;n<e.jr.length;n++){const r=e.jr[n][0],o=e.jr[n][1];if(o&&r.test(t))return o}return e.jd},has(t,e){return void 0===e&&(e=!1),e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){let o;return r=r||Wc.groups,e&&e.j?o=e:(o=new Wc(e),n&&r&&Vc(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let e=0;e<i-1;e++)o=o.tt(t[e]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Wc.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,a=o.go(t);if(a?(s=new Wc,Nc(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Wc,i){if(r)if(s.t&&"string"==typeof s.t){const t=Nc(function(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}(s.t,r),n);Vc(i,t,r)}else n&&Vc(i,n,r);s.t=i}return o.j[t]=s,s}};const qc=(t,e,n,r,o)=>t.ta(e,n,r,o),Uc=(t,e,n,r,o)=>t.tr(e,n,r,o),Kc=(t,e,n,r,o)=>t.ts(e,n,r,o),Jc=(t,e,n,r,o)=>t.tt(e,n,r,o),Gc="WORD",Yc="UWORD",Xc="LOCALHOST",Zc="TLD",Qc="UTLD",tu="SCHEME",eu="SLASH_SCHEME",nu="NUM",ru="WS",ou="NL",iu="OPENBRACE",su="OPENBRACKET",au="OPENANGLEBRACKET",lu="OPENPAREN",cu="CLOSEBRACE",uu="CLOSEBRACKET",hu="CLOSEANGLEBRACKET",pu="CLOSEPAREN",du="AMPERSAND",fu="APOSTROPHE",mu="ASTERISK",gu="AT",yu="BACKSLASH",vu="BACKTICK",bu="CARET",_u="COLON",wu="COMMA",ku="DOLLAR",xu="DOT",Su="EQUALS",Eu="EXCLAMATION",Ou="HYPHEN",Cu="PERCENT",Au="PIPE",Mu="PLUS",Tu="POUND",Nu="QUERY",Iu="QUOTE",Ru="SEMI",Lu="SLASH",Du="TILDE",$u="UNDERSCORE",Pu="EMOJI",zu="SYM";var ju=Object.freeze({__proto__:null,WORD:Gc,UWORD:Yc,LOCALHOST:Xc,TLD:Zc,UTLD:Qc,SCHEME:tu,SLASH_SCHEME:eu,NUM:nu,WS:ru,NL:ou,OPENBRACE:iu,OPENBRACKET:su,OPENANGLEBRACKET:au,OPENPAREN:lu,CLOSEBRACE:cu,CLOSEBRACKET:uu,CLOSEANGLEBRACKET:hu,CLOSEPAREN:pu,AMPERSAND:du,APOSTROPHE:fu,ASTERISK:mu,AT:gu,BACKSLASH:yu,BACKTICK:vu,CARET:bu,COLON:_u,COMMA:wu,DOLLAR:ku,DOT:xu,EQUALS:Su,EXCLAMATION:Eu,HYPHEN:Ou,PERCENT:Cu,PIPE:Au,PLUS:Mu,POUND:Tu,QUERY:Nu,QUOTE:Iu,SEMI:Ru,SLASH:Lu,TILDE:Du,UNDERSCORE:$u,EMOJI:Pu,SYM:zu});const Fu=/[a-z]/,Hu=/\p{L}/u,Bu=/\p{Emoji}/u,Vu=/\d/,Wu=/\s/,qu="\n",Uu="️",Ku="‍";let Ju=null,Gu=null;function Yu(t,e,n,r,o){let i;const s=e.length;for(let n=0;n<s-1;n++){const s=e[n];t.j[s]?i=t.j[s]:(i=new Wc(r),i.jr=o.slice(),t.j[s]=i),t=i}return i=new Wc(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function Xu(t){const e=[],n=[];let r=0;for(;r<t.length;){let o=0;for(;"0123456789".indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let e=parseInt(t.substring(r,r+o),10);e>0;e--)n.pop();r+=o}else n.push(t[r]),r++}return e}const Zu={defaultProtocol:"http",events:null,format:th,formatHref:th,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Qu(t,e){void 0===e&&(e=null);let n=Nc({},Zu);t&&(n=Nc(n,t instanceof Qu?t.o:t));const r=n.ignoreTags,o=[];for(let t=0;t<r.length;t++)o.push(r[t].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}function th(t){return t}function eh(t,e){this.t="token",this.v=t,this.tk=e}function nh(t,e){class n extends eh{constructor(e,n){super(e,n),this.t=t}}for(const t in e)n.prototype[t]=e[t];return n.t=t,n}Qu.prototype={o:Zu,ignoreTags:[],defaultRender:t=>t,check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=null!=e;let o=this.o[t];return o?("object"==typeof o?(o=n.t in o?o[n.t]:Zu[t],"function"==typeof o&&r&&(o=o(e,n))):"function"==typeof o&&r&&(o=o(e,n.t,n)),o):o},getObj(t,e,n){let r=this.o[t];return"function"==typeof r&&null!=e&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}},eh.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return void 0===t&&(t=Zu.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),h=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Nc(s,u),{tagName:o,attributes:s,content:i,eventListeners:h}}};const rh=nh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),oh=nh("text"),ih=nh("nl"),sh=nh("url",{isLink:!0,toHref(t){return void 0===t&&(t=Zu.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Xc&&t[1].t===_u}}),ah=t=>new Wc(t);function lh(t,e,n){const r=n[0].s,o=n[n.length-1].e;return new t(e.slice(r,o),n)}const ch="undefined"!=typeof console&&console&&console.warn||(()=>{}),uh={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function hh(t,e){if(void 0===e&&(e=!1),uh.initialized&&ch(`linkifyjs: already initialized - will not register custom scheme "${t}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error('linkifyjs: incorrect scheme format.\n 1. Must only contain digits, lowercase ASCII letters or "-"\n 2. Cannot start or end with "-"\n 3. "-" cannot repeat');uh.customSchemes.push([t,e])}function ph(){uh.scanner=function(t){void 0===t&&(t=[]);const e={};Wc.groups=e;const n=new Wc;null==Ju&&(Ju=Xu(Mc)),null==Gu&&(Gu=Xu(Tc)),Jc(n,"'",fu),Jc(n,"{",iu),Jc(n,"[",su),Jc(n,"<",au),Jc(n,"(",lu),Jc(n,"}",cu),Jc(n,"]",uu),Jc(n,">",hu),Jc(n,")",pu),Jc(n,"&",du),Jc(n,"*",mu),Jc(n,"@",gu),Jc(n,"`",vu),Jc(n,"^",bu),Jc(n,":",_u),Jc(n,",",wu),Jc(n,"$",ku),Jc(n,".",xu),Jc(n,"=",Su),Jc(n,"!",Eu),Jc(n,"-",Ou),Jc(n,"%",Cu),Jc(n,"|",Au),Jc(n,"+",Mu),Jc(n,"#",Tu),Jc(n,"?",Nu),Jc(n,'"',Iu),Jc(n,"/",Lu),Jc(n,";",Ru),Jc(n,"~",Du),Jc(n,"_",$u),Jc(n,"\\",yu);const r=Uc(n,Vu,nu,{[Ic]:!0});Uc(r,Vu,r);const o=Uc(n,Fu,Gc,{[Rc]:!0});Uc(o,Fu,o);const i=Uc(n,Hu,Yc,{[Lc]:!0});Uc(i,Fu),Uc(i,Hu,i);const s=Uc(n,Wu,ru,{[Hc]:!0});Jc(n,qu,ou,{[Hc]:!0}),Jc(s,qu),Uc(s,Wu,s);const a=Uc(n,Bu,Pu,{[zc]:!0});Uc(a,Bu,a),Jc(a,Uu,a);const l=Jc(a,Ku);Uc(l,Bu,a);const c=[[Fu,o]],u=[[Fu,null],[Hu,i]];for(let t=0;t<Ju.length;t++)Yu(n,Ju[t],Zc,Gc,c);for(let t=0;t<Gu.length;t++)Yu(n,Gu[t],Qc,Yc,u);Vc(Zc,{tld:!0,ascii:!0},e),Vc(Qc,{utld:!0,alpha:!0},e),Yu(n,"file",tu,Gc,c),Yu(n,"mailto",tu,Gc,c),Yu(n,"http",eu,Gc,c),Yu(n,"https",eu,Gc,c),Yu(n,"ftp",eu,Gc,c),Yu(n,"ftps",eu,Gc,c),Vc(tu,{scheme:!0,ascii:!0},e),Vc(eu,{slashscheme:!0,ascii:!0},e),t=t.sort(((t,e)=>t[0]>e[0]?1:-1));for(let e=0;e<t.length;e++){const r=t[e][0],o=t[e][1]?{[jc]:!0}:{[Fc]:!0};r.indexOf("-")>=0?o[Pc]=!0:Fu.test(r)?Vu.test(r)?o[Dc]=!0:o[Rc]=!0:o[Ic]=!0,Kc(n,r,r,o)}return Kc(n,"localhost",Xc,{ascii:!0}),n.jd=new Wc(zu),{start:n,tokens:Nc({groups:e},ju)}}(uh.customSchemes);for(let t=0;t<uh.tokenQueue.length;t++)uh.tokenQueue[t][1]({scanner:uh.scanner});uh.parser=function(t){let{groups:e}=t;const n=e.domain.concat([du,mu,gu,yu,vu,bu,ku,Su,Ou,nu,Cu,Au,Mu,Tu,Lu,zu,Du,$u]),r=[fu,hu,cu,uu,pu,_u,wu,xu,Eu,au,iu,su,lu,Nu,Iu,Ru],o=[du,fu,mu,yu,vu,bu,cu,ku,Su,Ou,iu,Cu,Au,Mu,Tu,Nu,Lu,zu,Du,$u],i=ah(),s=Jc(i,Du);qc(s,o,s),qc(s,e.domain,s);const a=ah(),l=ah(),c=ah();qc(i,e.domain,a),qc(i,e.scheme,l),qc(i,e.slashscheme,c),qc(a,o,s),qc(a,e.domain,a);const u=Jc(a,gu);Jc(s,gu,u),Jc(l,gu,u),Jc(c,gu,u);const h=Jc(s,xu);qc(h,o,s),qc(h,e.domain,s);const p=ah();qc(u,e.domain,p),qc(p,e.domain,p);const d=Jc(p,xu);qc(d,e.domain,p);const f=ah(rh);qc(d,e.tld,f),qc(d,e.utld,f),Jc(u,Xc,f);const m=Jc(p,Ou);qc(m,e.domain,p),qc(f,e.domain,p),Jc(f,xu,d),Jc(f,Ou,m);const g=Jc(f,_u);qc(g,e.numeric,rh);const y=Jc(a,Ou),v=Jc(a,xu);qc(y,e.domain,a),qc(v,o,s),qc(v,e.domain,a);const b=ah(sh);qc(v,e.tld,b),qc(v,e.utld,b),qc(b,e.domain,a),qc(b,o,s),Jc(b,xu,v),Jc(b,Ou,y),Jc(b,gu,u);const _=Jc(b,_u),w=ah(sh);qc(_,e.numeric,w);const k=ah(sh),x=ah();qc(k,n,k),qc(k,r,x),qc(x,n,k),qc(x,r,x),Jc(b,Lu,k),Jc(w,Lu,k);const S=Jc(l,_u),E=Jc(c,_u),O=Jc(E,Lu),C=Jc(O,Lu);qc(l,e.domain,a),Jc(l,xu,v),Jc(l,Ou,y),qc(c,e.domain,a),Jc(c,xu,v),Jc(c,Ou,y),qc(S,e.domain,k),Jc(S,Lu,k),qc(C,e.domain,k),qc(C,n,k),Jc(C,Lu,k);const A=Jc(k,iu),M=Jc(k,su),T=Jc(k,au),N=Jc(k,lu);Jc(x,iu,A),Jc(x,su,M),Jc(x,au,T),Jc(x,lu,N),Jc(A,cu,k),Jc(M,uu,k),Jc(T,hu,k),Jc(N,pu,k),Jc(A,cu,k);const I=ah(sh),R=ah(sh),L=ah(sh),D=ah(sh);qc(A,n,I),qc(M,n,R),qc(T,n,L),qc(N,n,D);const $=ah(),P=ah(),z=ah(),j=ah();return qc(A,r),qc(M,r),qc(T,r),qc(N,r),qc(I,n,I),qc(R,n,R),qc(L,n,L),qc(D,n,D),qc(I,r,I),qc(R,r,R),qc(L,r,L),qc(D,r,D),qc($,n,$),qc(P,n,R),qc(z,n,L),qc(j,n,D),qc($,r,$),qc(P,r,P),qc(z,r,z),qc(j,r,j),Jc(R,uu,k),Jc(L,hu,k),Jc(D,pu,k),Jc(I,cu,k),Jc(P,uu,k),Jc(z,hu,k),Jc(j,pu,k),Jc($,pu,k),Jc(i,Xc,b),Jc(i,ou,ih),{start:i,tokens:ju}}(uh.scanner.tokens);for(let t=0;t<uh.pluginQueue.length;t++)uh.pluginQueue[t][1]({scanner:uh.scanner,parser:uh.parser});uh.initialized=!0}function dh(t){return uh.initialized||ph(),function(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,c=null,u=0,h=null,p=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(p=0,h=a):p>=0&&p++,o++,u++;if(p<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(lh(oh,e,s)),s=[]),o-=p,u-=p;const t=h.t,r=n.slice(o-u,o);i.push(lh(t,e,r))}}return s.length>0&&i.push(lh(oh,e,s)),i}(uh.parser.start,t,function(t,e){const n=function(t){const e=[],n=t.length;let r=0;for(;r<n;){let o,i=t.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}(e.replace(/[A-Z]/g,(t=>t.toLowerCase()))),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,l=null,c=0,u=null,h=-1,p=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(h=0,p=0,u=a):h>=0&&(h+=n[s].length,p++),c+=n[s].length,i+=n[s].length,s++;i-=h,s-=p,c-=h,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}(uh.scanner.start,t))}function fh(t,e,n){if(void 0===e&&(e=null),void 0===n&&(n=null),e&&"object"==typeof e){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Qu(n),o=dh(t),i=[];for(let t=0;t<o.length;t++){const n=o[t];!n.isLink||e&&n.t!==e||i.push(n.toFormattedObject(r))}return i}class mh extends Oc{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(t,e,n){if(t.state.selection.empty)return!1;const r=n.content.textBetween(0,n.content.size).trim(),o=function(t,e){void 0===e&&(e=null);const n=dh(t);return 1===n.length&&n[0].isLink&&(!e||n[0].t===e)}(r);if(!r||!o)return!1;const i=this._createLinkAttrs(r,n.content);return this.editor.commands.applyLink(i),!0}_createLinkAttrs(t,e){const n=Fp.query(e,{typeName:_c.TEXT,mark:{typeName:kc.LINK},getMark:{typeName:kc.LINK}});return n?.attrs||{href:t}}}function gh(t){return(...e)=>n=>t(n,...e)}function yh(t){const e=Object.entries(t).reduce(((t,[e,n])=>{if(!n)return t;return`${t}--zw-${e.replace(/_/g,"-")}:${n};`}),"");return e?{style:e}:null}function vh(t){const e=yh(t);return["span",e?{...e,class:"zw-style"}:{},0]}function bh(t,...e){return({editor:n})=>(n.commands[t](...e),!0)}var _h=Object.defineProperty,wh=(t,e,n)=>(((t,e,n)=>{e in t?_h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);const kh=Object.freeze({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"}),xh="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",Sh=`[\\s|\\(]+(${xh})[,|\\s]+(${xh})[,|\\s]+(${xh})\\s*\\)?`,Eh=`[\\s|\\(]+(${xh})[,|\\s]+(${xh})[,|\\s]+(${xh})[,|\\s]+(${xh})\\s*\\)?`,Oh=Object.freeze({CSS_UNIT:new RegExp(xh),RGB:new RegExp(`rgb${Sh}`),RGBA:new RegExp(`rgba${Eh}`),HSL:new RegExp(`hsl${Sh}`),HSLA:new RegExp(`hsla${Eh}`),HSV:new RegExp(`hsv${Sh}`),HSVA:new RegExp(`hsva${Eh}`),HEX3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,HEX6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,HEX4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,HEX8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}),Ch=Object.freeze({WINDOW:Symbol("window")});function Ah(t,e){let n=!1;return function(){n||(t.apply(this,arguments),n=!0,setTimeout((function(){n=!1}),e))}}function Mh(t){return t>1||t<-1?t/100:t}const Th=3;function Nh(t){return Number.parseFloat(t.toFixed(Th+2).substr(0,Th+2))}function Ih(t){const e=function(t,e=1){const n=[];let r=0;for(;r<t.length;)n.push(t.substr(r,e)),r+=e;return n}(t.slice(1),2).map((t=>parseInt(t,16))),n=void 0!==e[3]?Math.round(e[3]/255*100)/100:1;return{r:e[0],g:e[1],b:e[2],a:n}}function Rh({h:t,s:e,v:n,a:r}){const o=r=>{const o=(r+t/60)%6;return n-n*e*Math.max(Math.min(o,4-o,1),0)},i=[o(5),o(3),o(1)].map((t=>Math.round(255*t)));return{r:i[0],g:i[1],b:i[2],a:r}}function Lh(t){if(!t)return{h:0,s:1,v:1,a:1};const e=t.r/255,n=t.g/255,r=t.b/255,o=Math.max(e,n,r),i=Math.min(e,n,r);let s=0;o!==i&&(o===e?s=60*(0+(n-r)/(o-i)):o===n?s=60*(2+(r-e)/(o-i)):o===r&&(s=60*(4+(e-n)/(o-i)))),s<0&&(s+=360);const a=[s,0===o?0:(o-i)/o,o],l=Nh(a[1]),c=Nh(a[2]);return{h:Math.floor(a[0]),s:l,v:c,a:t.a}}function Dh(t){const e=Lh(Ih(t));const n=function({h:t,s:e,v:n,a:r}){const o=n-n*e/2;return{h:t,s:Nh(1===o||0===o?0:(n-o)/Math.min(o,1-o)),l:Nh(o),a:r}}(e),r=Ih(t);return{alpha:e.a,hex:t.substr(0,7),hexa:t,hsla:n,hsva:e,hue:e.h,rgba:r}}function $h(t,e,n="0"){return t+n.repeat(Math.max(0,e-t.length))}function Ph(t){return Dh(function(t){let e=t;return e.startsWith("#")&&(e=e.slice(1)),e=e.replace(/([^0-9a-f])/gi,"F"),3!==e.length&&4!==e.length||(e=e.split("").map((t=>t+t)).join("")),e=6===e.length?$h(e,8,"F"):$h($h(e,6),8,"F"),`#${e}`.toUpperCase().substr(0,9)}(t))}const zh=class t{constructor(t){wh(this,"rgba"),wh(this,"hsva"),wh(this,"alpha"),this.rgba=t,this.hsva=this.calcHsva(),this.alpha=t.a}static create(e){if(!e)return t.fromBlack();let n=e.replace(/^\s+/,"").replace(/\s+$/,"").toLowerCase();if((t=>t in kh)(n))n=kh[n];else if(n===this.TRANSPARENT)return t.fromTransparent();const r=Oh.RGB.exec(n)||Oh.RGBA.exec(n);if(r){const e=void 0===r[4]?1:r[4];return t.fromRgba({r:Number.parseInt(r[1]),g:Number.parseInt(r[2]),b:Number.parseInt(r[3]),a:Number.parseFloat(e.toString())})}const o=Oh.HSL.exec(n)||Oh.HSLA.exec(n);if(o){const e=void 0===o[4]?1:o[4];return t.fromHsla({h:Number.parseInt(o[1]),s:Number.parseFloat(o[2]),l:Number.parseFloat(o[3]),a:Number.parseFloat(e.toString())})}const i=Oh.HSV.exec(n)||Oh.HSVA.exec(n);if(i){const e=void 0===i[4]?1:i[4];return t.fromHsva({h:Number.parseInt(i[1]),s:Number.parseFloat(i[2]),v:Number.parseFloat(i[3]),a:Number.parseFloat(e.toString())})}return Oh.HEX8.exec(n)||Oh.HEX6.exec(n)||Oh.HEX4.exec(n)||Oh.HEX3.exec(n)?t.fromHex(n):t.fromBlack()}static fromHex(e){const{rgba:n}=Ph(e);return new t(n)}static fromRgba({r:e,g:n,b:r,a:o}){const i=Mh(o);return new t({r:e,g:n,b:r,a:i})}static fromHsla({h:e,s:n,l:r,a:o}){const i=Mh(n),s=Mh(r),a=Mh(o);return t.fromHsva(function({h:t,s:e,l:n,a:r}){const o=n+e*Math.min(n,1-n);return{h:t,s:Nh(0===o?0:2-2*n/o),v:Nh(o),a:r}}({h:e,s:i,l:s,a:a}))}static fromHsva({h:e,s:n,v:r,a:o}){const i=Rh({h:e,s:Mh(n),v:Mh(r),a:Mh(o)});return new t(i)}static fromTransparent(){return new t({r:0,g:0,b:0,a:0})}static fromWhite(){return new t({r:255,g:255,b:255,a:1})}static fromBlack(){return new t({r:0,g:0,b:0,a:1})}static isTransparent(e){return t.create(e).isTransparent()}static isDark(e){return t.create(e).isDark()}get hex(){return this.toHexString()}get r(){return this.rgba.r}get b(){return this.rgba.b}get g(){return this.rgba.g}get h(){return this.hsva.h}get s(){return this.hsva.s}get v(){return this.hsva.v}setAlpha(t){return this.alpha=t,this}toHexString(){return function(t){const e=t=>{const e=Math.round(t).toString(16);return("00".substr(0,2-e.length)+e).toUpperCase()};return`#${[e(t.r),e(t.g),e(t.b)].join("")}`}({r:this.r,g:this.g,b:this.b})}toRgbaString(){const t=`${Math.floor(100*this.alpha)}%`;return`rgba(${[this.r,this.g,this.b,t].join(", ")})`}updateRgb(t){this.rgba={...this.rgba,...t},this.hsva=this.calcHsva()}updateHsv(t){this.hsva={...this.hsva,...t},this.rgba=this.calcRgba()}isTransparent(){return 0===this.alpha}isDark(){return this.getBrightness()<128}getBrightness(){return(299*this.rgba.r+587*this.rgba.g+114*this.rgba.b)/1e3}calcHsva(){return Lh(this.rgba)}calcRgba(){return Rh(this.hsva)}};wh(zh,"TRANSPARENT","transparent"),wh(zh,"NONE","none");let jh=zh;Ch.WINDOW;function Fh(t){const e=jh.create(t);return 1===e.alpha?e.toHexString():e.toRgbaString()}function Hh(t,e){if(!t.includes("em"))return parseInt(t);const n=$p.getComputedStyle(e).fontSize,r=parseFloat(t)*parseFloat(n);return Math.round(r)}function Bh(t,e,n){if(!t.includes("px"))return t;const r=function(t,e){return(t.firstElementChild||t).style.fontSize||$p.getComputedStyle(e).fontSize}(e,n),o=Hh(r,n);return o?(parseInt(t)/o).toFixed(2):null}Ch.WINDOW,Ch.WINDOW,Ah(((t,e)=>{t(e)}),20);const Vh={start:bc.LEFT,end:bc.RIGHT};const Wh=(t,e,n,r)=>({from:Math.max(r,t.pos),to:Math.min(r+n.nodeSize,e.pos)});function qh(t,e){return t.resolve(e).depth+1}const Uh=(t,e)=>t.eq(e);var Kh,Jh,Gh={exports:{}};
2
17
  /**
3
18
  * @license
4
19
  * Lodash <https://lodash.com/>
@@ -6,4 +21,4 @@
6
21
  * Released under MIT license <https://lodash.com/license>
7
22
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
23
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
- */Uh=Jh,Kh=Jh.exports,function(){var t,e="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",o=16,i=32,a=64,l=128,c=256,u=1/0,h=9007199254740991,p=NaN,d=4294967295,f=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",o],["flip",512],["partial",i],["partialRight",a],["rearg",c]],m="[object Arguments]",g="[object Array]",y="[object Boolean]",v="[object Date]",b="[object Error]",_="[object Function]",w="[object GeneratorFunction]",k="[object Map]",x="[object Number]",S="[object Object]",E="[object Promise]",C="[object RegExp]",O="[object Set]",A="[object String]",M="[object Symbol]",T="[object WeakMap]",N="[object ArrayBuffer]",I="[object DataView]",R="[object Float32Array]",D="[object Float64Array]",L="[object Int8Array]",$="[object Int16Array]",P="[object Int32Array]",z="[object Uint8Array]",j="[object Uint8ClampedArray]",F="[object Uint16Array]",H="[object Uint32Array]",B=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,U=/[&<>"']/g,K=RegExp(q.source),J=RegExp(U.source),G=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(et.source),rt=/^\s+/,ot=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,st=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pt=/\w*$/,dt=/^[-+]0x[0-9a-f]+$/i,ft=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,vt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bt=/($^)/,_t=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",kt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xt="\\u2700-\\u27bf",St="a-z\\xdf-\\xf6\\xf8-\\xff",Et="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="['’]",Mt="["+wt+"]",Tt="["+Ot+"]",Nt="["+kt+"]",It="\\d+",Rt="["+xt+"]",Dt="["+St+"]",Lt="[^"+wt+Ot+It+xt+St+Et+"]",$t="\\ud83c[\\udffb-\\udfff]",Pt="[^"+wt+"]",zt="(?:\\ud83c[\\udde6-\\uddff]){2}",jt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="["+Et+"]",Ht="\\u200d",Bt="(?:"+Dt+"|"+Lt+")",Vt="(?:"+Ft+"|"+Lt+")",Wt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ut="(?:"+Nt+"|"+$t+")?",Kt="["+Ct+"]?",Jt=Kt+Ut+"(?:"+Ht+"(?:"+[Pt,zt,jt].join("|")+")"+Kt+Ut+")*",Gt="(?:"+[Rt,zt,jt].join("|")+")"+Jt,Yt="(?:"+[Pt+Nt+"?",Nt,zt,jt,Mt].join("|")+")",Xt=RegExp(At,"g"),Zt=RegExp(Nt,"g"),Qt=RegExp($t+"(?="+$t+")|"+Yt+Jt,"g"),te=RegExp([Ft+"?"+Dt+"+"+Wt+"(?="+[Tt,Ft,"$"].join("|")+")",Vt+"+"+qt+"(?="+[Tt,Ft+Bt,"$"].join("|")+")",Ft+"?"+Bt+"+"+Wt,Ft+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",It,Gt].join("|"),"g"),ee=RegExp("["+Ht+wt+kt+Ct+"]"),ne=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],oe=-1,ie={};ie[R]=ie[D]=ie[L]=ie[$]=ie[P]=ie[z]=ie[j]=ie[F]=ie[H]=!0,ie[m]=ie[g]=ie[N]=ie[y]=ie[I]=ie[v]=ie[b]=ie[_]=ie[k]=ie[x]=ie[S]=ie[C]=ie[O]=ie[A]=ie[T]=!1;var se={};se[m]=se[g]=se[N]=se[I]=se[y]=se[v]=se[R]=se[D]=se[L]=se[$]=se[P]=se[k]=se[x]=se[S]=se[C]=se[O]=se[A]=se[M]=se[z]=se[j]=se[F]=se[H]=!0,se[b]=se[_]=se[T]=!1;var ae={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},le=parseFloat,ce=parseInt,ue="object"==typeof s&&s&&s.Object===Object&&s,he="object"==typeof self&&self&&self.Object===Object&&self,pe=ue||he||Function("return this")(),de=Kh&&!Kh.nodeType&&Kh,fe=de&&Uh&&!Uh.nodeType&&Uh,me=fe&&fe.exports===de,ge=me&&ue.process,ye=function(){try{var t=fe&&fe.require&&fe.require("util").types;return t||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),ve=ye&&ye.isArrayBuffer,be=ye&&ye.isDate,_e=ye&&ye.isMap,we=ye&&ye.isRegExp,ke=ye&&ye.isSet,xe=ye&&ye.isTypedArray;function Se(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ee(t,e,n,r){for(var o=-1,i=null==t?0:t.length;++o<i;){var s=t[o];e(r,s,n(s),t)}return r}function Ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ae(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Me(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var s=t[n];e(s,n,t)&&(i[o++]=s)}return i}function Te(t,e){return!(null==t||!t.length)&&Fe(t,e,0)>-1}function Ne(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1}function Ie(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function Re(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function De(t,e,n,r){var o=-1,i=null==t?0:t.length;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}function Le(t,e,n,r){var o=null==t?0:t.length;for(r&&o&&(n=t[--o]);o--;)n=e(n,t[o],o,t);return n}function $e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Pe=We("length");function ze(t,e,n){var r;return n(t,(function(t,n,o){if(e(t,n,o))return r=n,!1})),r}function je(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}function Fe(t,e,n){return e==e?function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}(t,e,n):je(t,Be,n)}function He(t,e,n,r){for(var o=n-1,i=t.length;++o<i;)if(r(t[o],e))return o;return-1}function Be(t){return t!=t}function Ve(t,e){var n=null==t?0:t.length;return n?Ke(t,e)/n:p}function We(e){return function(n){return null==n?t:n[e]}}function qe(e){return function(n){return null==e?t:e[n]}}function Ue(t,e,n,r,o){return o(t,(function(t,o,i){n=r?(r=!1,t):e(n,t,o,i)})),n}function Ke(e,n){for(var r,o=-1,i=e.length;++o<i;){var s=n(e[o]);s!==t&&(r=r===t?s:r+s)}return r}function Je(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ge(t){return t?t.slice(0,dn(t)+1).replace(rt,""):t}function Ye(t){return function(e){return t(e)}}function Xe(t,e){return Ie(e,(function(e){return t[e]}))}function Ze(t,e){return t.has(e)}function Qe(t,e){for(var n=-1,r=t.length;++n<r&&Fe(e,t[n],0)>-1;);return n}function tn(t,e){for(var n=t.length;n--&&Fe(e,t[n],0)>-1;);return n}var en=qe({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nn=qe({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rn(t){return"\\"+ae[t]}function on(t){return ee.test(t)}function sn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function an(t,e){return function(n){return t(e(n))}}function ln(t,e){for(var n=-1,o=t.length,i=0,s=[];++n<o;){var a=t[n];a!==e&&a!==r||(t[n]=r,s[i++]=n)}return s}function cn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function hn(t){return on(t)?function(t){for(var e=Qt.lastIndex=0;Qt.test(t);)++e;return e}(t):Pe(t)}function pn(t){return on(t)?function(t){return t.match(Qt)||[]}(t):function(t){return t.split("")}(t)}function dn(t){for(var e=t.length;e--&&ot.test(t.charAt(e)););return e}var fn=qe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),mn=function s(ot){var wt,kt=(ot=null==ot?pe:mn.defaults(pe.Object(),ot,mn.pick(pe,re))).Array,xt=ot.Date,St=ot.Error,Et=ot.Function,Ct=ot.Math,Ot=ot.Object,At=ot.RegExp,Mt=ot.String,Tt=ot.TypeError,Nt=kt.prototype,It=Et.prototype,Rt=Ot.prototype,Dt=ot["__core-js_shared__"],Lt=It.toString,$t=Rt.hasOwnProperty,Pt=0,zt=(wt=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||""))?"Symbol(src)_1."+wt:"",jt=Rt.toString,Ft=Lt.call(Ot),Ht=pe._,Bt=At("^"+Lt.call($t).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=me?ot.Buffer:t,Wt=ot.Symbol,qt=ot.Uint8Array,Ut=Vt?Vt.allocUnsafe:t,Kt=an(Ot.getPrototypeOf,Ot),Jt=Ot.create,Gt=Rt.propertyIsEnumerable,Yt=Nt.splice,Qt=Wt?Wt.isConcatSpreadable:t,ee=Wt?Wt.iterator:t,ae=Wt?Wt.toStringTag:t,ue=function(){try{var t=di(Ot,"defineProperty");return t({},"",{}),t}catch(t){}}(),he=ot.clearTimeout!==pe.clearTimeout&&ot.clearTimeout,de=xt&&xt.now!==pe.Date.now&&xt.now,fe=ot.setTimeout!==pe.setTimeout&&ot.setTimeout,ge=Ct.ceil,ye=Ct.floor,Pe=Ot.getOwnPropertySymbols,qe=Vt?Vt.isBuffer:t,gn=ot.isFinite,yn=Nt.join,vn=an(Ot.keys,Ot),bn=Ct.max,_n=Ct.min,wn=xt.now,kn=ot.parseInt,xn=Ct.random,Sn=Nt.reverse,En=di(ot,"DataView"),Cn=di(ot,"Map"),On=di(ot,"Promise"),An=di(ot,"Set"),Mn=di(ot,"WeakMap"),Tn=di(Ot,"create"),Nn=Mn&&new Mn,In={},Rn=ji(En),Dn=ji(Cn),Ln=ji(On),$n=ji(An),Pn=ji(Mn),zn=Wt?Wt.prototype:t,jn=zn?zn.valueOf:t,Fn=zn?zn.toString:t;function Hn(t){if(na(t)&&!qs(t)&&!(t instanceof qn)){if(t instanceof Wn)return t;if($t.call(t,"__wrapped__"))return Fi(t)}return new Wn(t)}var Bn=function(){function e(){}return function(n){if(!ea(n))return{};if(Jt)return Jt(n);e.prototype=n;var r=new e;return e.prototype=t,r}}();function Vn(){}function Wn(e,n){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=t}function qn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Un(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Kn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Jn;++e<n;)this.add(t[e])}function Yn(t){var e=this.__data__=new Kn(t);this.size=e.size}function Xn(t,e){var n=qs(t),r=!n&&Ws(t),o=!n&&!r&&Gs(t),i=!n&&!r&&!o&&ua(t),s=n||r||o||i,a=s?Je(t.length,Mt):[],l=a.length;for(var c in t)!e&&!$t.call(t,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_i(c,l))||a.push(c);return a}function Zn(e){var n=e.length;return n?e[Gr(0,n-1)]:t}function Qn(t,e){return $i(No(t),lr(e,0,t.length))}function tr(t){return $i(No(t))}function er(e,n,r){(r!==t&&!Hs(e[n],r)||r===t&&!(n in e))&&sr(e,n,r)}function nr(e,n,r){var o=e[n];$t.call(e,n)&&Hs(o,r)&&(r!==t||n in e)||sr(e,n,r)}function rr(t,e){for(var n=t.length;n--;)if(Hs(t[n][0],e))return n;return-1}function or(t,e,n,r){return dr(t,(function(t,o,i){e(r,t,n(t),i)})),r}function ir(t,e){return t&&Io(e,Ia(e),t)}function sr(t,e,n){"__proto__"==e&&ue?ue(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(e,n){for(var r=-1,o=n.length,i=kt(o),s=null==e;++r<o;)i[r]=s?t:Oa(e,n[r]);return i}function lr(e,n,r){return e==e&&(r!==t&&(e=e<=r?e:r),n!==t&&(e=e>=n?e:n)),e}function cr(e,n,r,o,i,s){var a,l=1&n,c=2&n,u=4&n;if(r&&(a=i?r(e,o,i,s):r(e)),a!==t)return a;if(!ea(e))return e;var h=qs(e);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&$t.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!l)return No(e,a)}else{var p=gi(e),d=p==_||p==w;if(Gs(e))return Eo(e,l);if(p==S||p==m||d&&!i){if(a=c||d?{}:vi(e),!l)return c?function(t,e){return Io(t,mi(t),e)}(e,function(t,e){return t&&Io(e,Ra(e),t)}(a,e)):function(t,e){return Io(t,fi(t),e)}(e,ir(a,e))}else{if(!se[p])return i?e:{};a=function(t,e,n){var r,o=t.constructor;switch(e){case N:return Co(t);case y:case v:return new o(+t);case I:return function(t,e){var n=e?Co(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case R:case D:case L:case $:case P:case z:case j:case F:case H:return Oo(t,n);case k:return new o;case x:case A:return new o(t);case C:return function(t){var e=new t.constructor(t.source,pt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new o;case M:return r=t,jn?Ot(jn.call(r)):{}}}(e,p,l)}}s||(s=new Yn);var f=s.get(e);if(f)return f;s.set(e,a),aa(e)?e.forEach((function(t){a.add(cr(t,n,r,t,e,s))})):ra(e)&&e.forEach((function(t,o){a.set(o,cr(t,n,r,o,e,s))}));var g=h?t:(u?c?si:ii:c?Ra:Ia)(e);return Ce(g||e,(function(t,o){g&&(t=e[o=t]),nr(a,o,cr(t,n,r,o,e,s))})),a}function ur(e,n,r){var o=r.length;if(null==e)return!o;for(e=Ot(e);o--;){var i=r[o],s=n[i],a=e[i];if(a===t&&!(i in e)||!s(a))return!1}return!0}function hr(n,r,o){if("function"!=typeof n)throw new Tt(e);return Ii((function(){n.apply(t,o)}),r)}function pr(t,e,n,r){var o=-1,i=Te,s=!0,a=t.length,l=[],c=e.length;if(!a)return l;n&&(e=Ie(e,Ye(n))),r?(i=Ne,s=!1):e.length>=200&&(i=Ze,s=!1,e=new Gn(e));t:for(;++o<a;){var u=t[o],h=null==n?u:n(u);if(u=r||0!==u?u:0,s&&h==h){for(var p=c;p--;)if(e[p]===h)continue t;l.push(u)}else i(e,h,r)||l.push(u)}return l}Hn.templateSettings={escape:G,evaluate:Y,interpolate:X,variable:"",imports:{_:Hn}},Hn.prototype=Vn.prototype,Hn.prototype.constructor=Hn,Wn.prototype=Bn(Vn.prototype),Wn.prototype.constructor=Wn,qn.prototype=Bn(Vn.prototype),qn.prototype.constructor=qn,Un.prototype.clear=function(){this.__data__=Tn?Tn(null):{},this.size=0},Un.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Un.prototype.get=function(e){var r=this.__data__;if(Tn){var o=r[e];return o===n?t:o}return $t.call(r,e)?r[e]:t},Un.prototype.has=function(e){var n=this.__data__;return Tn?n[e]!==t:$t.call(n,e)},Un.prototype.set=function(e,r){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Tn&&r===t?n:r,this},Kn.prototype.clear=function(){this.__data__=[],this.size=0},Kn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0||(n==e.length-1?e.pop():Yt.call(e,n,1),--this.size,0))},Kn.prototype.get=function(e){var n=this.__data__,r=rr(n,e);return r<0?t:n[r][1]},Kn.prototype.has=function(t){return rr(this.__data__,t)>-1},Kn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Jn.prototype.clear=function(){this.size=0,this.__data__={hash:new Un,map:new(Cn||Kn),string:new Un}},Jn.prototype.delete=function(t){var e=hi(this,t).delete(t);return this.size-=e?1:0,e},Jn.prototype.get=function(t){return hi(this,t).get(t)},Jn.prototype.has=function(t){return hi(this,t).has(t)},Jn.prototype.set=function(t,e){var n=hi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(t){return this.__data__.set(t,n),this},Gn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.clear=function(){this.__data__=new Kn,this.size=0},Yn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Yn.prototype.get=function(t){return this.__data__.get(t)},Yn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Kn){var r=n.__data__;if(!Cn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Jn(r)}return n.set(t,e),this.size=n.size,this};var dr=Lo(wr),fr=Lo(kr,!0);function mr(t,e){var n=!0;return dr(t,(function(t,r,o){return n=!!e(t,r,o)})),n}function gr(e,n,r){for(var o=-1,i=e.length;++o<i;){var s=e[o],a=n(s);if(null!=a&&(l===t?a==a&&!ca(a):r(a,l)))var l=a,c=s}return c}function yr(t,e){var n=[];return dr(t,(function(t,r,o){e(t,r,o)&&n.push(t)})),n}function vr(t,e,n,r,o){var i=-1,s=t.length;for(n||(n=bi),o||(o=[]);++i<s;){var a=t[i];e>0&&n(a)?e>1?vr(a,e-1,n,r,o):Re(o,a):r||(o[o.length]=a)}return o}var br=$o(),_r=$o(!0);function wr(t,e){return t&&br(t,e,Ia)}function kr(t,e){return t&&_r(t,e,Ia)}function xr(t,e){return Me(e,(function(e){return Zs(t[e])}))}function Sr(e,n){for(var r=0,o=(n=wo(n,e)).length;null!=e&&r<o;)e=e[zi(n[r++])];return r&&r==o?e:t}function Er(t,e,n){var r=e(t);return qs(t)?r:Re(r,n(t))}function Cr(e){return null==e?e===t?"[object Undefined]":"[object Null]":ae&&ae in Ot(e)?function(e){var n=$t.call(e,ae),r=e[ae];try{e[ae]=t;var o=!0}catch(t){}var i=jt.call(e);return o&&(n?e[ae]=r:delete e[ae]),i}(e):function(t){return jt.call(t)}(e)}function Or(t,e){return t>e}function Ar(t,e){return null!=t&&$t.call(t,e)}function Mr(t,e){return null!=t&&e in Ot(t)}function Tr(e,n,r){for(var o=r?Ne:Te,i=e[0].length,s=e.length,a=s,l=kt(s),c=1/0,u=[];a--;){var h=e[a];a&&n&&(h=Ie(h,Ye(n))),c=_n(h.length,c),l[a]=!r&&(n||i>=120&&h.length>=120)?new Gn(a&&h):t}h=e[0];var p=-1,d=l[0];t:for(;++p<i&&u.length<c;){var f=h[p],m=n?n(f):f;if(f=r||0!==f?f:0,!(d?Ze(d,m):o(u,m,r))){for(a=s;--a;){var g=l[a];if(!(g?Ze(g,m):o(e[a],m,r)))continue t}d&&d.push(m),u.push(f)}}return u}function Nr(e,n,r){var o=null==(e=Mi(e,n=wo(n,e)))?e:e[zi(Xi(n))];return null==o?t:Se(o,e,r)}function Ir(t){return na(t)&&Cr(t)==m}function Rr(e,n,r,o,i){return e===n||(null==e||null==n||!na(e)&&!na(n)?e!=e&&n!=n:function(e,n,r,o,i,s){var a=qs(e),l=qs(n),c=a?g:gi(e),u=l?g:gi(n),h=(c=c==m?S:c)==S,p=(u=u==m?S:u)==S,d=c==u;if(d&&Gs(e)){if(!Gs(n))return!1;a=!0,h=!1}if(d&&!h)return s||(s=new Yn),a||ua(e)?ri(e,n,r,o,i,s):function(t,e,n,r,o,i,s){switch(n){case I:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case N:return!(t.byteLength!=e.byteLength||!i(new qt(t),new qt(e)));case y:case v:case x:return Hs(+t,+e);case b:return t.name==e.name&&t.message==e.message;case C:case A:return t==e+"";case k:var a=sn;case O:var l=1&r;if(a||(a=cn),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var u=ri(a(t),a(e),r,o,i,s);return s.delete(t),u;case M:if(jn)return jn.call(t)==jn.call(e)}return!1}(e,n,c,r,o,i,s);if(!(1&r)){var f=h&&$t.call(e,"__wrapped__"),_=p&&$t.call(n,"__wrapped__");if(f||_){var w=f?e.value():e,E=_?n.value():n;return s||(s=new Yn),i(w,E,r,o,s)}}return!!d&&(s||(s=new Yn),function(e,n,r,o,i,s){var a=1&r,l=ii(e),c=l.length,u=ii(n),h=u.length;if(c!=h&&!a)return!1;for(var p=c;p--;){var d=l[p];if(!(a?d in n:$t.call(n,d)))return!1}var f=s.get(e),m=s.get(n);if(f&&m)return f==n&&m==e;var g=!0;s.set(e,n),s.set(n,e);for(var y=a;++p<c;){var v=e[d=l[p]],b=n[d];if(o)var _=a?o(b,v,d,n,e,s):o(v,b,d,e,n,s);if(!(_===t?v===b||i(v,b,r,o,s):_)){g=!1;break}y||(y="constructor"==d)}if(g&&!y){var w=e.constructor,k=n.constructor;w==k||!("constructor"in e)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof k&&k instanceof k||(g=!1)}return s.delete(e),s.delete(n),g}(e,n,r,o,i,s))}(e,n,r,o,Rr,i))}function Dr(e,n,r,o){var i=r.length,s=i,a=!o;if(null==e)return!s;for(e=Ot(e);i--;){var l=r[i];if(a&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<s;){var c=(l=r[i])[0],u=e[c],h=l[1];if(a&&l[2]){if(u===t&&!(c in e))return!1}else{var p=new Yn;if(o)var d=o(u,h,c,e,n,p);if(!(d===t?Rr(h,u,3,o,p):d))return!1}}return!0}function Lr(t){return!(!ea(t)||(e=t,zt&&zt in e))&&(Zs(t)?Bt:mt).test(ji(t));var e}function $r(t){return"function"==typeof t?t:null==t?ol:"object"==typeof t?qs(t)?Br(t[0],t[1]):Hr(t):dl(t)}function Pr(t){if(!Ei(t))return vn(t);var e=[];for(var n in Ot(t))$t.call(t,n)&&"constructor"!=n&&e.push(n);return e}function zr(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Ot(t))e.push(n);return e}(t);var e=Ei(t),n=[];for(var r in t)("constructor"!=r||!e&&$t.call(t,r))&&n.push(r);return n}function jr(t,e){return t<e}function Fr(t,e){var n=-1,r=Ks(t)?kt(t.length):[];return dr(t,(function(t,o,i){r[++n]=e(t,o,i)})),r}function Hr(t){var e=pi(t);return 1==e.length&&e[0][2]?Oi(e[0][0],e[0][1]):function(n){return n===t||Dr(n,t,e)}}function Br(e,n){return ki(e)&&Ci(n)?Oi(zi(e),n):function(r){var o=Oa(r,e);return o===t&&o===n?Aa(r,e):Rr(n,o,3)}}function Vr(e,n,r,o,i){e!==n&&br(n,(function(s,a){if(i||(i=new Yn),ea(s))!function(e,n,r,o,i,s,a){var l=Ti(e,r),c=Ti(n,r),u=a.get(c);if(u)er(e,r,u);else{var h=s?s(l,c,r+"",e,n,a):t,p=h===t;if(p){var d=qs(c),f=!d&&Gs(c),m=!d&&!f&&ua(c);h=c,d||f||m?qs(l)?h=l:Js(l)?h=No(l):f?(p=!1,h=Eo(c,!0)):m?(p=!1,h=Oo(c,!0)):h=[]:ia(c)||Ws(c)?(h=l,Ws(l)?h=va(l):ea(l)&&!Zs(l)||(h=vi(c))):p=!1}p&&(a.set(c,h),i(h,c,o,s,a),a.delete(c)),er(e,r,h)}}(e,n,a,r,Vr,o,i);else{var l=o?o(Ti(e,a),s,a+"",e,n,i):t;l===t&&(l=s),er(e,a,l)}}),Ra)}function Wr(e,n){var r=e.length;if(r)return _i(n+=n<0?r:0,r)?e[n]:t}function qr(t,e,n){e=e.length?Ie(e,(function(t){return qs(t)?function(e){return Sr(e,1===t.length?t[0]:t)}:t})):[ol];var r=-1;e=Ie(e,Ye(ui()));var o=Fr(t,(function(t,n,o){var i=Ie(e,(function(e){return e(t)}));return{criteria:i,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(o,(function(t,e){return function(t,e,n){for(var r=-1,o=t.criteria,i=e.criteria,s=o.length,a=n.length;++r<s;){var l=Ao(o[r],i[r]);if(l)return r>=a?l:l*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function Ur(t,e,n){for(var r=-1,o=e.length,i={};++r<o;){var s=e[r],a=Sr(t,s);n(a,s)&&to(i,wo(s,t),a)}return i}function Kr(t,e,n,r){var o=r?He:Fe,i=-1,s=e.length,a=t;for(t===e&&(e=No(e)),n&&(a=Ie(t,Ye(n)));++i<s;)for(var l=0,c=e[i],u=n?n(c):c;(l=o(a,u,l,r))>-1;)a!==t&&Yt.call(a,l,1),Yt.call(t,l,1);return t}function Jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var o=e[n];if(n==r||o!==i){var i=o;_i(o)?Yt.call(t,o,1):po(t,o)}}return t}function Gr(t,e){return t+ye(xn()*(e-t+1))}function Yr(t,e){var n="";if(!t||e<1||e>h)return n;do{e%2&&(n+=t),(e=ye(e/2))&&(t+=t)}while(e);return n}function Xr(t,e){return Ri(Ai(t,e,ol),t+"")}function Zr(t){return Zn(Ha(t))}function Qr(t,e){var n=Ha(t);return $i(n,lr(e,0,n.length))}function to(e,n,r,o){if(!ea(e))return e;for(var i=-1,s=(n=wo(n,e)).length,a=s-1,l=e;null!=l&&++i<s;){var c=zi(n[i]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=a){var h=l[c];(u=o?o(h,c,l):t)===t&&(u=ea(h)?h:_i(n[i+1])?[]:{})}nr(l,c,u),l=l[c]}return e}var eo=Nn?function(t,e){return Nn.set(t,e),t}:ol,no=ue?function(t,e){return ue(t,"toString",{configurable:!0,enumerable:!1,value:el(e),writable:!0})}:ol;function ro(t){return $i(Ha(t))}function oo(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=kt(o);++r<o;)i[r]=t[r+e];return i}function io(t,e){var n;return dr(t,(function(t,r,o){return!(n=e(t,r,o))})),!!n}function so(t,e,n){var r=0,o=null==t?r:t.length;if("number"==typeof e&&e==e&&o<=2147483647){for(;r<o;){var i=r+o>>>1,s=t[i];null!==s&&!ca(s)&&(n?s<=e:s<e)?r=i+1:o=i}return o}return ao(t,e,ol,n)}function ao(e,n,r,o){var i=0,s=null==e?0:e.length;if(0===s)return 0;for(var a=(n=r(n))!=n,l=null===n,c=ca(n),u=n===t;i<s;){var h=ye((i+s)/2),p=r(e[h]),d=p!==t,f=null===p,m=p==p,g=ca(p);if(a)var y=o||m;else y=u?m&&(o||d):l?m&&d&&(o||!f):c?m&&d&&!f&&(o||!g):!f&&!g&&(o?p<=n:p<n);y?i=h+1:s=h}return _n(s,4294967294)}function lo(t,e){for(var n=-1,r=t.length,o=0,i=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!Hs(a,l)){var l=a;i[o++]=0===s?0:s}}return i}function co(t){return"number"==typeof t?t:ca(t)?p:+t}function uo(t){if("string"==typeof t)return t;if(qs(t))return Ie(t,uo)+"";if(ca(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ho(t,e,n){var r=-1,o=Te,i=t.length,s=!0,a=[],l=a;if(n)s=!1,o=Ne;else if(i>=200){var c=e?null:Xo(t);if(c)return cn(c);s=!1,o=Ze,l=new Gn}else l=e?[]:a;t:for(;++r<i;){var u=t[r],h=e?e(u):u;if(u=n||0!==u?u:0,s&&h==h){for(var p=l.length;p--;)if(l[p]===h)continue t;e&&l.push(h),a.push(u)}else o(l,h,n)||(l!==a&&l.push(h),a.push(u))}return a}function po(t,e){return null==(t=Mi(t,e=wo(e,t)))||delete t[zi(Xi(e))]}function fo(t,e,n,r){return to(t,e,n(Sr(t,e)),r)}function mo(t,e,n,r){for(var o=t.length,i=r?o:-1;(r?i--:++i<o)&&e(t[i],i,t););return n?oo(t,r?0:i,r?i+1:o):oo(t,r?i+1:0,r?o:i)}function go(t,e){var n=t;return n instanceof qn&&(n=n.value()),De(e,(function(t,e){return e.func.apply(e.thisArg,Re([t],e.args))}),n)}function yo(t,e,n){var r=t.length;if(r<2)return r?ho(t[0]):[];for(var o=-1,i=kt(r);++o<r;)for(var s=t[o],a=-1;++a<r;)a!=o&&(i[o]=pr(i[o]||s,t[a],e,n));return ho(vr(i,1),e,n)}function vo(e,n,r){for(var o=-1,i=e.length,s=n.length,a={};++o<i;){var l=o<s?n[o]:t;r(a,e[o],l)}return a}function bo(t){return Js(t)?t:[]}function _o(t){return"function"==typeof t?t:ol}function wo(t,e){return qs(t)?t:ki(t,e)?[t]:Pi(ba(t))}var ko=Xr;function xo(e,n,r){var o=e.length;return r=r===t?o:r,!n&&r>=o?e:oo(e,n,r)}var So=he||function(t){return pe.clearTimeout(t)};function Eo(t,e){if(e)return t.slice();var n=t.length,r=Ut?Ut(n):new t.constructor(n);return t.copy(r),r}function Co(t){var e=new t.constructor(t.byteLength);return new qt(e).set(new qt(t)),e}function Oo(t,e){var n=e?Co(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ao(e,n){if(e!==n){var r=e!==t,o=null===e,i=e==e,s=ca(e),a=n!==t,l=null===n,c=n==n,u=ca(n);if(!l&&!u&&!s&&e>n||s&&a&&c&&!l&&!u||o&&a&&c||!r&&c||!i)return 1;if(!o&&!s&&!u&&e<n||u&&r&&i&&!o&&!s||l&&r&&i||!a&&i||!c)return-1}return 0}function Mo(t,e,n,r){for(var o=-1,i=t.length,s=n.length,a=-1,l=e.length,c=bn(i-s,0),u=kt(l+c),h=!r;++a<l;)u[a]=e[a];for(;++o<s;)(h||o<i)&&(u[n[o]]=t[o]);for(;c--;)u[a++]=t[o++];return u}function To(t,e,n,r){for(var o=-1,i=t.length,s=-1,a=n.length,l=-1,c=e.length,u=bn(i-a,0),h=kt(u+c),p=!r;++o<u;)h[o]=t[o];for(var d=o;++l<c;)h[d+l]=e[l];for(;++s<a;)(p||o<i)&&(h[d+n[s]]=t[o++]);return h}function No(t,e){var n=-1,r=t.length;for(e||(e=kt(r));++n<r;)e[n]=t[n];return e}function Io(e,n,r,o){var i=!r;r||(r={});for(var s=-1,a=n.length;++s<a;){var l=n[s],c=o?o(r[l],e[l],l,r,e):t;c===t&&(c=e[l]),i?sr(r,l,c):nr(r,l,c)}return r}function Ro(t,e){return function(n,r){var o=qs(n)?Ee:or,i=e?e():{};return o(n,t,ui(r,2),i)}}function Do(e){return Xr((function(n,r){var o=-1,i=r.length,s=i>1?r[i-1]:t,a=i>2?r[2]:t;for(s=e.length>3&&"function"==typeof s?(i--,s):t,a&&wi(r[0],r[1],a)&&(s=i<3?t:s,i=1),n=Ot(n);++o<i;){var l=r[o];l&&e(n,l,o,s)}return n}))}function Lo(t,e){return function(n,r){if(null==n)return n;if(!Ks(n))return t(n,r);for(var o=n.length,i=e?o:-1,s=Ot(n);(e?i--:++i<o)&&!1!==r(s[i],i,s););return n}}function $o(t){return function(e,n,r){for(var o=-1,i=Ot(e),s=r(e),a=s.length;a--;){var l=s[t?a:++o];if(!1===n(i[l],l,i))break}return e}}function Po(e){return function(n){var r=on(n=ba(n))?pn(n):t,o=r?r[0]:n.charAt(0),i=r?xo(r,1).join(""):n.slice(1);return o[e]()+i}}function zo(t){return function(e){return De(Za(Wa(e).replace(Xt,"")),t,"")}}function jo(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Bn(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function Fo(e){return function(n,r,o){var i=Ot(n);if(!Ks(n)){var s=ui(r,3);n=Ia(n),r=function(t){return s(i[t],t,i)}}var a=e(n,r,o);return a>-1?i[s?n[a]:a]:t}}function Ho(n){return oi((function(r){var o=r.length,i=o,s=Wn.prototype.thru;for(n&&r.reverse();i--;){var a=r[i];if("function"!=typeof a)throw new Tt(e);if(s&&!l&&"wrapper"==li(a))var l=new Wn([],!0)}for(i=l?i:o;++i<o;){var c=li(a=r[i]),u="wrapper"==c?ai(a):t;l=u&&xi(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[li(u[0])].apply(l,u[3]):1==a.length&&xi(a)?l[c]():l.thru(a)}return function(){var t=arguments,e=t[0];if(l&&1==t.length&&qs(e))return l.plant(e).value();for(var n=0,i=o?r[n].apply(this,t):e;++n<o;)i=r[n].call(this,i);return i}}))}function Bo(e,n,r,o,i,s,a,c,u,h){var p=n&l,d=1&n,f=2&n,m=24&n,g=512&n,y=f?t:jo(e);return function l(){for(var v=arguments.length,b=kt(v),_=v;_--;)b[_]=arguments[_];if(m)var w=ci(l),k=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,w);if(o&&(b=Mo(b,o,i,m)),s&&(b=To(b,s,a,m)),v-=k,m&&v<h){var x=ln(b,w);return Go(e,n,Bo,l.placeholder,r,b,x,c,u,h-v)}var S=d?r:this,E=f?S[e]:e;return v=b.length,c?b=function(e,n){for(var r=e.length,o=_n(n.length,r),i=No(e);o--;){var s=n[o];e[o]=_i(s,r)?i[s]:t}return e}(b,c):g&&v>1&&b.reverse(),p&&u<v&&(b.length=u),this&&this!==pe&&this instanceof l&&(E=y||jo(E)),E.apply(S,b)}}function Vo(t,e){return function(n,r){return function(t,e,n,r){return wr(t,(function(t,o,i){e(r,n(t),o,i)})),r}(n,t,e(r),{})}}function Wo(e,n){return function(r,o){var i;if(r===t&&o===t)return n;if(r!==t&&(i=r),o!==t){if(i===t)return o;"string"==typeof r||"string"==typeof o?(r=uo(r),o=uo(o)):(r=co(r),o=co(o)),i=e(r,o)}return i}}function qo(t){return oi((function(e){return e=Ie(e,Ye(ui())),Xr((function(n){var r=this;return t(e,(function(t){return Se(t,r,n)}))}))}))}function Uo(e,n){var r=(n=n===t?" ":uo(n)).length;if(r<2)return r?Yr(n,e):n;var o=Yr(n,ge(e/hn(n)));return on(n)?xo(pn(o),0,e).join(""):o.slice(0,e)}function Ko(e){return function(n,r,o){return o&&"number"!=typeof o&&wi(n,r,o)&&(r=o=t),n=fa(n),r===t?(r=n,n=0):r=fa(r),function(t,e,n,r){for(var o=-1,i=bn(ge((e-t)/(n||1)),0),s=kt(i);i--;)s[r?i:++o]=t,t+=n;return s}(n,r,o=o===t?n<r?1:-1:fa(o),e)}}function Jo(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ya(e),n=ya(n)),t(e,n)}}function Go(e,n,r,o,s,l,c,u,h,p){var d=8&n;n|=d?i:a,4&(n&=~(d?a:i))||(n&=-4);var f=[e,n,s,d?l:t,d?c:t,d?t:l,d?t:c,u,h,p],m=r.apply(t,f);return xi(e)&&Ni(m,f),m.placeholder=o,Di(m,e,n)}function Yo(t){var e=Ct[t];return function(t,n){if(t=ya(t),(n=null==n?0:_n(ma(n),292))&&gn(t)){var r=(ba(t)+"e").split("e");return+((r=(ba(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Xo=An&&1/cn(new An([,-0]))[1]==u?function(t){return new An(t)}:cl;function Zo(t){return function(e){var n=gi(e);return n==k?sn(e):n==O?un(e):function(t,e){return Ie(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Qo(n,s,u,h,p,d,f,m){var g=2&s;if(!g&&"function"!=typeof n)throw new Tt(e);var y=h?h.length:0;if(y||(s&=-97,h=p=t),f=f===t?f:bn(ma(f),0),m=m===t?m:ma(m),y-=p?p.length:0,s&a){var v=h,b=p;h=p=t}var _=g?t:ai(n),w=[n,s,u,h,p,v,b,d,f,m];if(_&&function(t,e){var n=t[1],o=e[1],i=n|o,s=i<131,a=o==l&&8==n||o==l&&n==c&&t[7].length<=e[8]||384==o&&e[7].length<=e[8]&&8==n;if(!s&&!a)return t;1&o&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var h=t[3];t[3]=h?Mo(h,u,e[4]):u,t[4]=h?ln(t[3],r):e[4]}(u=e[5])&&(h=t[5],t[5]=h?To(h,u,e[6]):u,t[6]=h?ln(t[5],r):e[6]),(u=e[7])&&(t[7]=u),o&l&&(t[8]=null==t[8]?e[8]:_n(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(w,_),n=w[0],s=w[1],u=w[2],h=w[3],p=w[4],!(m=w[9]=w[9]===t?g?0:n.length:bn(w[9]-y,0))&&24&s&&(s&=-25),s&&1!=s)k=8==s||s==o?function(e,n,r){var o=jo(e);return function i(){for(var s=arguments.length,a=kt(s),l=s,c=ci(i);l--;)a[l]=arguments[l];var u=s<3&&a[0]!==c&&a[s-1]!==c?[]:ln(a,c);return(s-=u.length)<r?Go(e,n,Bo,i.placeholder,t,a,u,t,t,r-s):Se(this&&this!==pe&&this instanceof i?o:e,this,a)}}(n,s,m):s!=i&&33!=s||p.length?Bo.apply(t,w):function(t,e,n,r){var o=1&e,i=jo(t);return function e(){for(var s=-1,a=arguments.length,l=-1,c=r.length,u=kt(c+a),h=this&&this!==pe&&this instanceof e?i:t;++l<c;)u[l]=r[l];for(;a--;)u[l++]=arguments[++s];return Se(h,o?n:this,u)}}(n,s,u,h);else var k=function(t,e,n){var r=1&e,o=jo(t);return function e(){return(this&&this!==pe&&this instanceof e?o:t).apply(r?n:this,arguments)}}(n,s,u);return Di((_?eo:Ni)(k,w),n,s)}function ti(e,n,r,o){return e===t||Hs(e,Rt[r])&&!$t.call(o,r)?n:e}function ei(e,n,r,o,i,s){return ea(e)&&ea(n)&&(s.set(n,e),Vr(e,n,t,ei,s),s.delete(n)),e}function ni(e){return ia(e)?t:e}function ri(e,n,r,o,i,s){var a=1&r,l=e.length,c=n.length;if(l!=c&&!(a&&c>l))return!1;var u=s.get(e),h=s.get(n);if(u&&h)return u==n&&h==e;var p=-1,d=!0,f=2&r?new Gn:t;for(s.set(e,n),s.set(n,e);++p<l;){var m=e[p],g=n[p];if(o)var y=a?o(g,m,p,n,e,s):o(m,g,p,e,n,s);if(y!==t){if(y)continue;d=!1;break}if(f){if(!$e(n,(function(t,e){if(!Ze(f,e)&&(m===t||i(m,t,r,o,s)))return f.push(e)}))){d=!1;break}}else if(m!==g&&!i(m,g,r,o,s)){d=!1;break}}return s.delete(e),s.delete(n),d}function oi(e){return Ri(Ai(e,t,Ui),e+"")}function ii(t){return Er(t,Ia,fi)}function si(t){return Er(t,Ra,mi)}var ai=Nn?function(t){return Nn.get(t)}:cl;function li(t){for(var e=t.name+"",n=In[e],r=$t.call(In,e)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==t)return o.name}return e}function ci(t){return($t.call(Hn,"placeholder")?Hn:t).placeholder}function ui(){var t=Hn.iteratee||il;return t=t===il?$r:t,arguments.length?t(arguments[0],arguments[1]):t}function hi(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function pi(t){for(var e=Ia(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Ci(o)]}return e}function di(e,n){var r=function(e,n){return null==e?t:e[n]}(e,n);return Lr(r)?r:t}var fi=Pe?function(t){return null==t?[]:(t=Ot(t),Me(Pe(t),(function(e){return Gt.call(t,e)})))}:gl,mi=Pe?function(t){for(var e=[];t;)Re(e,fi(t)),t=Kt(t);return e}:gl,gi=Cr;function yi(t,e,n){for(var r=-1,o=(e=wo(e,t)).length,i=!1;++r<o;){var s=zi(e[r]);if(!(i=null!=t&&n(t,s)))break;t=t[s]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&ta(o)&&_i(s,o)&&(qs(t)||Ws(t))}function vi(t){return"function"!=typeof t.constructor||Ei(t)?{}:Bn(Kt(t))}function bi(t){return qs(t)||Ws(t)||!!(Qt&&t&&t[Qt])}function _i(t,e){var n=typeof t;return!!(e=null==e?h:e)&&("number"==n||"symbol"!=n&&yt.test(t))&&t>-1&&t%1==0&&t<e}function wi(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Ks(n)&&_i(e,n.length):"string"==r&&e in n)&&Hs(n[e],t)}function ki(t,e){if(qs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||Q.test(t)||!Z.test(t)||null!=e&&t in Ot(e)}function xi(t){var e=li(t),n=Hn[e];if("function"!=typeof n||!(e in qn.prototype))return!1;if(t===n)return!0;var r=ai(n);return!!r&&t===r[0]}(En&&gi(new En(new ArrayBuffer(1)))!=I||Cn&&gi(new Cn)!=k||On&&gi(On.resolve())!=E||An&&gi(new An)!=O||Mn&&gi(new Mn)!=T)&&(gi=function(e){var n=Cr(e),r=n==S?e.constructor:t,o=r?ji(r):"";if(o)switch(o){case Rn:return I;case Dn:return k;case Ln:return E;case $n:return O;case Pn:return T}return n});var Si=Dt?Zs:yl;function Ei(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}function Ci(t){return t==t&&!ea(t)}function Oi(e,n){return function(r){return null!=r&&r[e]===n&&(n!==t||e in Ot(r))}}function Ai(e,n,r){return n=bn(n===t?e.length-1:n,0),function(){for(var t=arguments,o=-1,i=bn(t.length-n,0),s=kt(i);++o<i;)s[o]=t[n+o];o=-1;for(var a=kt(n+1);++o<n;)a[o]=t[o];return a[n]=r(s),Se(e,this,a)}}function Mi(t,e){return e.length<2?t:Sr(t,oo(e,0,-1))}function Ti(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ni=Li(eo),Ii=fe||function(t,e){return pe.setTimeout(t,e)},Ri=Li(no);function Di(t,e,n){var r=e+"";return Ri(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(f,(function(n){var r="_."+n[0];e&n[1]&&!Te(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(st);return e?e[1].split(at):[]}(r),n)))}function Li(e){var n=0,r=0;return function(){var o=wn(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(t,arguments)}}function $i(e,n){var r=-1,o=e.length,i=o-1;for(n=n===t?o:n;++r<n;){var s=Gr(r,i),a=e[s];e[s]=e[r],e[r]=a}return e.length=n,e}var Pi=function(t){var e=Ls(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,n,r,o){e.push(r?o.replace(ut,"$1"):n||t)})),e}));function zi(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ji(t){if(null!=t){try{return Lt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fi(t){if(t instanceof qn)return t.clone();var e=new Wn(t.__wrapped__,t.__chain__);return e.__actions__=No(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Hi=Xr((function(t,e){return Js(t)?pr(t,vr(e,1,Js,!0)):[]})),Bi=Xr((function(e,n){var r=Xi(n);return Js(r)&&(r=t),Js(e)?pr(e,vr(n,1,Js,!0),ui(r,2)):[]})),Vi=Xr((function(e,n){var r=Xi(n);return Js(r)&&(r=t),Js(e)?pr(e,vr(n,1,Js,!0),t,r):[]}));function Wi(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=bn(r+o,0)),je(t,ui(e,3),o)}function qi(e,n,r){var o=null==e?0:e.length;if(!o)return-1;var i=o-1;return r!==t&&(i=ma(r),i=r<0?bn(o+i,0):_n(i,o-1)),je(e,ui(n,3),i,!0)}function Ui(t){return null!=t&&t.length?vr(t,1):[]}function Ki(e){return e&&e.length?e[0]:t}var Ji=Xr((function(t){var e=Ie(t,bo);return e.length&&e[0]===t[0]?Tr(e):[]})),Gi=Xr((function(e){var n=Xi(e),r=Ie(e,bo);return n===Xi(r)?n=t:r.pop(),r.length&&r[0]===e[0]?Tr(r,ui(n,2)):[]})),Yi=Xr((function(e){var n=Xi(e),r=Ie(e,bo);return(n="function"==typeof n?n:t)&&r.pop(),r.length&&r[0]===e[0]?Tr(r,t,n):[]}));function Xi(e){var n=null==e?0:e.length;return n?e[n-1]:t}var Zi=Xr(Qi);function Qi(t,e){return t&&t.length&&e&&e.length?Kr(t,e):t}var ts=oi((function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Jr(t,Ie(e,(function(t){return _i(t,n)?+t:t})).sort(Ao)),r}));function es(t){return null==t?t:Sn.call(t)}var ns=Xr((function(t){return ho(vr(t,1,Js,!0))})),rs=Xr((function(e){var n=Xi(e);return Js(n)&&(n=t),ho(vr(e,1,Js,!0),ui(n,2))})),os=Xr((function(e){var n=Xi(e);return n="function"==typeof n?n:t,ho(vr(e,1,Js,!0),t,n)}));function is(t){if(!t||!t.length)return[];var e=0;return t=Me(t,(function(t){if(Js(t))return e=bn(t.length,e),!0})),Je(e,(function(e){return Ie(t,We(e))}))}function ss(e,n){if(!e||!e.length)return[];var r=is(e);return null==n?r:Ie(r,(function(e){return Se(n,t,e)}))}var as=Xr((function(t,e){return Js(t)?pr(t,e):[]})),ls=Xr((function(t){return yo(Me(t,Js))})),cs=Xr((function(e){var n=Xi(e);return Js(n)&&(n=t),yo(Me(e,Js),ui(n,2))})),us=Xr((function(e){var n=Xi(e);return n="function"==typeof n?n:t,yo(Me(e,Js),t,n)})),hs=Xr(is),ps=Xr((function(e){var n=e.length,r=n>1?e[n-1]:t;return r="function"==typeof r?(e.pop(),r):t,ss(e,r)}));function ds(t){var e=Hn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ms=oi((function(e){var n=e.length,r=n?e[0]:0,o=this.__wrapped__,i=function(t){return ar(t,e)};return!(n>1||this.__actions__.length)&&o instanceof qn&&_i(r)?((o=o.slice(r,+r+(n?1:0))).__actions__.push({func:fs,args:[i],thisArg:t}),new Wn(o,this.__chain__).thru((function(e){return n&&!e.length&&e.push(t),e}))):this.thru(i)})),gs=Ro((function(t,e,n){$t.call(t,n)?++t[n]:sr(t,n,1)})),ys=Fo(Wi),vs=Fo(qi);function bs(t,e){return(qs(t)?Ce:dr)(t,ui(e,3))}function _s(t,e){return(qs(t)?Oe:fr)(t,ui(e,3))}var ws=Ro((function(t,e,n){$t.call(t,n)?t[n].push(e):sr(t,n,[e])})),ks=Xr((function(t,e,n){var r=-1,o="function"==typeof e,i=Ks(t)?kt(t.length):[];return dr(t,(function(t){i[++r]=o?Se(e,t,n):Nr(t,e,n)})),i})),xs=Ro((function(t,e,n){sr(t,n,e)}));function Ss(t,e){return(qs(t)?Ie:Fr)(t,ui(e,3))}var Es=Ro((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),Cs=Xr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&wi(t,e[0],e[1])?e=[]:n>2&&wi(e[0],e[1],e[2])&&(e=[e[0]]),qr(t,vr(e,1),[])})),Os=de||function(){return pe.Date.now()};function As(e,n,r){return n=r?t:n,n=e&&null==n?e.length:n,Qo(e,l,t,t,t,t,n)}function Ms(n,r){var o;if("function"!=typeof r)throw new Tt(e);return n=ma(n),function(){return--n>0&&(o=r.apply(this,arguments)),n<=1&&(r=t),o}}var Ts=Xr((function(t,e,n){var r=1;if(n.length){var o=ln(n,ci(Ts));r|=i}return Qo(t,r,e,n,o)})),Ns=Xr((function(t,e,n){var r=3;if(n.length){var o=ln(n,ci(Ns));r|=i}return Qo(e,r,t,n,o)}));function Is(n,r,o){var i,s,a,l,c,u,h=0,p=!1,d=!1,f=!0;if("function"!=typeof n)throw new Tt(e);function m(e){var r=i,o=s;return i=s=t,h=e,l=n.apply(o,r)}function g(e){var n=e-u;return u===t||n>=r||n<0||d&&e-h>=a}function y(){var t=Os();if(g(t))return v(t);c=Ii(y,function(t){var e=r-(t-u);return d?_n(e,a-(t-h)):e}(t))}function v(e){return c=t,f&&i?m(e):(i=s=t,l)}function b(){var e=Os(),n=g(e);if(i=arguments,s=this,u=e,n){if(c===t)return function(t){return h=t,c=Ii(y,r),p?m(t):l}(u);if(d)return So(c),c=Ii(y,r),m(u)}return c===t&&(c=Ii(y,r)),l}return r=ya(r)||0,ea(o)&&(p=!!o.leading,a=(d="maxWait"in o)?bn(ya(o.maxWait)||0,r):a,f="trailing"in o?!!o.trailing:f),b.cancel=function(){c!==t&&So(c),h=0,i=u=s=c=t},b.flush=function(){return c===t?l:v(Os())},b}var Rs=Xr((function(t,e){return hr(t,1,e)})),Ds=Xr((function(t,e,n){return hr(t,ya(e)||0,n)}));function Ls(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new Tt(e);var r=function(){var e=arguments,o=n?n.apply(this,e):e[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,e);return r.cache=i.set(o,s)||i,s};return r.cache=new(Ls.Cache||Jn),r}function $s(t){if("function"!=typeof t)throw new Tt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ls.Cache=Jn;var Ps=ko((function(t,e){var n=(e=1==e.length&&qs(e[0])?Ie(e[0],Ye(ui())):Ie(vr(e,1),Ye(ui()))).length;return Xr((function(r){for(var o=-1,i=_n(r.length,n);++o<i;)r[o]=e[o].call(this,r[o]);return Se(t,this,r)}))})),zs=Xr((function(e,n){var r=ln(n,ci(zs));return Qo(e,i,t,n,r)})),js=Xr((function(e,n){var r=ln(n,ci(js));return Qo(e,a,t,n,r)})),Fs=oi((function(e,n){return Qo(e,c,t,t,t,n)}));function Hs(t,e){return t===e||t!=t&&e!=e}var Bs=Jo(Or),Vs=Jo((function(t,e){return t>=e})),Ws=Ir(function(){return arguments}())?Ir:function(t){return na(t)&&$t.call(t,"callee")&&!Gt.call(t,"callee")},qs=kt.isArray,Us=ve?Ye(ve):function(t){return na(t)&&Cr(t)==N};function Ks(t){return null!=t&&ta(t.length)&&!Zs(t)}function Js(t){return na(t)&&Ks(t)}var Gs=qe||yl,Ys=be?Ye(be):function(t){return na(t)&&Cr(t)==v};function Xs(t){if(!na(t))return!1;var e=Cr(t);return e==b||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ia(t)}function Zs(t){if(!ea(t))return!1;var e=Cr(t);return e==_||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qs(t){return"number"==typeof t&&t==ma(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=_e?Ye(_e):function(t){return na(t)&&gi(t)==k};function oa(t){return"number"==typeof t||na(t)&&Cr(t)==x}function ia(t){if(!na(t)||Cr(t)!=S)return!1;var e=Kt(t);if(null===e)return!0;var n=$t.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Lt.call(n)==Ft}var sa=we?Ye(we):function(t){return na(t)&&Cr(t)==C},aa=ke?Ye(ke):function(t){return na(t)&&gi(t)==O};function la(t){return"string"==typeof t||!qs(t)&&na(t)&&Cr(t)==A}function ca(t){return"symbol"==typeof t||na(t)&&Cr(t)==M}var ua=xe?Ye(xe):function(t){return na(t)&&ta(t.length)&&!!ie[Cr(t)]},ha=Jo(jr),pa=Jo((function(t,e){return t<=e}));function da(t){if(!t)return[];if(Ks(t))return la(t)?pn(t):No(t);if(ee&&t[ee])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[ee]());var e=gi(t);return(e==k?sn:e==O?cn:Ha)(t)}function fa(t){return t?(t=ya(t))===u||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ma(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ga(t){return t?lr(ma(t),0,d):0}function ya(t){if("number"==typeof t)return t;if(ca(t))return p;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ge(t);var n=ft.test(t);return n||gt.test(t)?ce(t.slice(2),n?2:8):dt.test(t)?p:+t}function va(t){return Io(t,Ra(t))}function ba(t){return null==t?"":uo(t)}var _a=Do((function(t,e){if(Ei(e)||Ks(e))Io(e,Ia(e),t);else for(var n in e)$t.call(e,n)&&nr(t,n,e[n])})),wa=Do((function(t,e){Io(e,Ra(e),t)})),ka=Do((function(t,e,n,r){Io(e,Ra(e),t,r)})),xa=Do((function(t,e,n,r){Io(e,Ia(e),t,r)})),Sa=oi(ar),Ea=Xr((function(e,n){e=Ot(e);var r=-1,o=n.length,i=o>2?n[2]:t;for(i&&wi(n[0],n[1],i)&&(o=1);++r<o;)for(var s=n[r],a=Ra(s),l=-1,c=a.length;++l<c;){var u=a[l],h=e[u];(h===t||Hs(h,Rt[u])&&!$t.call(e,u))&&(e[u]=s[u])}return e})),Ca=Xr((function(e){return e.push(t,ei),Se(La,t,e)}));function Oa(e,n,r){var o=null==e?t:Sr(e,n);return o===t?r:o}function Aa(t,e){return null!=t&&yi(t,e,Mr)}var Ma=Vo((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),t[e]=n}),el(ol)),Ta=Vo((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),$t.call(t,e)?t[e].push(n):t[e]=[n]}),ui),Na=Xr(Nr);function Ia(t){return Ks(t)?Xn(t):Pr(t)}function Ra(t){return Ks(t)?Xn(t,!0):zr(t)}var Da=Do((function(t,e,n){Vr(t,e,n)})),La=Do((function(t,e,n,r){Vr(t,e,n,r)})),$a=oi((function(t,e){var n={};if(null==t)return n;var r=!1;e=Ie(e,(function(e){return e=wo(e,t),r||(r=e.length>1),e})),Io(t,si(t),n),r&&(n=cr(n,7,ni));for(var o=e.length;o--;)po(n,e[o]);return n})),Pa=oi((function(t,e){return null==t?{}:function(t,e){return Ur(t,e,(function(e,n){return Aa(t,n)}))}(t,e)}));function za(t,e){if(null==t)return{};var n=Ie(si(t),(function(t){return[t]}));return e=ui(e),Ur(t,n,(function(t,n){return e(t,n[0])}))}var ja=Zo(Ia),Fa=Zo(Ra);function Ha(t){return null==t?[]:Xe(t,Ia(t))}var Ba=zo((function(t,e,n){return e=e.toLowerCase(),t+(n?Va(e):e)}));function Va(t){return Xa(ba(t).toLowerCase())}function Wa(t){return(t=ba(t))&&t.replace(vt,en).replace(Zt,"")}var qa=zo((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ua=zo((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ka=Po("toLowerCase"),Ja=zo((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Ga=zo((function(t,e,n){return t+(n?" ":"")+Xa(e)})),Ya=zo((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Xa=Po("toUpperCase");function Za(e,n,r){return e=ba(e),(n=r?t:n)===t?function(t){return ne.test(t)}(e)?function(t){return t.match(te)||[]}(e):function(t){return t.match(lt)||[]}(e):e.match(n)||[]}var Qa=Xr((function(e,n){try{return Se(e,t,n)}catch(t){return Xs(t)?t:new St(t)}})),tl=oi((function(t,e){return Ce(e,(function(e){e=zi(e),sr(t,e,Ts(t[e],t))})),t}));function el(t){return function(){return t}}var nl=Ho(),rl=Ho(!0);function ol(t){return t}function il(t){return $r("function"==typeof t?t:cr(t,1))}var sl=Xr((function(t,e){return function(n){return Nr(n,t,e)}})),al=Xr((function(t,e){return function(n){return Nr(t,n,e)}}));function ll(t,e,n){var r=Ia(e),o=xr(e,r);null!=n||ea(e)&&(o.length||!r.length)||(n=e,e=t,t=this,o=xr(e,Ia(e)));var i=!(ea(n)&&"chain"in n&&!n.chain),s=Zs(t);return Ce(o,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(i||e){var n=t(this.__wrapped__);return(n.__actions__=No(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Re([this.value()],arguments))})})),t}function cl(){}var ul=qo(Ie),hl=qo(Ae),pl=qo($e);function dl(t){return ki(t)?We(zi(t)):function(t){return function(e){return Sr(e,t)}}(t)}var fl=Ko(),ml=Ko(!0);function gl(){return[]}function yl(){return!1}var vl,bl=Wo((function(t,e){return t+e}),0),_l=Yo("ceil"),wl=Wo((function(t,e){return t/e}),1),kl=Yo("floor"),xl=Wo((function(t,e){return t*e}),1),Sl=Yo("round"),El=Wo((function(t,e){return t-e}),0);return Hn.after=function(t,n){if("function"!=typeof n)throw new Tt(e);return t=ma(t),function(){if(--t<1)return n.apply(this,arguments)}},Hn.ary=As,Hn.assign=_a,Hn.assignIn=wa,Hn.assignInWith=ka,Hn.assignWith=xa,Hn.at=Sa,Hn.before=Ms,Hn.bind=Ts,Hn.bindAll=tl,Hn.bindKey=Ns,Hn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qs(t)?t:[t]},Hn.chain=ds,Hn.chunk=function(e,n,r){n=(r?wi(e,n,r):n===t)?1:bn(ma(n),0);var o=null==e?0:e.length;if(!o||n<1)return[];for(var i=0,s=0,a=kt(ge(o/n));i<o;)a[s++]=oo(e,i,i+=n);return a},Hn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,o=[];++e<n;){var i=t[e];i&&(o[r++]=i)}return o},Hn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=kt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return Re(qs(n)?No(n):[n],vr(e,1))},Hn.cond=function(t){var n=null==t?0:t.length,r=ui();return t=n?Ie(t,(function(t){if("function"!=typeof t[1])throw new Tt(e);return[r(t[0]),t[1]]})):[],Xr((function(e){for(var r=-1;++r<n;){var o=t[r];if(Se(o[0],this,e))return Se(o[1],this,e)}}))},Hn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return ur(n,t,e)}}(cr(t,1))},Hn.constant=el,Hn.countBy=gs,Hn.create=function(t,e){var n=Bn(t);return null==e?n:ir(n,e)},Hn.curry=function e(n,r,o){var i=Qo(n,8,t,t,t,t,t,r=o?t:r);return i.placeholder=e.placeholder,i},Hn.curryRight=function e(n,r,i){var s=Qo(n,o,t,t,t,t,t,r=i?t:r);return s.placeholder=e.placeholder,s},Hn.debounce=Is,Hn.defaults=Ea,Hn.defaultsDeep=Ca,Hn.defer=Rs,Hn.delay=Ds,Hn.difference=Hi,Hn.differenceBy=Bi,Hn.differenceWith=Vi,Hn.drop=function(e,n,r){var o=null==e?0:e.length;return o?oo(e,(n=r||n===t?1:ma(n))<0?0:n,o):[]},Hn.dropRight=function(e,n,r){var o=null==e?0:e.length;return o?oo(e,0,(n=o-(n=r||n===t?1:ma(n)))<0?0:n):[]},Hn.dropRightWhile=function(t,e){return t&&t.length?mo(t,ui(e,3),!0,!0):[]},Hn.dropWhile=function(t,e){return t&&t.length?mo(t,ui(e,3),!0):[]},Hn.fill=function(e,n,r,o){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&wi(e,n,r)&&(r=0,o=i),function(e,n,r,o){var i=e.length;for((r=ma(r))<0&&(r=-r>i?0:i+r),(o=o===t||o>i?i:ma(o))<0&&(o+=i),o=r>o?0:ga(o);r<o;)e[r++]=n;return e}(e,n,r,o)):[]},Hn.filter=function(t,e){return(qs(t)?Me:yr)(t,ui(e,3))},Hn.flatMap=function(t,e){return vr(Ss(t,e),1)},Hn.flatMapDeep=function(t,e){return vr(Ss(t,e),u)},Hn.flatMapDepth=function(e,n,r){return r=r===t?1:ma(r),vr(Ss(e,n),r)},Hn.flatten=Ui,Hn.flattenDeep=function(t){return null!=t&&t.length?vr(t,u):[]},Hn.flattenDepth=function(e,n){return null!=e&&e.length?vr(e,n=n===t?1:ma(n)):[]},Hn.flip=function(t){return Qo(t,512)},Hn.flow=nl,Hn.flowRight=rl,Hn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var o=t[e];r[o[0]]=o[1]}return r},Hn.functions=function(t){return null==t?[]:xr(t,Ia(t))},Hn.functionsIn=function(t){return null==t?[]:xr(t,Ra(t))},Hn.groupBy=ws,Hn.initial=function(t){return null!=t&&t.length?oo(t,0,-1):[]},Hn.intersection=Ji,Hn.intersectionBy=Gi,Hn.intersectionWith=Yi,Hn.invert=Ma,Hn.invertBy=Ta,Hn.invokeMap=ks,Hn.iteratee=il,Hn.keyBy=xs,Hn.keys=Ia,Hn.keysIn=Ra,Hn.map=Ss,Hn.mapKeys=function(t,e){var n={};return e=ui(e,3),wr(t,(function(t,r,o){sr(n,e(t,r,o),t)})),n},Hn.mapValues=function(t,e){var n={};return e=ui(e,3),wr(t,(function(t,r,o){sr(n,r,e(t,r,o))})),n},Hn.matches=function(t){return Hr(cr(t,1))},Hn.matchesProperty=function(t,e){return Br(t,cr(e,1))},Hn.memoize=Ls,Hn.merge=Da,Hn.mergeWith=La,Hn.method=sl,Hn.methodOf=al,Hn.mixin=ll,Hn.negate=$s,Hn.nthArg=function(t){return t=ma(t),Xr((function(e){return Wr(e,t)}))},Hn.omit=$a,Hn.omitBy=function(t,e){return za(t,$s(ui(e)))},Hn.once=function(t){return Ms(2,t)},Hn.orderBy=function(e,n,r,o){return null==e?[]:(qs(n)||(n=null==n?[]:[n]),qs(r=o?t:r)||(r=null==r?[]:[r]),qr(e,n,r))},Hn.over=ul,Hn.overArgs=Ps,Hn.overEvery=hl,Hn.overSome=pl,Hn.partial=zs,Hn.partialRight=js,Hn.partition=Es,Hn.pick=Pa,Hn.pickBy=za,Hn.property=dl,Hn.propertyOf=function(e){return function(n){return null==e?t:Sr(e,n)}},Hn.pull=Zi,Hn.pullAll=Qi,Hn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Kr(t,e,ui(n,2)):t},Hn.pullAllWith=function(e,n,r){return e&&e.length&&n&&n.length?Kr(e,n,t,r):e},Hn.pullAt=ts,Hn.range=fl,Hn.rangeRight=ml,Hn.rearg=Fs,Hn.reject=function(t,e){return(qs(t)?Me:yr)(t,$s(ui(e,3)))},Hn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,o=[],i=t.length;for(e=ui(e,3);++r<i;){var s=t[r];e(s,r,t)&&(n.push(s),o.push(r))}return Jr(t,o),n},Hn.rest=function(n,r){if("function"!=typeof n)throw new Tt(e);return Xr(n,r=r===t?r:ma(r))},Hn.reverse=es,Hn.sampleSize=function(e,n,r){return n=(r?wi(e,n,r):n===t)?1:ma(n),(qs(e)?Qn:Qr)(e,n)},Hn.set=function(t,e,n){return null==t?t:to(t,e,n)},Hn.setWith=function(e,n,r,o){return o="function"==typeof o?o:t,null==e?e:to(e,n,r,o)},Hn.shuffle=function(t){return(qs(t)?tr:ro)(t)},Hn.slice=function(e,n,r){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&wi(e,n,r)?(n=0,r=o):(n=null==n?0:ma(n),r=r===t?o:ma(r)),oo(e,n,r)):[]},Hn.sortBy=Cs,Hn.sortedUniq=function(t){return t&&t.length?lo(t):[]},Hn.sortedUniqBy=function(t,e){return t&&t.length?lo(t,ui(e,2)):[]},Hn.split=function(e,n,r){return r&&"number"!=typeof r&&wi(e,n,r)&&(n=r=t),(r=r===t?d:r>>>0)?(e=ba(e))&&("string"==typeof n||null!=n&&!sa(n))&&!(n=uo(n))&&on(e)?xo(pn(e),0,r):e.split(n,r):[]},Hn.spread=function(t,n){if("function"!=typeof t)throw new Tt(e);return n=null==n?0:bn(ma(n),0),Xr((function(e){var r=e[n],o=xo(e,0,n);return r&&Re(o,r),Se(t,this,o)}))},Hn.tail=function(t){var e=null==t?0:t.length;return e?oo(t,1,e):[]},Hn.take=function(e,n,r){return e&&e.length?oo(e,0,(n=r||n===t?1:ma(n))<0?0:n):[]},Hn.takeRight=function(e,n,r){var o=null==e?0:e.length;return o?oo(e,(n=o-(n=r||n===t?1:ma(n)))<0?0:n,o):[]},Hn.takeRightWhile=function(t,e){return t&&t.length?mo(t,ui(e,3),!1,!0):[]},Hn.takeWhile=function(t,e){return t&&t.length?mo(t,ui(e,3)):[]},Hn.tap=function(t,e){return e(t),t},Hn.throttle=function(t,n,r){var o=!0,i=!0;if("function"!=typeof t)throw new Tt(e);return ea(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),Is(t,n,{leading:o,maxWait:n,trailing:i})},Hn.thru=fs,Hn.toArray=da,Hn.toPairs=ja,Hn.toPairsIn=Fa,Hn.toPath=function(t){return qs(t)?Ie(t,zi):ca(t)?[t]:No(Pi(ba(t)))},Hn.toPlainObject=va,Hn.transform=function(t,e,n){var r=qs(t),o=r||Gs(t)||ua(t);if(e=ui(e,4),null==n){var i=t&&t.constructor;n=o?r?new i:[]:ea(t)&&Zs(i)?Bn(Kt(t)):{}}return(o?Ce:wr)(t,(function(t,r,o){return e(n,t,r,o)})),n},Hn.unary=function(t){return As(t,1)},Hn.union=ns,Hn.unionBy=rs,Hn.unionWith=os,Hn.uniq=function(t){return t&&t.length?ho(t):[]},Hn.uniqBy=function(t,e){return t&&t.length?ho(t,ui(e,2)):[]},Hn.uniqWith=function(e,n){return n="function"==typeof n?n:t,e&&e.length?ho(e,t,n):[]},Hn.unset=function(t,e){return null==t||po(t,e)},Hn.unzip=is,Hn.unzipWith=ss,Hn.update=function(t,e,n){return null==t?t:fo(t,e,_o(n))},Hn.updateWith=function(e,n,r,o){return o="function"==typeof o?o:t,null==e?e:fo(e,n,_o(r),o)},Hn.values=Ha,Hn.valuesIn=function(t){return null==t?[]:Xe(t,Ra(t))},Hn.without=as,Hn.words=Za,Hn.wrap=function(t,e){return zs(_o(e),t)},Hn.xor=ls,Hn.xorBy=cs,Hn.xorWith=us,Hn.zip=hs,Hn.zipObject=function(t,e){return vo(t||[],e||[],nr)},Hn.zipObjectDeep=function(t,e){return vo(t||[],e||[],to)},Hn.zipWith=ps,Hn.entries=ja,Hn.entriesIn=Fa,Hn.extend=wa,Hn.extendWith=ka,ll(Hn,Hn),Hn.add=bl,Hn.attempt=Qa,Hn.camelCase=Ba,Hn.capitalize=Va,Hn.ceil=_l,Hn.clamp=function(e,n,r){return r===t&&(r=n,n=t),r!==t&&(r=(r=ya(r))==r?r:0),n!==t&&(n=(n=ya(n))==n?n:0),lr(ya(e),n,r)},Hn.clone=function(t){return cr(t,4)},Hn.cloneDeep=function(t){return cr(t,5)},Hn.cloneDeepWith=function(e,n){return cr(e,5,n="function"==typeof n?n:t)},Hn.cloneWith=function(e,n){return cr(e,4,n="function"==typeof n?n:t)},Hn.conformsTo=function(t,e){return null==e||ur(t,e,Ia(e))},Hn.deburr=Wa,Hn.defaultTo=function(t,e){return null==t||t!=t?e:t},Hn.divide=wl,Hn.endsWith=function(e,n,r){e=ba(e),n=uo(n);var o=e.length,i=r=r===t?o:lr(ma(r),0,o);return(r-=n.length)>=0&&e.slice(r,i)==n},Hn.eq=Hs,Hn.escape=function(t){return(t=ba(t))&&J.test(t)?t.replace(U,nn):t},Hn.escapeRegExp=function(t){return(t=ba(t))&&nt.test(t)?t.replace(et,"\\$&"):t},Hn.every=function(e,n,r){var o=qs(e)?Ae:mr;return r&&wi(e,n,r)&&(n=t),o(e,ui(n,3))},Hn.find=ys,Hn.findIndex=Wi,Hn.findKey=function(t,e){return ze(t,ui(e,3),wr)},Hn.findLast=vs,Hn.findLastIndex=qi,Hn.findLastKey=function(t,e){return ze(t,ui(e,3),kr)},Hn.floor=kl,Hn.forEach=bs,Hn.forEachRight=_s,Hn.forIn=function(t,e){return null==t?t:br(t,ui(e,3),Ra)},Hn.forInRight=function(t,e){return null==t?t:_r(t,ui(e,3),Ra)},Hn.forOwn=function(t,e){return t&&wr(t,ui(e,3))},Hn.forOwnRight=function(t,e){return t&&kr(t,ui(e,3))},Hn.get=Oa,Hn.gt=Bs,Hn.gte=Vs,Hn.has=function(t,e){return null!=t&&yi(t,e,Ar)},Hn.hasIn=Aa,Hn.head=Ki,Hn.identity=ol,Hn.includes=function(t,e,n,r){t=Ks(t)?t:Ha(t),n=n&&!r?ma(n):0;var o=t.length;return n<0&&(n=bn(o+n,0)),la(t)?n<=o&&t.indexOf(e,n)>-1:!!o&&Fe(t,e,n)>-1},Hn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=bn(r+o,0)),Fe(t,e,o)},Hn.inRange=function(e,n,r){return n=fa(n),r===t?(r=n,n=0):r=fa(r),function(t,e,n){return t>=_n(e,n)&&t<bn(e,n)}(e=ya(e),n,r)},Hn.invoke=Na,Hn.isArguments=Ws,Hn.isArray=qs,Hn.isArrayBuffer=Us,Hn.isArrayLike=Ks,Hn.isArrayLikeObject=Js,Hn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Cr(t)==y},Hn.isBuffer=Gs,Hn.isDate=Ys,Hn.isElement=function(t){return na(t)&&1===t.nodeType&&!ia(t)},Hn.isEmpty=function(t){if(null==t)return!0;if(Ks(t)&&(qs(t)||"string"==typeof t||"function"==typeof t.splice||Gs(t)||ua(t)||Ws(t)))return!t.length;var e=gi(t);if(e==k||e==O)return!t.size;if(Ei(t))return!Pr(t).length;for(var n in t)if($t.call(t,n))return!1;return!0},Hn.isEqual=function(t,e){return Rr(t,e)},Hn.isEqualWith=function(e,n,r){var o=(r="function"==typeof r?r:t)?r(e,n):t;return o===t?Rr(e,n,t,r):!!o},Hn.isError=Xs,Hn.isFinite=function(t){return"number"==typeof t&&gn(t)},Hn.isFunction=Zs,Hn.isInteger=Qs,Hn.isLength=ta,Hn.isMap=ra,Hn.isMatch=function(t,e){return t===e||Dr(t,e,pi(e))},Hn.isMatchWith=function(e,n,r){return r="function"==typeof r?r:t,Dr(e,n,pi(n),r)},Hn.isNaN=function(t){return oa(t)&&t!=+t},Hn.isNative=function(t){if(Si(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Lr(t)},Hn.isNil=function(t){return null==t},Hn.isNull=function(t){return null===t},Hn.isNumber=oa,Hn.isObject=ea,Hn.isObjectLike=na,Hn.isPlainObject=ia,Hn.isRegExp=sa,Hn.isSafeInteger=function(t){return Qs(t)&&t>=-9007199254740991&&t<=h},Hn.isSet=aa,Hn.isString=la,Hn.isSymbol=ca,Hn.isTypedArray=ua,Hn.isUndefined=function(e){return e===t},Hn.isWeakMap=function(t){return na(t)&&gi(t)==T},Hn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Cr(t)},Hn.join=function(t,e){return null==t?"":yn.call(t,e)},Hn.kebabCase=qa,Hn.last=Xi,Hn.lastIndexOf=function(e,n,r){var o=null==e?0:e.length;if(!o)return-1;var i=o;return r!==t&&(i=(i=ma(r))<0?bn(o+i,0):_n(i,o-1)),n==n?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(e,n,i):je(e,Be,i,!0)},Hn.lowerCase=Ua,Hn.lowerFirst=Ka,Hn.lt=ha,Hn.lte=pa,Hn.max=function(e){return e&&e.length?gr(e,ol,Or):t},Hn.maxBy=function(e,n){return e&&e.length?gr(e,ui(n,2),Or):t},Hn.mean=function(t){return Ve(t,ol)},Hn.meanBy=function(t,e){return Ve(t,ui(e,2))},Hn.min=function(e){return e&&e.length?gr(e,ol,jr):t},Hn.minBy=function(e,n){return e&&e.length?gr(e,ui(n,2),jr):t},Hn.stubArray=gl,Hn.stubFalse=yl,Hn.stubObject=function(){return{}},Hn.stubString=function(){return""},Hn.stubTrue=function(){return!0},Hn.multiply=xl,Hn.nth=function(e,n){return e&&e.length?Wr(e,ma(n)):t},Hn.noConflict=function(){return pe._===this&&(pe._=Ht),this},Hn.noop=cl,Hn.now=Os,Hn.pad=function(t,e,n){t=ba(t);var r=(e=ma(e))?hn(t):0;if(!e||r>=e)return t;var o=(e-r)/2;return Uo(ye(o),n)+t+Uo(ge(o),n)},Hn.padEnd=function(t,e,n){t=ba(t);var r=(e=ma(e))?hn(t):0;return e&&r<e?t+Uo(e-r,n):t},Hn.padStart=function(t,e,n){t=ba(t);var r=(e=ma(e))?hn(t):0;return e&&r<e?Uo(e-r,n)+t:t},Hn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),kn(ba(t).replace(rt,""),e||0)},Hn.random=function(e,n,r){if(r&&"boolean"!=typeof r&&wi(e,n,r)&&(n=r=t),r===t&&("boolean"==typeof n?(r=n,n=t):"boolean"==typeof e&&(r=e,e=t)),e===t&&n===t?(e=0,n=1):(e=fa(e),n===t?(n=e,e=0):n=fa(n)),e>n){var o=e;e=n,n=o}if(r||e%1||n%1){var i=xn();return _n(e+i*(n-e+le("1e-"+((i+"").length-1))),n)}return Gr(e,n)},Hn.reduce=function(t,e,n){var r=qs(t)?De:Ue,o=arguments.length<3;return r(t,ui(e,4),n,o,dr)},Hn.reduceRight=function(t,e,n){var r=qs(t)?Le:Ue,o=arguments.length<3;return r(t,ui(e,4),n,o,fr)},Hn.repeat=function(e,n,r){return n=(r?wi(e,n,r):n===t)?1:ma(n),Yr(ba(e),n)},Hn.replace=function(){var t=arguments,e=ba(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Hn.result=function(e,n,r){var o=-1,i=(n=wo(n,e)).length;for(i||(i=1,e=t);++o<i;){var s=null==e?t:e[zi(n[o])];s===t&&(o=i,s=r),e=Zs(s)?s.call(e):s}return e},Hn.round=Sl,Hn.runInContext=s,Hn.sample=function(t){return(qs(t)?Zn:Zr)(t)},Hn.size=function(t){if(null==t)return 0;if(Ks(t))return la(t)?hn(t):t.length;var e=gi(t);return e==k||e==O?t.size:Pr(t).length},Hn.snakeCase=Ja,Hn.some=function(e,n,r){var o=qs(e)?$e:io;return r&&wi(e,n,r)&&(n=t),o(e,ui(n,3))},Hn.sortedIndex=function(t,e){return so(t,e)},Hn.sortedIndexBy=function(t,e,n){return ao(t,e,ui(n,2))},Hn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=so(t,e);if(r<n&&Hs(t[r],e))return r}return-1},Hn.sortedLastIndex=function(t,e){return so(t,e,!0)},Hn.sortedLastIndexBy=function(t,e,n){return ao(t,e,ui(n,2),!0)},Hn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=so(t,e,!0)-1;if(Hs(t[n],e))return n}return-1},Hn.startCase=Ga,Hn.startsWith=function(t,e,n){return t=ba(t),n=null==n?0:lr(ma(n),0,t.length),e=uo(e),t.slice(n,n+e.length)==e},Hn.subtract=El,Hn.sum=function(t){return t&&t.length?Ke(t,ol):0},Hn.sumBy=function(t,e){return t&&t.length?Ke(t,ui(e,2)):0},Hn.template=function(e,n,r){var o=Hn.templateSettings;r&&wi(e,n,r)&&(n=t),e=ba(e),n=ka({},n,o,ti);var i,s,a=ka({},n.imports,o.imports,ti),l=Ia(a),c=Xe(a,l),u=0,h=n.interpolate||bt,p="__p += '",d=At((n.escape||bt).source+"|"+h.source+"|"+(h===X?ht:bt).source+"|"+(n.evaluate||bt).source+"|$","g"),f="//# sourceURL="+($t.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++oe+"]")+"\n";e.replace(d,(function(t,n,r,o,a,l){return r||(r=o),p+=e.slice(u,l).replace(_t,rn),n&&(i=!0,p+="' +\n__e("+n+") +\n'"),a&&(s=!0,p+="';\n"+a+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),p+="';\n";var m=$t.call(n,"variable")&&n.variable;if(m){if(ct.test(m))throw new St("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(s?p.replace(B,""):p).replace(V,"$1").replace(W,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Qa((function(){return Et(l,f+"return "+p).apply(t,c)}));if(g.source=p,Xs(g))throw g;return g},Hn.times=function(t,e){if((t=ma(t))<1||t>h)return[];var n=d,r=_n(t,d);e=ui(e),t-=d;for(var o=Je(r,e);++n<t;)e(n);return o},Hn.toFinite=fa,Hn.toInteger=ma,Hn.toLength=ga,Hn.toLower=function(t){return ba(t).toLowerCase()},Hn.toNumber=ya,Hn.toSafeInteger=function(t){return t?lr(ma(t),-9007199254740991,h):0===t?t:0},Hn.toString=ba,Hn.toUpper=function(t){return ba(t).toUpperCase()},Hn.trim=function(e,n,r){if((e=ba(e))&&(r||n===t))return Ge(e);if(!e||!(n=uo(n)))return e;var o=pn(e),i=pn(n);return xo(o,Qe(o,i),tn(o,i)+1).join("")},Hn.trimEnd=function(e,n,r){if((e=ba(e))&&(r||n===t))return e.slice(0,dn(e)+1);if(!e||!(n=uo(n)))return e;var o=pn(e);return xo(o,0,tn(o,pn(n))+1).join("")},Hn.trimStart=function(e,n,r){if((e=ba(e))&&(r||n===t))return e.replace(rt,"");if(!e||!(n=uo(n)))return e;var o=pn(e);return xo(o,Qe(o,pn(n))).join("")},Hn.truncate=function(e,n){var r=30,o="...";if(ea(n)){var i="separator"in n?n.separator:i;r="length"in n?ma(n.length):r,o="omission"in n?uo(n.omission):o}var s=(e=ba(e)).length;if(on(e)){var a=pn(e);s=a.length}if(r>=s)return e;var l=r-hn(o);if(l<1)return o;var c=a?xo(a,0,l).join(""):e.slice(0,l);if(i===t)return c+o;if(a&&(l+=c.length-l),sa(i)){if(e.slice(l).search(i)){var u,h=c;for(i.global||(i=At(i.source,ba(pt.exec(i))+"g")),i.lastIndex=0;u=i.exec(h);)var p=u.index;c=c.slice(0,p===t?l:p)}}else if(e.indexOf(uo(i),l)!=l){var d=c.lastIndexOf(i);d>-1&&(c=c.slice(0,d))}return c+o},Hn.unescape=function(t){return(t=ba(t))&&K.test(t)?t.replace(q,fn):t},Hn.uniqueId=function(t){var e=++Pt;return ba(t)+e},Hn.upperCase=Ya,Hn.upperFirst=Xa,Hn.each=bs,Hn.eachRight=_s,Hn.first=Ki,ll(Hn,(vl={},wr(Hn,(function(t,e){$t.call(Hn.prototype,e)||(vl[e]=t)})),vl),{chain:!1}),Hn.VERSION="4.17.21",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Hn[t].placeholder=Hn})),Ce(["drop","take"],(function(e,n){qn.prototype[e]=function(r){r=r===t?1:bn(ma(r),0);var o=this.__filtered__&&!n?new qn(this):this.clone();return o.__filtered__?o.__takeCount__=_n(r,o.__takeCount__):o.__views__.push({size:_n(r,d),type:e+(o.__dir__<0?"Right":"")}),o},qn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ce(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;qn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ui(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),Ce(["head","last"],(function(t,e){var n="take"+(e?"Right":"");qn.prototype[t]=function(){return this[n](1).value()[0]}})),Ce(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");qn.prototype[t]=function(){return this.__filtered__?new qn(this):this[n](1)}})),qn.prototype.compact=function(){return this.filter(ol)},qn.prototype.find=function(t){return this.filter(t).head()},qn.prototype.findLast=function(t){return this.reverse().find(t)},qn.prototype.invokeMap=Xr((function(t,e){return"function"==typeof t?new qn(this):this.map((function(n){return Nr(n,t,e)}))})),qn.prototype.reject=function(t){return this.filter($s(ui(t)))},qn.prototype.slice=function(e,n){e=ma(e);var r=this;return r.__filtered__&&(e>0||n<0)?new qn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),n!==t&&(r=(n=ma(n))<0?r.dropRight(-n):r.take(n-e)),r)},qn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},qn.prototype.toArray=function(){return this.take(d)},wr(qn.prototype,(function(e,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),o=/^(?:head|last)$/.test(n),i=Hn[o?"take"+("last"==n?"Right":""):n],s=o||/^find/.test(n);i&&(Hn.prototype[n]=function(){var n=this.__wrapped__,a=o?[1]:arguments,l=n instanceof qn,c=a[0],u=l||qs(n),h=function(t){var e=i.apply(Hn,Re([t],a));return o&&p?e[0]:e};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var p=this.__chain__,d=!!this.__actions__.length,f=s&&!p,m=l&&!d;if(!s&&u){n=m?n:new qn(this);var g=e.apply(n,a);return g.__actions__.push({func:fs,args:[h],thisArg:t}),new Wn(g,p)}return f&&m?e.apply(this,a):(g=this.thru(h),f?o?g.value()[0]:g.value():g)})})),Ce(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Nt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Hn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var o=this.value();return e.apply(qs(o)?o:[],t)}return this[n]((function(n){return e.apply(qs(n)?n:[],t)}))}})),wr(qn.prototype,(function(t,e){var n=Hn[e];if(n){var r=n.name+"";$t.call(In,r)||(In[r]=[]),In[r].push({name:e,func:n})}})),In[Bo(t,2).name]=[{name:"wrapper",func:t}],qn.prototype.clone=function(){var t=new qn(this.__wrapped__);return t.__actions__=No(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=No(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=No(this.__views__),t},qn.prototype.reverse=function(){if(this.__filtered__){var t=new qn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},qn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=qs(t),r=e<0,o=n?t.length:0,i=function(t,e,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],s=i.size;switch(i.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=_n(e,t+s);break;case"takeRight":t=bn(t,e-s)}}return{start:t,end:e}}(0,o,this.__views__),s=i.start,a=i.end,l=a-s,c=r?a:s-1,u=this.__iteratees__,h=u.length,p=0,d=_n(l,this.__takeCount__);if(!n||!r&&o==l&&d==l)return go(t,this.__actions__);var f=[];t:for(;l--&&p<d;){for(var m=-1,g=t[c+=e];++m<h;){var y=u[m],v=y.iteratee,b=y.type,_=v(g);if(2==b)g=_;else if(!_){if(1==b)continue t;break t}}f[p++]=g}return f},Hn.prototype.at=ms,Hn.prototype.chain=function(){return ds(this)},Hn.prototype.commit=function(){return new Wn(this.value(),this.__chain__)},Hn.prototype.next=function(){this.__values__===t&&(this.__values__=da(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?t:this.__values__[this.__index__++]}},Hn.prototype.plant=function(e){for(var n,r=this;r instanceof Vn;){var o=Fi(r);o.__index__=0,o.__values__=t,n?i.__wrapped__=o:n=o;var i=o;r=r.__wrapped__}return i.__wrapped__=e,n},Hn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof qn){var n=e;return this.__actions__.length&&(n=new qn(this)),(n=n.reverse()).__actions__.push({func:fs,args:[es],thisArg:t}),new Wn(n,this.__chain__)}return this.thru(es)},Hn.prototype.toJSON=Hn.prototype.valueOf=Hn.prototype.value=function(){return go(this.__wrapped__,this.__actions__)},Hn.prototype.first=Hn.prototype.head,ee&&(Hn.prototype[ee]=function(){return this}),Hn}();fe?((fe.exports=mn)._=mn,de._=mn):pe._=mn}.call(s);var Gh=Jh.exports;function Yh(t){return t.type.create(Gh.cloneDeep(t.attrs))}const Xh=wl.create({name:"node_processor",addCommands:()=>({setBlockAttributes:gh((({commands:t,state:e},n,r,o={})=>{const i=Je(t.getBlockAttributes(n))??{},{doc:s,tr:a}=e,{from:l,to:c}=a.selection;s.nodesBetween(l,c,((t,e)=>{_c.blocks.includes(t.type.name)&&a.setNodeAttribute(e,n,{...o,...i,...r})}))})),getBlockAttributes:gh((({editor:t},e,n)=>xr((()=>{let r=Object.assign({},n||{});for(const n of _c.blocks)Object.assign(r,t.getAttributes(n)?.[e]||{});return Object.keys(r).length?r:null})))),removeBlockAttributes:gh((({commands:t},e)=>{for(const n of _c.blocks)t.resetAttributes(n,e)})),applyMark:gh((({state:t,commands:e},n,r,o={})=>{const{tr:i,doc:s,schema:a}=t,{$from:l,$to:c}=i.selection,u=Cl(kc.LINK,a),h=Cl(n,a);if(!(h.spec.group||"").includes(xc.SETTINGS))return e.setMark(n,r);if(l.pos===c.pos)return;s.nodesBetween(l.pos,c.pos,((t,s)=>{if(t.type.name===_c.LIST)return;const a=function(t,e){const n="string"==typeof e?e:e.name;return t.find((t=>t.type.name===n))}(t.marks,n),p=h.create({...a?.attrs||{},...r}),d=Vh(l,c,t,s),f=!u.isInSet(t.marks)&&function(t,e,n,r=qh){const o=t.resolve(e).path.reverse();for(const t of o)if("number"!=typeof t)for(const e of t.marks)if(r(e,n))return!0;return!1}(i.doc,s,p,o.isAppliedToParent);if(f)return(t=>{if(!o.onAppliedToParent||!1===o.onAppliedToParent(t)){const{tr:n,node:r,position:o,mark:i}=t;e._removeNodeMark({tr:n,node:r,position:o,mark:i.type})}})({tr:i,node:t,position:s,mark:p});t.isText?i.addMark(d.from,d.to,p):function(t,e,n,r){const o=Wh(t,r),i=e.from-o<=r,s=e.to+o>=n.nodeSize+r;return i&&s}(i.doc,i.selection,t,s)&&i.addNodeMark(s,p)}))})),getMarks:gh((({editor:t},e)=>{const n=Ze(t,"state");return xr((()=>{const{selection:t,doc:r}=Je(n),{from:o,to:i}=Je(t),s=[];return r.nodesBetween(o,i,(t=>{for(const n of t.marks)n.type.name===e&&s.unshift(n.attrs)})),s}))})),getMark:gh((({commands:t},e)=>{const n=t.getMarks(e);return xr((()=>Je(n)[0]??null))})),hasMark:gh((({commands:t},e)=>{const n=t.getMark(e);return xr((()=>!!Je(n)))})),getCommonSettingMark:gh((({commands:t},e,n)=>{const r=t.getMark(e);return xr((()=>Je(r)?.value??Je(n)))})),getDeviceSettingMark:gh((({commands:t},e,n)=>{const r=t.getMarks(e),o=t.getDevice();return xr((()=>{for(const t of Je(r)){const e=t[Je(o)];if(e)return e}return Je(n)}))})),removeAllMarks:gh((({state:t,commands:e})=>{const{tr:n,doc:r}=t,{from:o,to:i}=n.selection;r.nodesBetween(o,i,((t,r)=>{for(const o of t.marks)e._removeNodeMark({tr:n,node:t,position:r,mark:o})}))})),removeMarks:gh((({state:t,commands:e},n)=>{const{tr:r,doc:o}=t,{from:i,to:s}=r.selection;o.nodesBetween(i,s,((t,o)=>{const i=t.marks.filter((t=>n.includes(t.type.name)));for(const n of i)e._removeNodeMark({tr:r,node:t,position:o,mark:n})}))})),_removeNodeMark:gh(((t,{tr:e,node:n,position:r,mark:o})=>n.isText?e.removeMark(r,r+n.nodeSize,o):e.removeNodeMark(r,o)))})}),Zh=wl.create({name:"text_processor",addCommands:()=>({getSelectedText:gh((({state:t})=>{const{from:e,to:n}=t.selection;return t.doc.textBetween(e,n," ")})),transformText:gh((({state:t},e)=>{const{$from:n,$to:r}=t.tr.selection;n.pos!==r.pos&&t.doc.nodesBetween(n.pos,r.pos,((o,i)=>{if(!o.isText)return;const s=Vh(n,r,o,i),a=Math.max(0,n.pos-i),l=Math.max(0,r.pos-i),c=e({text:o.textContent.substring(a,l)}),u=t.schema.text(c,o.marks);t.tr.replaceWith(s.from,s.to,u)}))}))})}),Qh=wl.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:gh((({state:t})=>{this.storage.selection=t.selection})),restoreSelection:gh((({commands:t})=>{this.storage.selection&&t.setTextSelection(this.storage.selection)})),expandSelection:gh((({tr:t,commands:e},n)=>{let r=t.selection.from,o=t.selection.to;t.doc.nodesBetween(r,o,((e,i,s)=>{if(n({node:e,parent:s})){const n=e.isText?0:Wh(t.doc,i);r=Math.min(r,i+n),o=Math.max(o,i+e.nodeSize-n)}})),e.setTextSelection({from:r,to:o})})),expandSelectionToBlock:gh((({commands:t})=>{t.expandSelection((({parent:t})=>t.type.name===_c.DOCUMENT))}))}}}),tp=Jl.create({name:"doc",topNode:!0,content:"block+"});class ep extends zo{constructor(t,e,n,r="SetDocAttr"){super(),this.key=t,this.value=e,this.schema=n,this.stepType=r}apply(t){this.prevValue=t.attrs.meta[this.key];const e=Zr.fromJSON(this.schema,t.toJSON());return e.attrs.meta[this.key]=this.value,jo.ok(e)}invert(){return new ep(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(t){return new ep(t.key,t.value,t.stepType)}}zo.jsonID("setDocAttr",ep);const np=tp.extend({marks:xc.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",(t=>{t.target.closest("a")&&t.preventDefault()}))},addCommands:()=>({setDocMetaAttributes:gh((({state:t},e,n)=>{t.tr.step(new ep(e,n,t.schema))}))})}),rp=Jl.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",el(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),op=rp.extend({marks:xc.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),ip=Jl.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,el(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode(this.name,t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})})),{})},addInputRules(){return this.options.levels.map((t=>{return e={find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}},new hl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=rl(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)}});var e}))}}),sp=ip.extend({marks:xc.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),ap=wl.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[Oc.create(this.editor),Ac.create(this.editor)]}}),lp=Kl.create({name:kc.FONT_FAMILY,group:xc.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e});const n=t.findFontByName(e);let r=Je(t.getFontWeight());n.isWeightSupported(r)||(r=n.findClosestWeight(r),t.applyFontWeight(r));const o=t.isSettingCustomized(kc.FONT_STYLE).value;!n.isItalicSupported(r)&&o&&t.removeItalic()})),getFont:gh((({commands:t})=>{const e=Je(this.options.defaultPreset),n=t.findFontByName(e.common.font_family),r=t.getFontFamily();return xr((()=>t.findFontByName(Je(r))||n))})),findFontByName:gh(((t,e)=>Je(this.options.fonts).find((t=>t.name===e)))),getFontFamily:gh((({commands:t})=>t.getCommonSettingMark(this.name,t.getDefaultFontFamily()))),getDefaultFontFamily:gh((({commands:t})=>{const e=t.getPreset();return xr((()=>Je(e).common.font_family))}))}},parseHTML(){const t=t=>({value:t.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:t},{style:"font-family",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({font_family:t.value?`"${t.value}"`:null})}),cp=wl.create({name:kc.STYLE_PRESET,addGlobalAttributes(){return[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{preset:{isRequired:!1,default:{id:Je(this.options.defaultId)},parseHTML:t=>{const e=Je(this.options.presets);if("LI"===t.parentElement.tagName)return null;for(const{id:n,node:r,fallbackClass:o}of e){if(o&&t.classList.contains(o))return{id:n};const e=Je(this.options.styleRenderer).makePresetCssClass({id:n});if(t.matches(e))return{id:n};if(t.tagName===`H${r?.level}`)return{id:n}}return"P"===t.tagName?{id:Je(this.options.defaultId)}:null},renderHTML:t=>t.preset?{class:Je(this.options.styleRenderer).makePresetHtmlClass(t.preset)}:null}}}]},addCommands(){function t(t,e){return t.find((t=>e===t.id))}function e(t,e){const n={};for(const r of Object.keys(t)){const o=t[r],i=e[r],s=!i||"inherit"===i.toLowerCase();n[r]=s?o:i}return n}return{getPresetList:gh((()=>xr((()=>Je(this.options.presets).filter((t=>!t.hidden)))))),getPreset:gh((({commands:n})=>{const r=n.getBlockAttributes("preset",{id:Je(this.options.defaultId)}),o=n.getPresetList(),i=n.isLink(),s=n.getLinkPreset();return xr((()=>{const n=t(Je(o),Je(r).id);if(!Je(i))return n;const a=Je(s);return{id:n.id,common:e(n.common,a.common),mobile:e(n.mobile,a.mobile),tablet:e(n.tablet,a.tablet),desktop:e(n.desktop,a.desktop)}}))})),applyPreset:gh((({commands:e,chain:n},r)=>{const o=t(Je(e.getPresetList()),r),i=o.node?.type??_c.PARAGRAPH,s={preset:{id:r}};o.node&&(s.level=o.node.level);for(const t of kc.attributes)s[t]=Je(e.getBlockAttributes(t));n().removeList().setNode(i,s).run()})),applyDefaultPreset:gh((({commands:t})=>{t.applyPreset(Je(this.options.defaultId))})),removePreset:gh((({commands:t})=>{t.setNode(_c.PARAGRAPH,{preset:null})})),getPresetCustomization:gh((({editor:t,commands:e})=>{const n=Ze(t,"state");return xr((()=>{const{selection:t,doc:r}=Je(n),{from:o,to:i}=t;return e._getSettingCustomization(r,o,i)}))})),isSettingCustomized:gh((({commands:t},e)=>{const n=t.getPresetCustomization(),r=kc.presetAttributes.includes(e)?"attributes":"marks";return xr((()=>Je(n)[r]?.includes(e)??!1))})),getContentCustomization:gh((({editor:t,commands:e})=>{const n=Ze(t,"state");return xr((()=>{const{doc:t}=Je(n);return e._getSettingCustomization(t,0,t.content.size)}))})),_getSettingCustomization:gh(((t,e,n,r)=>{const o=new Set,i=new Set;return e.nodesBetween(n,r,(t=>{for(const[e,n]of Object.entries(t.attrs)){kc.presetAttributes.includes(e)&&n&&i.add(e)}for(const{type:e}of t.marks)kc.marks.includes(e.name)&&o.add(e.name)})),{attributes:Array.from(i),marks:Array.from(o)}})),removePresetCustomization:gh((({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(kc.marks).resetAttributes(_c.PARAGRAPH,kc.presetAttributes).resetAttributes(_c.HEADING,kc.presetAttributes).restoreSelection().run()})),removeFormat:gh((({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()}))}},onCreate(){this.options.styleRenderer.inject(Lp.head,Je(this.options.presets))}}),up=Kl.create({name:kc.FONT_WEIGHT,group:xc.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e});Je(t.getFont()).isItalicSupported(e)||t.removeItalic()})),toggleBold:gh((({commands:t})=>{const e=Je(t.getFontWeight()),n=Je(t.getFont()),r=Number(e)>=600?"400":"700",o=n.findClosestWeight(r);t.applyFontWeight(o)})),getFontWeight:gh((({commands:t})=>{const e=t.getCommonSettingMark(this.name,t.getDefaultFontWeight()),n=t.getFont();return xr((()=>{const t=Je(e),r=Je(n);return r.isWeightSupported(t)?t:r.findClosestWeight(t)}))})),getDefaultFontWeight:gh((({commands:t})=>{const e=t.getPreset();return xr((()=>Je(e).common.font_weight))}))}},addKeyboardShortcuts:()=>({"Mod-b":bh("toggleBold"),"Mod-B":bh("toggleBold")}),parseHTML(){const t=t=>"bold"===t?{value:"700"}:!!Number(t)&&{value:t};return[{style:"--zw-font-weight",getAttrs:t},{style:"font-weight",getAttrs:t},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML:({HTMLAttributes:t})=>vh({font_weight:t.value})}),hp=Kl.create({name:kc.FONT_SIZE,group:xc.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes:()=>({mobile:{default:null},tablet:{default:null},desktop:{default:null}}),addCommands(){return{getFontSize:gh((({commands:t})=>t.getDeviceSettingMark(this.name,t.getDefaultFontSize()))),getDefaultFontSize:gh((({commands:t})=>{const e=t.getDevice(),n=t.getPreset();return xr((()=>Je(n)[Je(e)].font_size.replace("px","")))})),applyFontSize:gh((({commands:t},e)=>{const n=Je(t.getDevice());t.applyMark(this.name,{[n]:e},{isAppliedToParent:(t,e)=>t.type.name===e.type.name&&t.attrs[n]===e.attrs[n],onAppliedToParent:({tr:t,node:e,position:r,mark:o})=>{const i={...o.attrs,[n]:null},s=!Object.values(i).some((t=>!!t));if(s)return!1;const a=o.type.create(i);e.isText?t.addMark(r,r+e.nodeSize,a):t.addNodeMark(r,a)}})})),increaseFontSize:gh((({commands:t})=>{const e=Number(Je(t.getFontSize())),n=Math.min(e+1,Je(this.options.maxSize));t.applyFontSize(String(n))})),decreaseFontSize:gh((({commands:t})=>{const e=Number(Je(t.getFontSize())),n=Math.max(e-1,Je(this.options.minSize));t.applyFontSize(String(n))}))}},addKeyboardShortcuts:()=>({"Mod-Shift-=":bh("increaseFontSize"),"Mod-Shift--":bh("decreaseFontSize")}),parseHTML(){const t=t=>{if(!t)return null;const e=Fh(t,Je(this.options.wrapperRef));return String(e)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:t(e.getPropertyValue("--zw-font-size-mobile")),tablet:t(e.getPropertyValue("--zw-font-size-tablet")),desktop:t(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const n=t(e);return{desktop:n,tablet:n,mobile:null}}}]},renderHTML({HTMLAttributes:t}){const e=t=>t?`${t}px`:null;return vh({font_size_mobile:e(t.mobile),font_size_tablet:e(t.tablet),font_size_desktop:e(t.desktop)})}}),pp=Kl.create({name:kc.FONT_COLOR,group:xc.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:gh((({commands:t})=>t.getCommonSettingMark(this.name,t.getDefaultFontColor()))),getDefaultFontColor:gh((({commands:t})=>{const e=t.getPreset();return xr((()=>Je(e).common.color))})),applyFontColor:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e})}))}},parseHTML(){const t=t=>({value:jh(t)});return[{style:"--zw-font-color",getAttrs:t},{style:"color",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({font_color:t.value})}),dp=Kl.create({name:kc.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:gh((({commands:t})=>t.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)"))),applyBackgroundColor:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e})}))}},parseHTML(){const t=t=>({value:jh(t)});return[{style:"--zw-background-color",getAttrs:t},{style:"background-color",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({background_color:t.value})}),fp=wl.create({name:"device_manager",addCommands(){return{getDevice:gh((()=>Ze(this.options,"device")))}}}),mp=Kl.create({name:kc.FONT_STYLE,group:xc.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:gh((({commands:t})=>{const e=t.getMark(this.name),n=t.getDefaultFontStyle();return xr((()=>Je(e)?.italic??Je(n).italic))})),isItalicAvailable:gh((({commands:t})=>{const e=t.getFont(),n=t.getFontWeight();return xr((()=>{const t=Je(e),r=Je(n);return t.isItalicSupported(r)&&!t.isWeightItalicOnly(r)}))})),getDefaultFontStyle:gh((({commands:t})=>{const e=t.getPreset();return xr((()=>({italic:"italic"===Je(e).common.font_style})))})),toggleItalic:gh((({commands:t})=>{Je(t.isItalicAvailable())&&(Je(t.isItalic())?t.removeItalic():t.applyItalic())})),applyItalic:gh((({commands:t})=>{t.applyMark(this.name,{italic:!0})})),removeItalic:gh((({commands:t})=>{t.applyMark(this.name,{italic:!1})}))}},addKeyboardShortcuts:()=>({"Mod-i":bh("toggleItalic"),"Mod-I":bh("toggleItalic")}),parseHTML(){const t=t=>({italic:t.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:t},{style:"font-style",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({font_style:t.italic?"italic":"normal"})}),gp=Kl.create({name:kc.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:gh((({commands:t})=>{const e=t.getTextDecoration();return xr((()=>Je(e).underline))})),isStrikeThrough:gh((({commands:t})=>{const e=t.getTextDecoration();return xr((()=>Je(e).strike_through))})),getTextDecoration:gh((({commands:t})=>{const e=t.getMark(this.name),n=t.getDefaultTextDecoration();return xr((()=>{const t=Je(e)??{},r=Je(n);return{underline:t.underline||r.underline,strike_through:t.strike_through||r.strike_through}}))})),isUnderlineCustomized:gh((({commands:t})=>{const e=t.isUnderline(),n=t.getDefaultTextDecoration();return xr((()=>Je(e)!==Je(n).underline))})),getDefaultTextDecoration:gh((({commands:t})=>{const e=t.getPreset();return xr((()=>{const{text_decoration:t}=Je(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}}))})),toggleUnderline:gh((({commands:t})=>{t.toggleTextDecoration("underline")})),toggleStrikeThrough:gh((({commands:t})=>{t.toggleTextDecoration("strike_through")})),toggleTextDecoration:gh((({commands:t},e,n=null)=>{const r=Je(t.getTextDecoration()),o=n??!r[e];t.applyMark(this.name,{[e]:o})})),applyTextDecoration:gh((({commands:t},e)=>{t.toggleTextDecoration(e,!0)})),removeTextDecoration:gh((({commands:t},e)=>{t.toggleTextDecoration(e,!1)}))}},addKeyboardShortcuts:()=>({"Mod-u":bh("toggleUnderline"),"Mod-U":bh("toggleUnderline")}),parseHTML(){const t=t=>{const e=t.includes("underline"),n=t.includes("line-through");return!(!e&&!n)&&{underline:e,strike_through:n}};return[{style:"--zw-text-decoration",getAttrs:t},{style:"text-decoration-line",getAttrs:t},{style:"text-decoration",getAttrs:t},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:t}){const e=[];return t.underline&&e.push("underline"),t.strike_through&&e.push("line-through"),e.length||e.push("none"),vh({text_decoration:e.join(" ")})}}),yp=wl.create({name:"case_style",addCommands:()=>({applyCaseStyle:gh((({commands:t},e)=>{switch(e){case vc.CAPITALIZE:return t.applyCapitalize();case vc.LOWERCASE:return t.applyLowerCase();case vc.UPPERCASE:return t.applyUpperCase()}})),applyCapitalize:gh((({commands:t})=>{t.transformText((({text:t})=>function(t){return t.toLowerCase().replace(/(?:^|\s)\S/g,(t=>t.toUpperCase()))}(t)))})),applyLowerCase:gh((({commands:t})=>{t.transformText((({text:t})=>t.toLowerCase()))})),applyUpperCase:gh((({commands:t})=>{t.transformText((({text:t})=>t.toUpperCase()))}))})}),vp={mobile:null,tablet:null,desktop:null},bp=wl.create({name:kc.ALIGNMENT,addGlobalAttributes:()=>[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{[kc.ALIGNMENT]:{isRequired:!1,parseHTML({style:t}){const e=function(t){const e=Bh[t]||t;return bc.values.includes(e)?e:null}(t.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const n=t.getPropertyValue("--zw-alignment-mobile")||null,r=t.getPropertyValue("--zw-alignment-tablet")||null,o=t.getPropertyValue("--zw-alignment-desktop")||null;return n||r||o?{desktop:o,tablet:r,mobile:n}:null},renderHTML:t=>t.alignment?yh({alignment_mobile:t.alignment.mobile,alignment_tablet:t.alignment.tablet,alignment_desktop:t.alignment.desktop}):null}}}],addCommands(){return{applyAlignment:gh((({commands:t},e)=>{const n=Je(t.getDevice());t.setBlockAttributes(this.name,{[n]:e},vp)})),removeAlignment:gh((({commands:t})=>t.removeBlockAttributes(this.name))),getAlignment:gh((({commands:t})=>{const e=t.getBlockAttributes(this.name,vp),n=t.getDevice(),r=t.getDefaultAlignment();return xr((()=>Je(e)?.[Je(n)]??Je(r)))})),getDefaultAlignment:gh((({commands:t})=>{const e=t.getDevice(),n=t.getPreset();return xr((()=>Je(n)[Je(e)].alignment??bc.LEFT))}))}},addKeyboardShortcuts:()=>({"Mod-Shift-l":bh("applyAlignment",bc.LEFT),"Mod-Shift-e":bh("applyAlignment",bc.CENTER),"Mod-Shift-r":bh("applyAlignment",bc.RIGHT),"Mod-Shift-j":bh("applyAlignment",bc.JUSTIFY)})}),_p={mobile:null,tablet:null,desktop:null},wp=wl.create({name:kc.LINE_HEIGHT,addGlobalAttributes(){return[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{[kc.LINE_HEIGHT]:{isRequired:!1,parseHTML:t=>{if(t.matches('[style*="--zw-line-height"]')){return{mobile:null,tablet:t.style.getPropertyValue("--zw-line-height-tablet")||null,desktop:t.style.getPropertyValue("--zw-line-height-desktop")||null}}const e=t.style.lineHeight;if(!e)return null;const n=Hh(e,t,Je(this.options.wrapperRef));return n?{desktop:n,tablet:n,mobile:null}:null},renderHTML:t=>t.line_height?yh({line_height_mobile:t.line_height.mobile,line_height_tablet:t.line_height.tablet,line_height_desktop:t.line_height.desktop}):null}}}]},addCommands(){return{getLineHeight:gh((({commands:t})=>{const e=t.getBlockAttributes(this.name,_p),n=t.getDevice(),r=t.getDefaultLineHeight();return xr((()=>Je(e)?.[Je(n)]??Je(r)))})),getDefaultLineHeight:gh((({commands:t})=>{const e=t.getDevice(),n=t.getPreset();return xr((()=>Je(n)[Je(e)].line_height))})),applyLineHeight:gh((({commands:t},e)=>{const n=Je(t.getDevice());t.setBlockAttributes(this.name,{[n]:e},_p)}))}}}),kp=Jl.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",el(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}).extend({name:_c.LIST_ITEM,marks:xc.SETTINGS,addCommands(){const t=({selection:t})=>t.$cursor.before(t.$cursor.depth-1);return{listItemNewline:gh((({commands:e,tr:n})=>{const r=n.doc.nodeAt(t(n));if(!n.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=t(n);for(const t of r.marks)n.addNodeMark(o,Yh(t));return!0}))}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:t=>{const{state:e,commands:n}=t.editor,r=e.selection.$cursor?.path.some((t=>t.type?.name===_c.LIST));if(r)return n.listItemNewline()}})}),xp=Jl.create({name:_c.LIST,content:`${_c.LIST_ITEM}+`,group:"block list",marks:xc.SETTINGS,addExtensions:()=>[kp],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:wc.DISC}}}),parseHTML(){const t={a:wc.ROMAN,i:wc.LATIN,1:wc.DECIMAL},e=e=>{for(const n of wc.values){const r=`.${Je(this.options.baseClass)}${n}`;if(e.matches(r))return n;if(t[e.type.toLowerCase()]===n)return n}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||wc.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||wc.DISC}})}]},renderHTML({HTMLAttributes:t}){const e=[Je(this.options.baseClass)+t.bullet.type,Je(this.options.presetClass)];return[wc.ordered.includes(t.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands:()=>({getListType:gh((({commands:t})=>{const e=t.getBlockAttributes("bullet",{type:null});return xr((()=>Je(e).type??null))})),applyList:gh((({commands:t,chain:e},n)=>{if(Je(t.getListType())!==n)return e().applyDefaultPreset().toggleList(_c.LIST,_c.LIST_ITEM).setBlockAttributes("bullet",{type:n}).command((({commands:t,tr:e})=>t._bubbleListItemMarks(e))).run();t.removeList()})),_bubbleListItemMarks:gh(((t,e)=>{const{doc:n,selection:r}=e,o=r.$from.start(),i=r.$to.end();function s(t,e){if(kc.inlineMarks.includes(e.type))return!1;if(e.type.isInSet(t.marks))return!1;for(const n of t.content.content)if(n.childCount){if(!n.marks)return!1;if(!e.isInSet(n.marks))return!1}return!0}n.nodesBetween(o,i,((t,n)=>{if(t.type.name===_c.LIST)return;if(t.type.name!==_c.LIST_ITEM)return!1;const r=[];return t.forEach((o=>{for(const i of o.marks)i.isInSet(r)?e.removeNodeMark(n+1,i):s(t,i)&&(e.removeNodeMark(n+1,i),e.addNodeMark(n,Yh(i)),r.push(i))})),!1}))})),removeList:gh((({commands:t,state:e})=>{const{tr:n,doc:r,selection:o}=e,i=o.$from.start(),s=o.$to.end();r.nodesBetween(i,s,((t,e,r)=>{if([_c.LIST,_c.LIST_ITEM].includes(t.type.name))return;if(r.type.name!==_c.LIST_ITEM)return!1;const o=r.marks.filter((function(e){return!e.type.isInSet(t.marks)}));for(const t of o)n.addNodeMark(e,Yh(t));return!1})),t.liftListItem(_c.LIST_ITEM)}))}),addInputRules(){const t=(t,e)=>{return n={find:e,type:this.type,getAttributes:{bullet:{type:t}},joinPredicate:(e,{attrs:n})=>n.bullet.type===t},new hl({find:n.find,handler:({state:t,range:e,match:r,chain:o})=>{const i=rl(n.getAttributes,void 0,r)||{},s=t.tr.delete(e.from,e.to),a=s.doc.resolve(e.from).blockRange(),l=a&&Yo(a,n.type,i);if(!l)return null;if(s.wrap(a,l),n.keepMarks&&n.editor){const{selection:e,storedMarks:r}=t,{splittableMarks:o}=n.editor.extensionManager,i=r||e.$to.parentOffset&&e.$from.marks();if(i){const t=i.filter((t=>o.includes(t.type.name)));s.ensureMarks(t)}}if(n.keepAttributes){const t="bulletList"===n.type.name||"orderedList"===n.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(e.from-1).nodeBefore;c&&c.type===n.type&&Qo(s.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&s.join(e.from-1)}});var n};return[t(wc.DISC,/^\s*([-+*])\s$/),t(wc.DECIMAL,/^(\d+)\.\s$/),t(wc.LATIN,/^([ivx]{1,3})\.\s$/i),t(wc.ROMAN,/^([a-z])\.\s$/i)]}});function Sp(t){return new Ii({key:new Li("autolink"),appendTransaction:(e,n,r)=>{const o=e.some((t=>t.docChanged))&&!n.doc.eq(r.doc),i=e.some((t=>t.getMeta("preventAutolink")));if(!o||i)return;const{tr:s}=r,a=function(t,e){const n=new mi(t);return e.forEach((t=>{t.steps.forEach((t=>{n.step(t)}))})),n}(n.doc,[...e]),l=function(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach(((t,o)=>{const i=[];if(t.ranges.length)t.forEach(((t,e)=>{i.push({from:t,to:e})}));else{const{from:t,to:e}=n[o];if(void 0===t||void 0===e)return;i.push({from:t,to:e})}i.forEach((({from:t,to:n})=>{const i=e.slice(o).map(t,-1),s=e.slice(o).map(n),a=e.invert().map(i,-1),l=e.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})}))})),jl(r)}(a);return l.forEach((({newRange:e})=>{const n=function(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,((t,e)=>{n(t)&&r.push({node:t,pos:e})})),r}(r.doc,e,(t=>t.isTextblock));let o,i;if(n.length>1?(o=n[0],i=r.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ")):n.length&&r.doc.textBetween(e.from,e.to," "," ").endsWith(" ")&&(o=n[0],i=r.doc.textBetween(o.pos,e.to,void 0," ")),o&&i){const e=i.split(" ").filter((t=>""!==t));if(e.length<=0)return!1;const n=e[e.length-1],a=o.pos+i.lastIndexOf(n);if(!n)return!1;fh(n).filter((t=>t.isLink)).map((t=>({...t,from:a+t.start+1,to:a+t.end+1}))).filter((t=>!r.schema.marks.code||!r.doc.rangeHasMark(t.from,t.to,r.schema.marks.code))).filter((e=>!t.validate||t.validate(e.value))).forEach((e=>{Fl(e.from,e.to,r.doc).some((e=>e.mark.type===t.type))||s.addMark(e.from,e.to,t.type.create({href:e.href}))}))}})),s.steps.length?s:void 0}})}const Ep=Kl.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach((t=>{"string"!=typeof t?hh(t.scheme,t.optionalSlashes):hh(t)}))},onDestroy(){Wc.groups={},uh.scanner=null,uh.parser=null,uh.tokenQueue=[],uh.pluginQueue=[],uh.customSchemes=[],uh.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}),addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML:()=>[{tag:'a[href]:not([href *= "javascript:" i])'}],renderHTML({HTMLAttributes:t}){var e;return(null===(e=t.href)||void 0===e?void 0:e.startsWith("javascript:"))?["a",el(this.options.HTMLAttributes,{...t,href:""}),0]:["a",el(this.options.HTMLAttributes,t),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[(t={find:t=>fh(t).filter((t=>!this.options.validate||this.options.validate(t.value))).filter((t=>t.isLink)).map((t=>({text:t.value,index:t.start,data:t}))),type:this.type,getAttributes:(t,e)=>{var n,r;const o=null===(n=null==e?void 0:e.clipboardData)||void 0===n?void 0:n.getData("text/html"),i=null==o?void 0:o.match(/href="([^"]*)"/);return i?{href:i[1]}:{href:null===(r=t.data)||void 0===r?void 0:r.href}}},new ml({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=rl(t.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),u=o+a.length;if(Fl(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>o)).length)return null;u<n.to&&s.delete(u,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}}))];var t},addProseMirrorPlugins(){const t=[];var e;return this.options.autolink&&t.push(Sp({type:this.type,validate:this.options.validate})),this.options.openOnClick&&t.push((e={type:this.type},new Ii({key:new Li("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if("A"!==r.target.nodeName)return!1;const s=zl(t.state,e.type.name),a=r.target,l=null!==(o=null==a?void 0:a.href)&&void 0!==o?o:s.href,c=null!==(i=null==a?void 0:a.target)&&void 0!==i?i:s.target;return!(!a||!l||(t.editable&&window.open(l,c),0))}}}))),this.options.linkOnPaste&&t.push(function(t){return new Ii({key:new Li("handlePasteLink"),props:{handlePaste:(e,n,r)=>{var o;const{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach((t=>{l+=t.textContent}));const c=fh(l).find((t=>t.isLink&&t.value===l));if(!l||!c)return!1;const u=null===(o=n.clipboardData)||void 0===o?void 0:o.getData("text/html"),h=null==u?void 0:u.match(/href="([^"]*)"/),p=h?h[1]:c.href;return t.editor.commands.setMark(t.type,{href:p}),!0}}})}({editor:this.editor,type:this.type})),t}}),Cp=Ep.extend({name:kc.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:t=>{const e=t.getAttribute("href");return e.startsWith("#")?parseFloat(t.getAttribute("href").replace("#","")):e}},target:{default:Sc.SELF,parseHTML:t=>t.getAttribute("target")||Sc.SELF},destination:{default:Ec.URL,parseHTML:t=>{const e=t.getAttribute("href");if(!e.startsWith("#"))return Ec.URL;const n=e.replace("#","");return Je(this.options.pageBlocks).find((t=>t.id===parseInt(n)))?Ec.BLOCK:Ec.URL}}}},addCommands(){const{unsetLink:t}=this.parent();return{removeLink:t,applyLink:gh((({commands:t,chain:e},n)=>(t.setMeta("preventAutolink",!0),t.getSelectedText()?e().applyMark(this.name,n).expandSelectionToLink().command((({tr:t})=>(n.text&&t.insertText(n.text,t.selection.from,t.selection.to),!0))).run():t.insertContent(Pp.text(n.text,[Pp.mark(kc.LINK,n)]))))),expandSelectionToLink:gh((({commands:t})=>{t.expandSelection((({node:t})=>this.type.isInSet(t.marks)))})),isLink:gh((({commands:t})=>t.hasMark(this.name))),getLinkPreset:gh((()=>xr((()=>Je(this.options.preset)))))}},addProseMirrorPlugins(){return[...this.parent(),mh.create(this.editor)]},renderHTML({HTMLAttributes:t}){const e=t.destination===Ec.BLOCK?`#${t.href}`:t.href,n=Je(this.options.basePresetClass)+Je(this.options.preset).id;return["a",{href:e,target:t.target,class:`${n} zw-style`},0]}}),Op=Kl.create({name:kc.SUPERSCRIPT,addCommands(){return{applySuperscript:gh((({commands:t})=>{t.setMark(this.name)})),removeSuperscript:gh((({commands:t})=>{t.unsetMark(this.name)})),toggleSuperscript:gh((({commands:t})=>{Je(t.isSuperscript())?t.removeSuperscript():t.applySuperscript()})),isSuperscript:gh((({commands:t})=>{const e=t.getMark(this.name);return xr((()=>!!Je(e)))}))}},parseHTML:()=>[{tag:"sup"},{style:"vertical-align",getAttrs:t=>"super"===t&&null}],renderHTML:()=>["sup",{class:"zw-superscript"},0]}),Ap=wl.create({name:kc.MARGIN,addGlobalAttributes:()=>[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{[kc.MARGIN]:{isRequired:!1,parseHTML(t){const{margin:e,marginTop:n,marginRight:r,marginBottom:o,marginLeft:i}=t.style;if(![e,n,r,o,i].some((t=>!!t)))return null;if(e)return{value:e};return{value:[n||0,r||0,o||0,i||0].join(" ")}},renderHTML:t=>t.margin?yh({margin:t.margin.value}):null}}}]});function Mp(t){const e=e=>t.presetsRef.value.find((t=>t.id===e)),n=Ie({default:null,link:null});return function(t,e,n){"production"===process.env.NODE_ENV||it(e)||en("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),$n(t,e,n)}(t.presetsRef,(()=>{n.default=e(t.defaultPresetId),n.link=e(t.linkPresetId)}),{immediate:!0,deep:!0}),[np,op,sp,Gl,gc,Xh,Zh,Qh,ap].concat([cp.configure({presets:t.presetsRef,defaultId:t.defaultPresetId,styleRenderer:new zp({baseClass:t.basePresetClass,makeVariable:t.makePresetVariable,linkPresetId:t.linkPresetId})}),xp.configure({baseClass:t.baseListClass,presetClass:t.basePresetClass+t.defaultPresetId}),fp.configure({device:t.deviceRef}),hp.configure({minSize:t.minFontSize,maxSize:t.maxFontSize,wrapperRef:t.wrapperRef}),lp.configure({fonts:t.fonts,defaultPreset:Ze(n,"default")}),up,pp,dp,mp,gp,yp,Op,bp,wp.configure({wrapperRef:t.wrapperRef}),Cp.configure({preset:Ze(n,"link"),basePresetClass:t.basePresetClass,pageBlocks:t.pageBlocksRef}),Ap])}class Tp{_domParser=new DOMParser;types=window;parse(t){return this._domParser.parseFromString(t,"text/html")}}class Np{content;constructor({content:t}){this.content=t}normalize(){throw new Error("Implement abstract method")}}class Ip extends Np{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=Ip.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:t,parser:e}){super({content:t}),this._parser=e,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,(t=>"BR"===t.tagName)),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,(t=>"LI"===t.tagName)),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const t=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(t,(t=>t.remove()))}_normalizeRootTags(){const t=Array.from(this.dom.body.childNodes),e=this.dom.createDocumentFragment();let n;for(const r of t)this._isRootNode(r)?(e.append(r),n=null):(n||(n=this.dom.createElement("p"),e.append(n)),n.append(r));this.dom.body.innerHTML="",this.dom.body.append(e)}_createNodeIterator(t,e){return this.dom.createNodeIterator(this.dom.body,t,e)}_iterateNodes(t,e=(()=>!0)){const n=t=>"BODY"!==t.tagName&&e.call(this,t),r=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:t=>n(t)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(r,t)}_runIterator(t,e){let n=t.nextNode();for(;n;)e.call(this,n),n=t.nextNode()}_removeEmptyNodes(t){t.innerHTML.trim()||t.remove()}_normalizeListItems(t){const e=this.dom.createDocumentFragment(),n=Array.from(t.childNodes);let r,o;const i=n=>{this._assignElementProperties(n,t,Ip.BLOCK_STYLES),e.append(n)};this._assignElementProperties(t,t.parentElement,Ip.BLOCK_STYLES);for(const t of n)if(this._isBlockNode(t))i(t),r=null,o=t;else if("BR"===t.tagName&&o&&"BR"!==o?.tagName)t.remove(),o=t;else if("BR"!==t.tagName)r||(r=this.dom.createElement("p"),i(r)),r.append(t),o=t;else{const e=this.dom.createElement("p");e.append(t),i(e),r=null,o=t}t.append(e),this._removeStyleProperties(t,Ip.BLOCK_STYLES),this._removeStyleProperties(t.parentElement,Ip.BLOCK_STYLES),this._assignElementProperties(t,t.parentElement),t.parentElement.lastElementChild===t&&this._removeStyleProperties(t.parentElement)}_isBlockNode(t){return Ip.BLOCK_NODE_NAMES.includes(t.tagName)}_isRootNode(t){return Ip.ROOT_NODE_NAMES.includes(t.tagName)}_assignElementProperties(t,e,n=Array.from(e.style)){for(const r of n){const n=e.style.getPropertyValue(r);n&&!t.style.getPropertyValue(r)&&t.style.setProperty(r,n)}}_removeStyleProperties(t,e=Array.from(t.style)){for(const n of e)t.style.removeProperty(n);0===t.style.length&&t.removeAttribute("style")}_normalizeBreakLines({parentElement:t}){if(!this._isBlockNode(t))return;if(!t.textContent)return;const e=this.dom.createDocumentFragment(),n=Array.from(t.childNodes),r=t.cloneNode(!0);r.innerHTML="";let o=r.cloneNode();const i=n=>{this._assignElementProperties(n,t,Ip.BLOCK_STYLES),e.append(n)};for(const t of n)"BR"!==t.tagName?o.append(t):(i(o),o=r.cloneNode());e.append(o),t.replaceWith(e)}_normalizeBlockTextDecoration(){const t=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const e of t)this._moveTextDecorationToChildren(e)}_moveTextDecorationToChildren(t){const e=this._parseTextDecoration(t);if(t.style.removeProperty("text-decoration-line"),t.style.removeProperty("text-decoration"),t.style.cssText||t.removeAttribute("style"),!e.none)for(const n of t.childNodes){const r=this._wrapTextNode(t,n),o=this._parseTextDecoration(r),i={underline:o.underline||e.underline,line_through:o.line_through||e.line_through};r.style.removeProperty("text-decoration-line"),r.style.removeProperty("text-decoration"),r.style.textDecoration=Object.entries(i).filter((([,t])=>t)).map((([t])=>t.replace("_","-"))).join(" ")}}_parseTextDecoration(t){const{textDecoration:e,textDecorationLine:n}=t.style,r=e||n||"";return{none:r.includes("none"),underline:r.includes("underline"),line_through:r.includes("line-through")}}_normalizeBlockBackgroundColor(){const t=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const e of t)this._moveBackgroundColorToChildren(e)}_moveBackgroundColorToChildren(t){const e=t.style.backgroundColor;t.style.removeProperty("background-color"),t.style.cssText||t.removeAttribute("style");for(const n of t.childNodes){const r=this._wrapTextNode(t,n),o=r.style.backgroundColor||e;r.style.backgroundColor=o}}_wrapTextNode(t,e){if(e.nodeType!==this._Node.TEXT_NODE)return e;const n=this.dom.createElement("span");return n.append(e.cloneNode()),t.replaceChild(n,e),n}}class Rp extends Np{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(t){this._iterateChildNodes(this.content,t)}_iterateChildNodes(t,e){for(const n of t.content)n.content&&this._iterateChildNodes(n,e),e.call(this,n)}_bubbleMarks(t){if(t.content&&t.type!==_c.LIST)for(const e of t.content)if(!this._isLink(e)&&e.marks)for(const n of e.marks.slice())this._includesMark(t,n)?this._removeMark(e,n):this._canBubbleMark(t,n)&&(this._removeMark(e,n),this._addMark(t,n))}_canBubbleMark(t,e){if(kc.inlineMarks.includes(e.type))return!1;if(this._includesMarkType(t,e.type))return!1;for(const n of t.content)if(n.content||t.type!==_c.LIST_ITEM){if(!n.marks)return!1;if(!this._includesMark(n,e))return!1}return!0}_includesMark(t,e){return t.marks?.some((t=>Gh.isEqual(t,e)))??!1}_includesMarkType(t,e){return t.marks?.some((t=>t.type===e))??!1}_isLink(t){return t.type===_c.TEXT&&this._includesMarkType(t,kc.LINK)}_removeMark(t,e){if(!t.marks)return;const n=this._findMarkIndexByType(t,e.type);n>=0&&t.marks.splice(n,1),t.marks.length||delete t.marks}_addMark(t,e){this._removeMark(t,e),t.marks??=[],t.marks.push(e)}_findMarkIndexByType(t,e){return t.marks?.findIndex((t=>t.type===e))??null}}class Dp{static build(t,e={}){return"string"==typeof t?this._buildHtml(t,e):this._buildJson(t)}static _buildHtml(t,e){return new Ip({content:t,parser:e.parser||new Tp})}static _buildJson(t){return new Rp({content:t})}static normalize(t,e={}){return Dp.build(t,e).normalize()}}class Lp{static window=globalThis.window;static use(t){this.window=t}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(t){return this.window.getComputedStyle(t)}}class $p{static build({config:t,nodeDomParser:e}){const n=function(t,e){return sl(vl.resolve(t),e)}(Mp({fonts:t.fonts,minFontSize:0,maxFontSize:0,presetsRef:Ue(t.presets),defaultPresetId:t.defaultPresetId,linkPresetId:t.linkPresetId,makePresetVariable:()=>"",basePresetClass:t.basePresetClass,baseListClass:t.baseListClass,deviceRef:Ue(yc.DESKTOP),pageBlocksRef:Ue([]),wrapperRef:Lp.document.createElement("p")}));return new $p({schema:n,domParser:bo.fromSchema(n),nodeDomParser:e})}_schema;_domParser;_nodeDomParser;constructor({schema:t,domParser:e,nodeDomParser:n}){this._schema=t,this._domParser=e,this._nodeDomParser=n}toJSON(t){const e=Dp.build(t,{parser:this._nodeDomParser});return e.normalizeHTML(),this._domParser.parse(e.dom.body).toJSON()}}class Pp{static doc(t){return{type:_c.DOCUMENT,content:t}}static list(t,e){return{type:_c.LIST,attrs:{bullet:{type:t}},content:e.map((t=>t.type===_c.LIST_ITEM?t:this.listItem([].concat(t))))}}static listItem(...t){const{attrs:e,content:n,marks:r}=this._normalizeTextBlockArgs(t);return{type:_c.LIST_ITEM,...e?{attrs:e}:{},...r?{marks:r}:{},content:[].concat(n).map((t=>"string"==typeof t?this.paragraph(t):t))}}static heading(t,...e){const n=this._textBlock(e,this.text);return n.attrs??={},n.attrs.level=t,{type:_c.HEADING,...n}}static paragraph(...t){return{type:_c.PARAGRAPH,...this._textBlock(t,this.text)}}static _textBlock(t){const{attrs:e,content:n,marks:r}=this._normalizeTextBlockArgs(t);return{content:"string"==typeof n?[this.text(n)]:n,...e?{attrs:e}:{},...r?{marks:r}:{}}}static _normalizeTextBlockArgs(t){return 1===t.length?{attrs:null,marks:null,content:t[0]}:2===t.length?{attrs:t[0],marks:null,content:t[1]}:{attrs:t[0],marks:t[1],content:t[2]}}static text(t,e){return{type:_c.TEXT,...e?{marks:e}:{},text:t}}static link(t,e,n=[]){return this.text(t,[this.mark(kc.LINK,e),...n])}static mark(t,e){return{type:t,attrs:e}}static populateAllDevices(t){return{mobile:t,tablet:t,desktop:t}}}class zp{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:t,makeVariable:e,linkPresetId:n}){this._baseClass=t,this._makeVariable=e,this._linkPresetId=n}inject(t,e){let n=t.querySelector("[data-zw-styles]");n||(n=Lp.document.createElement("style"),n.dataset.zwStyles="",n.innerHTML=this.render(e),t.append(n))}render(t){let e="";for(const n of t){const t=n.id===this._linkPresetId;e+=` ${this.makePresetCssClass(n)} {`;for(const r of yc.values)for(const o of Object.keys(n[r])){const i=this._makeVariable({device:r,preset:n,property:o}),s=this._makeInternalVariableName(o,r);if(e+=`${s}: var(${i}, inherit);`,t&&!kc.attributes.includes(o)){e+=`${s.replace("preset-","")}: var(${s});`}}e+="}"}return e}_makeInternalVariableName(t,e){return`--zw-preset-${"color"===t?"font-color":t.replace(/_/i,"-")}${e===yc.COMMON?"":`-${e}`}`}makePresetHtmlClass(t){return this._baseClass+t.id}makePresetCssClass(t){return this.makePresetHtmlClass(t).split(" ").map((t=>`.${t}`)).join("")}}class jp{static _instance;static get instance(){return this._instance??=new jp,this._instance}static query(t,e){return this.instance.query(t,e)}query(t,e){let n=null;return t.descendants((t=>!n&&(this.matchNode(t,e)?(n=t,!1):void 0))),n?e.getMark?this.getMark(n,e.getMark):n:null}matchNode(t,e){return(!e.typeName||e.typeName===t.type.name)&&!(e.mark&&!this.getMark(t,e.mark))}getMark(t,e){return t.marks.find((t=>this.matchMark(t,e)))||null}matchMark(t,e){return t.type.name===e.typeName}}class Fp{static createWindow(){return(new i.JSDOM).window}types;parse(t){const{window:e}=new i.JSDOM(t);return this.types=e,e.document}}class Hp{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(t){if(!this.name)throw new Error('Command "name" is required');let e=t.command(this.name);if(this.description&&(e=e.description(this.description)),this.argument&&(e=e.argument(this.argument)),this.options.length)for(const t of this.options)e=e.option(t.flags,t.description,t.default);e.action(this.doCommand.bind(this))}output(t){console.log(t)}}const Bp=new W,Vp=[class extends Hp{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:n.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(t,{config:e,format:r}){Lp.use(Fp.createWindow());const o=n.resolve(process.cwd(),e),i=$p.build({config:require(o).editor,nodeDomParser:new Fp}),s=t.map((t=>i.toJSON(this._formatInputHtml(t)))),a=1===s.length?s[0]:s,l=this._stringifyContent(a);this.output("rb"===r?this._formatOutputRb(l):l)}_formatInputHtml(t){return t.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,((t,e)=>t.replace(e,parseFloat(e)/100)))}_stringifyContent(t){return JSON.stringify(t,((t,e)=>null===e?void 0:e),2)}_formatOutputRb(t){return t.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,(t=>t.replace(/"/g,""))).replace(/: "(.+)"([,\n])/g,": '$1'$2")}},class extends Hp{name="version";description="display cli version";doCommand(){this.output("4.1.0")}}];for(const t of Vp)(new t).install(Bp);Bp.parse();
24
+ */Kh=Gh,Jh=Gh.exports,function(){var t,e="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",o=16,i=32,a=64,l=128,c=256,u=1/0,h=9007199254740991,p=NaN,d=4294967295,f=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",o],["flip",512],["partial",i],["partialRight",a],["rearg",c]],m="[object Arguments]",g="[object Array]",y="[object Boolean]",v="[object Date]",b="[object Error]",_="[object Function]",w="[object GeneratorFunction]",k="[object Map]",x="[object Number]",S="[object Object]",E="[object Promise]",O="[object RegExp]",C="[object Set]",A="[object String]",M="[object Symbol]",T="[object WeakMap]",N="[object ArrayBuffer]",I="[object DataView]",R="[object Float32Array]",L="[object Float64Array]",D="[object Int8Array]",$="[object Int16Array]",P="[object Int32Array]",z="[object Uint8Array]",j="[object Uint8ClampedArray]",F="[object Uint16Array]",H="[object Uint32Array]",B=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,U=/[&<>"']/g,K=RegExp(q.source),J=RegExp(U.source),G=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(et.source),rt=/^\s+/,ot=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,st=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pt=/\w*$/,dt=/^[-+]0x[0-9a-f]+$/i,ft=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,vt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bt=/($^)/,_t=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",kt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xt="\\u2700-\\u27bf",St="a-z\\xdf-\\xf6\\xf8-\\xff",Et="A-Z\\xc0-\\xd6\\xd8-\\xde",Ot="\\ufe0e\\ufe0f",Ct="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="['’]",Mt="["+wt+"]",Tt="["+Ct+"]",Nt="["+kt+"]",It="\\d+",Rt="["+xt+"]",Lt="["+St+"]",Dt="[^"+wt+Ct+It+xt+St+Et+"]",$t="\\ud83c[\\udffb-\\udfff]",Pt="[^"+wt+"]",zt="(?:\\ud83c[\\udde6-\\uddff]){2}",jt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="["+Et+"]",Ht="\\u200d",Bt="(?:"+Lt+"|"+Dt+")",Vt="(?:"+Ft+"|"+Dt+")",Wt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ut="(?:"+Nt+"|"+$t+")?",Kt="["+Ot+"]?",Jt=Kt+Ut+"(?:"+Ht+"(?:"+[Pt,zt,jt].join("|")+")"+Kt+Ut+")*",Gt="(?:"+[Rt,zt,jt].join("|")+")"+Jt,Yt="(?:"+[Pt+Nt+"?",Nt,zt,jt,Mt].join("|")+")",Xt=RegExp(At,"g"),Zt=RegExp(Nt,"g"),Qt=RegExp($t+"(?="+$t+")|"+Yt+Jt,"g"),te=RegExp([Ft+"?"+Lt+"+"+Wt+"(?="+[Tt,Ft,"$"].join("|")+")",Vt+"+"+qt+"(?="+[Tt,Ft+Bt,"$"].join("|")+")",Ft+"?"+Bt+"+"+Wt,Ft+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",It,Gt].join("|"),"g"),ee=RegExp("["+Ht+wt+kt+Ot+"]"),ne=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],oe=-1,ie={};ie[R]=ie[L]=ie[D]=ie[$]=ie[P]=ie[z]=ie[j]=ie[F]=ie[H]=!0,ie[m]=ie[g]=ie[N]=ie[y]=ie[I]=ie[v]=ie[b]=ie[_]=ie[k]=ie[x]=ie[S]=ie[O]=ie[C]=ie[A]=ie[T]=!1;var se={};se[m]=se[g]=se[N]=se[I]=se[y]=se[v]=se[R]=se[L]=se[D]=se[$]=se[P]=se[k]=se[x]=se[S]=se[O]=se[C]=se[A]=se[M]=se[z]=se[j]=se[F]=se[H]=!0,se[b]=se[_]=se[T]=!1;var ae={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},le=parseFloat,ce=parseInt,ue="object"==typeof s&&s&&s.Object===Object&&s,he="object"==typeof self&&self&&self.Object===Object&&self,pe=ue||he||Function("return this")(),de=Jh&&!Jh.nodeType&&Jh,fe=de&&Kh&&!Kh.nodeType&&Kh,me=fe&&fe.exports===de,ge=me&&ue.process,ye=function(){try{var t=fe&&fe.require&&fe.require("util").types;return t||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),ve=ye&&ye.isArrayBuffer,be=ye&&ye.isDate,_e=ye&&ye.isMap,we=ye&&ye.isRegExp,ke=ye&&ye.isSet,xe=ye&&ye.isTypedArray;function Se(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ee(t,e,n,r){for(var o=-1,i=null==t?0:t.length;++o<i;){var s=t[o];e(r,s,n(s),t)}return r}function Oe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ae(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Me(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var s=t[n];e(s,n,t)&&(i[o++]=s)}return i}function Te(t,e){return!(null==t||!t.length)&&Fe(t,e,0)>-1}function Ne(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1}function Ie(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function Re(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function Le(t,e,n,r){var o=-1,i=null==t?0:t.length;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}function De(t,e,n,r){var o=null==t?0:t.length;for(r&&o&&(n=t[--o]);o--;)n=e(n,t[o],o,t);return n}function $e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Pe=We("length");function ze(t,e,n){var r;return n(t,(function(t,n,o){if(e(t,n,o))return r=n,!1})),r}function je(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}function Fe(t,e,n){return e==e?function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}(t,e,n):je(t,Be,n)}function He(t,e,n,r){for(var o=n-1,i=t.length;++o<i;)if(r(t[o],e))return o;return-1}function Be(t){return t!=t}function Ve(t,e){var n=null==t?0:t.length;return n?Ke(t,e)/n:p}function We(e){return function(n){return null==n?t:n[e]}}function qe(e){return function(n){return null==e?t:e[n]}}function Ue(t,e,n,r,o){return o(t,(function(t,o,i){n=r?(r=!1,t):e(n,t,o,i)})),n}function Ke(e,n){for(var r,o=-1,i=e.length;++o<i;){var s=n(e[o]);s!==t&&(r=r===t?s:r+s)}return r}function Je(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ge(t){return t?t.slice(0,dn(t)+1).replace(rt,""):t}function Ye(t){return function(e){return t(e)}}function Xe(t,e){return Ie(e,(function(e){return t[e]}))}function Ze(t,e){return t.has(e)}function Qe(t,e){for(var n=-1,r=t.length;++n<r&&Fe(e,t[n],0)>-1;);return n}function tn(t,e){for(var n=t.length;n--&&Fe(e,t[n],0)>-1;);return n}var en=qe({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nn=qe({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rn(t){return"\\"+ae[t]}function on(t){return ee.test(t)}function sn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function an(t,e){return function(n){return t(e(n))}}function ln(t,e){for(var n=-1,o=t.length,i=0,s=[];++n<o;){var a=t[n];a!==e&&a!==r||(t[n]=r,s[i++]=n)}return s}function cn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function hn(t){return on(t)?function(t){for(var e=Qt.lastIndex=0;Qt.test(t);)++e;return e}(t):Pe(t)}function pn(t){return on(t)?function(t){return t.match(Qt)||[]}(t):function(t){return t.split("")}(t)}function dn(t){for(var e=t.length;e--&&ot.test(t.charAt(e)););return e}var fn=qe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),mn=function s(ot){var wt,kt=(ot=null==ot?pe:mn.defaults(pe.Object(),ot,mn.pick(pe,re))).Array,xt=ot.Date,St=ot.Error,Et=ot.Function,Ot=ot.Math,Ct=ot.Object,At=ot.RegExp,Mt=ot.String,Tt=ot.TypeError,Nt=kt.prototype,It=Et.prototype,Rt=Ct.prototype,Lt=ot["__core-js_shared__"],Dt=It.toString,$t=Rt.hasOwnProperty,Pt=0,zt=(wt=/[^.]+$/.exec(Lt&&Lt.keys&&Lt.keys.IE_PROTO||""))?"Symbol(src)_1."+wt:"",jt=Rt.toString,Ft=Dt.call(Ct),Ht=pe._,Bt=At("^"+Dt.call($t).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=me?ot.Buffer:t,Wt=ot.Symbol,qt=ot.Uint8Array,Ut=Vt?Vt.allocUnsafe:t,Kt=an(Ct.getPrototypeOf,Ct),Jt=Ct.create,Gt=Rt.propertyIsEnumerable,Yt=Nt.splice,Qt=Wt?Wt.isConcatSpreadable:t,ee=Wt?Wt.iterator:t,ae=Wt?Wt.toStringTag:t,ue=function(){try{var t=di(Ct,"defineProperty");return t({},"",{}),t}catch(t){}}(),he=ot.clearTimeout!==pe.clearTimeout&&ot.clearTimeout,de=xt&&xt.now!==pe.Date.now&&xt.now,fe=ot.setTimeout!==pe.setTimeout&&ot.setTimeout,ge=Ot.ceil,ye=Ot.floor,Pe=Ct.getOwnPropertySymbols,qe=Vt?Vt.isBuffer:t,gn=ot.isFinite,yn=Nt.join,vn=an(Ct.keys,Ct),bn=Ot.max,_n=Ot.min,wn=xt.now,kn=ot.parseInt,xn=Ot.random,Sn=Nt.reverse,En=di(ot,"DataView"),On=di(ot,"Map"),Cn=di(ot,"Promise"),An=di(ot,"Set"),Mn=di(ot,"WeakMap"),Tn=di(Ct,"create"),Nn=Mn&&new Mn,In={},Rn=ji(En),Ln=ji(On),Dn=ji(Cn),$n=ji(An),Pn=ji(Mn),zn=Wt?Wt.prototype:t,jn=zn?zn.valueOf:t,Fn=zn?zn.toString:t;function Hn(t){if(na(t)&&!qs(t)&&!(t instanceof qn)){if(t instanceof Wn)return t;if($t.call(t,"__wrapped__"))return Fi(t)}return new Wn(t)}var Bn=function(){function e(){}return function(n){if(!ea(n))return{};if(Jt)return Jt(n);e.prototype=n;var r=new e;return e.prototype=t,r}}();function Vn(){}function Wn(e,n){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=t}function qn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Un(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Kn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Jn;++e<n;)this.add(t[e])}function Yn(t){var e=this.__data__=new Kn(t);this.size=e.size}function Xn(t,e){var n=qs(t),r=!n&&Ws(t),o=!n&&!r&&Gs(t),i=!n&&!r&&!o&&ua(t),s=n||r||o||i,a=s?Je(t.length,Mt):[],l=a.length;for(var c in t)!e&&!$t.call(t,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_i(c,l))||a.push(c);return a}function Zn(e){var n=e.length;return n?e[Gr(0,n-1)]:t}function Qn(t,e){return $i(No(t),lr(e,0,t.length))}function tr(t){return $i(No(t))}function er(e,n,r){(r!==t&&!Hs(e[n],r)||r===t&&!(n in e))&&sr(e,n,r)}function nr(e,n,r){var o=e[n];$t.call(e,n)&&Hs(o,r)&&(r!==t||n in e)||sr(e,n,r)}function rr(t,e){for(var n=t.length;n--;)if(Hs(t[n][0],e))return n;return-1}function or(t,e,n,r){return dr(t,(function(t,o,i){e(r,t,n(t),i)})),r}function ir(t,e){return t&&Io(e,Ia(e),t)}function sr(t,e,n){"__proto__"==e&&ue?ue(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(e,n){for(var r=-1,o=n.length,i=kt(o),s=null==e;++r<o;)i[r]=s?t:Ca(e,n[r]);return i}function lr(e,n,r){return e==e&&(r!==t&&(e=e<=r?e:r),n!==t&&(e=e>=n?e:n)),e}function cr(e,n,r,o,i,s){var a,l=1&n,c=2&n,u=4&n;if(r&&(a=i?r(e,o,i,s):r(e)),a!==t)return a;if(!ea(e))return e;var h=qs(e);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&$t.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!l)return No(e,a)}else{var p=gi(e),d=p==_||p==w;if(Gs(e))return Eo(e,l);if(p==S||p==m||d&&!i){if(a=c||d?{}:vi(e),!l)return c?function(t,e){return Io(t,mi(t),e)}(e,function(t,e){return t&&Io(e,Ra(e),t)}(a,e)):function(t,e){return Io(t,fi(t),e)}(e,ir(a,e))}else{if(!se[p])return i?e:{};a=function(t,e,n){var r,o=t.constructor;switch(e){case N:return Oo(t);case y:case v:return new o(+t);case I:return function(t,e){var n=e?Oo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case R:case L:case D:case $:case P:case z:case j:case F:case H:return Co(t,n);case k:return new o;case x:case A:return new o(t);case O:return function(t){var e=new t.constructor(t.source,pt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case C:return new o;case M:return r=t,jn?Ct(jn.call(r)):{}}}(e,p,l)}}s||(s=new Yn);var f=s.get(e);if(f)return f;s.set(e,a),aa(e)?e.forEach((function(t){a.add(cr(t,n,r,t,e,s))})):ra(e)&&e.forEach((function(t,o){a.set(o,cr(t,n,r,o,e,s))}));var g=h?t:(u?c?si:ii:c?Ra:Ia)(e);return Oe(g||e,(function(t,o){g&&(t=e[o=t]),nr(a,o,cr(t,n,r,o,e,s))})),a}function ur(e,n,r){var o=r.length;if(null==e)return!o;for(e=Ct(e);o--;){var i=r[o],s=n[i],a=e[i];if(a===t&&!(i in e)||!s(a))return!1}return!0}function hr(n,r,o){if("function"!=typeof n)throw new Tt(e);return Ii((function(){n.apply(t,o)}),r)}function pr(t,e,n,r){var o=-1,i=Te,s=!0,a=t.length,l=[],c=e.length;if(!a)return l;n&&(e=Ie(e,Ye(n))),r?(i=Ne,s=!1):e.length>=200&&(i=Ze,s=!1,e=new Gn(e));t:for(;++o<a;){var u=t[o],h=null==n?u:n(u);if(u=r||0!==u?u:0,s&&h==h){for(var p=c;p--;)if(e[p]===h)continue t;l.push(u)}else i(e,h,r)||l.push(u)}return l}Hn.templateSettings={escape:G,evaluate:Y,interpolate:X,variable:"",imports:{_:Hn}},Hn.prototype=Vn.prototype,Hn.prototype.constructor=Hn,Wn.prototype=Bn(Vn.prototype),Wn.prototype.constructor=Wn,qn.prototype=Bn(Vn.prototype),qn.prototype.constructor=qn,Un.prototype.clear=function(){this.__data__=Tn?Tn(null):{},this.size=0},Un.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Un.prototype.get=function(e){var r=this.__data__;if(Tn){var o=r[e];return o===n?t:o}return $t.call(r,e)?r[e]:t},Un.prototype.has=function(e){var n=this.__data__;return Tn?n[e]!==t:$t.call(n,e)},Un.prototype.set=function(e,r){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Tn&&r===t?n:r,this},Kn.prototype.clear=function(){this.__data__=[],this.size=0},Kn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0||(n==e.length-1?e.pop():Yt.call(e,n,1),--this.size,0))},Kn.prototype.get=function(e){var n=this.__data__,r=rr(n,e);return r<0?t:n[r][1]},Kn.prototype.has=function(t){return rr(this.__data__,t)>-1},Kn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Jn.prototype.clear=function(){this.size=0,this.__data__={hash:new Un,map:new(On||Kn),string:new Un}},Jn.prototype.delete=function(t){var e=hi(this,t).delete(t);return this.size-=e?1:0,e},Jn.prototype.get=function(t){return hi(this,t).get(t)},Jn.prototype.has=function(t){return hi(this,t).has(t)},Jn.prototype.set=function(t,e){var n=hi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(t){return this.__data__.set(t,n),this},Gn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.clear=function(){this.__data__=new Kn,this.size=0},Yn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Yn.prototype.get=function(t){return this.__data__.get(t)},Yn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Kn){var r=n.__data__;if(!On||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Jn(r)}return n.set(t,e),this.size=n.size,this};var dr=Do(wr),fr=Do(kr,!0);function mr(t,e){var n=!0;return dr(t,(function(t,r,o){return n=!!e(t,r,o)})),n}function gr(e,n,r){for(var o=-1,i=e.length;++o<i;){var s=e[o],a=n(s);if(null!=a&&(l===t?a==a&&!ca(a):r(a,l)))var l=a,c=s}return c}function yr(t,e){var n=[];return dr(t,(function(t,r,o){e(t,r,o)&&n.push(t)})),n}function vr(t,e,n,r,o){var i=-1,s=t.length;for(n||(n=bi),o||(o=[]);++i<s;){var a=t[i];e>0&&n(a)?e>1?vr(a,e-1,n,r,o):Re(o,a):r||(o[o.length]=a)}return o}var br=$o(),_r=$o(!0);function wr(t,e){return t&&br(t,e,Ia)}function kr(t,e){return t&&_r(t,e,Ia)}function xr(t,e){return Me(e,(function(e){return Zs(t[e])}))}function Sr(e,n){for(var r=0,o=(n=wo(n,e)).length;null!=e&&r<o;)e=e[zi(n[r++])];return r&&r==o?e:t}function Er(t,e,n){var r=e(t);return qs(t)?r:Re(r,n(t))}function Or(e){return null==e?e===t?"[object Undefined]":"[object Null]":ae&&ae in Ct(e)?function(e){var n=$t.call(e,ae),r=e[ae];try{e[ae]=t;var o=!0}catch(t){}var i=jt.call(e);return o&&(n?e[ae]=r:delete e[ae]),i}(e):function(t){return jt.call(t)}(e)}function Cr(t,e){return t>e}function Ar(t,e){return null!=t&&$t.call(t,e)}function Mr(t,e){return null!=t&&e in Ct(t)}function Tr(e,n,r){for(var o=r?Ne:Te,i=e[0].length,s=e.length,a=s,l=kt(s),c=1/0,u=[];a--;){var h=e[a];a&&n&&(h=Ie(h,Ye(n))),c=_n(h.length,c),l[a]=!r&&(n||i>=120&&h.length>=120)?new Gn(a&&h):t}h=e[0];var p=-1,d=l[0];t:for(;++p<i&&u.length<c;){var f=h[p],m=n?n(f):f;if(f=r||0!==f?f:0,!(d?Ze(d,m):o(u,m,r))){for(a=s;--a;){var g=l[a];if(!(g?Ze(g,m):o(e[a],m,r)))continue t}d&&d.push(m),u.push(f)}}return u}function Nr(e,n,r){var o=null==(e=Mi(e,n=wo(n,e)))?e:e[zi(Xi(n))];return null==o?t:Se(o,e,r)}function Ir(t){return na(t)&&Or(t)==m}function Rr(e,n,r,o,i){return e===n||(null==e||null==n||!na(e)&&!na(n)?e!=e&&n!=n:function(e,n,r,o,i,s){var a=qs(e),l=qs(n),c=a?g:gi(e),u=l?g:gi(n),h=(c=c==m?S:c)==S,p=(u=u==m?S:u)==S,d=c==u;if(d&&Gs(e)){if(!Gs(n))return!1;a=!0,h=!1}if(d&&!h)return s||(s=new Yn),a||ua(e)?ri(e,n,r,o,i,s):function(t,e,n,r,o,i,s){switch(n){case I:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case N:return!(t.byteLength!=e.byteLength||!i(new qt(t),new qt(e)));case y:case v:case x:return Hs(+t,+e);case b:return t.name==e.name&&t.message==e.message;case O:case A:return t==e+"";case k:var a=sn;case C:var l=1&r;if(a||(a=cn),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var u=ri(a(t),a(e),r,o,i,s);return s.delete(t),u;case M:if(jn)return jn.call(t)==jn.call(e)}return!1}(e,n,c,r,o,i,s);if(!(1&r)){var f=h&&$t.call(e,"__wrapped__"),_=p&&$t.call(n,"__wrapped__");if(f||_){var w=f?e.value():e,E=_?n.value():n;return s||(s=new Yn),i(w,E,r,o,s)}}return!!d&&(s||(s=new Yn),function(e,n,r,o,i,s){var a=1&r,l=ii(e),c=l.length,u=ii(n),h=u.length;if(c!=h&&!a)return!1;for(var p=c;p--;){var d=l[p];if(!(a?d in n:$t.call(n,d)))return!1}var f=s.get(e),m=s.get(n);if(f&&m)return f==n&&m==e;var g=!0;s.set(e,n),s.set(n,e);for(var y=a;++p<c;){var v=e[d=l[p]],b=n[d];if(o)var _=a?o(b,v,d,n,e,s):o(v,b,d,e,n,s);if(!(_===t?v===b||i(v,b,r,o,s):_)){g=!1;break}y||(y="constructor"==d)}if(g&&!y){var w=e.constructor,k=n.constructor;w==k||!("constructor"in e)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof k&&k instanceof k||(g=!1)}return s.delete(e),s.delete(n),g}(e,n,r,o,i,s))}(e,n,r,o,Rr,i))}function Lr(e,n,r,o){var i=r.length,s=i,a=!o;if(null==e)return!s;for(e=Ct(e);i--;){var l=r[i];if(a&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<s;){var c=(l=r[i])[0],u=e[c],h=l[1];if(a&&l[2]){if(u===t&&!(c in e))return!1}else{var p=new Yn;if(o)var d=o(u,h,c,e,n,p);if(!(d===t?Rr(h,u,3,o,p):d))return!1}}return!0}function Dr(t){return!(!ea(t)||(e=t,zt&&zt in e))&&(Zs(t)?Bt:mt).test(ji(t));var e}function $r(t){return"function"==typeof t?t:null==t?ol:"object"==typeof t?qs(t)?Br(t[0],t[1]):Hr(t):dl(t)}function Pr(t){if(!Ei(t))return vn(t);var e=[];for(var n in Ct(t))$t.call(t,n)&&"constructor"!=n&&e.push(n);return e}function zr(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Ct(t))e.push(n);return e}(t);var e=Ei(t),n=[];for(var r in t)("constructor"!=r||!e&&$t.call(t,r))&&n.push(r);return n}function jr(t,e){return t<e}function Fr(t,e){var n=-1,r=Ks(t)?kt(t.length):[];return dr(t,(function(t,o,i){r[++n]=e(t,o,i)})),r}function Hr(t){var e=pi(t);return 1==e.length&&e[0][2]?Ci(e[0][0],e[0][1]):function(n){return n===t||Lr(n,t,e)}}function Br(e,n){return ki(e)&&Oi(n)?Ci(zi(e),n):function(r){var o=Ca(r,e);return o===t&&o===n?Aa(r,e):Rr(n,o,3)}}function Vr(e,n,r,o,i){e!==n&&br(n,(function(s,a){if(i||(i=new Yn),ea(s))!function(e,n,r,o,i,s,a){var l=Ti(e,r),c=Ti(n,r),u=a.get(c);if(u)er(e,r,u);else{var h=s?s(l,c,r+"",e,n,a):t,p=h===t;if(p){var d=qs(c),f=!d&&Gs(c),m=!d&&!f&&ua(c);h=c,d||f||m?qs(l)?h=l:Js(l)?h=No(l):f?(p=!1,h=Eo(c,!0)):m?(p=!1,h=Co(c,!0)):h=[]:ia(c)||Ws(c)?(h=l,Ws(l)?h=va(l):ea(l)&&!Zs(l)||(h=vi(c))):p=!1}p&&(a.set(c,h),i(h,c,o,s,a),a.delete(c)),er(e,r,h)}}(e,n,a,r,Vr,o,i);else{var l=o?o(Ti(e,a),s,a+"",e,n,i):t;l===t&&(l=s),er(e,a,l)}}),Ra)}function Wr(e,n){var r=e.length;if(r)return _i(n+=n<0?r:0,r)?e[n]:t}function qr(t,e,n){e=e.length?Ie(e,(function(t){return qs(t)?function(e){return Sr(e,1===t.length?t[0]:t)}:t})):[ol];var r=-1;e=Ie(e,Ye(ui()));var o=Fr(t,(function(t,n,o){var i=Ie(e,(function(e){return e(t)}));return{criteria:i,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(o,(function(t,e){return function(t,e,n){for(var r=-1,o=t.criteria,i=e.criteria,s=o.length,a=n.length;++r<s;){var l=Ao(o[r],i[r]);if(l)return r>=a?l:l*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function Ur(t,e,n){for(var r=-1,o=e.length,i={};++r<o;){var s=e[r],a=Sr(t,s);n(a,s)&&to(i,wo(s,t),a)}return i}function Kr(t,e,n,r){var o=r?He:Fe,i=-1,s=e.length,a=t;for(t===e&&(e=No(e)),n&&(a=Ie(t,Ye(n)));++i<s;)for(var l=0,c=e[i],u=n?n(c):c;(l=o(a,u,l,r))>-1;)a!==t&&Yt.call(a,l,1),Yt.call(t,l,1);return t}function Jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var o=e[n];if(n==r||o!==i){var i=o;_i(o)?Yt.call(t,o,1):po(t,o)}}return t}function Gr(t,e){return t+ye(xn()*(e-t+1))}function Yr(t,e){var n="";if(!t||e<1||e>h)return n;do{e%2&&(n+=t),(e=ye(e/2))&&(t+=t)}while(e);return n}function Xr(t,e){return Ri(Ai(t,e,ol),t+"")}function Zr(t){return Zn(Ha(t))}function Qr(t,e){var n=Ha(t);return $i(n,lr(e,0,n.length))}function to(e,n,r,o){if(!ea(e))return e;for(var i=-1,s=(n=wo(n,e)).length,a=s-1,l=e;null!=l&&++i<s;){var c=zi(n[i]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=a){var h=l[c];(u=o?o(h,c,l):t)===t&&(u=ea(h)?h:_i(n[i+1])?[]:{})}nr(l,c,u),l=l[c]}return e}var eo=Nn?function(t,e){return Nn.set(t,e),t}:ol,no=ue?function(t,e){return ue(t,"toString",{configurable:!0,enumerable:!1,value:el(e),writable:!0})}:ol;function ro(t){return $i(Ha(t))}function oo(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=kt(o);++r<o;)i[r]=t[r+e];return i}function io(t,e){var n;return dr(t,(function(t,r,o){return!(n=e(t,r,o))})),!!n}function so(t,e,n){var r=0,o=null==t?r:t.length;if("number"==typeof e&&e==e&&o<=2147483647){for(;r<o;){var i=r+o>>>1,s=t[i];null!==s&&!ca(s)&&(n?s<=e:s<e)?r=i+1:o=i}return o}return ao(t,e,ol,n)}function ao(e,n,r,o){var i=0,s=null==e?0:e.length;if(0===s)return 0;for(var a=(n=r(n))!=n,l=null===n,c=ca(n),u=n===t;i<s;){var h=ye((i+s)/2),p=r(e[h]),d=p!==t,f=null===p,m=p==p,g=ca(p);if(a)var y=o||m;else y=u?m&&(o||d):l?m&&d&&(o||!f):c?m&&d&&!f&&(o||!g):!f&&!g&&(o?p<=n:p<n);y?i=h+1:s=h}return _n(s,4294967294)}function lo(t,e){for(var n=-1,r=t.length,o=0,i=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!Hs(a,l)){var l=a;i[o++]=0===s?0:s}}return i}function co(t){return"number"==typeof t?t:ca(t)?p:+t}function uo(t){if("string"==typeof t)return t;if(qs(t))return Ie(t,uo)+"";if(ca(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ho(t,e,n){var r=-1,o=Te,i=t.length,s=!0,a=[],l=a;if(n)s=!1,o=Ne;else if(i>=200){var c=e?null:Xo(t);if(c)return cn(c);s=!1,o=Ze,l=new Gn}else l=e?[]:a;t:for(;++r<i;){var u=t[r],h=e?e(u):u;if(u=n||0!==u?u:0,s&&h==h){for(var p=l.length;p--;)if(l[p]===h)continue t;e&&l.push(h),a.push(u)}else o(l,h,n)||(l!==a&&l.push(h),a.push(u))}return a}function po(t,e){return null==(t=Mi(t,e=wo(e,t)))||delete t[zi(Xi(e))]}function fo(t,e,n,r){return to(t,e,n(Sr(t,e)),r)}function mo(t,e,n,r){for(var o=t.length,i=r?o:-1;(r?i--:++i<o)&&e(t[i],i,t););return n?oo(t,r?0:i,r?i+1:o):oo(t,r?i+1:0,r?o:i)}function go(t,e){var n=t;return n instanceof qn&&(n=n.value()),Le(e,(function(t,e){return e.func.apply(e.thisArg,Re([t],e.args))}),n)}function yo(t,e,n){var r=t.length;if(r<2)return r?ho(t[0]):[];for(var o=-1,i=kt(r);++o<r;)for(var s=t[o],a=-1;++a<r;)a!=o&&(i[o]=pr(i[o]||s,t[a],e,n));return ho(vr(i,1),e,n)}function vo(e,n,r){for(var o=-1,i=e.length,s=n.length,a={};++o<i;){var l=o<s?n[o]:t;r(a,e[o],l)}return a}function bo(t){return Js(t)?t:[]}function _o(t){return"function"==typeof t?t:ol}function wo(t,e){return qs(t)?t:ki(t,e)?[t]:Pi(ba(t))}var ko=Xr;function xo(e,n,r){var o=e.length;return r=r===t?o:r,!n&&r>=o?e:oo(e,n,r)}var So=he||function(t){return pe.clearTimeout(t)};function Eo(t,e){if(e)return t.slice();var n=t.length,r=Ut?Ut(n):new t.constructor(n);return t.copy(r),r}function Oo(t){var e=new t.constructor(t.byteLength);return new qt(e).set(new qt(t)),e}function Co(t,e){var n=e?Oo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ao(e,n){if(e!==n){var r=e!==t,o=null===e,i=e==e,s=ca(e),a=n!==t,l=null===n,c=n==n,u=ca(n);if(!l&&!u&&!s&&e>n||s&&a&&c&&!l&&!u||o&&a&&c||!r&&c||!i)return 1;if(!o&&!s&&!u&&e<n||u&&r&&i&&!o&&!s||l&&r&&i||!a&&i||!c)return-1}return 0}function Mo(t,e,n,r){for(var o=-1,i=t.length,s=n.length,a=-1,l=e.length,c=bn(i-s,0),u=kt(l+c),h=!r;++a<l;)u[a]=e[a];for(;++o<s;)(h||o<i)&&(u[n[o]]=t[o]);for(;c--;)u[a++]=t[o++];return u}function To(t,e,n,r){for(var o=-1,i=t.length,s=-1,a=n.length,l=-1,c=e.length,u=bn(i-a,0),h=kt(u+c),p=!r;++o<u;)h[o]=t[o];for(var d=o;++l<c;)h[d+l]=e[l];for(;++s<a;)(p||o<i)&&(h[d+n[s]]=t[o++]);return h}function No(t,e){var n=-1,r=t.length;for(e||(e=kt(r));++n<r;)e[n]=t[n];return e}function Io(e,n,r,o){var i=!r;r||(r={});for(var s=-1,a=n.length;++s<a;){var l=n[s],c=o?o(r[l],e[l],l,r,e):t;c===t&&(c=e[l]),i?sr(r,l,c):nr(r,l,c)}return r}function Ro(t,e){return function(n,r){var o=qs(n)?Ee:or,i=e?e():{};return o(n,t,ui(r,2),i)}}function Lo(e){return Xr((function(n,r){var o=-1,i=r.length,s=i>1?r[i-1]:t,a=i>2?r[2]:t;for(s=e.length>3&&"function"==typeof s?(i--,s):t,a&&wi(r[0],r[1],a)&&(s=i<3?t:s,i=1),n=Ct(n);++o<i;){var l=r[o];l&&e(n,l,o,s)}return n}))}function Do(t,e){return function(n,r){if(null==n)return n;if(!Ks(n))return t(n,r);for(var o=n.length,i=e?o:-1,s=Ct(n);(e?i--:++i<o)&&!1!==r(s[i],i,s););return n}}function $o(t){return function(e,n,r){for(var o=-1,i=Ct(e),s=r(e),a=s.length;a--;){var l=s[t?a:++o];if(!1===n(i[l],l,i))break}return e}}function Po(e){return function(n){var r=on(n=ba(n))?pn(n):t,o=r?r[0]:n.charAt(0),i=r?xo(r,1).join(""):n.slice(1);return o[e]()+i}}function zo(t){return function(e){return Le(Za(Wa(e).replace(Xt,"")),t,"")}}function jo(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Bn(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function Fo(e){return function(n,r,o){var i=Ct(n);if(!Ks(n)){var s=ui(r,3);n=Ia(n),r=function(t){return s(i[t],t,i)}}var a=e(n,r,o);return a>-1?i[s?n[a]:a]:t}}function Ho(n){return oi((function(r){var o=r.length,i=o,s=Wn.prototype.thru;for(n&&r.reverse();i--;){var a=r[i];if("function"!=typeof a)throw new Tt(e);if(s&&!l&&"wrapper"==li(a))var l=new Wn([],!0)}for(i=l?i:o;++i<o;){var c=li(a=r[i]),u="wrapper"==c?ai(a):t;l=u&&xi(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[li(u[0])].apply(l,u[3]):1==a.length&&xi(a)?l[c]():l.thru(a)}return function(){var t=arguments,e=t[0];if(l&&1==t.length&&qs(e))return l.plant(e).value();for(var n=0,i=o?r[n].apply(this,t):e;++n<o;)i=r[n].call(this,i);return i}}))}function Bo(e,n,r,o,i,s,a,c,u,h){var p=n&l,d=1&n,f=2&n,m=24&n,g=512&n,y=f?t:jo(e);return function l(){for(var v=arguments.length,b=kt(v),_=v;_--;)b[_]=arguments[_];if(m)var w=ci(l),k=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,w);if(o&&(b=Mo(b,o,i,m)),s&&(b=To(b,s,a,m)),v-=k,m&&v<h){var x=ln(b,w);return Go(e,n,Bo,l.placeholder,r,b,x,c,u,h-v)}var S=d?r:this,E=f?S[e]:e;return v=b.length,c?b=function(e,n){for(var r=e.length,o=_n(n.length,r),i=No(e);o--;){var s=n[o];e[o]=_i(s,r)?i[s]:t}return e}(b,c):g&&v>1&&b.reverse(),p&&u<v&&(b.length=u),this&&this!==pe&&this instanceof l&&(E=y||jo(E)),E.apply(S,b)}}function Vo(t,e){return function(n,r){return function(t,e,n,r){return wr(t,(function(t,o,i){e(r,n(t),o,i)})),r}(n,t,e(r),{})}}function Wo(e,n){return function(r,o){var i;if(r===t&&o===t)return n;if(r!==t&&(i=r),o!==t){if(i===t)return o;"string"==typeof r||"string"==typeof o?(r=uo(r),o=uo(o)):(r=co(r),o=co(o)),i=e(r,o)}return i}}function qo(t){return oi((function(e){return e=Ie(e,Ye(ui())),Xr((function(n){var r=this;return t(e,(function(t){return Se(t,r,n)}))}))}))}function Uo(e,n){var r=(n=n===t?" ":uo(n)).length;if(r<2)return r?Yr(n,e):n;var o=Yr(n,ge(e/hn(n)));return on(n)?xo(pn(o),0,e).join(""):o.slice(0,e)}function Ko(e){return function(n,r,o){return o&&"number"!=typeof o&&wi(n,r,o)&&(r=o=t),n=fa(n),r===t?(r=n,n=0):r=fa(r),function(t,e,n,r){for(var o=-1,i=bn(ge((e-t)/(n||1)),0),s=kt(i);i--;)s[r?i:++o]=t,t+=n;return s}(n,r,o=o===t?n<r?1:-1:fa(o),e)}}function Jo(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ya(e),n=ya(n)),t(e,n)}}function Go(e,n,r,o,s,l,c,u,h,p){var d=8&n;n|=d?i:a,4&(n&=~(d?a:i))||(n&=-4);var f=[e,n,s,d?l:t,d?c:t,d?t:l,d?t:c,u,h,p],m=r.apply(t,f);return xi(e)&&Ni(m,f),m.placeholder=o,Li(m,e,n)}function Yo(t){var e=Ot[t];return function(t,n){if(t=ya(t),(n=null==n?0:_n(ma(n),292))&&gn(t)){var r=(ba(t)+"e").split("e");return+((r=(ba(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Xo=An&&1/cn(new An([,-0]))[1]==u?function(t){return new An(t)}:cl;function Zo(t){return function(e){var n=gi(e);return n==k?sn(e):n==C?un(e):function(t,e){return Ie(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Qo(n,s,u,h,p,d,f,m){var g=2&s;if(!g&&"function"!=typeof n)throw new Tt(e);var y=h?h.length:0;if(y||(s&=-97,h=p=t),f=f===t?f:bn(ma(f),0),m=m===t?m:ma(m),y-=p?p.length:0,s&a){var v=h,b=p;h=p=t}var _=g?t:ai(n),w=[n,s,u,h,p,v,b,d,f,m];if(_&&function(t,e){var n=t[1],o=e[1],i=n|o,s=i<131,a=o==l&&8==n||o==l&&n==c&&t[7].length<=e[8]||384==o&&e[7].length<=e[8]&&8==n;if(!s&&!a)return t;1&o&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var h=t[3];t[3]=h?Mo(h,u,e[4]):u,t[4]=h?ln(t[3],r):e[4]}(u=e[5])&&(h=t[5],t[5]=h?To(h,u,e[6]):u,t[6]=h?ln(t[5],r):e[6]),(u=e[7])&&(t[7]=u),o&l&&(t[8]=null==t[8]?e[8]:_n(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(w,_),n=w[0],s=w[1],u=w[2],h=w[3],p=w[4],!(m=w[9]=w[9]===t?g?0:n.length:bn(w[9]-y,0))&&24&s&&(s&=-25),s&&1!=s)k=8==s||s==o?function(e,n,r){var o=jo(e);return function i(){for(var s=arguments.length,a=kt(s),l=s,c=ci(i);l--;)a[l]=arguments[l];var u=s<3&&a[0]!==c&&a[s-1]!==c?[]:ln(a,c);return(s-=u.length)<r?Go(e,n,Bo,i.placeholder,t,a,u,t,t,r-s):Se(this&&this!==pe&&this instanceof i?o:e,this,a)}}(n,s,m):s!=i&&33!=s||p.length?Bo.apply(t,w):function(t,e,n,r){var o=1&e,i=jo(t);return function e(){for(var s=-1,a=arguments.length,l=-1,c=r.length,u=kt(c+a),h=this&&this!==pe&&this instanceof e?i:t;++l<c;)u[l]=r[l];for(;a--;)u[l++]=arguments[++s];return Se(h,o?n:this,u)}}(n,s,u,h);else var k=function(t,e,n){var r=1&e,o=jo(t);return function e(){return(this&&this!==pe&&this instanceof e?o:t).apply(r?n:this,arguments)}}(n,s,u);return Li((_?eo:Ni)(k,w),n,s)}function ti(e,n,r,o){return e===t||Hs(e,Rt[r])&&!$t.call(o,r)?n:e}function ei(e,n,r,o,i,s){return ea(e)&&ea(n)&&(s.set(n,e),Vr(e,n,t,ei,s),s.delete(n)),e}function ni(e){return ia(e)?t:e}function ri(e,n,r,o,i,s){var a=1&r,l=e.length,c=n.length;if(l!=c&&!(a&&c>l))return!1;var u=s.get(e),h=s.get(n);if(u&&h)return u==n&&h==e;var p=-1,d=!0,f=2&r?new Gn:t;for(s.set(e,n),s.set(n,e);++p<l;){var m=e[p],g=n[p];if(o)var y=a?o(g,m,p,n,e,s):o(m,g,p,e,n,s);if(y!==t){if(y)continue;d=!1;break}if(f){if(!$e(n,(function(t,e){if(!Ze(f,e)&&(m===t||i(m,t,r,o,s)))return f.push(e)}))){d=!1;break}}else if(m!==g&&!i(m,g,r,o,s)){d=!1;break}}return s.delete(e),s.delete(n),d}function oi(e){return Ri(Ai(e,t,Ui),e+"")}function ii(t){return Er(t,Ia,fi)}function si(t){return Er(t,Ra,mi)}var ai=Nn?function(t){return Nn.get(t)}:cl;function li(t){for(var e=t.name+"",n=In[e],r=$t.call(In,e)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==t)return o.name}return e}function ci(t){return($t.call(Hn,"placeholder")?Hn:t).placeholder}function ui(){var t=Hn.iteratee||il;return t=t===il?$r:t,arguments.length?t(arguments[0],arguments[1]):t}function hi(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function pi(t){for(var e=Ia(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Oi(o)]}return e}function di(e,n){var r=function(e,n){return null==e?t:e[n]}(e,n);return Dr(r)?r:t}var fi=Pe?function(t){return null==t?[]:(t=Ct(t),Me(Pe(t),(function(e){return Gt.call(t,e)})))}:gl,mi=Pe?function(t){for(var e=[];t;)Re(e,fi(t)),t=Kt(t);return e}:gl,gi=Or;function yi(t,e,n){for(var r=-1,o=(e=wo(e,t)).length,i=!1;++r<o;){var s=zi(e[r]);if(!(i=null!=t&&n(t,s)))break;t=t[s]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&ta(o)&&_i(s,o)&&(qs(t)||Ws(t))}function vi(t){return"function"!=typeof t.constructor||Ei(t)?{}:Bn(Kt(t))}function bi(t){return qs(t)||Ws(t)||!!(Qt&&t&&t[Qt])}function _i(t,e){var n=typeof t;return!!(e=null==e?h:e)&&("number"==n||"symbol"!=n&&yt.test(t))&&t>-1&&t%1==0&&t<e}function wi(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Ks(n)&&_i(e,n.length):"string"==r&&e in n)&&Hs(n[e],t)}function ki(t,e){if(qs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||Q.test(t)||!Z.test(t)||null!=e&&t in Ct(e)}function xi(t){var e=li(t),n=Hn[e];if("function"!=typeof n||!(e in qn.prototype))return!1;if(t===n)return!0;var r=ai(n);return!!r&&t===r[0]}(En&&gi(new En(new ArrayBuffer(1)))!=I||On&&gi(new On)!=k||Cn&&gi(Cn.resolve())!=E||An&&gi(new An)!=C||Mn&&gi(new Mn)!=T)&&(gi=function(e){var n=Or(e),r=n==S?e.constructor:t,o=r?ji(r):"";if(o)switch(o){case Rn:return I;case Ln:return k;case Dn:return E;case $n:return C;case Pn:return T}return n});var Si=Lt?Zs:yl;function Ei(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}function Oi(t){return t==t&&!ea(t)}function Ci(e,n){return function(r){return null!=r&&r[e]===n&&(n!==t||e in Ct(r))}}function Ai(e,n,r){return n=bn(n===t?e.length-1:n,0),function(){for(var t=arguments,o=-1,i=bn(t.length-n,0),s=kt(i);++o<i;)s[o]=t[n+o];o=-1;for(var a=kt(n+1);++o<n;)a[o]=t[o];return a[n]=r(s),Se(e,this,a)}}function Mi(t,e){return e.length<2?t:Sr(t,oo(e,0,-1))}function Ti(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ni=Di(eo),Ii=fe||function(t,e){return pe.setTimeout(t,e)},Ri=Di(no);function Li(t,e,n){var r=e+"";return Ri(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Oe(f,(function(n){var r="_."+n[0];e&n[1]&&!Te(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(st);return e?e[1].split(at):[]}(r),n)))}function Di(e){var n=0,r=0;return function(){var o=wn(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(t,arguments)}}function $i(e,n){var r=-1,o=e.length,i=o-1;for(n=n===t?o:n;++r<n;){var s=Gr(r,i),a=e[s];e[s]=e[r],e[r]=a}return e.length=n,e}var Pi=function(t){var e=Ds(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,n,r,o){e.push(r?o.replace(ut,"$1"):n||t)})),e}));function zi(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ji(t){if(null!=t){try{return Dt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fi(t){if(t instanceof qn)return t.clone();var e=new Wn(t.__wrapped__,t.__chain__);return e.__actions__=No(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Hi=Xr((function(t,e){return Js(t)?pr(t,vr(e,1,Js,!0)):[]})),Bi=Xr((function(e,n){var r=Xi(n);return Js(r)&&(r=t),Js(e)?pr(e,vr(n,1,Js,!0),ui(r,2)):[]})),Vi=Xr((function(e,n){var r=Xi(n);return Js(r)&&(r=t),Js(e)?pr(e,vr(n,1,Js,!0),t,r):[]}));function Wi(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=bn(r+o,0)),je(t,ui(e,3),o)}function qi(e,n,r){var o=null==e?0:e.length;if(!o)return-1;var i=o-1;return r!==t&&(i=ma(r),i=r<0?bn(o+i,0):_n(i,o-1)),je(e,ui(n,3),i,!0)}function Ui(t){return null!=t&&t.length?vr(t,1):[]}function Ki(e){return e&&e.length?e[0]:t}var Ji=Xr((function(t){var e=Ie(t,bo);return e.length&&e[0]===t[0]?Tr(e):[]})),Gi=Xr((function(e){var n=Xi(e),r=Ie(e,bo);return n===Xi(r)?n=t:r.pop(),r.length&&r[0]===e[0]?Tr(r,ui(n,2)):[]})),Yi=Xr((function(e){var n=Xi(e),r=Ie(e,bo);return(n="function"==typeof n?n:t)&&r.pop(),r.length&&r[0]===e[0]?Tr(r,t,n):[]}));function Xi(e){var n=null==e?0:e.length;return n?e[n-1]:t}var Zi=Xr(Qi);function Qi(t,e){return t&&t.length&&e&&e.length?Kr(t,e):t}var ts=oi((function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Jr(t,Ie(e,(function(t){return _i(t,n)?+t:t})).sort(Ao)),r}));function es(t){return null==t?t:Sn.call(t)}var ns=Xr((function(t){return ho(vr(t,1,Js,!0))})),rs=Xr((function(e){var n=Xi(e);return Js(n)&&(n=t),ho(vr(e,1,Js,!0),ui(n,2))})),os=Xr((function(e){var n=Xi(e);return n="function"==typeof n?n:t,ho(vr(e,1,Js,!0),t,n)}));function is(t){if(!t||!t.length)return[];var e=0;return t=Me(t,(function(t){if(Js(t))return e=bn(t.length,e),!0})),Je(e,(function(e){return Ie(t,We(e))}))}function ss(e,n){if(!e||!e.length)return[];var r=is(e);return null==n?r:Ie(r,(function(e){return Se(n,t,e)}))}var as=Xr((function(t,e){return Js(t)?pr(t,e):[]})),ls=Xr((function(t){return yo(Me(t,Js))})),cs=Xr((function(e){var n=Xi(e);return Js(n)&&(n=t),yo(Me(e,Js),ui(n,2))})),us=Xr((function(e){var n=Xi(e);return n="function"==typeof n?n:t,yo(Me(e,Js),t,n)})),hs=Xr(is),ps=Xr((function(e){var n=e.length,r=n>1?e[n-1]:t;return r="function"==typeof r?(e.pop(),r):t,ss(e,r)}));function ds(t){var e=Hn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ms=oi((function(e){var n=e.length,r=n?e[0]:0,o=this.__wrapped__,i=function(t){return ar(t,e)};return!(n>1||this.__actions__.length)&&o instanceof qn&&_i(r)?((o=o.slice(r,+r+(n?1:0))).__actions__.push({func:fs,args:[i],thisArg:t}),new Wn(o,this.__chain__).thru((function(e){return n&&!e.length&&e.push(t),e}))):this.thru(i)})),gs=Ro((function(t,e,n){$t.call(t,n)?++t[n]:sr(t,n,1)})),ys=Fo(Wi),vs=Fo(qi);function bs(t,e){return(qs(t)?Oe:dr)(t,ui(e,3))}function _s(t,e){return(qs(t)?Ce:fr)(t,ui(e,3))}var ws=Ro((function(t,e,n){$t.call(t,n)?t[n].push(e):sr(t,n,[e])})),ks=Xr((function(t,e,n){var r=-1,o="function"==typeof e,i=Ks(t)?kt(t.length):[];return dr(t,(function(t){i[++r]=o?Se(e,t,n):Nr(t,e,n)})),i})),xs=Ro((function(t,e,n){sr(t,n,e)}));function Ss(t,e){return(qs(t)?Ie:Fr)(t,ui(e,3))}var Es=Ro((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),Os=Xr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&wi(t,e[0],e[1])?e=[]:n>2&&wi(e[0],e[1],e[2])&&(e=[e[0]]),qr(t,vr(e,1),[])})),Cs=de||function(){return pe.Date.now()};function As(e,n,r){return n=r?t:n,n=e&&null==n?e.length:n,Qo(e,l,t,t,t,t,n)}function Ms(n,r){var o;if("function"!=typeof r)throw new Tt(e);return n=ma(n),function(){return--n>0&&(o=r.apply(this,arguments)),n<=1&&(r=t),o}}var Ts=Xr((function(t,e,n){var r=1;if(n.length){var o=ln(n,ci(Ts));r|=i}return Qo(t,r,e,n,o)})),Ns=Xr((function(t,e,n){var r=3;if(n.length){var o=ln(n,ci(Ns));r|=i}return Qo(e,r,t,n,o)}));function Is(n,r,o){var i,s,a,l,c,u,h=0,p=!1,d=!1,f=!0;if("function"!=typeof n)throw new Tt(e);function m(e){var r=i,o=s;return i=s=t,h=e,l=n.apply(o,r)}function g(e){var n=e-u;return u===t||n>=r||n<0||d&&e-h>=a}function y(){var t=Cs();if(g(t))return v(t);c=Ii(y,function(t){var e=r-(t-u);return d?_n(e,a-(t-h)):e}(t))}function v(e){return c=t,f&&i?m(e):(i=s=t,l)}function b(){var e=Cs(),n=g(e);if(i=arguments,s=this,u=e,n){if(c===t)return function(t){return h=t,c=Ii(y,r),p?m(t):l}(u);if(d)return So(c),c=Ii(y,r),m(u)}return c===t&&(c=Ii(y,r)),l}return r=ya(r)||0,ea(o)&&(p=!!o.leading,a=(d="maxWait"in o)?bn(ya(o.maxWait)||0,r):a,f="trailing"in o?!!o.trailing:f),b.cancel=function(){c!==t&&So(c),h=0,i=u=s=c=t},b.flush=function(){return c===t?l:v(Cs())},b}var Rs=Xr((function(t,e){return hr(t,1,e)})),Ls=Xr((function(t,e,n){return hr(t,ya(e)||0,n)}));function Ds(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new Tt(e);var r=function(){var e=arguments,o=n?n.apply(this,e):e[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,e);return r.cache=i.set(o,s)||i,s};return r.cache=new(Ds.Cache||Jn),r}function $s(t){if("function"!=typeof t)throw new Tt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ds.Cache=Jn;var Ps=ko((function(t,e){var n=(e=1==e.length&&qs(e[0])?Ie(e[0],Ye(ui())):Ie(vr(e,1),Ye(ui()))).length;return Xr((function(r){for(var o=-1,i=_n(r.length,n);++o<i;)r[o]=e[o].call(this,r[o]);return Se(t,this,r)}))})),zs=Xr((function(e,n){var r=ln(n,ci(zs));return Qo(e,i,t,n,r)})),js=Xr((function(e,n){var r=ln(n,ci(js));return Qo(e,a,t,n,r)})),Fs=oi((function(e,n){return Qo(e,c,t,t,t,n)}));function Hs(t,e){return t===e||t!=t&&e!=e}var Bs=Jo(Cr),Vs=Jo((function(t,e){return t>=e})),Ws=Ir(function(){return arguments}())?Ir:function(t){return na(t)&&$t.call(t,"callee")&&!Gt.call(t,"callee")},qs=kt.isArray,Us=ve?Ye(ve):function(t){return na(t)&&Or(t)==N};function Ks(t){return null!=t&&ta(t.length)&&!Zs(t)}function Js(t){return na(t)&&Ks(t)}var Gs=qe||yl,Ys=be?Ye(be):function(t){return na(t)&&Or(t)==v};function Xs(t){if(!na(t))return!1;var e=Or(t);return e==b||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ia(t)}function Zs(t){if(!ea(t))return!1;var e=Or(t);return e==_||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qs(t){return"number"==typeof t&&t==ma(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=_e?Ye(_e):function(t){return na(t)&&gi(t)==k};function oa(t){return"number"==typeof t||na(t)&&Or(t)==x}function ia(t){if(!na(t)||Or(t)!=S)return!1;var e=Kt(t);if(null===e)return!0;var n=$t.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Dt.call(n)==Ft}var sa=we?Ye(we):function(t){return na(t)&&Or(t)==O},aa=ke?Ye(ke):function(t){return na(t)&&gi(t)==C};function la(t){return"string"==typeof t||!qs(t)&&na(t)&&Or(t)==A}function ca(t){return"symbol"==typeof t||na(t)&&Or(t)==M}var ua=xe?Ye(xe):function(t){return na(t)&&ta(t.length)&&!!ie[Or(t)]},ha=Jo(jr),pa=Jo((function(t,e){return t<=e}));function da(t){if(!t)return[];if(Ks(t))return la(t)?pn(t):No(t);if(ee&&t[ee])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[ee]());var e=gi(t);return(e==k?sn:e==C?cn:Ha)(t)}function fa(t){return t?(t=ya(t))===u||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ma(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ga(t){return t?lr(ma(t),0,d):0}function ya(t){if("number"==typeof t)return t;if(ca(t))return p;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ge(t);var n=ft.test(t);return n||gt.test(t)?ce(t.slice(2),n?2:8):dt.test(t)?p:+t}function va(t){return Io(t,Ra(t))}function ba(t){return null==t?"":uo(t)}var _a=Lo((function(t,e){if(Ei(e)||Ks(e))Io(e,Ia(e),t);else for(var n in e)$t.call(e,n)&&nr(t,n,e[n])})),wa=Lo((function(t,e){Io(e,Ra(e),t)})),ka=Lo((function(t,e,n,r){Io(e,Ra(e),t,r)})),xa=Lo((function(t,e,n,r){Io(e,Ia(e),t,r)})),Sa=oi(ar),Ea=Xr((function(e,n){e=Ct(e);var r=-1,o=n.length,i=o>2?n[2]:t;for(i&&wi(n[0],n[1],i)&&(o=1);++r<o;)for(var s=n[r],a=Ra(s),l=-1,c=a.length;++l<c;){var u=a[l],h=e[u];(h===t||Hs(h,Rt[u])&&!$t.call(e,u))&&(e[u]=s[u])}return e})),Oa=Xr((function(e){return e.push(t,ei),Se(Da,t,e)}));function Ca(e,n,r){var o=null==e?t:Sr(e,n);return o===t?r:o}function Aa(t,e){return null!=t&&yi(t,e,Mr)}var Ma=Vo((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),t[e]=n}),el(ol)),Ta=Vo((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),$t.call(t,e)?t[e].push(n):t[e]=[n]}),ui),Na=Xr(Nr);function Ia(t){return Ks(t)?Xn(t):Pr(t)}function Ra(t){return Ks(t)?Xn(t,!0):zr(t)}var La=Lo((function(t,e,n){Vr(t,e,n)})),Da=Lo((function(t,e,n,r){Vr(t,e,n,r)})),$a=oi((function(t,e){var n={};if(null==t)return n;var r=!1;e=Ie(e,(function(e){return e=wo(e,t),r||(r=e.length>1),e})),Io(t,si(t),n),r&&(n=cr(n,7,ni));for(var o=e.length;o--;)po(n,e[o]);return n})),Pa=oi((function(t,e){return null==t?{}:function(t,e){return Ur(t,e,(function(e,n){return Aa(t,n)}))}(t,e)}));function za(t,e){if(null==t)return{};var n=Ie(si(t),(function(t){return[t]}));return e=ui(e),Ur(t,n,(function(t,n){return e(t,n[0])}))}var ja=Zo(Ia),Fa=Zo(Ra);function Ha(t){return null==t?[]:Xe(t,Ia(t))}var Ba=zo((function(t,e,n){return e=e.toLowerCase(),t+(n?Va(e):e)}));function Va(t){return Xa(ba(t).toLowerCase())}function Wa(t){return(t=ba(t))&&t.replace(vt,en).replace(Zt,"")}var qa=zo((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ua=zo((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ka=Po("toLowerCase"),Ja=zo((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Ga=zo((function(t,e,n){return t+(n?" ":"")+Xa(e)})),Ya=zo((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Xa=Po("toUpperCase");function Za(e,n,r){return e=ba(e),(n=r?t:n)===t?function(t){return ne.test(t)}(e)?function(t){return t.match(te)||[]}(e):function(t){return t.match(lt)||[]}(e):e.match(n)||[]}var Qa=Xr((function(e,n){try{return Se(e,t,n)}catch(t){return Xs(t)?t:new St(t)}})),tl=oi((function(t,e){return Oe(e,(function(e){e=zi(e),sr(t,e,Ts(t[e],t))})),t}));function el(t){return function(){return t}}var nl=Ho(),rl=Ho(!0);function ol(t){return t}function il(t){return $r("function"==typeof t?t:cr(t,1))}var sl=Xr((function(t,e){return function(n){return Nr(n,t,e)}})),al=Xr((function(t,e){return function(n){return Nr(t,n,e)}}));function ll(t,e,n){var r=Ia(e),o=xr(e,r);null!=n||ea(e)&&(o.length||!r.length)||(n=e,e=t,t=this,o=xr(e,Ia(e)));var i=!(ea(n)&&"chain"in n&&!n.chain),s=Zs(t);return Oe(o,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(i||e){var n=t(this.__wrapped__);return(n.__actions__=No(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Re([this.value()],arguments))})})),t}function cl(){}var ul=qo(Ie),hl=qo(Ae),pl=qo($e);function dl(t){return ki(t)?We(zi(t)):function(t){return function(e){return Sr(e,t)}}(t)}var fl=Ko(),ml=Ko(!0);function gl(){return[]}function yl(){return!1}var vl,bl=Wo((function(t,e){return t+e}),0),_l=Yo("ceil"),wl=Wo((function(t,e){return t/e}),1),kl=Yo("floor"),xl=Wo((function(t,e){return t*e}),1),Sl=Yo("round"),El=Wo((function(t,e){return t-e}),0);return Hn.after=function(t,n){if("function"!=typeof n)throw new Tt(e);return t=ma(t),function(){if(--t<1)return n.apply(this,arguments)}},Hn.ary=As,Hn.assign=_a,Hn.assignIn=wa,Hn.assignInWith=ka,Hn.assignWith=xa,Hn.at=Sa,Hn.before=Ms,Hn.bind=Ts,Hn.bindAll=tl,Hn.bindKey=Ns,Hn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qs(t)?t:[t]},Hn.chain=ds,Hn.chunk=function(e,n,r){n=(r?wi(e,n,r):n===t)?1:bn(ma(n),0);var o=null==e?0:e.length;if(!o||n<1)return[];for(var i=0,s=0,a=kt(ge(o/n));i<o;)a[s++]=oo(e,i,i+=n);return a},Hn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,o=[];++e<n;){var i=t[e];i&&(o[r++]=i)}return o},Hn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=kt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return Re(qs(n)?No(n):[n],vr(e,1))},Hn.cond=function(t){var n=null==t?0:t.length,r=ui();return t=n?Ie(t,(function(t){if("function"!=typeof t[1])throw new Tt(e);return[r(t[0]),t[1]]})):[],Xr((function(e){for(var r=-1;++r<n;){var o=t[r];if(Se(o[0],this,e))return Se(o[1],this,e)}}))},Hn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return ur(n,t,e)}}(cr(t,1))},Hn.constant=el,Hn.countBy=gs,Hn.create=function(t,e){var n=Bn(t);return null==e?n:ir(n,e)},Hn.curry=function e(n,r,o){var i=Qo(n,8,t,t,t,t,t,r=o?t:r);return i.placeholder=e.placeholder,i},Hn.curryRight=function e(n,r,i){var s=Qo(n,o,t,t,t,t,t,r=i?t:r);return s.placeholder=e.placeholder,s},Hn.debounce=Is,Hn.defaults=Ea,Hn.defaultsDeep=Oa,Hn.defer=Rs,Hn.delay=Ls,Hn.difference=Hi,Hn.differenceBy=Bi,Hn.differenceWith=Vi,Hn.drop=function(e,n,r){var o=null==e?0:e.length;return o?oo(e,(n=r||n===t?1:ma(n))<0?0:n,o):[]},Hn.dropRight=function(e,n,r){var o=null==e?0:e.length;return o?oo(e,0,(n=o-(n=r||n===t?1:ma(n)))<0?0:n):[]},Hn.dropRightWhile=function(t,e){return t&&t.length?mo(t,ui(e,3),!0,!0):[]},Hn.dropWhile=function(t,e){return t&&t.length?mo(t,ui(e,3),!0):[]},Hn.fill=function(e,n,r,o){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&wi(e,n,r)&&(r=0,o=i),function(e,n,r,o){var i=e.length;for((r=ma(r))<0&&(r=-r>i?0:i+r),(o=o===t||o>i?i:ma(o))<0&&(o+=i),o=r>o?0:ga(o);r<o;)e[r++]=n;return e}(e,n,r,o)):[]},Hn.filter=function(t,e){return(qs(t)?Me:yr)(t,ui(e,3))},Hn.flatMap=function(t,e){return vr(Ss(t,e),1)},Hn.flatMapDeep=function(t,e){return vr(Ss(t,e),u)},Hn.flatMapDepth=function(e,n,r){return r=r===t?1:ma(r),vr(Ss(e,n),r)},Hn.flatten=Ui,Hn.flattenDeep=function(t){return null!=t&&t.length?vr(t,u):[]},Hn.flattenDepth=function(e,n){return null!=e&&e.length?vr(e,n=n===t?1:ma(n)):[]},Hn.flip=function(t){return Qo(t,512)},Hn.flow=nl,Hn.flowRight=rl,Hn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var o=t[e];r[o[0]]=o[1]}return r},Hn.functions=function(t){return null==t?[]:xr(t,Ia(t))},Hn.functionsIn=function(t){return null==t?[]:xr(t,Ra(t))},Hn.groupBy=ws,Hn.initial=function(t){return null!=t&&t.length?oo(t,0,-1):[]},Hn.intersection=Ji,Hn.intersectionBy=Gi,Hn.intersectionWith=Yi,Hn.invert=Ma,Hn.invertBy=Ta,Hn.invokeMap=ks,Hn.iteratee=il,Hn.keyBy=xs,Hn.keys=Ia,Hn.keysIn=Ra,Hn.map=Ss,Hn.mapKeys=function(t,e){var n={};return e=ui(e,3),wr(t,(function(t,r,o){sr(n,e(t,r,o),t)})),n},Hn.mapValues=function(t,e){var n={};return e=ui(e,3),wr(t,(function(t,r,o){sr(n,r,e(t,r,o))})),n},Hn.matches=function(t){return Hr(cr(t,1))},Hn.matchesProperty=function(t,e){return Br(t,cr(e,1))},Hn.memoize=Ds,Hn.merge=La,Hn.mergeWith=Da,Hn.method=sl,Hn.methodOf=al,Hn.mixin=ll,Hn.negate=$s,Hn.nthArg=function(t){return t=ma(t),Xr((function(e){return Wr(e,t)}))},Hn.omit=$a,Hn.omitBy=function(t,e){return za(t,$s(ui(e)))},Hn.once=function(t){return Ms(2,t)},Hn.orderBy=function(e,n,r,o){return null==e?[]:(qs(n)||(n=null==n?[]:[n]),qs(r=o?t:r)||(r=null==r?[]:[r]),qr(e,n,r))},Hn.over=ul,Hn.overArgs=Ps,Hn.overEvery=hl,Hn.overSome=pl,Hn.partial=zs,Hn.partialRight=js,Hn.partition=Es,Hn.pick=Pa,Hn.pickBy=za,Hn.property=dl,Hn.propertyOf=function(e){return function(n){return null==e?t:Sr(e,n)}},Hn.pull=Zi,Hn.pullAll=Qi,Hn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Kr(t,e,ui(n,2)):t},Hn.pullAllWith=function(e,n,r){return e&&e.length&&n&&n.length?Kr(e,n,t,r):e},Hn.pullAt=ts,Hn.range=fl,Hn.rangeRight=ml,Hn.rearg=Fs,Hn.reject=function(t,e){return(qs(t)?Me:yr)(t,$s(ui(e,3)))},Hn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,o=[],i=t.length;for(e=ui(e,3);++r<i;){var s=t[r];e(s,r,t)&&(n.push(s),o.push(r))}return Jr(t,o),n},Hn.rest=function(n,r){if("function"!=typeof n)throw new Tt(e);return Xr(n,r=r===t?r:ma(r))},Hn.reverse=es,Hn.sampleSize=function(e,n,r){return n=(r?wi(e,n,r):n===t)?1:ma(n),(qs(e)?Qn:Qr)(e,n)},Hn.set=function(t,e,n){return null==t?t:to(t,e,n)},Hn.setWith=function(e,n,r,o){return o="function"==typeof o?o:t,null==e?e:to(e,n,r,o)},Hn.shuffle=function(t){return(qs(t)?tr:ro)(t)},Hn.slice=function(e,n,r){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&wi(e,n,r)?(n=0,r=o):(n=null==n?0:ma(n),r=r===t?o:ma(r)),oo(e,n,r)):[]},Hn.sortBy=Os,Hn.sortedUniq=function(t){return t&&t.length?lo(t):[]},Hn.sortedUniqBy=function(t,e){return t&&t.length?lo(t,ui(e,2)):[]},Hn.split=function(e,n,r){return r&&"number"!=typeof r&&wi(e,n,r)&&(n=r=t),(r=r===t?d:r>>>0)?(e=ba(e))&&("string"==typeof n||null!=n&&!sa(n))&&!(n=uo(n))&&on(e)?xo(pn(e),0,r):e.split(n,r):[]},Hn.spread=function(t,n){if("function"!=typeof t)throw new Tt(e);return n=null==n?0:bn(ma(n),0),Xr((function(e){var r=e[n],o=xo(e,0,n);return r&&Re(o,r),Se(t,this,o)}))},Hn.tail=function(t){var e=null==t?0:t.length;return e?oo(t,1,e):[]},Hn.take=function(e,n,r){return e&&e.length?oo(e,0,(n=r||n===t?1:ma(n))<0?0:n):[]},Hn.takeRight=function(e,n,r){var o=null==e?0:e.length;return o?oo(e,(n=o-(n=r||n===t?1:ma(n)))<0?0:n,o):[]},Hn.takeRightWhile=function(t,e){return t&&t.length?mo(t,ui(e,3),!1,!0):[]},Hn.takeWhile=function(t,e){return t&&t.length?mo(t,ui(e,3)):[]},Hn.tap=function(t,e){return e(t),t},Hn.throttle=function(t,n,r){var o=!0,i=!0;if("function"!=typeof t)throw new Tt(e);return ea(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),Is(t,n,{leading:o,maxWait:n,trailing:i})},Hn.thru=fs,Hn.toArray=da,Hn.toPairs=ja,Hn.toPairsIn=Fa,Hn.toPath=function(t){return qs(t)?Ie(t,zi):ca(t)?[t]:No(Pi(ba(t)))},Hn.toPlainObject=va,Hn.transform=function(t,e,n){var r=qs(t),o=r||Gs(t)||ua(t);if(e=ui(e,4),null==n){var i=t&&t.constructor;n=o?r?new i:[]:ea(t)&&Zs(i)?Bn(Kt(t)):{}}return(o?Oe:wr)(t,(function(t,r,o){return e(n,t,r,o)})),n},Hn.unary=function(t){return As(t,1)},Hn.union=ns,Hn.unionBy=rs,Hn.unionWith=os,Hn.uniq=function(t){return t&&t.length?ho(t):[]},Hn.uniqBy=function(t,e){return t&&t.length?ho(t,ui(e,2)):[]},Hn.uniqWith=function(e,n){return n="function"==typeof n?n:t,e&&e.length?ho(e,t,n):[]},Hn.unset=function(t,e){return null==t||po(t,e)},Hn.unzip=is,Hn.unzipWith=ss,Hn.update=function(t,e,n){return null==t?t:fo(t,e,_o(n))},Hn.updateWith=function(e,n,r,o){return o="function"==typeof o?o:t,null==e?e:fo(e,n,_o(r),o)},Hn.values=Ha,Hn.valuesIn=function(t){return null==t?[]:Xe(t,Ra(t))},Hn.without=as,Hn.words=Za,Hn.wrap=function(t,e){return zs(_o(e),t)},Hn.xor=ls,Hn.xorBy=cs,Hn.xorWith=us,Hn.zip=hs,Hn.zipObject=function(t,e){return vo(t||[],e||[],nr)},Hn.zipObjectDeep=function(t,e){return vo(t||[],e||[],to)},Hn.zipWith=ps,Hn.entries=ja,Hn.entriesIn=Fa,Hn.extend=wa,Hn.extendWith=ka,ll(Hn,Hn),Hn.add=bl,Hn.attempt=Qa,Hn.camelCase=Ba,Hn.capitalize=Va,Hn.ceil=_l,Hn.clamp=function(e,n,r){return r===t&&(r=n,n=t),r!==t&&(r=(r=ya(r))==r?r:0),n!==t&&(n=(n=ya(n))==n?n:0),lr(ya(e),n,r)},Hn.clone=function(t){return cr(t,4)},Hn.cloneDeep=function(t){return cr(t,5)},Hn.cloneDeepWith=function(e,n){return cr(e,5,n="function"==typeof n?n:t)},Hn.cloneWith=function(e,n){return cr(e,4,n="function"==typeof n?n:t)},Hn.conformsTo=function(t,e){return null==e||ur(t,e,Ia(e))},Hn.deburr=Wa,Hn.defaultTo=function(t,e){return null==t||t!=t?e:t},Hn.divide=wl,Hn.endsWith=function(e,n,r){e=ba(e),n=uo(n);var o=e.length,i=r=r===t?o:lr(ma(r),0,o);return(r-=n.length)>=0&&e.slice(r,i)==n},Hn.eq=Hs,Hn.escape=function(t){return(t=ba(t))&&J.test(t)?t.replace(U,nn):t},Hn.escapeRegExp=function(t){return(t=ba(t))&&nt.test(t)?t.replace(et,"\\$&"):t},Hn.every=function(e,n,r){var o=qs(e)?Ae:mr;return r&&wi(e,n,r)&&(n=t),o(e,ui(n,3))},Hn.find=ys,Hn.findIndex=Wi,Hn.findKey=function(t,e){return ze(t,ui(e,3),wr)},Hn.findLast=vs,Hn.findLastIndex=qi,Hn.findLastKey=function(t,e){return ze(t,ui(e,3),kr)},Hn.floor=kl,Hn.forEach=bs,Hn.forEachRight=_s,Hn.forIn=function(t,e){return null==t?t:br(t,ui(e,3),Ra)},Hn.forInRight=function(t,e){return null==t?t:_r(t,ui(e,3),Ra)},Hn.forOwn=function(t,e){return t&&wr(t,ui(e,3))},Hn.forOwnRight=function(t,e){return t&&kr(t,ui(e,3))},Hn.get=Ca,Hn.gt=Bs,Hn.gte=Vs,Hn.has=function(t,e){return null!=t&&yi(t,e,Ar)},Hn.hasIn=Aa,Hn.head=Ki,Hn.identity=ol,Hn.includes=function(t,e,n,r){t=Ks(t)?t:Ha(t),n=n&&!r?ma(n):0;var o=t.length;return n<0&&(n=bn(o+n,0)),la(t)?n<=o&&t.indexOf(e,n)>-1:!!o&&Fe(t,e,n)>-1},Hn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=bn(r+o,0)),Fe(t,e,o)},Hn.inRange=function(e,n,r){return n=fa(n),r===t?(r=n,n=0):r=fa(r),function(t,e,n){return t>=_n(e,n)&&t<bn(e,n)}(e=ya(e),n,r)},Hn.invoke=Na,Hn.isArguments=Ws,Hn.isArray=qs,Hn.isArrayBuffer=Us,Hn.isArrayLike=Ks,Hn.isArrayLikeObject=Js,Hn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Or(t)==y},Hn.isBuffer=Gs,Hn.isDate=Ys,Hn.isElement=function(t){return na(t)&&1===t.nodeType&&!ia(t)},Hn.isEmpty=function(t){if(null==t)return!0;if(Ks(t)&&(qs(t)||"string"==typeof t||"function"==typeof t.splice||Gs(t)||ua(t)||Ws(t)))return!t.length;var e=gi(t);if(e==k||e==C)return!t.size;if(Ei(t))return!Pr(t).length;for(var n in t)if($t.call(t,n))return!1;return!0},Hn.isEqual=function(t,e){return Rr(t,e)},Hn.isEqualWith=function(e,n,r){var o=(r="function"==typeof r?r:t)?r(e,n):t;return o===t?Rr(e,n,t,r):!!o},Hn.isError=Xs,Hn.isFinite=function(t){return"number"==typeof t&&gn(t)},Hn.isFunction=Zs,Hn.isInteger=Qs,Hn.isLength=ta,Hn.isMap=ra,Hn.isMatch=function(t,e){return t===e||Lr(t,e,pi(e))},Hn.isMatchWith=function(e,n,r){return r="function"==typeof r?r:t,Lr(e,n,pi(n),r)},Hn.isNaN=function(t){return oa(t)&&t!=+t},Hn.isNative=function(t){if(Si(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Dr(t)},Hn.isNil=function(t){return null==t},Hn.isNull=function(t){return null===t},Hn.isNumber=oa,Hn.isObject=ea,Hn.isObjectLike=na,Hn.isPlainObject=ia,Hn.isRegExp=sa,Hn.isSafeInteger=function(t){return Qs(t)&&t>=-9007199254740991&&t<=h},Hn.isSet=aa,Hn.isString=la,Hn.isSymbol=ca,Hn.isTypedArray=ua,Hn.isUndefined=function(e){return e===t},Hn.isWeakMap=function(t){return na(t)&&gi(t)==T},Hn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Or(t)},Hn.join=function(t,e){return null==t?"":yn.call(t,e)},Hn.kebabCase=qa,Hn.last=Xi,Hn.lastIndexOf=function(e,n,r){var o=null==e?0:e.length;if(!o)return-1;var i=o;return r!==t&&(i=(i=ma(r))<0?bn(o+i,0):_n(i,o-1)),n==n?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(e,n,i):je(e,Be,i,!0)},Hn.lowerCase=Ua,Hn.lowerFirst=Ka,Hn.lt=ha,Hn.lte=pa,Hn.max=function(e){return e&&e.length?gr(e,ol,Cr):t},Hn.maxBy=function(e,n){return e&&e.length?gr(e,ui(n,2),Cr):t},Hn.mean=function(t){return Ve(t,ol)},Hn.meanBy=function(t,e){return Ve(t,ui(e,2))},Hn.min=function(e){return e&&e.length?gr(e,ol,jr):t},Hn.minBy=function(e,n){return e&&e.length?gr(e,ui(n,2),jr):t},Hn.stubArray=gl,Hn.stubFalse=yl,Hn.stubObject=function(){return{}},Hn.stubString=function(){return""},Hn.stubTrue=function(){return!0},Hn.multiply=xl,Hn.nth=function(e,n){return e&&e.length?Wr(e,ma(n)):t},Hn.noConflict=function(){return pe._===this&&(pe._=Ht),this},Hn.noop=cl,Hn.now=Cs,Hn.pad=function(t,e,n){t=ba(t);var r=(e=ma(e))?hn(t):0;if(!e||r>=e)return t;var o=(e-r)/2;return Uo(ye(o),n)+t+Uo(ge(o),n)},Hn.padEnd=function(t,e,n){t=ba(t);var r=(e=ma(e))?hn(t):0;return e&&r<e?t+Uo(e-r,n):t},Hn.padStart=function(t,e,n){t=ba(t);var r=(e=ma(e))?hn(t):0;return e&&r<e?Uo(e-r,n)+t:t},Hn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),kn(ba(t).replace(rt,""),e||0)},Hn.random=function(e,n,r){if(r&&"boolean"!=typeof r&&wi(e,n,r)&&(n=r=t),r===t&&("boolean"==typeof n?(r=n,n=t):"boolean"==typeof e&&(r=e,e=t)),e===t&&n===t?(e=0,n=1):(e=fa(e),n===t?(n=e,e=0):n=fa(n)),e>n){var o=e;e=n,n=o}if(r||e%1||n%1){var i=xn();return _n(e+i*(n-e+le("1e-"+((i+"").length-1))),n)}return Gr(e,n)},Hn.reduce=function(t,e,n){var r=qs(t)?Le:Ue,o=arguments.length<3;return r(t,ui(e,4),n,o,dr)},Hn.reduceRight=function(t,e,n){var r=qs(t)?De:Ue,o=arguments.length<3;return r(t,ui(e,4),n,o,fr)},Hn.repeat=function(e,n,r){return n=(r?wi(e,n,r):n===t)?1:ma(n),Yr(ba(e),n)},Hn.replace=function(){var t=arguments,e=ba(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Hn.result=function(e,n,r){var o=-1,i=(n=wo(n,e)).length;for(i||(i=1,e=t);++o<i;){var s=null==e?t:e[zi(n[o])];s===t&&(o=i,s=r),e=Zs(s)?s.call(e):s}return e},Hn.round=Sl,Hn.runInContext=s,Hn.sample=function(t){return(qs(t)?Zn:Zr)(t)},Hn.size=function(t){if(null==t)return 0;if(Ks(t))return la(t)?hn(t):t.length;var e=gi(t);return e==k||e==C?t.size:Pr(t).length},Hn.snakeCase=Ja,Hn.some=function(e,n,r){var o=qs(e)?$e:io;return r&&wi(e,n,r)&&(n=t),o(e,ui(n,3))},Hn.sortedIndex=function(t,e){return so(t,e)},Hn.sortedIndexBy=function(t,e,n){return ao(t,e,ui(n,2))},Hn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=so(t,e);if(r<n&&Hs(t[r],e))return r}return-1},Hn.sortedLastIndex=function(t,e){return so(t,e,!0)},Hn.sortedLastIndexBy=function(t,e,n){return ao(t,e,ui(n,2),!0)},Hn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=so(t,e,!0)-1;if(Hs(t[n],e))return n}return-1},Hn.startCase=Ga,Hn.startsWith=function(t,e,n){return t=ba(t),n=null==n?0:lr(ma(n),0,t.length),e=uo(e),t.slice(n,n+e.length)==e},Hn.subtract=El,Hn.sum=function(t){return t&&t.length?Ke(t,ol):0},Hn.sumBy=function(t,e){return t&&t.length?Ke(t,ui(e,2)):0},Hn.template=function(e,n,r){var o=Hn.templateSettings;r&&wi(e,n,r)&&(n=t),e=ba(e),n=ka({},n,o,ti);var i,s,a=ka({},n.imports,o.imports,ti),l=Ia(a),c=Xe(a,l),u=0,h=n.interpolate||bt,p="__p += '",d=At((n.escape||bt).source+"|"+h.source+"|"+(h===X?ht:bt).source+"|"+(n.evaluate||bt).source+"|$","g"),f="//# sourceURL="+($t.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++oe+"]")+"\n";e.replace(d,(function(t,n,r,o,a,l){return r||(r=o),p+=e.slice(u,l).replace(_t,rn),n&&(i=!0,p+="' +\n__e("+n+") +\n'"),a&&(s=!0,p+="';\n"+a+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),p+="';\n";var m=$t.call(n,"variable")&&n.variable;if(m){if(ct.test(m))throw new St("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(s?p.replace(B,""):p).replace(V,"$1").replace(W,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Qa((function(){return Et(l,f+"return "+p).apply(t,c)}));if(g.source=p,Xs(g))throw g;return g},Hn.times=function(t,e){if((t=ma(t))<1||t>h)return[];var n=d,r=_n(t,d);e=ui(e),t-=d;for(var o=Je(r,e);++n<t;)e(n);return o},Hn.toFinite=fa,Hn.toInteger=ma,Hn.toLength=ga,Hn.toLower=function(t){return ba(t).toLowerCase()},Hn.toNumber=ya,Hn.toSafeInteger=function(t){return t?lr(ma(t),-9007199254740991,h):0===t?t:0},Hn.toString=ba,Hn.toUpper=function(t){return ba(t).toUpperCase()},Hn.trim=function(e,n,r){if((e=ba(e))&&(r||n===t))return Ge(e);if(!e||!(n=uo(n)))return e;var o=pn(e),i=pn(n);return xo(o,Qe(o,i),tn(o,i)+1).join("")},Hn.trimEnd=function(e,n,r){if((e=ba(e))&&(r||n===t))return e.slice(0,dn(e)+1);if(!e||!(n=uo(n)))return e;var o=pn(e);return xo(o,0,tn(o,pn(n))+1).join("")},Hn.trimStart=function(e,n,r){if((e=ba(e))&&(r||n===t))return e.replace(rt,"");if(!e||!(n=uo(n)))return e;var o=pn(e);return xo(o,Qe(o,pn(n))).join("")},Hn.truncate=function(e,n){var r=30,o="...";if(ea(n)){var i="separator"in n?n.separator:i;r="length"in n?ma(n.length):r,o="omission"in n?uo(n.omission):o}var s=(e=ba(e)).length;if(on(e)){var a=pn(e);s=a.length}if(r>=s)return e;var l=r-hn(o);if(l<1)return o;var c=a?xo(a,0,l).join(""):e.slice(0,l);if(i===t)return c+o;if(a&&(l+=c.length-l),sa(i)){if(e.slice(l).search(i)){var u,h=c;for(i.global||(i=At(i.source,ba(pt.exec(i))+"g")),i.lastIndex=0;u=i.exec(h);)var p=u.index;c=c.slice(0,p===t?l:p)}}else if(e.indexOf(uo(i),l)!=l){var d=c.lastIndexOf(i);d>-1&&(c=c.slice(0,d))}return c+o},Hn.unescape=function(t){return(t=ba(t))&&K.test(t)?t.replace(q,fn):t},Hn.uniqueId=function(t){var e=++Pt;return ba(t)+e},Hn.upperCase=Ya,Hn.upperFirst=Xa,Hn.each=bs,Hn.eachRight=_s,Hn.first=Ki,ll(Hn,(vl={},wr(Hn,(function(t,e){$t.call(Hn.prototype,e)||(vl[e]=t)})),vl),{chain:!1}),Hn.VERSION="4.17.21",Oe(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Hn[t].placeholder=Hn})),Oe(["drop","take"],(function(e,n){qn.prototype[e]=function(r){r=r===t?1:bn(ma(r),0);var o=this.__filtered__&&!n?new qn(this):this.clone();return o.__filtered__?o.__takeCount__=_n(r,o.__takeCount__):o.__views__.push({size:_n(r,d),type:e+(o.__dir__<0?"Right":"")}),o},qn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Oe(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;qn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ui(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),Oe(["head","last"],(function(t,e){var n="take"+(e?"Right":"");qn.prototype[t]=function(){return this[n](1).value()[0]}})),Oe(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");qn.prototype[t]=function(){return this.__filtered__?new qn(this):this[n](1)}})),qn.prototype.compact=function(){return this.filter(ol)},qn.prototype.find=function(t){return this.filter(t).head()},qn.prototype.findLast=function(t){return this.reverse().find(t)},qn.prototype.invokeMap=Xr((function(t,e){return"function"==typeof t?new qn(this):this.map((function(n){return Nr(n,t,e)}))})),qn.prototype.reject=function(t){return this.filter($s(ui(t)))},qn.prototype.slice=function(e,n){e=ma(e);var r=this;return r.__filtered__&&(e>0||n<0)?new qn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),n!==t&&(r=(n=ma(n))<0?r.dropRight(-n):r.take(n-e)),r)},qn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},qn.prototype.toArray=function(){return this.take(d)},wr(qn.prototype,(function(e,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),o=/^(?:head|last)$/.test(n),i=Hn[o?"take"+("last"==n?"Right":""):n],s=o||/^find/.test(n);i&&(Hn.prototype[n]=function(){var n=this.__wrapped__,a=o?[1]:arguments,l=n instanceof qn,c=a[0],u=l||qs(n),h=function(t){var e=i.apply(Hn,Re([t],a));return o&&p?e[0]:e};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var p=this.__chain__,d=!!this.__actions__.length,f=s&&!p,m=l&&!d;if(!s&&u){n=m?n:new qn(this);var g=e.apply(n,a);return g.__actions__.push({func:fs,args:[h],thisArg:t}),new Wn(g,p)}return f&&m?e.apply(this,a):(g=this.thru(h),f?o?g.value()[0]:g.value():g)})})),Oe(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Nt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Hn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var o=this.value();return e.apply(qs(o)?o:[],t)}return this[n]((function(n){return e.apply(qs(n)?n:[],t)}))}})),wr(qn.prototype,(function(t,e){var n=Hn[e];if(n){var r=n.name+"";$t.call(In,r)||(In[r]=[]),In[r].push({name:e,func:n})}})),In[Bo(t,2).name]=[{name:"wrapper",func:t}],qn.prototype.clone=function(){var t=new qn(this.__wrapped__);return t.__actions__=No(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=No(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=No(this.__views__),t},qn.prototype.reverse=function(){if(this.__filtered__){var t=new qn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},qn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=qs(t),r=e<0,o=n?t.length:0,i=function(t,e,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],s=i.size;switch(i.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=_n(e,t+s);break;case"takeRight":t=bn(t,e-s)}}return{start:t,end:e}}(0,o,this.__views__),s=i.start,a=i.end,l=a-s,c=r?a:s-1,u=this.__iteratees__,h=u.length,p=0,d=_n(l,this.__takeCount__);if(!n||!r&&o==l&&d==l)return go(t,this.__actions__);var f=[];t:for(;l--&&p<d;){for(var m=-1,g=t[c+=e];++m<h;){var y=u[m],v=y.iteratee,b=y.type,_=v(g);if(2==b)g=_;else if(!_){if(1==b)continue t;break t}}f[p++]=g}return f},Hn.prototype.at=ms,Hn.prototype.chain=function(){return ds(this)},Hn.prototype.commit=function(){return new Wn(this.value(),this.__chain__)},Hn.prototype.next=function(){this.__values__===t&&(this.__values__=da(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?t:this.__values__[this.__index__++]}},Hn.prototype.plant=function(e){for(var n,r=this;r instanceof Vn;){var o=Fi(r);o.__index__=0,o.__values__=t,n?i.__wrapped__=o:n=o;var i=o;r=r.__wrapped__}return i.__wrapped__=e,n},Hn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof qn){var n=e;return this.__actions__.length&&(n=new qn(this)),(n=n.reverse()).__actions__.push({func:fs,args:[es],thisArg:t}),new Wn(n,this.__chain__)}return this.thru(es)},Hn.prototype.toJSON=Hn.prototype.valueOf=Hn.prototype.value=function(){return go(this.__wrapped__,this.__actions__)},Hn.prototype.first=Hn.prototype.head,ee&&(Hn.prototype[ee]=function(){return this}),Hn}();fe?((fe.exports=mn)._=mn,de._=mn):pe._=mn}.call(s);var Yh=Gh.exports;function Xh(t){return t.type.create(Yh.cloneDeep(t.attrs))}const Zh=wl.create({name:"node_processor",addCommands:()=>({setBlockAttributes:gh((({commands:t,state:e},n,r,o={})=>{const i=Ge(t.getBlockAttributes(n))??{},{doc:s,tr:a}=e,{from:l,to:c}=a.selection;s.nodesBetween(l,c,((t,e)=>{_c.blocks.includes(t.type.name)&&a.setNodeAttribute(e,n,{...o,...i,...r})}))})),getBlockAttributes:gh((({editor:t},e,n)=>Sr((()=>{let r=Object.assign({},n||{});for(const n of _c.blocks)Object.assign(r,t.getAttributes(n)?.[e]||{});return Object.keys(r).length?r:null})))),removeBlockAttributes:gh((({commands:t},e)=>{for(const n of _c.blocks)t.resetAttributes(n,e)})),applyMark:gh((({state:t,commands:e},n,r,o={})=>{const{tr:i,doc:s,schema:a}=t,{$from:l,$to:c}=i.selection,u=Ol(kc.LINK,a),h=Ol(n,a);if(!(h.spec.group||"").includes(xc.SETTINGS))return e.setMark(n,r);if(l.pos===c.pos)return;s.nodesBetween(l.pos,c.pos,((t,s)=>{if(t.type.name===_c.LIST)return;const a=function(t,e){const n="string"==typeof e?e:e.name;return t.find((t=>t.type.name===n))}(t.marks,n),p=h.create({...a?.attrs||{},...r}),d=Wh(l,c,t,s),f=!u.isInSet(t.marks)&&function(t,e,n,r=Uh){const o=t.resolve(e).path.reverse();for(const t of o)if("number"!=typeof t)for(const e of t.marks)if(r(e,n))return!0;return!1}(i.doc,s,p,o.isAppliedToParent);if(f)return(t=>{if(!o.onAppliedToParent||!1===o.onAppliedToParent(t)){const{tr:n,node:r,position:o,mark:i}=t;e._removeNodeMark({tr:n,node:r,position:o,mark:i.type})}})({tr:i,node:t,position:s,mark:p});t.isText?i.addMark(d.from,d.to,p):function(t,e,n,r){const o=qh(t,r),i=e.from-o<=r,s=e.to+o>=n.nodeSize+r;return i&&s}(i.doc,i.selection,t,s)&&i.addNodeMark(s,p)}))})),getMarks:gh((({editor:t},e)=>{const n=Qe(t,"state");return Sr((()=>{const{selection:t,doc:r}=Ge(n),{from:o,to:i}=Ge(t),s=[];return r.nodesBetween(o,i,(t=>{for(const n of t.marks)n.type.name===e&&s.unshift(n.attrs)})),s}))})),getMark:gh((({commands:t},e)=>{const n=t.getMarks(e);return Sr((()=>Ge(n)[0]??null))})),hasMark:gh((({commands:t},e)=>{const n=t.getMark(e);return Sr((()=>!!Ge(n)))})),getCommonSettingMark:gh((({commands:t},e,n)=>{const r=t.getMark(e);return Sr((()=>Ge(r)?.value??Ge(n)))})),getDeviceSettingMark:gh((({commands:t},e,n)=>{const r=t.getMarks(e),o=t.getDevice();return Sr((()=>{for(const t of Ge(r)){const e=t[Ge(o)];if(e)return e}return Ge(n)}))})),removeAllMarks:gh((({state:t,commands:e})=>{const{tr:n,doc:r}=t,{from:o,to:i}=n.selection;r.nodesBetween(o,i,((t,r)=>{for(const o of t.marks)e._removeNodeMark({tr:n,node:t,position:r,mark:o})}))})),removeMarks:gh((({state:t,commands:e},n)=>{const{tr:r,doc:o}=t,{from:i,to:s}=r.selection;o.nodesBetween(i,s,((t,o)=>{const i=t.marks.filter((t=>n.includes(t.type.name)));for(const n of i)e._removeNodeMark({tr:r,node:t,position:o,mark:n})}))})),_removeNodeMark:gh(((t,{tr:e,node:n,position:r,mark:o})=>n.isText?e.removeMark(r,r+n.nodeSize,o):e.removeNodeMark(r,o)))})}),Qh=wl.create({name:"text_processor",addCommands:()=>({getSelectedText:gh((({state:t})=>{const{from:e,to:n}=t.selection;return t.doc.textBetween(e,n," ")})),transformText:gh((({state:t},e)=>{const{$from:n,$to:r}=t.tr.selection;n.pos!==r.pos&&t.doc.nodesBetween(n.pos,r.pos,((o,i)=>{if(!o.isText)return;const s=Wh(n,r,o,i),a=Math.max(0,n.pos-i),l=Math.max(0,r.pos-i),c=e({text:o.textContent.substring(a,l)}),u=t.schema.text(c,o.marks);t.tr.replaceWith(s.from,s.to,u)}))}))})}),tp=wl.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:gh((({state:t})=>{this.storage.selection=t.selection})),restoreSelection:gh((({commands:t})=>{this.storage.selection&&t.setTextSelection(this.storage.selection)})),expandSelection:gh((({tr:t,commands:e},n)=>{let r=t.selection.from,o=t.selection.to;t.doc.nodesBetween(r,o,((e,i,s)=>{if(n({node:e,parent:s})){const n=e.isText?0:qh(t.doc,i);r=Math.min(r,i+n),o=Math.max(o,i+e.nodeSize-n)}})),e.setTextSelection({from:r,to:o})})),expandSelectionToBlock:gh((({commands:t})=>{t.expandSelection((({parent:t})=>t.type.name===_c.DOCUMENT))}))}}}),ep=Jl.create({name:"doc",topNode:!0,content:"block+"});class np extends zo{constructor(t,e,n,r="SetDocAttr"){super(),this.key=t,this.value=e,this.schema=n,this.stepType=r}apply(t){this.prevValue=t.attrs.meta[this.key];const e=Zr.fromJSON(this.schema,t.toJSON());return e.attrs.meta[this.key]=this.value,jo.ok(e)}invert(){return new np(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(t){return new np(t.key,t.value,t.stepType)}}zo.jsonID("setDocAttr",np);const rp=ep.extend({marks:xc.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",(t=>{t.target.closest("a")&&t.preventDefault()}))},addCommands:()=>({setDocMetaAttributes:gh((({state:t},e,n)=>{t.tr.step(new np(e,n,t.schema))}))})}),op=Jl.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",el(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ip=op.extend({marks:xc.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),sp=Jl.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,el(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode(this.name,t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})})),{})},addInputRules(){return this.options.levels.map((t=>{return e={find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}},new hl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=rl(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)}});var e}))}}),ap=sp.extend({marks:xc.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),lp=wl.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[Cc.create(this.editor),Ac.create(this.editor)]}}),cp=Kl.create({name:kc.FONT_FAMILY,group:xc.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e});const n=t.findFontByName(e);let r=Ge(t.getFontWeight());n.isWeightSupported(r)||(r=n.findClosestWeight(r),t.applyFontWeight(r));const o=t.isSettingCustomized(kc.FONT_STYLE).value;!n.isItalicSupported(r)&&o&&t.removeItalic()})),getFont:gh((({commands:t})=>{const e=Ge(this.options.defaultPreset),n=t.findFontByName(e.common.font_family),r=t.getFontFamily();return Sr((()=>t.findFontByName(Ge(r))||n))})),findFontByName:gh(((t,e)=>Ge(this.options.fonts).find((t=>t.name===e)))),getFontFamily:gh((({commands:t})=>t.getCommonSettingMark(this.name,t.getDefaultFontFamily()))),getDefaultFontFamily:gh((({commands:t})=>{const e=t.getPreset();return Sr((()=>Ge(e).common.font_family))}))}},parseHTML(){const t=t=>({value:t.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:t},{style:"font-family",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({font_family:t.value?`"${t.value}"`:null})}),up=wl.create({name:kc.STYLE_PRESET,addGlobalAttributes(){return[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{preset:{isRequired:!1,default:{id:Ge(this.options.defaultId)},parseHTML:t=>{const e=Ge(this.options.presets);if("LI"===t.parentElement.tagName)return null;for(const{id:n,node:r,fallbackClass:o}of e){if(o&&t.classList.contains(o))return{id:n};const e=Ge(this.options.styleRenderer).makePresetCssClass({id:n});if(t.matches(e))return{id:n};if(t.tagName===`H${r?.level}`)return{id:n}}return"P"===t.tagName?{id:Ge(this.options.defaultId)}:null},renderHTML:t=>t.preset?{class:Ge(this.options.styleRenderer).makePresetHtmlClass(t.preset)}:null}}}]},addCommands(){function t(t,e){return t.find((t=>e===t.id))}function e(t,e){const n={};for(const r of Object.keys(t)){const o=t[r],i=e[r],s=!i||"inherit"===i.toLowerCase();n[r]=s?o:i}return n}return{getPresetList:gh((()=>Sr((()=>Ge(this.options.presets).filter((t=>!t.hidden)))))),getPreset:gh((({commands:n})=>{const r=n.getBlockAttributes("preset",{id:Ge(this.options.defaultId)}),o=n.getPresetList(),i=n.isLink(),s=n.getLinkPreset();return Sr((()=>{const n=t(Ge(o),Ge(r).id);if(!Ge(i))return n;const a=Ge(s);return{id:n.id,common:e(n.common,a.common),mobile:e(n.mobile,a.mobile),tablet:e(n.tablet,a.tablet),desktop:e(n.desktop,a.desktop)}}))})),applyPreset:gh((({commands:e,chain:n},r)=>{const o=t(Ge(e.getPresetList()),r),i=o.node?.type??_c.PARAGRAPH,s={preset:{id:r}};o.node&&(s.level=o.node.level);for(const t of kc.attributes)s[t]=Ge(e.getBlockAttributes(t));n().removeList().setNode(i,s).run()})),applyDefaultPreset:gh((({commands:t})=>{t.applyPreset(Ge(this.options.defaultId))})),removePreset:gh((({commands:t})=>{t.setNode(_c.PARAGRAPH,{preset:null})})),getPresetCustomization:gh((({editor:t,commands:e})=>{const n=Qe(t,"state");return Sr((()=>{const{selection:t,doc:r}=Ge(n),{from:o,to:i}=t;return e._getSettingCustomization(r,o,i)}))})),isSettingCustomized:gh((({commands:t},e)=>{const n=t.getPresetCustomization(),r=kc.presetAttributes.includes(e)?"attributes":"marks";return Sr((()=>Ge(n)[r]?.includes(e)??!1))})),getContentCustomization:gh((({editor:t,commands:e})=>{const n=Qe(t,"state");return Sr((()=>{const{doc:t}=Ge(n);return e._getSettingCustomization(t,0,t.content.size)}))})),_getSettingCustomization:gh(((t,e,n,r)=>{const o=new Set,i=new Set;return e.nodesBetween(n,r,(t=>{for(const[e,n]of Object.entries(t.attrs)){kc.presetAttributes.includes(e)&&n&&i.add(e)}for(const{type:e}of t.marks)kc.marks.includes(e.name)&&o.add(e.name)})),{attributes:Array.from(i),marks:Array.from(o)}})),removePresetCustomization:gh((({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(kc.marks).resetAttributes(_c.PARAGRAPH,kc.presetAttributes).resetAttributes(_c.HEADING,kc.presetAttributes).restoreSelection().run()})),removeFormat:gh((({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()}))}},onCreate(){this.options.styleRenderer.inject($p.head,Ge(this.options.presets))}}),hp=Kl.create({name:kc.FONT_WEIGHT,group:xc.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e});Ge(t.getFont()).isItalicSupported(e)||t.removeItalic()})),toggleBold:gh((({commands:t})=>{const e=Ge(t.getFontWeight()),n=Ge(t.getFont()),r=Number(e)>=600?"400":"700",o=n.findClosestWeight(r);t.applyFontWeight(o)})),getFontWeight:gh((({commands:t})=>{const e=t.getCommonSettingMark(this.name,t.getDefaultFontWeight()),n=t.getFont();return Sr((()=>{const t=Ge(e),r=Ge(n);return r.isWeightSupported(t)?t:r.findClosestWeight(t)}))})),getDefaultFontWeight:gh((({commands:t})=>{const e=t.getPreset();return Sr((()=>Ge(e).common.font_weight))}))}},addKeyboardShortcuts:()=>({"Mod-b":bh("toggleBold"),"Mod-B":bh("toggleBold")}),parseHTML(){const t=t=>"bold"===t?{value:"700"}:!!Number(t)&&{value:t};return[{style:"--zw-font-weight",getAttrs:t},{style:"font-weight",getAttrs:t},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML:({HTMLAttributes:t})=>vh({font_weight:t.value})}),pp=Kl.create({name:kc.FONT_SIZE,group:xc.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes:()=>({mobile:{default:null},tablet:{default:null},desktop:{default:null}}),addCommands(){return{getFontSize:gh((({commands:t})=>t.getDeviceSettingMark(this.name,t.getDefaultFontSize()))),getDefaultFontSize:gh((({commands:t})=>{const e=t.getDevice(),n=t.getPreset();return Sr((()=>Ge(n)[Ge(e)].font_size.replace("px","")))})),applyFontSize:gh((({commands:t},e)=>{const n=Ge(t.getDevice());t.applyMark(this.name,{[n]:e},{isAppliedToParent:(t,e)=>t.type.name===e.type.name&&t.attrs[n]===e.attrs[n],onAppliedToParent:({tr:t,node:e,position:r,mark:o})=>{const i={...o.attrs,[n]:null};if(!Object.values(i).some((t=>!!t)))return!1;const s=o.type.create(i);e.isText?t.addMark(r,r+e.nodeSize,s):t.addNodeMark(r,s)}})})),increaseFontSize:gh((({commands:t})=>{const e=Number(Ge(t.getFontSize())),n=Math.min(e+1,Ge(this.options.maxSize));t.applyFontSize(String(n))})),decreaseFontSize:gh((({commands:t})=>{const e=Number(Ge(t.getFontSize())),n=Math.max(e-1,Ge(this.options.minSize));t.applyFontSize(String(n))}))}},addKeyboardShortcuts:()=>({"Mod-Shift-=":bh("increaseFontSize"),"Mod-Shift--":bh("decreaseFontSize")}),parseHTML(){const t=t=>{if(!t)return null;const e=Hh(t,Ge(this.options.wrapperRef));return String(e)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:t(e.getPropertyValue("--zw-font-size-mobile")),tablet:t(e.getPropertyValue("--zw-font-size-tablet")),desktop:t(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const n=t(e);return{desktop:n,tablet:n,mobile:null}}}]},renderHTML({HTMLAttributes:t}){const e=t=>t?`${t}px`:null;return vh({font_size_mobile:e(t.mobile),font_size_tablet:e(t.tablet),font_size_desktop:e(t.desktop)})}}),dp=Kl.create({name:kc.FONT_COLOR,group:xc.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:gh((({commands:t})=>t.getCommonSettingMark(this.name,t.getDefaultFontColor()))),getDefaultFontColor:gh((({commands:t})=>{const e=t.getPreset();return Sr((()=>Ge(e).common.color))})),applyFontColor:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e})}))}},parseHTML(){const t=t=>({value:Fh(t)});return[{style:"--zw-font-color",getAttrs:t},{style:"color",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({font_color:t.value})}),fp=Kl.create({name:kc.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:gh((({commands:t})=>t.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)"))),applyBackgroundColor:gh((({commands:t},e)=>{t.applyMark(this.name,{value:e})}))}},parseHTML(){const t=t=>({value:Fh(t)});return[{style:"--zw-background-color",getAttrs:t},{style:"background-color",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({background_color:t.value})}),mp=wl.create({name:"device_manager",addCommands(){return{getDevice:gh((()=>Qe(this.options,"device")))}}}),gp=Kl.create({name:kc.FONT_STYLE,group:xc.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:gh((({commands:t})=>{const e=t.getMark(this.name),n=t.getDefaultFontStyle();return Sr((()=>Ge(e)?.italic??Ge(n).italic))})),isItalicAvailable:gh((({commands:t})=>{const e=t.getFont(),n=t.getFontWeight();return Sr((()=>{const t=Ge(e),r=Ge(n);return t.isItalicSupported(r)&&!t.isWeightItalicOnly(r)}))})),getDefaultFontStyle:gh((({commands:t})=>{const e=t.getPreset();return Sr((()=>({italic:"italic"===Ge(e).common.font_style})))})),toggleItalic:gh((({commands:t})=>{Ge(t.isItalicAvailable())&&(Ge(t.isItalic())?t.removeItalic():t.applyItalic())})),applyItalic:gh((({commands:t})=>{t.applyMark(this.name,{italic:!0})})),removeItalic:gh((({commands:t})=>{t.applyMark(this.name,{italic:!1})}))}},addKeyboardShortcuts:()=>({"Mod-i":bh("toggleItalic"),"Mod-I":bh("toggleItalic")}),parseHTML(){const t=t=>({italic:t.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:t},{style:"font-style",getAttrs:t}]},renderHTML:({HTMLAttributes:t})=>vh({font_style:t.italic?"italic":"normal"})}),yp=Kl.create({name:kc.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:gh((({commands:t})=>{const e=t.getTextDecoration();return Sr((()=>Ge(e).underline))})),isStrikeThrough:gh((({commands:t})=>{const e=t.getTextDecoration();return Sr((()=>Ge(e).strike_through))})),getTextDecoration:gh((({commands:t})=>{const e=t.getMark(this.name),n=t.getDefaultTextDecoration();return Sr((()=>{const t=Ge(e)??{},r=Ge(n);return{underline:t.underline||r.underline,strike_through:t.strike_through||r.strike_through}}))})),isUnderlineCustomized:gh((({commands:t})=>{const e=t.isUnderline(),n=t.getDefaultTextDecoration();return Sr((()=>Ge(e)!==Ge(n).underline))})),getDefaultTextDecoration:gh((({commands:t})=>{const e=t.getPreset();return Sr((()=>{const{text_decoration:t}=Ge(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}}))})),toggleUnderline:gh((({commands:t})=>{t.toggleTextDecoration("underline")})),toggleStrikeThrough:gh((({commands:t})=>{t.toggleTextDecoration("strike_through")})),toggleTextDecoration:gh((({commands:t},e,n=null)=>{const r=Ge(t.getTextDecoration()),o=n??!r[e];t.applyMark(this.name,{[e]:o})})),applyTextDecoration:gh((({commands:t},e)=>{t.toggleTextDecoration(e,!0)})),removeTextDecoration:gh((({commands:t},e)=>{t.toggleTextDecoration(e,!1)}))}},addKeyboardShortcuts:()=>({"Mod-u":bh("toggleUnderline"),"Mod-U":bh("toggleUnderline")}),parseHTML(){const t=t=>{const e=t.includes("underline"),n=t.includes("line-through");return!(!e&&!n)&&{underline:e,strike_through:n}};return[{style:"--zw-text-decoration",getAttrs:t},{style:"text-decoration-line",getAttrs:t},{style:"text-decoration",getAttrs:t},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:t}){const e=[];return t.underline&&e.push("underline"),t.strike_through&&e.push("line-through"),e.length||e.push("none"),vh({text_decoration:e.join(" ")})}}),vp=wl.create({name:"case_style",addCommands:()=>({applyCaseStyle:gh((({commands:t},e)=>{switch(e){case vc.CAPITALIZE:return t.applyCapitalize();case vc.LOWERCASE:return t.applyLowerCase();case vc.UPPERCASE:return t.applyUpperCase()}})),applyCapitalize:gh((({commands:t})=>{t.transformText((({text:t})=>function(t){return t.toLowerCase().replace(/(?:^|\s)\S/g,(t=>t.toUpperCase()))}(t)))})),applyLowerCase:gh((({commands:t})=>{t.transformText((({text:t})=>t.toLowerCase()))})),applyUpperCase:gh((({commands:t})=>{t.transformText((({text:t})=>t.toUpperCase()))}))})}),bp={mobile:null,tablet:null,desktop:null},_p=wl.create({name:kc.ALIGNMENT,addGlobalAttributes:()=>[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{[kc.ALIGNMENT]:{isRequired:!1,parseHTML({style:t}){const e=function(t){const e=Vh[t]||t;return bc.values.includes(e)?e:null}(t.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const n=t.getPropertyValue("--zw-alignment-mobile")||null,r=t.getPropertyValue("--zw-alignment-tablet")||null,o=t.getPropertyValue("--zw-alignment-desktop")||null;return n||r||o?{desktop:o,tablet:r,mobile:n}:null},renderHTML:t=>t.alignment?yh({alignment_mobile:t.alignment.mobile,alignment_tablet:t.alignment.tablet,alignment_desktop:t.alignment.desktop}):null}}}],addCommands(){return{applyAlignment:gh((({commands:t},e)=>{const n=Ge(t.getDevice());t.setBlockAttributes(this.name,{[n]:e},bp)})),removeAlignment:gh((({commands:t})=>t.removeBlockAttributes(this.name))),getAlignment:gh((({commands:t})=>{const e=t.getBlockAttributes(this.name,bp),n=t.getDevice(),r=t.getDefaultAlignment();return Sr((()=>Ge(e)?.[Ge(n)]??Ge(r)))})),getDefaultAlignment:gh((({commands:t})=>{const e=t.getDevice(),n=t.getPreset();return Sr((()=>Ge(n)[Ge(e)].alignment??bc.LEFT))}))}},addKeyboardShortcuts:()=>({"Mod-Shift-l":bh("applyAlignment",bc.LEFT),"Mod-Shift-e":bh("applyAlignment",bc.CENTER),"Mod-Shift-r":bh("applyAlignment",bc.RIGHT),"Mod-Shift-j":bh("applyAlignment",bc.JUSTIFY)})}),wp={mobile:null,tablet:null,desktop:null},kp=wl.create({name:kc.LINE_HEIGHT,addGlobalAttributes(){return[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{[kc.LINE_HEIGHT]:{isRequired:!1,parseHTML:t=>{if(t.matches('[style*="--zw-line-height"]')){return{mobile:null,tablet:t.style.getPropertyValue("--zw-line-height-tablet")||null,desktop:t.style.getPropertyValue("--zw-line-height-desktop")||null}}const e=t.style.lineHeight;if(!e)return null;const n=Bh(e,t,Ge(this.options.wrapperRef));return n?{desktop:n,tablet:n,mobile:null}:null},renderHTML:t=>t.line_height?yh({line_height_mobile:t.line_height.mobile,line_height_tablet:t.line_height.tablet,line_height_desktop:t.line_height.desktop}):null}}}]},addCommands(){return{getLineHeight:gh((({commands:t})=>{const e=t.getBlockAttributes(this.name,wp),n=t.getDevice(),r=t.getDefaultLineHeight();return Sr((()=>Ge(e)?.[Ge(n)]??Ge(r)))})),getDefaultLineHeight:gh((({commands:t})=>{const e=t.getDevice(),n=t.getPreset();return Sr((()=>Ge(n)[Ge(e)].line_height))})),applyLineHeight:gh((({commands:t},e)=>{const n=Ge(t.getDevice());t.setBlockAttributes(this.name,{[n]:e},wp)}))}}}),xp=Jl.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",el(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}).extend({name:_c.LIST_ITEM,marks:xc.SETTINGS,addCommands(){const t=({selection:t})=>t.$cursor.before(t.$cursor.depth-1);return{listItemNewline:gh((({commands:e,tr:n})=>{const r=n.doc.nodeAt(t(n));if(!n.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=t(n);for(const t of r.marks)n.addNodeMark(o,Xh(t));return!0}))}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:t=>{const{state:e,commands:n}=t.editor,r=e.selection.$cursor?.path.some((t=>t.type?.name===_c.LIST));if(r)return n.listItemNewline()}})}),Sp=Jl.create({name:_c.LIST,content:`${_c.LIST_ITEM}+`,group:"block list",marks:xc.SETTINGS,addExtensions:()=>[xp],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:wc.DISC}}}),parseHTML(){const t={a:wc.ROMAN,i:wc.LATIN,1:wc.DECIMAL},e=e=>{for(const n of wc.values){const r=`.${Ge(this.options.baseClass)}${n}`;if(e.matches(r))return n;if(t[e.type.toLowerCase()]===n)return n}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||wc.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||wc.DISC}})}]},renderHTML({HTMLAttributes:t}){const e=[Ge(this.options.baseClass)+t.bullet.type,Ge(this.options.presetClass)];return[wc.ordered.includes(t.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands:()=>({getListType:gh((({commands:t})=>{const e=t.getBlockAttributes("bullet",{type:null});return Sr((()=>Ge(e).type??null))})),applyList:gh((({commands:t,chain:e},n)=>{if(Ge(t.getListType())!==n)return e().applyDefaultPreset().toggleList(_c.LIST,_c.LIST_ITEM).setBlockAttributes("bullet",{type:n}).command((({commands:t,tr:e})=>t._bubbleListItemMarks(e))).run();t.removeList()})),_bubbleListItemMarks:gh(((t,e)=>{const{doc:n,selection:r}=e,o=r.$from.start(),i=r.$to.end();function s(t,e){if(kc.inlineMarks.includes(e.type))return!1;if(e.type.isInSet(t.marks))return!1;for(const n of t.content.content)if(n.childCount){if(!n.marks)return!1;if(!e.isInSet(n.marks))return!1}return!0}n.nodesBetween(o,i,((t,n)=>{if(t.type.name===_c.LIST)return;if(t.type.name!==_c.LIST_ITEM)return!1;const r=[];return t.forEach((o=>{for(const i of o.marks)i.isInSet(r)?e.removeNodeMark(n+1,i):s(t,i)&&(e.removeNodeMark(n+1,i),e.addNodeMark(n,Xh(i)),r.push(i))})),!1}))})),removeList:gh((({commands:t,state:e})=>{const{tr:n,doc:r,selection:o}=e,i=o.$from.start(),s=o.$to.end();r.nodesBetween(i,s,((t,e,r)=>{if([_c.LIST,_c.LIST_ITEM].includes(t.type.name))return;if(r.type.name!==_c.LIST_ITEM)return!1;const o=r.marks.filter((function(e){return!e.type.isInSet(t.marks)}));for(const t of o)n.addNodeMark(e,Xh(t));return!1})),t.liftListItem(_c.LIST_ITEM)}))}),addInputRules(){const t=(t,e)=>{return n={find:e,type:this.type,getAttributes:{bullet:{type:t}},joinPredicate:(e,{attrs:n})=>n.bullet.type===t},new hl({find:n.find,handler:({state:t,range:e,match:r,chain:o})=>{const i=rl(n.getAttributes,void 0,r)||{},s=t.tr.delete(e.from,e.to),a=s.doc.resolve(e.from).blockRange(),l=a&&Yo(a,n.type,i);if(!l)return null;if(s.wrap(a,l),n.keepMarks&&n.editor){const{selection:e,storedMarks:r}=t,{splittableMarks:o}=n.editor.extensionManager,i=r||e.$to.parentOffset&&e.$from.marks();if(i){const t=i.filter((t=>o.includes(t.type.name)));s.ensureMarks(t)}}if(n.keepAttributes){const t="bulletList"===n.type.name||"orderedList"===n.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(e.from-1).nodeBefore;c&&c.type===n.type&&Qo(s.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&s.join(e.from-1)}});var n};return[t(wc.DISC,/^\s*([-+*])\s$/),t(wc.DECIMAL,/^(\d+)\.\s$/),t(wc.LATIN,/^([ivx]{1,3})\.\s$/i),t(wc.ROMAN,/^([a-z])\.\s$/i)]}});function Ep(t){return new Ii({key:new Di("autolink"),appendTransaction:(e,n,r)=>{const o=e.some((t=>t.docChanged))&&!n.doc.eq(r.doc),i=e.some((t=>t.getMeta("preventAutolink")));if(!o||i)return;const{tr:s}=r,a=function(t,e){const n=new mi(t);return e.forEach((t=>{t.steps.forEach((t=>{n.step(t)}))})),n}(n.doc,[...e]),l=function(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach(((t,o)=>{const i=[];if(t.ranges.length)t.forEach(((t,e)=>{i.push({from:t,to:e})}));else{const{from:t,to:e}=n[o];if(void 0===t||void 0===e)return;i.push({from:t,to:e})}i.forEach((({from:t,to:n})=>{const i=e.slice(o).map(t,-1),s=e.slice(o).map(n),a=e.invert().map(i,-1),l=e.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})}))})),jl(r)}(a);return l.forEach((({newRange:e})=>{const n=function(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,((t,e)=>{n(t)&&r.push({node:t,pos:e})})),r}(r.doc,e,(t=>t.isTextblock));let o,i;if(n.length>1?(o=n[0],i=r.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ")):n.length&&r.doc.textBetween(e.from,e.to," "," ").endsWith(" ")&&(o=n[0],i=r.doc.textBetween(o.pos,e.to,void 0," ")),o&&i){const e=i.split(" ").filter((t=>""!==t));if(e.length<=0)return!1;const n=e[e.length-1],a=o.pos+i.lastIndexOf(n);if(!n)return!1;fh(n).filter((t=>t.isLink)).map((t=>({...t,from:a+t.start+1,to:a+t.end+1}))).filter((t=>!r.schema.marks.code||!r.doc.rangeHasMark(t.from,t.to,r.schema.marks.code))).filter((e=>!t.validate||t.validate(e.value))).forEach((e=>{Fl(e.from,e.to,r.doc).some((e=>e.mark.type===t.type))||s.addMark(e.from,e.to,t.type.create({href:e.href}))}))}})),s.steps.length?s:void 0}})}const Op=Kl.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach((t=>{"string"!=typeof t?hh(t.scheme,t.optionalSlashes):hh(t)}))},onDestroy(){Wc.groups={},uh.scanner=null,uh.parser=null,uh.tokenQueue=[],uh.pluginQueue=[],uh.customSchemes=[],uh.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}),addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML:()=>[{tag:'a[href]:not([href *= "javascript:" i])'}],renderHTML({HTMLAttributes:t}){var e;return(null===(e=t.href)||void 0===e?void 0:e.startsWith("javascript:"))?["a",el(this.options.HTMLAttributes,{...t,href:""}),0]:["a",el(this.options.HTMLAttributes,t),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[(t={find:t=>fh(t).filter((t=>!this.options.validate||this.options.validate(t.value))).filter((t=>t.isLink)).map((t=>({text:t.value,index:t.start,data:t}))),type:this.type,getAttributes:(t,e)=>{var n,r;const o=null===(n=null==e?void 0:e.clipboardData)||void 0===n?void 0:n.getData("text/html"),i=null==o?void 0:o.match(/href="([^"]*)"/);return i?{href:i[1]}:{href:null===(r=t.data)||void 0===r?void 0:r.href}}},new ml({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=rl(t.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),u=o+a.length;if(Fl(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>o)).length)return null;u<n.to&&s.delete(u,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}}))];var t},addProseMirrorPlugins(){const t=[];var e;return this.options.autolink&&t.push(Ep({type:this.type,validate:this.options.validate})),this.options.openOnClick&&t.push((e={type:this.type},new Ii({key:new Di("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if("A"!==r.target.nodeName)return!1;const s=zl(t.state,e.type.name),a=r.target,l=null!==(o=null==a?void 0:a.href)&&void 0!==o?o:s.href,c=null!==(i=null==a?void 0:a.target)&&void 0!==i?i:s.target;return!(!a||!l||(t.editable&&window.open(l,c),0))}}}))),this.options.linkOnPaste&&t.push(function(t){return new Ii({key:new Di("handlePasteLink"),props:{handlePaste:(e,n,r)=>{var o;const{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach((t=>{l+=t.textContent}));const c=fh(l).find((t=>t.isLink&&t.value===l));if(!l||!c)return!1;const u=null===(o=n.clipboardData)||void 0===o?void 0:o.getData("text/html"),h=null==u?void 0:u.match(/href="([^"]*)"/),p=h?h[1]:c.href;return t.editor.commands.setMark(t.type,{href:p}),!0}}})}({editor:this.editor,type:this.type})),t}}),Cp=Op.extend({name:kc.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:t=>{const e=t.getAttribute("href");return e.startsWith("#")?parseFloat(t.getAttribute("href").replace("#","")):e}},target:{default:Sc.SELF,parseHTML:t=>t.getAttribute("target")||Sc.SELF},destination:{default:Ec.URL,parseHTML:t=>{const e=t.getAttribute("href");if(!e.startsWith("#"))return Ec.URL;const n=e.replace("#","");return Ge(this.options.pageBlocks).find((t=>t.id===parseInt(n)))?Ec.BLOCK:Ec.URL}}}},addCommands(){const{unsetLink:t}=this.parent();return{removeLink:t,applyLink:gh((({commands:t,chain:e},n)=>(t.setMeta("preventAutolink",!0),t.getSelectedText()?e().applyMark(this.name,n).expandSelectionToLink().command((({tr:t})=>(n.text&&t.insertText(n.text,t.selection.from,t.selection.to),!0))).run():t.insertContent(zp.text(n.text,[zp.mark(kc.LINK,n)]))))),expandSelectionToLink:gh((({commands:t})=>{t.expandSelection((({node:t})=>this.type.isInSet(t.marks)))})),isLink:gh((({commands:t})=>t.hasMark(this.name))),getLinkPreset:gh((()=>Sr((()=>Ge(this.options.preset)))))}},addProseMirrorPlugins(){return[...this.parent(),mh.create(this.editor)]},renderHTML({HTMLAttributes:t}){const e=t.destination===Ec.BLOCK?`#${t.href}`:t.href,n=Ge(this.options.basePresetClass)+Ge(this.options.preset).id;return["a",{href:e,target:t.target,class:`${n} zw-style`},0]}}),Ap=Kl.create({name:kc.SUPERSCRIPT,addCommands(){return{applySuperscript:gh((({commands:t})=>{t.setMark(this.name)})),removeSuperscript:gh((({commands:t})=>{t.unsetMark(this.name)})),toggleSuperscript:gh((({commands:t})=>{Ge(t.isSuperscript())?t.removeSuperscript():t.applySuperscript()})),isSuperscript:gh((({commands:t})=>{const e=t.getMark(this.name);return Sr((()=>!!Ge(e)))}))}},parseHTML:()=>[{tag:"sup"},{style:"vertical-align",getAttrs:t=>"super"===t&&null}],renderHTML:()=>["sup",{class:"zw-superscript"},0]}),Mp=wl.create({name:kc.MARGIN,addGlobalAttributes:()=>[{types:[_c.PARAGRAPH,_c.HEADING],attributes:{[kc.MARGIN]:{isRequired:!1,parseHTML(t){const{margin:e,marginTop:n,marginRight:r,marginBottom:o,marginLeft:i}=t.style;if(![e,n,r,o,i].some((t=>!!t)))return null;if(e)return{value:e};return{value:[n||0,r||0,o||0,i||0].join(" ")}},renderHTML:t=>t.margin?yh({margin:t.margin.value}):null}}}]});function Tp(t){const e=e=>t.presetsRef.value.find((t=>t.id===e)),n=Ie({default:null,link:null});return function(t,e,n){"production"===process.env.NODE_ENV||it(e)||en("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),zn(t,e,n)}(t.presetsRef,(()=>{n.default=e(t.defaultPresetId),n.link=e(t.linkPresetId)}),{immediate:!0,deep:!0}),[rp,ip,ap,Gl,gc,Zh,Qh,tp,lp].concat([up.configure({presets:t.presetsRef,defaultId:t.defaultPresetId,styleRenderer:new jp({baseClass:t.basePresetClass,makeVariable:t.makePresetVariable,linkPresetId:t.linkPresetId})}),Sp.configure({baseClass:t.baseListClass,presetClass:t.basePresetClass+t.defaultPresetId}),mp.configure({device:t.deviceRef}),pp.configure({minSize:t.minFontSize,maxSize:t.maxFontSize,wrapperRef:t.wrapperRef}),cp.configure({fonts:t.fonts,defaultPreset:Qe(n,"default")}),hp,dp,fp,gp,yp,vp,Ap,_p,kp.configure({wrapperRef:t.wrapperRef}),Cp.configure({preset:Qe(n,"link"),basePresetClass:t.basePresetClass,pageBlocks:t.pageBlocksRef}),Mp])}class Np{_domParser=new DOMParser;types=window;parse(t){return this._domParser.parseFromString(t,"text/html")}}class Ip{content;constructor({content:t}){this.content=t}normalize(){throw new Error("Implement abstract method")}}class Rp extends Ip{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=Rp.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:t,parser:e}){super({content:t}),this._parser=e,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,(t=>"BR"===t.tagName)),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,(t=>"LI"===t.tagName)),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const t=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(t,(t=>t.remove()))}_normalizeRootTags(){const t=Array.from(this.dom.body.childNodes),e=this.dom.createDocumentFragment();let n;for(const r of t)this._isRootNode(r)?(e.append(r),n=null):(n||(n=this.dom.createElement("p"),e.append(n)),n.append(r));this.dom.body.innerHTML="",this.dom.body.append(e)}_createNodeIterator(t,e){return this.dom.createNodeIterator(this.dom.body,t,e)}_iterateNodes(t,e=(()=>!0)){const n=t=>"BODY"!==t.tagName&&e.call(this,t),r=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:t=>n(t)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(r,t)}_runIterator(t,e){let n=t.nextNode();for(;n;)e.call(this,n),n=t.nextNode()}_removeEmptyNodes(t){t.innerHTML.trim()||t.remove()}_normalizeListItems(t){const e=this.dom.createDocumentFragment(),n=Array.from(t.childNodes);let r,o;const i=n=>{this._assignElementProperties(n,t,Rp.BLOCK_STYLES),e.append(n)};this._assignElementProperties(t,t.parentElement,Rp.BLOCK_STYLES);for(const t of n)if(this._isBlockNode(t))i(t),r=null,o=t;else if("BR"===t.tagName&&o&&"BR"!==o?.tagName)t.remove(),o=t;else if("BR"!==t.tagName)r||(r=this.dom.createElement("p"),i(r)),r.append(t),o=t;else{const e=this.dom.createElement("p");e.append(t),i(e),r=null,o=t}t.append(e),this._removeStyleProperties(t,Rp.BLOCK_STYLES),this._removeStyleProperties(t.parentElement,Rp.BLOCK_STYLES),this._assignElementProperties(t,t.parentElement),t.parentElement.lastElementChild===t&&this._removeStyleProperties(t.parentElement)}_isBlockNode(t){return Rp.BLOCK_NODE_NAMES.includes(t.tagName)}_isRootNode(t){return Rp.ROOT_NODE_NAMES.includes(t.tagName)}_assignElementProperties(t,e,n=Array.from(e.style)){for(const r of n){const n=e.style.getPropertyValue(r);n&&!t.style.getPropertyValue(r)&&t.style.setProperty(r,n)}}_removeStyleProperties(t,e=Array.from(t.style)){for(const n of e)t.style.removeProperty(n);0===t.style.length&&t.removeAttribute("style")}_normalizeBreakLines({parentElement:t}){if(!this._isBlockNode(t))return;if(!t.textContent)return;const e=this.dom.createDocumentFragment(),n=Array.from(t.childNodes),r=t.cloneNode(!0);r.innerHTML="";let o=r.cloneNode();const i=n=>{this._assignElementProperties(n,t,Rp.BLOCK_STYLES),e.append(n)};for(const t of n)"BR"!==t.tagName?o.append(t):(i(o),o=r.cloneNode());e.append(o),t.replaceWith(e)}_normalizeBlockTextDecoration(){const t=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const e of t)this._moveTextDecorationToChildren(e)}_moveTextDecorationToChildren(t){const e=this._parseTextDecoration(t);if(t.style.removeProperty("text-decoration-line"),t.style.removeProperty("text-decoration"),t.style.cssText||t.removeAttribute("style"),!e.none)for(const n of t.childNodes){const r=this._wrapTextNode(t,n),o=this._parseTextDecoration(r),i={underline:o.underline||e.underline,line_through:o.line_through||e.line_through};r.style.removeProperty("text-decoration-line"),r.style.removeProperty("text-decoration"),r.style.textDecoration=Object.entries(i).filter((([,t])=>t)).map((([t])=>t.replace("_","-"))).join(" ")}}_parseTextDecoration(t){const{textDecoration:e,textDecorationLine:n}=t.style,r=e||n||"";return{none:r.includes("none"),underline:r.includes("underline"),line_through:r.includes("line-through")}}_normalizeBlockBackgroundColor(){const t=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const e of t)this._moveBackgroundColorToChildren(e)}_moveBackgroundColorToChildren(t){const e=t.style.backgroundColor;t.style.removeProperty("background-color"),t.style.cssText||t.removeAttribute("style");for(const n of t.childNodes){const r=this._wrapTextNode(t,n),o=r.style.backgroundColor||e;r.style.backgroundColor=o}}_wrapTextNode(t,e){if(e.nodeType!==this._Node.TEXT_NODE)return e;const n=this.dom.createElement("span");return n.append(e.cloneNode()),t.replaceChild(n,e),n}}class Lp extends Ip{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(t){this._iterateChildNodes(this.content,t)}_iterateChildNodes(t,e){for(const n of t.content)n.content&&this._iterateChildNodes(n,e),e.call(this,n)}_bubbleMarks(t){if(t.content&&t.type!==_c.LIST)for(const e of t.content)if(!this._isLink(e)&&e.marks)for(const n of e.marks.slice())this._includesMark(t,n)?this._removeMark(e,n):this._canBubbleMark(t,n)&&(this._removeMark(e,n),this._addMark(t,n))}_canBubbleMark(t,e){if(kc.inlineMarks.includes(e.type))return!1;if(this._includesMarkType(t,e.type))return!1;for(const n of t.content)if(n.content||t.type!==_c.LIST_ITEM){if(!n.marks)return!1;if(!this._includesMark(n,e))return!1}return!0}_includesMark(t,e){return t.marks?.some((t=>Yh.isEqual(t,e)))??!1}_includesMarkType(t,e){return t.marks?.some((t=>t.type===e))??!1}_isLink(t){return t.type===_c.TEXT&&this._includesMarkType(t,kc.LINK)}_removeMark(t,e){if(!t.marks)return;const n=this._findMarkIndexByType(t,e.type);n>=0&&t.marks.splice(n,1),t.marks.length||delete t.marks}_addMark(t,e){this._removeMark(t,e),t.marks??=[],t.marks.push(e)}_findMarkIndexByType(t,e){return t.marks?.findIndex((t=>t.type===e))??null}}class Dp{static build(t,e={}){return"string"==typeof t?this._buildHtml(t,e):this._buildJson(t)}static _buildHtml(t,e){return new Rp({content:t,parser:e.parser||new Np})}static _buildJson(t){return new Lp({content:t})}static normalize(t,e={}){return Dp.build(t,e).normalize()}}class $p{static window=globalThis.window;static use(t){this.window=t}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(t){return this.window.getComputedStyle(t)}}class Pp{static build({config:t,nodeDomParser:e}){const n=function(t,e){return sl(vl.resolve(t),e)}(Tp({fonts:t.fonts,minFontSize:0,maxFontSize:0,presetsRef:Ke(t.presets),defaultPresetId:t.defaultPresetId,linkPresetId:t.linkPresetId,makePresetVariable:()=>"",basePresetClass:t.basePresetClass,baseListClass:t.baseListClass,deviceRef:Ke(yc.DESKTOP),pageBlocksRef:Ke([]),wrapperRef:$p.document.createElement("p")}));return new Pp({schema:n,domParser:bo.fromSchema(n),nodeDomParser:e})}_schema;_domParser;_nodeDomParser;constructor({schema:t,domParser:e,nodeDomParser:n}){this._schema=t,this._domParser=e,this._nodeDomParser=n}toJSON(t){const e=Dp.build(t,{parser:this._nodeDomParser});return e.normalizeHTML(),this._domParser.parse(e.dom.body).toJSON()}}class zp{static doc(t){return{type:_c.DOCUMENT,content:t}}static list(t,e){return{type:_c.LIST,attrs:{bullet:{type:t}},content:e.map((t=>t.type===_c.LIST_ITEM?t:this.listItem([].concat(t))))}}static listItem(...t){const{attrs:e,content:n,marks:r}=this._normalizeTextBlockArgs(t);return{type:_c.LIST_ITEM,...e?{attrs:e}:{},...r?{marks:r}:{},content:[].concat(n).map((t=>"string"==typeof t?this.paragraph(t):t))}}static heading(t,...e){const n=this._textBlock(e,this.text);return n.attrs??={},n.attrs.level=t,{type:_c.HEADING,...n}}static paragraph(...t){return{type:_c.PARAGRAPH,...this._textBlock(t,this.text)}}static _textBlock(t){const{attrs:e,content:n,marks:r}=this._normalizeTextBlockArgs(t);return{content:"string"==typeof n?[this.text(n)]:n,...e?{attrs:e}:{},...r?{marks:r}:{}}}static _normalizeTextBlockArgs(t){return 1===t.length?{attrs:null,marks:null,content:t[0]}:2===t.length?{attrs:t[0],marks:null,content:t[1]}:{attrs:t[0],marks:t[1],content:t[2]}}static text(t,e){return{type:_c.TEXT,...e?{marks:e}:{},text:t}}static link(t,e,n=[]){return this.text(t,[this.mark(kc.LINK,e),...n])}static mark(t,e){return{type:t,attrs:e}}static populateAllDevices(t){return{mobile:t,tablet:t,desktop:t}}}class jp{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:t,makeVariable:e,linkPresetId:n}){this._baseClass=t,this._makeVariable=e,this._linkPresetId=n}inject(t,e){let n=t.querySelector("[data-zw-styles]");n||(n=$p.document.createElement("style"),n.dataset.zwStyles="",n.innerHTML=this.render(e),t.append(n))}render(t){let e="";for(const n of t){const t=n.id===this._linkPresetId;e+=` ${this.makePresetCssClass(n)} {`;for(const r of yc.values)for(const o of Object.keys(n[r])){const i=this._makeVariable({device:r,preset:n,property:o}),s=this._makeInternalVariableName(o,r);if(e+=`${s}: var(${i}, inherit);`,t&&!kc.attributes.includes(o)){e+=`${s.replace("preset-","")}: var(${s});`}}e+="}"}return e}_makeInternalVariableName(t,e){return`--zw-preset-${"color"===t?"font-color":t.replace(/_/i,"-")}${e===yc.COMMON?"":`-${e}`}`}makePresetHtmlClass(t){return this._baseClass+t.id}makePresetCssClass(t){return this.makePresetHtmlClass(t).split(" ").map((t=>`.${t}`)).join("")}}class Fp{static _instance;static get instance(){return this._instance??=new Fp,this._instance}static query(t,e){return this.instance.query(t,e)}query(t,e){let n=null;return t.descendants((t=>!n&&(this.matchNode(t,e)?(n=t,!1):void 0))),n?e.getMark?this.getMark(n,e.getMark):n:null}matchNode(t,e){return(!e.typeName||e.typeName===t.type.name)&&!(e.mark&&!this.getMark(t,e.mark))}getMark(t,e){return t.marks.find((t=>this.matchMark(t,e)))||null}matchMark(t,e){return t.type.name===e.typeName}}class Hp{static createWindow(){return(new i.JSDOM).window}types;parse(t){const{window:e}=new i.JSDOM(t);return this.types=e,e.document}}class Bp{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(t){if(!this.name)throw new Error('Command "name" is required');let e=t.command(this.name);if(this.description&&(e=e.description(this.description)),this.argument&&(e=e.argument(this.argument)),this.options.length)for(const t of this.options)e=e.option(t.flags,t.description,t.default);e.action(this.doCommand.bind(this))}output(t){console.log(t)}}const Vp=new q,Wp=[class extends Bp{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:n.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(t,{config:e,format:r}){$p.use(Hp.createWindow());const o=n.resolve(process.cwd(),e),i=Pp.build({config:require(o).editor,nodeDomParser:new Hp}),s=t.map((t=>i.toJSON(this._formatInputHtml(t)))),a=1===s.length?s[0]:s,l=this._stringifyContent(a);this.output("rb"===r?this._formatOutputRb(l):l)}_formatInputHtml(t){return t.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,((t,e)=>t.replace(e,parseFloat(e)/100)))}_stringifyContent(t){return JSON.stringify(t,((t,e)=>null===e?void 0:e),2)}_formatOutputRb(t){return t.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,(t=>t.replace(/"/g,""))).replace(/: "(.+)"([,\n])/g,": '$1'$2")}},class extends Bp{name="version";description="display cli version";doCommand(){this.output("4.2.0-0")}}];for(const t of Wp)(new t).install(Vp);Vp.parse();