spell 0.8.7 → 0.8.9

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 (304) hide show
  1. package/README-epics.md +149 -49
  2. package/app/package.json +25 -1
  3. package/app/spaces/@spell/guides/SpellUI/SpellUI.spellml +486 -486
  4. package/app/spaces/@spell/sites/SpellApp/SpellApp.spellml +50 -124
  5. package/dist/app/app/pages/SiteBoardView.css +5 -5
  6. package/dist/app/app/pages/SiteBoardView.js +1 -1
  7. package/dist/app/app/pages/SiteEditorPage.js +6 -3
  8. package/dist/app/app/pages/SiteEdits.js +27 -10
  9. package/dist/app/app/pages/SiteWrites.js +11 -0
  10. package/dist/app/app/runner/spellRuntime.js +1 -0
  11. package/dist/cli/publish/PublishedPackage.d.ts +2 -1
  12. package/dist/cli/publish/PublishedPackage.js +6 -3
  13. package/dist/cli/publish/ScratchInstall.d.ts +14 -3
  14. package/dist/cli/publish/ScratchInstall.js +69 -8
  15. package/dist/epic/cli/EpicProgram.js +20 -5
  16. package/dist/epic/cli/epicGroups.js +7 -1
  17. package/dist/epic/command/BaseBranch.d.ts +35 -0
  18. package/dist/epic/command/BaseBranch.js +58 -0
  19. package/dist/epic/command/EpicCheckout.d.ts +1 -1
  20. package/dist/epic/command/EpicCheckout.js +4 -4
  21. package/dist/epic/command/EpicGuide.js +3 -2
  22. package/dist/epic/command/EpicTools.d.ts +5 -0
  23. package/dist/epic/command/EpicTools.js +14 -3
  24. package/dist/epic/command/MainMerge.d.ts +26 -15
  25. package/dist/epic/command/MainMerge.js +60 -16
  26. package/dist/epic/command/PullRequest.d.ts +45 -0
  27. package/dist/epic/command/PullRequest.js +100 -0
  28. package/dist/epic/command/RepoInit.d.ts +196 -39
  29. package/dist/epic/command/RepoInit.js +481 -60
  30. package/dist/epic/command/Requests.d.ts +1 -0
  31. package/dist/epic/command/Requests.js +7 -1
  32. package/dist/epic/command/SessionMoves.js +2 -1
  33. package/dist/epic/command/SkillsCheck.js +3 -2
  34. package/dist/epic/command/Stock.js +3 -1
  35. package/dist/epic/command/TurnEnd.d.ts +1 -1
  36. package/dist/epic/command/TurnEnd.js +4 -3
  37. package/dist/epic/command/Worktrees.d.ts +20 -3
  38. package/dist/epic/command/Worktrees.js +39 -7
  39. package/dist/epic/command/command.types.d.ts +3 -0
  40. package/dist/epic/components/__pack/epics.entry.js +43 -43
  41. package/dist/epic/components/__pack/epics.pack.js +36 -12794
  42. package/dist/epic/config/CodeHost.d.ts +96 -0
  43. package/dist/epic/config/CodeHost.js +89 -0
  44. package/dist/epic/config/EngineFiles.mjs +60 -0
  45. package/dist/epic/config/EpicConfig.d.ts +20 -3
  46. package/dist/epic/config/EpicConfig.js +25 -1
  47. package/dist/epic/config/EpicRepo.js +1 -1
  48. package/dist/epic/config/GitHub.d.ts +75 -3
  49. package/dist/epic/config/GitHub.js +106 -5
  50. package/dist/epic/config/GitLab.d.ts +138 -0
  51. package/dist/epic/config/GitLab.js +297 -0
  52. package/dist/epic/config/LayeredSettings.js +3 -2
  53. package/dist/epic/server/EpicServer.d.ts +1 -1
  54. package/dist/epic/server/EpicServer.js +26 -12
  55. package/dist/epic/tool/InboxPoller.mjs +2 -1
  56. package/dist/epic/tool/MigrateCommands.js +6 -8
  57. package/dist/epic/tool/PlanCommits.d.ts +7 -4
  58. package/dist/epic/tool/PlanCommits.js +7 -5
  59. package/dist/epic/tool/PlanDocCommands.js +3 -4
  60. package/dist/epic/tool/PlanDocFiles.d.ts +3 -1
  61. package/dist/epic/tool/PlanDocFiles.js +13 -5
  62. package/dist/epic/tool/ServedFolders.d.ts +1 -1
  63. package/dist/epic/tool/ServedFolders.js +4 -4
  64. package/dist/epic/tools/PageInboxes.js +3 -3
  65. package/dist/epic/tools/_assets/commands.entry.js +149 -68
  66. package/dist/epic/tools/_assets/commands.js +20 -2073
  67. package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
  68. package/dist/epic/tools/_assets/core-reference.js +20 -2142
  69. package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
  70. package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
  71. package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
  72. package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
  73. package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
  74. package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
  75. package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
  76. package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
  77. package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
  78. package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
  79. package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
  80. package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
  81. package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
  82. package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
  83. package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
  84. package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
  85. package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
  86. package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
  87. package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
  88. package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
  89. package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
  90. package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
  91. package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
  92. package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
  93. package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
  94. package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
  95. package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
  96. package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
  97. package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
  98. package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
  99. package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
  100. package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
  101. package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
  102. package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
  103. package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
  104. package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
  105. package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
  106. package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
  107. package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
  108. package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
  109. package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
  110. package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
  111. package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
  112. package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
  113. package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
  114. package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
  115. package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
  116. package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
  117. package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
  118. package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
  119. package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
  120. package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
  121. package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
  122. package/dist/epic/tools/_assets/goals-live.js +318 -210
  123. package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
  124. package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
  125. package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
  126. package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
  127. package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
  128. package/dist/epic/tools/_assets/spell-comments.js +24 -3716
  129. package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
  130. package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
  131. package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
  132. package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
  133. package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
  134. package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
  135. package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
  136. package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
  137. package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
  138. package/dist/epic/tools/pages.d.ts +5 -6
  139. package/dist/epic/tools/pages.js +7 -6
  140. package/dist/epic/window.mjs +2 -3
  141. package/dist/parser/core/classes/View.d.ts +20 -0
  142. package/dist/parser/core/classes/View.js +91 -17
  143. package/dist/parser/core/core.declarations.json5 +18 -0
  144. package/dist/parser/core/core.scopes.js +5 -0
  145. package/dist/parser/core/sites.d.ts +10 -0
  146. package/dist/parser/core/sites.js +12 -0
  147. package/dist/parser/parser/tokenizer/Tokenizer.d.ts +9 -1
  148. package/dist/parser/parser/tokenizer/Tokenizer.js +43 -5
  149. package/dist/parser/parser/tokenizer/Tokens.d.ts +4 -0
  150. package/dist/parser/parser/tokenizer/Tokens.js +4 -0
  151. package/dist/parser/parser/tokenizer/tokenizer.types.d.ts +5 -0
  152. package/dist/parser/parser/tokenizer/tokenizer.types.js +2 -0
  153. package/dist/parser/py/core/spell_core/apps.py +2 -0
  154. package/dist/parser/spell/PARSING.md +21 -0
  155. package/dist/parser/spell/SpellParser.d.ts +2 -0
  156. package/dist/parser/spell/SpellParser.js +58 -3
  157. package/dist/parser/spell/SpellxTokenizer.js +2 -1
  158. package/dist/parser/spell/SpellxTwin.d.ts +4 -1
  159. package/dist/parser/spell/SpellxTwin.js +10 -3
  160. package/dist/parser/spell/builtinTypes.js +24 -1
  161. package/dist/parser/spell/ingest/PlaceIngest.js +3 -1
  162. package/dist/parser/spell/languages/Language.d.ts +11 -2
  163. package/dist/parser/spell/languages/en/words.js +3 -2
  164. package/dist/parser/spell/languages/es/words.js +7 -4
  165. package/dist/parser/spell/rules/Statement.js +1 -1
  166. package/dist/parser/spell/rules/classes/DrawSlot.js +6 -1
  167. package/dist/parser/spell/rules/sites/SitePage.d.ts +3 -3
  168. package/dist/parser/spell/rules/sites/SitePage.js +2 -2
  169. package/dist/parser/spell/rules/sites/sites.en.js +1 -1
  170. package/dist/parser/spell/rules/sites/sites.es.js +1 -1
  171. package/dist/parser/spell/rules/sites/sites.shared.d.ts +2 -2
  172. package/dist/parser/spell/spell.types.d.ts +7 -0
  173. package/dist/parser/spell/spellSyntax.es.json +6 -6
  174. package/dist/parser/spell/spellSyntax.json +6 -6
  175. package/dist/parser/spellx/SpellxView.js +2 -1
  176. package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
  177. package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
  178. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
  179. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
  180. package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
  181. package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
  182. package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
  183. package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
  184. package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
  185. package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
  186. package/dist/ui/components/ui-card/UICards.d.ts +31 -0
  187. package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
  188. package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
  189. package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
  190. package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
  191. package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
  192. package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
  193. package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
  194. package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
  195. package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
  196. package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
  197. package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
  198. package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
  199. package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
  200. package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
  201. package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
  202. package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
  203. package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
  204. package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
  205. package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
  206. package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
  207. package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
  208. package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
  209. package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
  210. package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
  211. package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
  212. package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
  213. package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
  214. package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
  215. package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
  216. package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
  217. package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
  218. package/dist/ui/components/ui-list/UIList.d.ts +2 -0
  219. package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
  220. package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
  221. package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
  222. package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
  223. package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
  224. package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
  225. package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
  226. package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
  227. package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
  228. package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
  229. package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
  230. package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
  231. package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
  232. package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
  233. package/dist/ui/components/ui-parts/UIHeader.d.ts +15 -3
  234. package/dist/ui/components/ui-parts/UIHeader.en.d.ts +5 -2
  235. package/dist/ui/components/ui-parts/UIHeader.en.js +6 -3
  236. package/dist/ui/components/ui-parts/UIHeader.js +45 -5
  237. package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
  238. package/dist/ui/components/ui-parts/UIParts.css +18 -0
  239. package/dist/ui/components/ui-parts/UIParts.css.inline.js +1 -1
  240. package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
  241. package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
  242. package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
  243. package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
  244. package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
  245. package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
  246. package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
  247. package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
  248. package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
  249. package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
  250. package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
  251. package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
  252. package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
  253. package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
  254. package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
  255. package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
  256. package/dist/ui/components/ui-section/UISections.d.ts +1 -0
  257. package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
  258. package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
  259. package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
  260. package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
  261. package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
  262. package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
  263. package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
  264. package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
  265. package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
  266. package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
  267. package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
  268. package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
  269. package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
  270. package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
  271. package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
  272. package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
  273. package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
  274. package/dist/ui/components/ui-table/UICell.d.ts +1 -0
  275. package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
  276. package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
  277. package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
  278. package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
  279. package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
  280. package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
  281. package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
  282. package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
  283. package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
  284. package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
  285. package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
  286. package/dist/ui/jsx.d.ts +4 -4
  287. package/dist/ui/vocabulary/defaults.generated.js +1 -1
  288. package/dist/util/spell/constants.js +1 -1
  289. package/epic/.claude-plugin/plugin.json +1 -1
  290. package/epic/.codex-plugin/plugin.json +1 -1
  291. package/epic/hooks/handoff.mjs +4 -3
  292. package/epic/hooks/worktree.mjs +22 -3
  293. package/epic/package.json +41 -2
  294. package/epic/skills/details/SKILL.md +2 -1
  295. package/epic/skills/epic/SKILL.md +7 -1
  296. package/epic/skills/epic/guide.md +3 -0
  297. package/epic/skills/isolate/SKILL.md +53 -20
  298. package/epic/src/AGENTS.md +11 -2
  299. package/epic/templates/durable.html +1 -1
  300. package/epic/vscode/package.json +1 -1
  301. package/epic/vscode/spell-epic.vsix +0 -0
  302. package/package.json +1 -1
  303. package/parser/package.json +1 -1
  304. package/ui/package.json +15 -2
@@ -1,2378 +1,23 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/tools/_assets/spell-comments.js
5
- (() => {
6
- var Ko = Object.create;
7
- var mn = Object.defineProperty;
8
- var Uo = Object.getOwnPropertyDescriptor;
9
- var Wo = Object.getOwnPropertyNames;
10
- var Vo = Object.getPrototypeOf, Ho = Object.prototype.hasOwnProperty;
11
- var m = /* @__PURE__ */ __name((n, e) => () => {
12
- try {
13
- return e || n((e = { exports: {} }).exports, e), e.exports;
14
- } catch (t) {
15
- throw e = 0, t;
16
- }
17
- }, "m");
18
- var Go = /* @__PURE__ */ __name((n, e, t, r) => {
19
- if (e && typeof e == "object" || typeof e == "function") for (let i of Wo(e)) !Ho.call(n, i) && i !== t && mn(n, i, { get: /* @__PURE__ */ __name(() => e[i], "get"), enumerable: !(r = Uo(e, i)) || r.enumerable });
20
- return n;
21
- }, "Go");
22
- var qe = /* @__PURE__ */ __name((n, e, t) => (t = n != null ? Ko(Vo(n)) : {}, Go(e || !n || !n.__esModule ? mn(t, "default", { value: n, enumerable: true }) : t, n)), "qe");
23
- var dt = m((Df, Ln) => {
24
- var ca = Array.isArray;
25
- Ln.exports = ca;
26
- });
27
- var _n = m((yf, $n) => {
28
- var la = typeof global == "object" && global && global.Object === Object && global;
29
- $n.exports = la;
30
- });
31
- var ft = m((wf, qn) => {
32
- var da = _n(), fa = typeof self == "object" && self && self.Object === Object && self, pa = da || fa || Function("return this")();
33
- qn.exports = pa;
34
- });
35
- var pt = m((Ef, Mn) => {
36
- var ha = ft(), ga = ha.Symbol;
37
- Mn.exports = ga;
38
- });
39
- var Wn = m((Af, Un) => {
40
- var jn = pt(), Kn = Object.prototype, ma = Kn.hasOwnProperty, Da = Kn.toString, He = jn ? jn.toStringTag : void 0;
41
- function ya(n) {
42
- var e = ma.call(n, He), t = n[He];
43
- try {
44
- n[He] = void 0;
45
- var r = true;
46
- } catch {
47
- }
48
- var i = Da.call(n);
49
- return r && (e ? n[He] = t : delete n[He]), i;
50
- }
51
- __name(ya, "ya");
52
- Un.exports = ya;
53
- });
54
- var Hn = m((vf, Vn) => {
55
- var wa = Object.prototype, Ea = wa.toString;
56
- function Aa(n) {
57
- return Ea.call(n);
58
- }
59
- __name(Aa, "Aa");
60
- Vn.exports = Aa;
61
- });
62
- var Ut = m((Cf, Yn) => {
63
- var Gn = pt(), va = Wn(), Ca = Hn(), ba = "[object Null]", Fa = "[object Undefined]", zn = Gn ? Gn.toStringTag : void 0;
64
- function xa(n) {
65
- return n == null ? n === void 0 ? Fa : ba : zn && zn in Object(n) ? va(n) : Ca(n);
66
- }
67
- __name(xa, "xa");
68
- Yn.exports = xa;
69
- });
70
- var Xn = m((bf, Jn) => {
71
- function Sa(n) {
72
- return n != null && typeof n == "object";
73
- }
74
- __name(Sa, "Sa");
75
- Jn.exports = Sa;
76
- });
77
- var ht = m((Ff, Qn) => {
78
- var ka = Ut(), Ta = Xn(), Pa = "[object Symbol]";
79
- function Oa(n) {
80
- return typeof n == "symbol" || Ta(n) && ka(n) == Pa;
81
- }
82
- __name(Oa, "Oa");
83
- Qn.exports = Oa;
84
- });
85
- var er = m((xf, Zn) => {
86
- var Ba = dt(), Ia = ht(), Ra = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Na = /^\w*$/;
87
- function La(n, e) {
88
- if (Ba(n)) return false;
89
- var t = typeof n;
90
- return t == "number" || t == "symbol" || t == "boolean" || n == null || Ia(n) ? true : Na.test(n) || !Ra.test(n) || e != null && n in Object(e);
91
- }
92
- __name(La, "La");
93
- Zn.exports = La;
94
- });
95
- var gt = m((Sf, tr) => {
96
- function $a(n) {
97
- var e = typeof n;
98
- return n != null && (e == "object" || e == "function");
99
- }
100
- __name($a, "$a");
101
- tr.exports = $a;
102
- });
103
- var rr = m((kf, nr) => {
104
- var _a = Ut(), qa = gt(), Ma = "[object AsyncFunction]", ja = "[object Function]", Ka = "[object GeneratorFunction]", Ua = "[object Proxy]";
105
- function Wa(n) {
106
- if (!qa(n)) return false;
107
- var e = _a(n);
108
- return e == ja || e == Ka || e == Ma || e == Ua;
109
- }
110
- __name(Wa, "Wa");
111
- nr.exports = Wa;
112
- });
113
- var sr = m((Tf, ir) => {
114
- var Va = ft(), Ha = Va["__core-js_shared__"];
115
- ir.exports = Ha;
116
- });
117
- var ur = m((Pf, ar) => {
118
- var Wt = sr(), or = (function() {
119
- var n = /[^.]+$/.exec(Wt && Wt.keys && Wt.keys.IE_PROTO || "");
120
- return n ? "Symbol(src)_1." + n : "";
121
- })();
122
- function Ga(n) {
123
- return !!or && or in n;
124
- }
125
- __name(Ga, "Ga");
126
- ar.exports = Ga;
127
- });
128
- var lr = m((Of, cr) => {
129
- var za = Function.prototype, Ya = za.toString;
130
- function Ja(n) {
131
- if (n != null) {
132
- try {
133
- return Ya.call(n);
134
- } catch {
135
- }
136
- try {
137
- return n + "";
138
- } catch {
139
- }
140
- }
141
- return "";
142
- }
143
- __name(Ja, "Ja");
144
- cr.exports = Ja;
145
- });
146
- var fr = m((Bf, dr) => {
147
- var Xa = rr(), Qa = ur(), Za = gt(), eu = lr(), tu = /[\\^$.*+?()[\]{}|]/g, nu = /^\[object .+?Constructor\]$/, ru = Function.prototype, iu = Object.prototype, su = ru.toString, ou = iu.hasOwnProperty, au = RegExp("^" + su.call(ou).replace(tu, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
148
- function uu(n) {
149
- if (!Za(n) || Qa(n)) return false;
150
- var e = Xa(n) ? au : nu;
151
- return e.test(eu(n));
152
- }
153
- __name(uu, "uu");
154
- dr.exports = uu;
155
- });
156
- var hr = m((If, pr) => {
157
- function cu(n, e) {
158
- return n?.[e];
159
- }
160
- __name(cu, "cu");
161
- pr.exports = cu;
162
- });
163
- var mt = m((Rf, gr) => {
164
- var lu = fr(), du = hr();
165
- function fu(n, e) {
166
- var t = du(n, e);
167
- return lu(t) ? t : void 0;
168
- }
169
- __name(fu, "fu");
170
- gr.exports = fu;
171
- });
172
- var Ge = m((Nf, mr) => {
173
- var pu = mt(), hu = pu(Object, "create");
174
- mr.exports = hu;
175
- });
176
- var wr = m((Lf, yr) => {
177
- var Dr = Ge();
178
- function gu() {
179
- this.__data__ = Dr ? Dr(null) : {}, this.size = 0;
180
- }
181
- __name(gu, "gu");
182
- yr.exports = gu;
183
- });
184
- var Ar = m(($f, Er) => {
185
- function mu(n) {
186
- var e = this.has(n) && delete this.__data__[n];
187
- return this.size -= e ? 1 : 0, e;
188
- }
189
- __name(mu, "mu");
190
- Er.exports = mu;
191
- });
192
- var Cr = m((_f, vr) => {
193
- var Du = Ge(), yu = "__lodash_hash_undefined__", wu = Object.prototype, Eu = wu.hasOwnProperty;
194
- function Au(n) {
195
- var e = this.__data__;
196
- if (Du) {
197
- var t = e[n];
198
- return t === yu ? void 0 : t;
199
- }
200
- return Eu.call(e, n) ? e[n] : void 0;
201
- }
202
- __name(Au, "Au");
203
- vr.exports = Au;
204
- });
205
- var Fr = m((qf, br) => {
206
- var vu = Ge(), Cu = Object.prototype, bu = Cu.hasOwnProperty;
207
- function Fu(n) {
208
- var e = this.__data__;
209
- return vu ? e[n] !== void 0 : bu.call(e, n);
210
- }
211
- __name(Fu, "Fu");
212
- br.exports = Fu;
213
- });
214
- var Sr = m((Mf, xr) => {
215
- var xu = Ge(), Su = "__lodash_hash_undefined__";
216
- function ku(n, e) {
217
- var t = this.__data__;
218
- return this.size += this.has(n) ? 0 : 1, t[n] = xu && e === void 0 ? Su : e, this;
219
- }
220
- __name(ku, "ku");
221
- xr.exports = ku;
222
- });
223
- var Tr = m((jf, kr) => {
224
- var Tu = wr(), Pu = Ar(), Ou = Cr(), Bu = Fr(), Iu = Sr();
225
- function Pe(n) {
226
- var e = -1, t = n == null ? 0 : n.length;
227
- for (this.clear(); ++e < t; ) {
228
- var r = n[e];
229
- this.set(r[0], r[1]);
230
- }
231
- }
232
- __name(Pe, "Pe");
233
- Pe.prototype.clear = Tu;
234
- Pe.prototype.delete = Pu;
235
- Pe.prototype.get = Ou;
236
- Pe.prototype.has = Bu;
237
- Pe.prototype.set = Iu;
238
- kr.exports = Pe;
239
- });
240
- var Or = m((Kf, Pr) => {
241
- function Ru() {
242
- this.__data__ = [], this.size = 0;
243
- }
244
- __name(Ru, "Ru");
245
- Pr.exports = Ru;
246
- });
247
- var Vt = m((Uf, Br) => {
248
- function Nu(n, e) {
249
- return n === e || n !== n && e !== e;
250
- }
251
- __name(Nu, "Nu");
252
- Br.exports = Nu;
253
- });
254
- var ze = m((Wf, Ir) => {
255
- var Lu = Vt();
256
- function $u(n, e) {
257
- for (var t = n.length; t--; ) if (Lu(n[t][0], e)) return t;
258
- return -1;
259
- }
260
- __name($u, "$u");
261
- Ir.exports = $u;
262
- });
263
- var Nr = m((Vf, Rr) => {
264
- var _u = ze(), qu = Array.prototype, Mu = qu.splice;
265
- function ju(n) {
266
- var e = this.__data__, t = _u(e, n);
267
- if (t < 0) return false;
268
- var r = e.length - 1;
269
- return t == r ? e.pop() : Mu.call(e, t, 1), --this.size, true;
270
- }
271
- __name(ju, "ju");
272
- Rr.exports = ju;
273
- });
274
- var $r = m((Hf, Lr) => {
275
- var Ku = ze();
276
- function Uu(n) {
277
- var e = this.__data__, t = Ku(e, n);
278
- return t < 0 ? void 0 : e[t][1];
279
- }
280
- __name(Uu, "Uu");
281
- Lr.exports = Uu;
282
- });
283
- var qr = m((Gf, _r) => {
284
- var Wu = ze();
285
- function Vu(n) {
286
- return Wu(this.__data__, n) > -1;
287
- }
288
- __name(Vu, "Vu");
289
- _r.exports = Vu;
290
- });
291
- var jr = m((zf, Mr) => {
292
- var Hu = ze();
293
- function Gu(n, e) {
294
- var t = this.__data__, r = Hu(t, n);
295
- return r < 0 ? (++this.size, t.push([n, e])) : t[r][1] = e, this;
296
- }
297
- __name(Gu, "Gu");
298
- Mr.exports = Gu;
299
- });
300
- var Ur = m((Yf, Kr) => {
301
- var zu = Or(), Yu = Nr(), Ju = $r(), Xu = qr(), Qu = jr();
302
- function Oe(n) {
303
- var e = -1, t = n == null ? 0 : n.length;
304
- for (this.clear(); ++e < t; ) {
305
- var r = n[e];
306
- this.set(r[0], r[1]);
307
- }
308
- }
309
- __name(Oe, "Oe");
310
- Oe.prototype.clear = zu;
311
- Oe.prototype.delete = Yu;
312
- Oe.prototype.get = Ju;
313
- Oe.prototype.has = Xu;
314
- Oe.prototype.set = Qu;
315
- Kr.exports = Oe;
316
- });
317
- var Vr = m((Jf, Wr) => {
318
- var Zu = mt(), ec = ft(), tc = Zu(ec, "Map");
319
- Wr.exports = tc;
320
- });
321
- var zr = m((Xf, Gr) => {
322
- var Hr = Tr(), nc = Ur(), rc = Vr();
323
- function ic() {
324
- this.size = 0, this.__data__ = { hash: new Hr(), map: new (rc || nc)(), string: new Hr() };
325
- }
326
- __name(ic, "ic");
327
- Gr.exports = ic;
328
- });
329
- var Jr = m((Qf, Yr) => {
330
- function sc(n) {
331
- var e = typeof n;
332
- return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? n !== "__proto__" : n === null;
333
- }
334
- __name(sc, "sc");
335
- Yr.exports = sc;
336
- });
337
- var Ye = m((Zf, Xr) => {
338
- var oc = Jr();
339
- function ac(n, e) {
340
- var t = n.__data__;
341
- return oc(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
342
- }
343
- __name(ac, "ac");
344
- Xr.exports = ac;
345
- });
346
- var Zr = m((ep, Qr) => {
347
- var uc = Ye();
348
- function cc(n) {
349
- var e = uc(this, n).delete(n);
350
- return this.size -= e ? 1 : 0, e;
351
- }
352
- __name(cc, "cc");
353
- Qr.exports = cc;
354
- });
355
- var ti = m((tp, ei) => {
356
- var lc = Ye();
357
- function dc(n) {
358
- return lc(this, n).get(n);
359
- }
360
- __name(dc, "dc");
361
- ei.exports = dc;
362
- });
363
- var ri = m((np, ni) => {
364
- var fc = Ye();
365
- function pc(n) {
366
- return fc(this, n).has(n);
367
- }
368
- __name(pc, "pc");
369
- ni.exports = pc;
370
- });
371
- var si = m((rp, ii) => {
372
- var hc = Ye();
373
- function gc(n, e) {
374
- var t = hc(this, n), r = t.size;
375
- return t.set(n, e), this.size += t.size == r ? 0 : 1, this;
376
- }
377
- __name(gc, "gc");
378
- ii.exports = gc;
379
- });
380
- var ai = m((ip, oi) => {
381
- var mc = zr(), Dc = Zr(), yc = ti(), wc = ri(), Ec = si();
382
- function Be(n) {
383
- var e = -1, t = n == null ? 0 : n.length;
384
- for (this.clear(); ++e < t; ) {
385
- var r = n[e];
386
- this.set(r[0], r[1]);
387
- }
388
- }
389
- __name(Be, "Be");
390
- Be.prototype.clear = mc;
391
- Be.prototype.delete = Dc;
392
- Be.prototype.get = yc;
393
- Be.prototype.has = wc;
394
- Be.prototype.set = Ec;
395
- oi.exports = Be;
396
- });
397
- var li = m((sp, ci) => {
398
- var ui = ai(), Ac = "Expected a function";
399
- function Ht(n, e) {
400
- if (typeof n != "function" || e != null && typeof e != "function") throw new TypeError(Ac);
401
- var t = /* @__PURE__ */ __name(function() {
402
- var r = arguments, i = e ? e.apply(this, r) : r[0], s = t.cache;
403
- if (s.has(i)) return s.get(i);
404
- var o = n.apply(this, r);
405
- return t.cache = s.set(i, o) || s, o;
406
- }, "t");
407
- return t.cache = new (Ht.Cache || ui)(), t;
408
- }
409
- __name(Ht, "Ht");
410
- Ht.Cache = ui;
411
- ci.exports = Ht;
412
- });
413
- var fi = m((op, di) => {
414
- var vc = li(), Cc = 500;
415
- function bc(n) {
416
- var e = vc(n, function(r) {
417
- return t.size === Cc && t.clear(), r;
418
- }), t = e.cache;
419
- return e;
420
- }
421
- __name(bc, "bc");
422
- di.exports = bc;
423
- });
424
- var hi = m((ap, pi) => {
425
- var Fc = fi(), xc = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Sc = /\\(\\)?/g, kc = Fc(function(n) {
426
- var e = [];
427
- return n.charCodeAt(0) === 46 && e.push(""), n.replace(xc, function(t, r, i, s) {
428
- e.push(i ? s.replace(Sc, "$1") : r || t);
429
- }), e;
430
- });
431
- pi.exports = kc;
432
- });
433
- var mi = m((up, gi) => {
434
- function Tc(n, e) {
435
- for (var t = -1, r = n == null ? 0 : n.length, i = Array(r); ++t < r; ) i[t] = e(n[t], t, n);
436
- return i;
437
- }
438
- __name(Tc, "Tc");
439
- gi.exports = Tc;
440
- });
441
- var vi = m((cp, Ai) => {
442
- var Di = pt(), Pc = mi(), Oc = dt(), Bc = ht(), Ic = 1 / 0, yi = Di ? Di.prototype : void 0, wi = yi ? yi.toString : void 0;
443
- function Ei(n) {
444
- if (typeof n == "string") return n;
445
- if (Oc(n)) return Pc(n, Ei) + "";
446
- if (Bc(n)) return wi ? wi.call(n) : "";
447
- var e = n + "";
448
- return e == "0" && 1 / n == -Ic ? "-0" : e;
449
- }
450
- __name(Ei, "Ei");
451
- Ai.exports = Ei;
452
- });
453
- var bi = m((lp, Ci) => {
454
- var Rc = vi();
455
- function Nc(n) {
456
- return n == null ? "" : Rc(n);
457
- }
458
- __name(Nc, "Nc");
459
- Ci.exports = Nc;
460
- });
461
- var Gt = m((dp, Fi) => {
462
- var Lc = dt(), $c = er(), _c = hi(), qc = bi();
463
- function Mc(n, e) {
464
- return Lc(n) ? n : $c(n, e) ? [n] : _c(qc(n));
465
- }
466
- __name(Mc, "Mc");
467
- Fi.exports = Mc;
468
- });
469
- var zt = m((fp, xi) => {
470
- var jc = ht(), Kc = 1 / 0;
471
- function Uc(n) {
472
- if (typeof n == "string" || jc(n)) return n;
473
- var e = n + "";
474
- return e == "0" && 1 / n == -Kc ? "-0" : e;
475
- }
476
- __name(Uc, "Uc");
477
- xi.exports = Uc;
478
- });
479
- var ki = m((pp, Si) => {
480
- var Wc = Gt(), Vc = zt();
481
- function Hc(n, e) {
482
- e = Wc(e, n);
483
- for (var t = 0, r = e.length; n != null && t < r; ) n = n[Vc(e[t++])];
484
- return t && t == r ? n : void 0;
485
- }
486
- __name(Hc, "Hc");
487
- Si.exports = Hc;
488
- });
489
- var Pi = m((hp, Ti) => {
490
- var Gc = ki();
491
- function zc(n, e, t) {
492
- var r = n == null ? void 0 : Gc(n, e);
493
- return r === void 0 ? t : r;
494
- }
495
- __name(zc, "zc");
496
- Ti.exports = zc;
497
- });
498
- var Bi = m((gp, Oi) => {
499
- var Yc = mt(), Jc = (function() {
500
- try {
501
- var n = Yc(Object, "defineProperty");
502
- return n({}, "", {}), n;
503
- } catch {
504
- }
505
- })();
506
- Oi.exports = Jc;
507
- });
508
- var Ni = m((mp, Ri) => {
509
- var Ii = Bi();
510
- function Xc(n, e, t) {
511
- e == "__proto__" && Ii ? Ii(n, e, { configurable: true, enumerable: true, value: t, writable: true }) : n[e] = t;
512
- }
513
- __name(Xc, "Xc");
514
- Ri.exports = Xc;
515
- });
516
- var $i = m((Dp, Li) => {
517
- var Qc = Ni(), Zc = Vt(), el = Object.prototype, tl = el.hasOwnProperty;
518
- function nl(n, e, t) {
519
- var r = n[e];
520
- (!(tl.call(n, e) && Zc(r, t)) || t === void 0 && !(e in n)) && Qc(n, e, t);
521
- }
522
- __name(nl, "nl");
523
- Li.exports = nl;
524
- });
525
- var qi = m((yp, _i) => {
526
- var rl = 9007199254740991, il = /^(?:0|[1-9]\d*)$/;
527
- function sl(n, e) {
528
- var t = typeof n;
529
- return e = e ?? rl, !!e && (t == "number" || t != "symbol" && il.test(n)) && n > -1 && n % 1 == 0 && n < e;
530
- }
531
- __name(sl, "sl");
532
- _i.exports = sl;
533
- });
534
- var Ki = m((wp, ji) => {
535
- var ol = $i(), al = Gt(), ul = qi(), Mi = gt(), cl = zt();
536
- function ll(n, e, t, r) {
537
- if (!Mi(n)) return n;
538
- e = al(e, n);
539
- for (var i = -1, s = e.length, o = s - 1, u = n; u != null && ++i < s; ) {
540
- var d = cl(e[i]), f = t;
541
- if (d === "__proto__" || d === "constructor" || d === "prototype") return n;
542
- if (i != o) {
543
- var p = u[d];
544
- f = r ? r(p, d, u) : void 0, f === void 0 && (f = Mi(p) ? p : ul(e[i + 1]) ? [] : {});
545
- }
546
- ol(u, d, f), u = u[d];
547
- }
548
- return n;
549
- }
550
- __name(ll, "ll");
551
- ji.exports = ll;
552
- });
553
- var Wi = m((Ep, Ui) => {
554
- var dl = Ki();
555
- function fl(n, e, t) {
556
- return n == null ? n : dl(n, e, t);
557
- }
558
- __name(fl, "fl");
559
- Ui.exports = fl;
560
- });
561
- var Hi = m((Ap, Vi) => {
562
- "use strict";
563
- Vi.exports = (n) => encodeURIComponent(n).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`);
564
- });
565
- var Xi = m((vp, Ji) => {
566
- "use strict";
567
- var Yi = "%[a-f0-9]{2}", Gi = new RegExp("(" + Yi + ")|([^%]+?)", "gi"), zi = new RegExp("(" + Yi + ")+", "gi");
568
- function Yt(n, e) {
569
- try {
570
- return [decodeURIComponent(n.join(""))];
571
- } catch {
572
- }
573
- if (n.length === 1) return n;
574
- e = e || 1;
575
- var t = n.slice(0, e), r = n.slice(e);
576
- return Array.prototype.concat.call([], Yt(t), Yt(r));
577
- }
578
- __name(Yt, "Yt");
579
- function pl(n) {
580
- try {
581
- return decodeURIComponent(n);
582
- } catch {
583
- for (var e = n.match(Gi) || [], t = 1; t < e.length; t++) n = Yt(e, t).join(""), e = n.match(Gi) || [];
584
- return n;
585
- }
586
- }
587
- __name(pl, "pl");
588
- function hl(n) {
589
- for (var e = { "%FE%FF": "��", "%FF%FE": "��" }, t = zi.exec(n); t; ) {
590
- try {
591
- e[t[0]] = decodeURIComponent(t[0]);
592
- } catch {
593
- var r = pl(t[0]);
594
- r !== t[0] && (e[t[0]] = r);
595
- }
596
- t = zi.exec(n);
597
- }
598
- e["%C2"] = "�";
599
- for (var i = Object.keys(e), s = 0; s < i.length; s++) {
600
- var o = i[s];
601
- n = n.replace(new RegExp(o, "g"), e[o]);
602
- }
603
- return n;
604
- }
605
- __name(hl, "hl");
606
- Ji.exports = function(n) {
607
- if (typeof n != "string") throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof n + "`");
608
- try {
609
- return n = n.replace(/\+/g, " "), decodeURIComponent(n);
610
- } catch {
611
- return hl(n);
612
- }
613
- };
614
- });
615
- var Zi = m((Cp, Qi) => {
616
- "use strict";
617
- Qi.exports = (n, e) => {
618
- if (!(typeof n == "string" && typeof e == "string")) throw new TypeError("Expected the arguments to be of type `string`");
619
- if (e === "") return [n];
620
- let t = n.indexOf(e);
621
- return t === -1 ? [n] : [n.slice(0, t), n.slice(t + e.length)];
622
- };
623
- });
624
- var ts = m((bp, es) => {
625
- "use strict";
626
- es.exports = function(n, e) {
627
- for (var t = {}, r = Object.keys(n), i = Array.isArray(e), s = 0; s < r.length; s++) {
628
- var o = r[s], u = n[o];
629
- (i ? e.indexOf(o) !== -1 : e(o, u, n)) && (t[o] = u);
630
- }
631
- return t;
632
- };
633
- });
634
- var cs = m((Y) => {
635
- "use strict";
636
- var gl = Hi(), ml = Xi(), rs = Zi(), Dl = ts(), yl = /* @__PURE__ */ __name((n) => n == null, "yl");
637
- function wl(n) {
638
- switch (n.arrayFormat) {
639
- case "index":
640
- return (e) => (t, r) => {
641
- let i = t.length;
642
- return r === void 0 || n.skipNull && r === null || n.skipEmptyString && r === "" ? t : r === null ? [...t, [j(e, n), "[", i, "]"].join("")] : [...t, [j(e, n), "[", j(i, n), "]=", j(r, n)].join("")];
643
- };
644
- case "bracket":
645
- return (e) => (t, r) => r === void 0 || n.skipNull && r === null || n.skipEmptyString && r === "" ? t : r === null ? [...t, [j(e, n), "[]"].join("")] : [...t, [j(e, n), "[]=", j(r, n)].join("")];
646
- case "comma":
647
- case "separator":
648
- return (e) => (t, r) => r == null || r.length === 0 ? t : t.length === 0 ? [[j(e, n), "=", j(r, n)].join("")] : [[t, j(r, n)].join(n.arrayFormatSeparator)];
649
- default:
650
- return (e) => (t, r) => r === void 0 || n.skipNull && r === null || n.skipEmptyString && r === "" ? t : r === null ? [...t, j(e, n)] : [...t, [j(e, n), "=", j(r, n)].join("")];
651
- }
652
- }
653
- __name(wl, "wl");
654
- function El(n) {
655
- let e;
656
- switch (n.arrayFormat) {
657
- case "index":
658
- return (t, r, i) => {
659
- if (e = /\[(\d*)\]$/.exec(t), t = t.replace(/\[\d*\]$/, ""), !e) {
660
- i[t] = r;
661
- return;
662
- }
663
- i[t] === void 0 && (i[t] = {}), i[t][e[1]] = r;
664
- };
665
- case "bracket":
666
- return (t, r, i) => {
667
- if (e = /(\[\])$/.exec(t), t = t.replace(/\[\]$/, ""), !e) {
668
- i[t] = r;
669
- return;
670
- }
671
- if (i[t] === void 0) {
672
- i[t] = [r];
673
- return;
674
- }
675
- i[t] = [].concat(i[t], r);
676
- };
677
- case "comma":
678
- case "separator":
679
- return (t, r, i) => {
680
- let s = typeof r == "string" && r.includes(n.arrayFormatSeparator), o = typeof r == "string" && !s && Ee(r, n).includes(n.arrayFormatSeparator);
681
- r = o ? Ee(r, n) : r;
682
- let u = s || o ? r.split(n.arrayFormatSeparator).map((d) => Ee(d, n)) : r === null ? r : Ee(r, n);
683
- i[t] = u;
684
- };
685
- default:
686
- return (t, r, i) => {
687
- if (i[t] === void 0) {
688
- i[t] = r;
689
- return;
690
- }
691
- i[t] = [].concat(i[t], r);
692
- };
693
- }
694
- }
695
- __name(El, "El");
696
- function is(n) {
697
- if (typeof n != "string" || n.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string");
698
- }
699
- __name(is, "is");
700
- function j(n, e) {
701
- return e.encode ? e.strict ? gl(n) : encodeURIComponent(n) : n;
702
- }
703
- __name(j, "j");
704
- function Ee(n, e) {
705
- return e.decode ? ml(n) : n;
706
- }
707
- __name(Ee, "Ee");
708
- function ss(n) {
709
- return Array.isArray(n) ? n.sort() : typeof n == "object" ? ss(Object.keys(n)).sort((e, t) => Number(e) - Number(t)).map((e) => n[e]) : n;
710
- }
711
- __name(ss, "ss");
712
- function os(n) {
713
- let e = n.indexOf("#");
714
- return e !== -1 && (n = n.slice(0, e)), n;
715
- }
716
- __name(os, "os");
717
- function Al(n) {
718
- let e = "", t = n.indexOf("#");
719
- return t !== -1 && (e = n.slice(t)), e;
720
- }
721
- __name(Al, "Al");
722
- function as(n) {
723
- n = os(n);
724
- let e = n.indexOf("?");
725
- return e === -1 ? "" : n.slice(e + 1);
726
- }
727
- __name(as, "as");
728
- function ns(n, e) {
729
- return e.parseNumbers && !Number.isNaN(Number(n)) && typeof n == "string" && n.trim() !== "" ? n = Number(n) : e.parseBooleans && n !== null && (n.toLowerCase() === "true" || n.toLowerCase() === "false") && (n = n.toLowerCase() === "true"), n;
730
- }
731
- __name(ns, "ns");
732
- function us(n, e) {
733
- e = Object.assign({ decode: true, sort: true, arrayFormat: "none", arrayFormatSeparator: ",", parseNumbers: false, parseBooleans: false }, e), is(e.arrayFormatSeparator);
734
- let t = El(e), r = /* @__PURE__ */ Object.create(null);
735
- if (typeof n != "string" || (n = n.trim().replace(/^[?#&]/, ""), !n)) return r;
736
- for (let i of n.split("&")) {
737
- if (i === "") continue;
738
- let [s, o] = rs(e.decode ? i.replace(/\+/g, " ") : i, "=");
739
- o = o === void 0 ? null : ["comma", "separator"].includes(e.arrayFormat) ? o : Ee(o, e), t(Ee(s, e), o, r);
740
- }
741
- for (let i of Object.keys(r)) {
742
- let s = r[i];
743
- if (typeof s == "object" && s !== null) for (let o of Object.keys(s)) s[o] = ns(s[o], e);
744
- else r[i] = ns(s, e);
745
- }
746
- return e.sort === false ? r : (e.sort === true ? Object.keys(r).sort() : Object.keys(r).sort(e.sort)).reduce((i, s) => {
747
- let o = r[s];
748
- return o && typeof o == "object" && !Array.isArray(o) ? i[s] = ss(o) : i[s] = o, i;
749
- }, /* @__PURE__ */ Object.create(null));
750
- }
751
- __name(us, "us");
752
- Y.extract = as;
753
- Y.parse = us;
754
- Y.stringify = (n, e) => {
755
- if (!n) return "";
756
- e = Object.assign({ encode: true, strict: true, arrayFormat: "none", arrayFormatSeparator: "," }, e), is(e.arrayFormatSeparator);
757
- let t = /* @__PURE__ */ __name((o) => e.skipNull && yl(n[o]) || e.skipEmptyString && n[o] === "", "t"), r = wl(e), i = {};
758
- for (let o of Object.keys(n)) t(o) || (i[o] = n[o]);
759
- let s = Object.keys(i);
760
- return e.sort !== false && s.sort(e.sort), s.map((o) => {
761
- let u = n[o];
762
- return u === void 0 ? "" : u === null ? j(o, e) : Array.isArray(u) ? u.reduce(r(o), []).join("&") : j(o, e) + "=" + j(u, e);
763
- }).filter((o) => o.length > 0).join("&");
764
- };
765
- Y.parseUrl = (n, e) => {
766
- e = Object.assign({ decode: true }, e);
767
- let [t, r] = rs(n, "#");
768
- return Object.assign({ url: t.split("?")[0] || "", query: us(as(n), e) }, e && e.parseFragmentIdentifier && r ? { fragmentIdentifier: Ee(r, e) } : {});
769
- };
770
- Y.stringifyUrl = (n, e) => {
771
- e = Object.assign({ encode: true, strict: true }, e);
772
- let t = os(n.url).split("?")[0] || "", r = Y.extract(n.url), i = Y.parse(r, { sort: false }), s = Object.assign(i, n.query), o = Y.stringify(s, e);
773
- o && (o = `?${o}`);
774
- let u = Al(n.url);
775
- return n.fragmentIdentifier && (u = `#${j(n.fragmentIdentifier, e)}`), `${t}${o}${u}`;
776
- };
777
- Y.pick = (n, e, t) => {
778
- t = Object.assign({ parseFragmentIdentifier: true }, t);
779
- let { url: r, query: i, fragmentIdentifier: s } = Y.parseUrl(n, t);
780
- return Y.stringifyUrl({ url: r, query: Dl(i, e), fragmentIdentifier: s }, t);
781
- };
782
- Y.exclude = (n, e, t) => {
783
- let r = Array.isArray(e) ? (i) => !e.includes(i) : (i, s) => !e(i, s);
784
- return Y.pick(n, r, t);
785
- };
786
- });
787
- var ls = m((Jt, Xt) => {
788
- (function(n, e) {
789
- typeof Jt == "object" && typeof Xt < "u" ? Xt.exports = e() : typeof define == "function" && define.amd ? define(e) : n.JSON5 = e();
790
- })(Jt, (function() {
791
- "use strict";
792
- function n(a, c) {
793
- return c = { exports: {} }, a(c, c.exports), c.exports;
794
- }
795
- __name(n, "n");
796
- var e = n(function(a) {
797
- var c = a.exports = typeof window < "u" && window.Math == Math ? window : typeof self < "u" && self.Math == Math ? self : Function("return this")();
798
- typeof __g == "number" && (__g = c);
799
- }), t = n(function(a) {
800
- var c = a.exports = { version: "2.6.5" };
801
- typeof __e == "number" && (__e = c);
802
- }), r = t.version, i = /* @__PURE__ */ __name(function(a) {
803
- return typeof a == "object" ? a !== null : typeof a == "function";
804
- }, "i"), s = /* @__PURE__ */ __name(function(a) {
805
- if (!i(a)) throw TypeError(a + " is not an object!");
806
- return a;
807
- }, "s"), o = /* @__PURE__ */ __name(function(a) {
808
- try {
809
- return !!a();
810
- } catch {
811
- return true;
812
- }
813
- }, "o"), u = !o(function() {
814
- return Object.defineProperty({}, "a", { get: /* @__PURE__ */ __name(function() {
815
- return 7;
816
- }, "get") }).a != 7;
817
- }), d = e.document, f = i(d) && i(d.createElement), p = /* @__PURE__ */ __name(function(a) {
818
- return f ? d.createElement(a) : {};
819
- }, "p"), v = !u && !o(function() {
820
- return Object.defineProperty(p("div"), "a", { get: /* @__PURE__ */ __name(function() {
821
- return 7;
822
- }, "get") }).a != 7;
823
- }), y = /* @__PURE__ */ __name(function(a, c) {
824
- if (!i(a)) return a;
825
- var D, g;
826
- if (c && typeof (D = a.toString) == "function" && !i(g = D.call(a)) || typeof (D = a.valueOf) == "function" && !i(g = D.call(a)) || !c && typeof (D = a.toString) == "function" && !i(g = D.call(a))) return g;
827
- throw TypeError("Can't convert object to primitive value");
828
- }, "y"), T = Object.defineProperty, h = u ? Object.defineProperty : function(c, D, g) {
829
- if (s(c), D = y(D, true), s(g), v) try {
830
- return T(c, D, g);
831
- } catch {
832
- }
833
- if ("get" in g || "set" in g) throw TypeError("Accessors not supported!");
834
- return "value" in g && (c[D] = g.value), c;
835
- }, w = { f: h }, P = /* @__PURE__ */ __name(function(a, c) {
836
- return { enumerable: !(a & 1), configurable: !(a & 2), writable: !(a & 4), value: c };
837
- }, "P"), R = u ? function(a, c, D) {
838
- return w.f(a, c, P(1, D));
839
- } : function(a, c, D) {
840
- return a[c] = D, a;
841
- }, $ = {}.hasOwnProperty, Ce = /* @__PURE__ */ __name(function(a, c) {
842
- return $.call(a, c);
843
- }, "Ce"), co = 0, lo = Math.random(), fo = /* @__PURE__ */ __name(function(a) {
844
- return "Symbol(".concat(a === void 0 ? "" : a, ")_", (++co + lo).toString(36));
845
- }, "fo"), po = false, ho = n(function(a) {
846
- var c = "__core-js_shared__", D = e[c] || (e[c] = {});
847
- (a.exports = function(g, A) {
848
- return D[g] || (D[g] = A !== void 0 ? A : {});
849
- })("versions", []).push({ version: t.version, mode: po ? "pure" : "global", copyright: "© 2019 Denis Pushkarev (zloirock.ru)" });
850
- }), kt = ho("native-function-to-string", Function.toString), go = n(function(a) {
851
- var c = fo("src"), D = "toString", g = ("" + kt).split(D);
852
- t.inspectSource = function(A) {
853
- return kt.call(A);
854
- }, (a.exports = function(A, x, k, G) {
855
- var _ = typeof k == "function";
856
- _ && (Ce(k, "name") || R(k, "name", x)), A[x] !== k && (_ && (Ce(k, c) || R(k, c, A[x] ? "" + A[x] : g.join(String(x)))), A === e ? A[x] = k : G ? A[x] ? A[x] = k : R(A, x, k) : (delete A[x], R(A, x, k)));
857
- })(Function.prototype, D, function() {
858
- return typeof this == "function" && this[c] || kt.call(this);
859
- });
860
- }), mo = /* @__PURE__ */ __name(function(a) {
861
- if (typeof a != "function") throw TypeError(a + " is not a function!");
862
- return a;
863
- }, "mo"), cn = /* @__PURE__ */ __name(function(a, c, D) {
864
- if (mo(a), c === void 0) return a;
865
- switch (D) {
866
- case 1:
867
- return function(g) {
868
- return a.call(c, g);
869
- };
870
- case 2:
871
- return function(g, A) {
872
- return a.call(c, g, A);
873
- };
874
- case 3:
875
- return function(g, A, x) {
876
- return a.call(c, g, A, x);
877
- };
878
- }
879
- return function() {
880
- return a.apply(c, arguments);
881
- };
882
- }, "cn"), Tt = "prototype", V = /* @__PURE__ */ __name(function(a, c, D) {
883
- var g = a & V.F, A = a & V.G, x = a & V.S, k = a & V.P, G = a & V.B, _ = A ? e : x ? e[c] || (e[c] = {}) : (e[c] || {})[Tt], he = A ? t : t[c] || (t[c] = {}), be = he[Tt] || (he[Tt] = {}), Z, ne, z, Fe;
884
- A && (D = c);
885
- for (Z in D) ne = !g && _ && _[Z] !== void 0, z = (ne ? _ : D)[Z], Fe = G && ne ? cn(z, e) : k && typeof z == "function" ? cn(Function.call, z) : z, _ && go(_, Z, z, a & V.U), he[Z] != z && R(he, Z, Fe), k && be[Z] != z && (be[Z] = z);
886
- }, "V");
887
- e.core = t, V.F = 1, V.G = 2, V.S = 4, V.P = 8, V.B = 16, V.W = 32, V.U = 64, V.R = 128;
888
- var Le = V, Do = Math.ceil, yo = Math.floor, ln = /* @__PURE__ */ __name(function(a) {
889
- return isNaN(a = +a) ? 0 : (a > 0 ? yo : Do)(a);
890
- }, "ln"), wo = /* @__PURE__ */ __name(function(a) {
891
- if (a == null) throw TypeError("Can't call method on " + a);
892
- return a;
893
- }, "wo"), Eo = /* @__PURE__ */ __name(function(a) {
894
- return function(c, D) {
895
- var g = String(wo(c)), A = ln(D), x = g.length, k, G;
896
- return A < 0 || A >= x ? a ? "" : void 0 : (k = g.charCodeAt(A), k < 55296 || k > 56319 || A + 1 === x || (G = g.charCodeAt(A + 1)) < 56320 || G > 57343 ? a ? g.charAt(A) : k : a ? g.slice(A, A + 2) : (k - 55296 << 10) + (G - 56320) + 65536);
897
- };
898
- }, "Eo"), Ao = Eo(false);
899
- Le(Le.P, "String", { codePointAt: /* @__PURE__ */ __name(function(c) {
900
- return Ao(this, c);
901
- }, "codePointAt") });
902
- var Gd = t.String.codePointAt, vo = Math.max, Co = Math.min, bo = /* @__PURE__ */ __name(function(a, c) {
903
- return a = ln(a), a < 0 ? vo(a + c, 0) : Co(a, c);
904
- }, "bo"), dn = String.fromCharCode, fn = String.fromCodePoint;
905
- Le(Le.S + Le.F * (!!fn && fn.length != 1), "String", { fromCodePoint: /* @__PURE__ */ __name(function(c) {
906
- for (var D = arguments, g = [], A = arguments.length, x = 0, k; A > x; ) {
907
- if (k = +D[x++], bo(k, 1114111) !== k) throw RangeError(k + " is not a valid code point");
908
- g.push(k < 65536 ? dn(k) : dn(((k -= 65536) >> 10) + 55296, k % 1024 + 56320));
909
- }
910
- return g.join("");
911
- }, "fromCodePoint") });
912
- var zd = t.String.fromCodePoint, Fo = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/, xo = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/, So = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/, Pt = { Space_Separator: Fo, ID_Start: xo, ID_Continue: So }, L = { isSpaceSeparator: /* @__PURE__ */ __name(function(c) {
913
- return typeof c == "string" && Pt.Space_Separator.test(c);
914
- }, "isSpaceSeparator"), isIdStartChar: /* @__PURE__ */ __name(function(c) {
915
- return typeof c == "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || Pt.ID_Start.test(c));
916
- }, "isIdStartChar"), isIdContinueChar: /* @__PURE__ */ __name(function(c) {
917
- return typeof c == "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "$" || c === "_" || c === "‌" || c === "‍" || Pt.ID_Continue.test(c));
918
- }, "isIdContinueChar"), isDigit: /* @__PURE__ */ __name(function(c) {
919
- return typeof c == "string" && /[0-9]/.test(c);
920
- }, "isDigit"), isHexDigit: /* @__PURE__ */ __name(function(c) {
921
- return typeof c == "string" && /[0-9A-Fa-f]/.test(c);
922
- }, "isHexDigit") }, Ot, H, re, tt, ae, Q, q, Bt, $e, ko = /* @__PURE__ */ __name(function(c, D) {
923
- Ot = String(c), H = "start", re = [], tt = 0, ae = 1, Q = 0, q = void 0, Bt = void 0, $e = void 0;
924
- do
925
- q = To(), Bo[H]();
926
- while (q.type !== "eof");
927
- return typeof D == "function" ? It({ "": $e }, "", D) : $e;
928
- }, "ko");
929
- function It(a, c, D) {
930
- var g = a[c];
931
- if (g != null && typeof g == "object") if (Array.isArray(g)) for (var A = 0; A < g.length; A++) {
932
- var x = String(A), k = It(g, x, D);
933
- k === void 0 ? delete g[x] : Object.defineProperty(g, x, { value: k, writable: true, enumerable: true, configurable: true });
934
- }
935
- else for (var G in g) {
936
- var _ = It(g, G, D);
937
- _ === void 0 ? delete g[G] : Object.defineProperty(g, G, { value: _, writable: true, enumerable: true, configurable: true });
938
- }
939
- return D.call(a, c, g);
940
- }
941
- __name(It, "It");
942
- var F, C, _e, ie, S;
943
- function To() {
944
- for (F = "default", C = "", _e = false, ie = 1; ; ) {
945
- S = se();
946
- var a = pn[F]();
947
- if (a) return a;
948
- }
949
- }
950
- __name(To, "To");
951
- function se() {
952
- if (Ot[tt]) return String.fromCodePoint(Ot.codePointAt(tt));
953
- }
954
- __name(se, "se");
955
- function l() {
956
- var a = se();
957
- return a === `
958
- ` ? (ae++, Q = 0) : a ? Q += a.length : Q++, a && (tt += a.length), a;
959
- }
960
- __name(l, "l");
961
- var pn = { default: /* @__PURE__ */ __name(function() {
962
- switch (S) {
963
- case " ":
964
- case "\v":
965
- case "\f":
966
- case " ":
967
- case " ":
968
- case "\uFEFF":
969
- case `
970
- `:
971
- case "\r":
972
- case "\u2028":
973
- case "\u2029":
974
- l();
975
- return;
976
- case "/":
977
- l(), F = "comment";
978
- return;
979
- case void 0:
980
- return l(), B("eof");
981
- }
982
- if (L.isSpaceSeparator(S)) {
983
- l();
984
- return;
985
- }
986
- return pn[H]();
987
- }, "default"), comment: /* @__PURE__ */ __name(function() {
988
- switch (S) {
989
- case "*":
990
- l(), F = "multiLineComment";
991
- return;
992
- case "/":
993
- l(), F = "singleLineComment";
994
- return;
995
- }
996
- throw I(l());
997
- }, "comment"), multiLineComment: /* @__PURE__ */ __name(function() {
998
- switch (S) {
999
- case "*":
1000
- l(), F = "multiLineCommentAsterisk";
1001
- return;
1002
- case void 0:
1003
- throw I(l());
1004
- }
1005
- l();
1006
- }, "multiLineComment"), multiLineCommentAsterisk: /* @__PURE__ */ __name(function() {
1007
- switch (S) {
1008
- case "*":
1009
- l();
1010
- return;
1011
- case "/":
1012
- l(), F = "default";
1013
- return;
1014
- case void 0:
1015
- throw I(l());
1016
- }
1017
- l(), F = "multiLineComment";
1018
- }, "multiLineCommentAsterisk"), singleLineComment: /* @__PURE__ */ __name(function() {
1019
- switch (S) {
1020
- case `
1021
- `:
1022
- case "\r":
1023
- case "\u2028":
1024
- case "\u2029":
1025
- l(), F = "default";
1026
- return;
1027
- case void 0:
1028
- return l(), B("eof");
1029
- }
1030
- l();
1031
- }, "singleLineComment"), value: /* @__PURE__ */ __name(function() {
1032
- switch (S) {
1033
- case "{":
1034
- case "[":
1035
- return B("punctuator", l());
1036
- case "n":
1037
- return l(), fe("ull"), B("null", null);
1038
- case "t":
1039
- return l(), fe("rue"), B("boolean", true);
1040
- case "f":
1041
- return l(), fe("alse"), B("boolean", false);
1042
- case "-":
1043
- case "+":
1044
- l() === "-" && (ie = -1), F = "sign";
1045
- return;
1046
- case ".":
1047
- C = l(), F = "decimalPointLeading";
1048
- return;
1049
- case "0":
1050
- C = l(), F = "zero";
1051
- return;
1052
- case "1":
1053
- case "2":
1054
- case "3":
1055
- case "4":
1056
- case "5":
1057
- case "6":
1058
- case "7":
1059
- case "8":
1060
- case "9":
1061
- C = l(), F = "decimalInteger";
1062
- return;
1063
- case "I":
1064
- return l(), fe("nfinity"), B("numeric", 1 / 0);
1065
- case "N":
1066
- return l(), fe("aN"), B("numeric", NaN);
1067
- case '"':
1068
- case "'":
1069
- _e = l() === '"', C = "", F = "string";
1070
- return;
1071
- }
1072
- throw I(l());
1073
- }, "value"), identifierNameStartEscape: /* @__PURE__ */ __name(function() {
1074
- if (S !== "u") throw I(l());
1075
- l();
1076
- var c = Rt();
1077
- switch (c) {
1078
- case "$":
1079
- case "_":
1080
- break;
1081
- default:
1082
- if (!L.isIdStartChar(c)) throw hn();
1083
- break;
1084
- }
1085
- C += c, F = "identifierName";
1086
- }, "identifierNameStartEscape"), identifierName: /* @__PURE__ */ __name(function() {
1087
- switch (S) {
1088
- case "$":
1089
- case "_":
1090
- case "‌":
1091
- case "‍":
1092
- C += l();
1093
- return;
1094
- case "\\":
1095
- l(), F = "identifierNameEscape";
1096
- return;
1097
- }
1098
- if (L.isIdContinueChar(S)) {
1099
- C += l();
1100
- return;
1101
- }
1102
- return B("identifier", C);
1103
- }, "identifierName"), identifierNameEscape: /* @__PURE__ */ __name(function() {
1104
- if (S !== "u") throw I(l());
1105
- l();
1106
- var c = Rt();
1107
- switch (c) {
1108
- case "$":
1109
- case "_":
1110
- case "‌":
1111
- case "‍":
1112
- break;
1113
- default:
1114
- if (!L.isIdContinueChar(c)) throw hn();
1115
- break;
1116
- }
1117
- C += c, F = "identifierName";
1118
- }, "identifierNameEscape"), sign: /* @__PURE__ */ __name(function() {
1119
- switch (S) {
1120
- case ".":
1121
- C = l(), F = "decimalPointLeading";
1122
- return;
1123
- case "0":
1124
- C = l(), F = "zero";
1125
- return;
1126
- case "1":
1127
- case "2":
1128
- case "3":
1129
- case "4":
1130
- case "5":
1131
- case "6":
1132
- case "7":
1133
- case "8":
1134
- case "9":
1135
- C = l(), F = "decimalInteger";
1136
- return;
1137
- case "I":
1138
- return l(), fe("nfinity"), B("numeric", ie * (1 / 0));
1139
- case "N":
1140
- return l(), fe("aN"), B("numeric", NaN);
1141
- }
1142
- throw I(l());
1143
- }, "sign"), zero: /* @__PURE__ */ __name(function() {
1144
- switch (S) {
1145
- case ".":
1146
- C += l(), F = "decimalPoint";
1147
- return;
1148
- case "e":
1149
- case "E":
1150
- C += l(), F = "decimalExponent";
1151
- return;
1152
- case "x":
1153
- case "X":
1154
- C += l(), F = "hexadecimal";
1155
- return;
1156
- }
1157
- return B("numeric", ie * 0);
1158
- }, "zero"), decimalInteger: /* @__PURE__ */ __name(function() {
1159
- switch (S) {
1160
- case ".":
1161
- C += l(), F = "decimalPoint";
1162
- return;
1163
- case "e":
1164
- case "E":
1165
- C += l(), F = "decimalExponent";
1166
- return;
1167
- }
1168
- if (L.isDigit(S)) {
1169
- C += l();
1170
- return;
1171
- }
1172
- return B("numeric", ie * Number(C));
1173
- }, "decimalInteger"), decimalPointLeading: /* @__PURE__ */ __name(function() {
1174
- if (L.isDigit(S)) {
1175
- C += l(), F = "decimalFraction";
1176
- return;
1177
- }
1178
- throw I(l());
1179
- }, "decimalPointLeading"), decimalPoint: /* @__PURE__ */ __name(function() {
1180
- switch (S) {
1181
- case "e":
1182
- case "E":
1183
- C += l(), F = "decimalExponent";
1184
- return;
1185
- }
1186
- if (L.isDigit(S)) {
1187
- C += l(), F = "decimalFraction";
1188
- return;
1189
- }
1190
- return B("numeric", ie * Number(C));
1191
- }, "decimalPoint"), decimalFraction: /* @__PURE__ */ __name(function() {
1192
- switch (S) {
1193
- case "e":
1194
- case "E":
1195
- C += l(), F = "decimalExponent";
1196
- return;
1197
- }
1198
- if (L.isDigit(S)) {
1199
- C += l();
1200
- return;
1201
- }
1202
- return B("numeric", ie * Number(C));
1203
- }, "decimalFraction"), decimalExponent: /* @__PURE__ */ __name(function() {
1204
- switch (S) {
1205
- case "+":
1206
- case "-":
1207
- C += l(), F = "decimalExponentSign";
1208
- return;
1209
- }
1210
- if (L.isDigit(S)) {
1211
- C += l(), F = "decimalExponentInteger";
1212
- return;
1213
- }
1214
- throw I(l());
1215
- }, "decimalExponent"), decimalExponentSign: /* @__PURE__ */ __name(function() {
1216
- if (L.isDigit(S)) {
1217
- C += l(), F = "decimalExponentInteger";
1218
- return;
1219
- }
1220
- throw I(l());
1221
- }, "decimalExponentSign"), decimalExponentInteger: /* @__PURE__ */ __name(function() {
1222
- if (L.isDigit(S)) {
1223
- C += l();
1224
- return;
1225
- }
1226
- return B("numeric", ie * Number(C));
1227
- }, "decimalExponentInteger"), hexadecimal: /* @__PURE__ */ __name(function() {
1228
- if (L.isHexDigit(S)) {
1229
- C += l(), F = "hexadecimalInteger";
1230
- return;
1231
- }
1232
- throw I(l());
1233
- }, "hexadecimal"), hexadecimalInteger: /* @__PURE__ */ __name(function() {
1234
- if (L.isHexDigit(S)) {
1235
- C += l();
1236
- return;
1237
- }
1238
- return B("numeric", ie * Number(C));
1239
- }, "hexadecimalInteger"), string: /* @__PURE__ */ __name(function() {
1240
- switch (S) {
1241
- case "\\":
1242
- l(), C += Po();
1243
- return;
1244
- case '"':
1245
- if (_e) return l(), B("string", C);
1246
- C += l();
1247
- return;
1248
- case "'":
1249
- if (!_e) return l(), B("string", C);
1250
- C += l();
1251
- return;
1252
- case `
1253
- `:
1254
- case "\r":
1255
- throw I(l());
1256
- case "\u2028":
1257
- case "\u2029":
1258
- Io(S);
1259
- break;
1260
- case void 0:
1261
- throw I(l());
1262
- }
1263
- C += l();
1264
- }, "string"), start: /* @__PURE__ */ __name(function() {
1265
- switch (S) {
1266
- case "{":
1267
- case "[":
1268
- return B("punctuator", l());
1269
- }
1270
- F = "value";
1271
- }, "start"), beforePropertyName: /* @__PURE__ */ __name(function() {
1272
- switch (S) {
1273
- case "$":
1274
- case "_":
1275
- C = l(), F = "identifierName";
1276
- return;
1277
- case "\\":
1278
- l(), F = "identifierNameStartEscape";
1279
- return;
1280
- case "}":
1281
- return B("punctuator", l());
1282
- case '"':
1283
- case "'":
1284
- _e = l() === '"', F = "string";
1285
- return;
1286
- }
1287
- if (L.isIdStartChar(S)) {
1288
- C += l(), F = "identifierName";
1289
- return;
1290
- }
1291
- throw I(l());
1292
- }, "beforePropertyName"), afterPropertyName: /* @__PURE__ */ __name(function() {
1293
- if (S === ":") return B("punctuator", l());
1294
- throw I(l());
1295
- }, "afterPropertyName"), beforePropertyValue: /* @__PURE__ */ __name(function() {
1296
- F = "value";
1297
- }, "beforePropertyValue"), afterPropertyValue: /* @__PURE__ */ __name(function() {
1298
- switch (S) {
1299
- case ",":
1300
- case "}":
1301
- return B("punctuator", l());
1302
- }
1303
- throw I(l());
1304
- }, "afterPropertyValue"), beforeArrayValue: /* @__PURE__ */ __name(function() {
1305
- if (S === "]") return B("punctuator", l());
1306
- F = "value";
1307
- }, "beforeArrayValue"), afterArrayValue: /* @__PURE__ */ __name(function() {
1308
- switch (S) {
1309
- case ",":
1310
- case "]":
1311
- return B("punctuator", l());
1312
- }
1313
- throw I(l());
1314
- }, "afterArrayValue"), end: /* @__PURE__ */ __name(function() {
1315
- throw I(l());
1316
- }, "end") };
1317
- function B(a, c) {
1318
- return { type: a, value: c, line: ae, column: Q };
1319
- }
1320
- __name(B, "B");
1321
- function fe(a) {
1322
- for (var c = 0, D = a; c < D.length; c += 1) {
1323
- var g = D[c], A = se();
1324
- if (A !== g) throw I(l());
1325
- l();
1326
- }
1327
- }
1328
- __name(fe, "fe");
1329
- function Po() {
1330
- var a = se();
1331
- switch (a) {
1332
- case "b":
1333
- return l(), "\b";
1334
- case "f":
1335
- return l(), "\f";
1336
- case "n":
1337
- return l(), `
1338
- `;
1339
- case "r":
1340
- return l(), "\r";
1341
- case "t":
1342
- return l(), " ";
1343
- case "v":
1344
- return l(), "\v";
1345
- case "0":
1346
- if (l(), L.isDigit(se())) throw I(l());
1347
- return "\0";
1348
- case "x":
1349
- return l(), Oo();
1350
- case "u":
1351
- return l(), Rt();
1352
- case `
1353
- `:
1354
- case "\u2028":
1355
- case "\u2029":
1356
- return l(), "";
1357
- case "\r":
1358
- return l(), se() === `
1359
- ` && l(), "";
1360
- case "1":
1361
- case "2":
1362
- case "3":
1363
- case "4":
1364
- case "5":
1365
- case "6":
1366
- case "7":
1367
- case "8":
1368
- case "9":
1369
- throw I(l());
1370
- case void 0:
1371
- throw I(l());
1372
- }
1373
- return l();
1374
- }
1375
- __name(Po, "Po");
1376
- function Oo() {
1377
- var a = "", c = se();
1378
- if (!L.isHexDigit(c) || (a += l(), c = se(), !L.isHexDigit(c))) throw I(l());
1379
- return a += l(), String.fromCodePoint(parseInt(a, 16));
1380
- }
1381
- __name(Oo, "Oo");
1382
- function Rt() {
1383
- for (var a = "", c = 4; c-- > 0; ) {
1384
- var D = se();
1385
- if (!L.isHexDigit(D)) throw I(l());
1386
- a += l();
1387
- }
1388
- return String.fromCodePoint(parseInt(a, 16));
1389
- }
1390
- __name(Rt, "Rt");
1391
- var Bo = { start: /* @__PURE__ */ __name(function() {
1392
- if (q.type === "eof") throw pe();
1393
- Nt();
1394
- }, "start"), beforePropertyName: /* @__PURE__ */ __name(function() {
1395
- switch (q.type) {
1396
- case "identifier":
1397
- case "string":
1398
- Bt = q.value, H = "afterPropertyName";
1399
- return;
1400
- case "punctuator":
1401
- nt();
1402
- return;
1403
- case "eof":
1404
- throw pe();
1405
- }
1406
- }, "beforePropertyName"), afterPropertyName: /* @__PURE__ */ __name(function() {
1407
- if (q.type === "eof") throw pe();
1408
- H = "beforePropertyValue";
1409
- }, "afterPropertyName"), beforePropertyValue: /* @__PURE__ */ __name(function() {
1410
- if (q.type === "eof") throw pe();
1411
- Nt();
1412
- }, "beforePropertyValue"), beforeArrayValue: /* @__PURE__ */ __name(function() {
1413
- if (q.type === "eof") throw pe();
1414
- if (q.type === "punctuator" && q.value === "]") {
1415
- nt();
1416
- return;
1417
- }
1418
- Nt();
1419
- }, "beforeArrayValue"), afterPropertyValue: /* @__PURE__ */ __name(function() {
1420
- if (q.type === "eof") throw pe();
1421
- switch (q.value) {
1422
- case ",":
1423
- H = "beforePropertyName";
1424
- return;
1425
- case "}":
1426
- nt();
1427
- }
1428
- }, "afterPropertyValue"), afterArrayValue: /* @__PURE__ */ __name(function() {
1429
- if (q.type === "eof") throw pe();
1430
- switch (q.value) {
1431
- case ",":
1432
- H = "beforeArrayValue";
1433
- return;
1434
- case "]":
1435
- nt();
1436
- }
1437
- }, "afterArrayValue"), end: /* @__PURE__ */ __name(function() {
1438
- }, "end") };
1439
- function Nt() {
1440
- var a;
1441
- switch (q.type) {
1442
- case "punctuator":
1443
- switch (q.value) {
1444
- case "{":
1445
- a = {};
1446
- break;
1447
- case "[":
1448
- a = [];
1449
- break;
1450
- }
1451
- break;
1452
- case "null":
1453
- case "boolean":
1454
- case "numeric":
1455
- case "string":
1456
- a = q.value;
1457
- break;
1458
- }
1459
- if ($e === void 0) $e = a;
1460
- else {
1461
- var c = re[re.length - 1];
1462
- Array.isArray(c) ? c.push(a) : Object.defineProperty(c, Bt, { value: a, writable: true, enumerable: true, configurable: true });
1463
- }
1464
- if (a !== null && typeof a == "object") re.push(a), Array.isArray(a) ? H = "beforeArrayValue" : H = "beforePropertyName";
1465
- else {
1466
- var D = re[re.length - 1];
1467
- D == null ? H = "end" : Array.isArray(D) ? H = "afterArrayValue" : H = "afterPropertyValue";
1468
- }
1469
- }
1470
- __name(Nt, "Nt");
1471
- function nt() {
1472
- re.pop();
1473
- var a = re[re.length - 1];
1474
- a == null ? H = "end" : Array.isArray(a) ? H = "afterArrayValue" : H = "afterPropertyValue";
1475
- }
1476
- __name(nt, "nt");
1477
- function I(a) {
1478
- return rt(a === void 0 ? "JSON5: invalid end of input at " + ae + ":" + Q : "JSON5: invalid character '" + gn(a) + "' at " + ae + ":" + Q);
1479
- }
1480
- __name(I, "I");
1481
- function pe() {
1482
- return rt("JSON5: invalid end of input at " + ae + ":" + Q);
1483
- }
1484
- __name(pe, "pe");
1485
- function hn() {
1486
- return Q -= 5, rt("JSON5: invalid identifier character at " + ae + ":" + Q);
1487
- }
1488
- __name(hn, "hn");
1489
- function Io(a) {
1490
- console.warn("JSON5: '" + gn(a) + "' in strings is not valid ECMAScript; consider escaping");
1491
- }
1492
- __name(Io, "Io");
1493
- function gn(a) {
1494
- var c = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" };
1495
- if (c[a]) return c[a];
1496
- if (a < " ") {
1497
- var D = a.charCodeAt(0).toString(16);
1498
- return "\\x" + ("00" + D).substring(D.length);
1499
- }
1500
- return a;
1501
- }
1502
- __name(gn, "gn");
1503
- function rt(a) {
1504
- var c = new SyntaxError(a);
1505
- return c.lineNumber = ae, c.columnNumber = Q, c;
1506
- }
1507
- __name(rt, "rt");
1508
- var Ro = /* @__PURE__ */ __name(function(c, D, g) {
1509
- var A = [], x = "", k, G, _ = "", he;
1510
- if (D != null && typeof D == "object" && !Array.isArray(D) && (g = D.space, he = D.quote, D = D.replacer), typeof D == "function") G = D;
1511
- else if (Array.isArray(D)) {
1512
- k = [];
1513
- for (var be = 0, Z = D; be < Z.length; be += 1) {
1514
- var ne = Z[be], z = void 0;
1515
- typeof ne == "string" ? z = ne : (typeof ne == "number" || ne instanceof String || ne instanceof Number) && (z = String(ne)), z !== void 0 && k.indexOf(z) < 0 && k.push(z);
1516
- }
1517
- }
1518
- return g instanceof Number ? g = Number(g) : g instanceof String && (g = String(g)), typeof g == "number" ? g > 0 && (g = Math.min(10, Math.floor(g)), _ = " ".substr(0, g)) : typeof g == "string" && (_ = g.substr(0, 10)), Fe("", { "": c });
1519
- function Fe(O, U) {
1520
- var b = U[O];
1521
- switch (b != null && (typeof b.toJSON5 == "function" ? b = b.toJSON5(O) : typeof b.toJSON == "function" && (b = b.toJSON(O))), G && (b = G.call(U, O, b)), b instanceof Number ? b = Number(b) : b instanceof String ? b = String(b) : b instanceof Boolean && (b = b.valueOf()), b) {
1522
- case null:
1523
- return "null";
1524
- case true:
1525
- return "true";
1526
- case false:
1527
- return "false";
1528
- }
1529
- if (typeof b == "string") return it(b, false);
1530
- if (typeof b == "number") return String(b);
1531
- if (typeof b == "object") return Array.isArray(b) ? Mo(b) : _o(b);
1532
- }
1533
- __name(Fe, "Fe");
1534
- function it(O) {
1535
- for (var U = { "'": 0.1, '"': 0.2 }, b = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" }, M = "", ee = 0; ee < O.length; ee++) {
1536
- var W = O[ee];
1537
- switch (W) {
1538
- case "'":
1539
- case '"':
1540
- U[W]++, M += W;
1541
- continue;
1542
- case "\0":
1543
- if (L.isDigit(O[ee + 1])) {
1544
- M += "\\x00";
1545
- continue;
1546
- }
1547
- }
1548
- if (b[W]) {
1549
- M += b[W];
1550
- continue;
1551
- }
1552
- if (W < " ") {
1553
- var ge = W.charCodeAt(0).toString(16);
1554
- M += "\\x" + ("00" + ge).substring(ge.length);
1555
- continue;
1556
- }
1557
- M += W;
1558
- }
1559
- var oe = he || Object.keys(U).reduce(function(ue, me) {
1560
- return U[ue] < U[me] ? ue : me;
1561
- });
1562
- return M = M.replace(new RegExp(oe, "g"), b[oe]), oe + M + oe;
1563
- }
1564
- __name(it, "it");
1565
- function _o(O) {
1566
- if (A.indexOf(O) >= 0) throw TypeError("Converting circular structure to JSON5");
1567
- A.push(O);
1568
- var U = x;
1569
- x = x + _;
1570
- for (var b = k || Object.keys(O), M = [], ee = 0, W = b; ee < W.length; ee += 1) {
1571
- var ge = W[ee], oe = Fe(ge, O);
1572
- if (oe !== void 0) {
1573
- var ue = qo(ge) + ":";
1574
- _ !== "" && (ue += " "), ue += oe, M.push(ue);
1575
- }
1576
- }
1577
- var me;
1578
- if (M.length === 0) me = "{}";
1579
- else {
1580
- var st;
1581
- if (_ === "") st = M.join(","), me = "{" + st + "}";
1582
- else {
1583
- var jo = `,
1584
- ` + x;
1585
- st = M.join(jo), me = `{
1586
- ` + x + st + `,
1587
- ` + U + "}";
1588
- }
1589
- }
1590
- return A.pop(), x = U, me;
1591
- }
1592
- __name(_o, "_o");
1593
- function qo(O) {
1594
- if (O.length === 0) return it(O, true);
1595
- var U = String.fromCodePoint(O.codePointAt(0));
1596
- if (!L.isIdStartChar(U)) return it(O, true);
1597
- for (var b = U.length; b < O.length; b++) if (!L.isIdContinueChar(String.fromCodePoint(O.codePointAt(b)))) return it(O, true);
1598
- return O;
1599
- }
1600
- __name(qo, "qo");
1601
- function Mo(O) {
1602
- if (A.indexOf(O) >= 0) throw TypeError("Converting circular structure to JSON5");
1603
- A.push(O);
1604
- var U = x;
1605
- x = x + _;
1606
- for (var b = [], M = 0; M < O.length; M++) {
1607
- var ee = Fe(String(M), O);
1608
- b.push(ee !== void 0 ? ee : "null");
1609
- }
1610
- var W;
1611
- if (b.length === 0) W = "[]";
1612
- else if (_ === "") {
1613
- var ge = b.join(",");
1614
- W = "[" + ge + "]";
1615
- } else {
1616
- var oe = `,
1617
- ` + x, ue = b.join(oe);
1618
- W = `[
1619
- ` + x + ue + `,
1620
- ` + U + "]";
1621
- }
1622
- return A.pop(), x = U, W;
1623
- }
1624
- __name(Mo, "Mo");
1625
- }, "Ro"), No = { parse: ko, stringify: Ro }, Lo = No, $o = Lo;
1626
- return $o;
1627
- }));
1628
- });
1629
- var gs = m((Sp, hs) => {
1630
- var Je;
1631
- typeof window < "u" ? Je = window : typeof global < "u" ? Je = global : typeof self < "u" ? Je = self : Je = {};
1632
- hs.exports = Je;
1633
- });
1634
- async function De(n = 1) {
1635
- let e = performance.now();
1636
- for (let t = n; t > 0; t--) e = await new Promise((r) => requestAnimationFrame(r));
1637
- return e;
1638
- }
1639
- __name(De, "De");
1640
- function ot(n, e, t) {
1641
- return Math.min(t, Math.max(e, n));
1642
- }
1643
- __name(ot, "ot");
1644
- var Lt = [["section", "ui-section"], ["overview", "epic-overview"], ["item", "epic-item"], ["field", "epic-field"], ["update", "epic-update[at]"], ["summary", "epic-summary"], ["prose", "epic-section > p, epic-overview > p"], ["markdown", "ui-markdown"], ["table", "ui-table, table"], ["aside", "ui-accordion.spell-aside, epic-aside"], ["code", "ui-accordion.spell-code, ui-code, epic-code, pre"], ["message", "ui-message"], ["cards", "ui-cards, epic-list"], ["steps", "ui-steps"], ["list", "ui-list, ul, ol"]], zo = "ui-section[id], epic-overview[id], epic-section[id], epic-phase[id], epic-item[id]", Me = "page";
1645
- var Yo = Lt.map(([, n]) => n).join(", "), Jo = "epic-update[at]", Xo = ["section", "overview"], Qo = Lt.filter(([n]) => !Xo.includes(n)).map(([, n]) => n).join(", "), Dn = "spell-notes, [data-spell-added], .spell-page-head, ui-sticky.spell-h1, .site-masthead, nav, footer", Zo = "epic-event, epic-commit, epic-updated[slot], [slot='status']", ea = /^(.+)#([a-z][a-z-]*)-(\d+)$/;
1646
- function je(n) {
1647
- return Lt.find(([, e]) => n.matches(e))?.[0];
1648
- }
1649
- __name(je, "je");
1650
- function Ue(n) {
1651
- return Array.from(n.querySelectorAll(Yo)).filter((e) => {
1652
- if (e.closest(Dn) || e.closest(Zo)) return false;
1653
- let t = e.parentElement?.closest(Qo);
1654
- return !t || !n.contains(t) || e.matches(Jo);
1655
- });
1656
- }
1657
- __name(Ue, "Ue");
1658
- function yn(n, e) {
1659
- let t = new Set(e);
1660
- for (let r = n.nodeType === 1 ? n : n.parentElement; r; r = r.parentElement ?? We(r)) if (t.has(r)) return r;
1661
- return null;
1662
- }
1663
- __name(yn, "yn");
1664
- function We(n) {
1665
- return n.getRootNode().host;
1666
- }
1667
- __name(We, "We");
1668
- function $t(n, e) {
1669
- for (let t = e; t; t = We(t)) if (n.contains(t)) return true;
1670
- return false;
1671
- }
1672
- __name($t, "$t");
1673
- function Ve(n) {
1674
- return n.querySelector("ui-sticky.spell-h1") ?? n.querySelector(".spell-page-head") ?? n.querySelector(":scope > .site-masthead");
1675
- }
1676
- __name(Ve, "Ve");
1677
- function Ke(n, e) {
1678
- let t = n.parentElement?.closest(zo);
1679
- return t && e.contains(t) ? t : null;
1680
- }
1681
- __name(Ke, "Ke");
1682
- function wn(n, e, t = Ue(e)) {
1683
- if (n.id) return n.id;
1684
- let r = je(n), i = Ke(n, e), s = t.filter((o) => je(o) === r && Ke(o, e) === i);
1685
- return `${i?.id ?? Me}#${r}-${s.indexOf(n) + 1}`;
1686
- }
1687
- __name(wn, "wn");
1688
- function _t(n) {
1689
- return n.matches("ui-section, epic-overview, epic-item, epic-section, epic-phase") ? qt(n) : ta(n).slice(0, 80).trim();
1690
- }
1691
- __name(_t, "_t");
1692
- function qt(n) {
1693
- let e = Array.from(n.children).find((t) => /^(label|title)$/.test(t.getAttribute("slot")));
1694
- return at(n.getAttribute("label") ?? n.getAttribute("title") ?? e?.textContent ?? "");
1695
- }
1696
- __name(qt, "qt");
1697
- function En(n, { anchor: e, excerpt: t = "" }, r = Ue(n)) {
1698
- if (e === Me) return { block: Ve(n), exact: true };
1699
- let i = n.ownerDocument, s = ea.exec(e);
1700
- if (!s) {
1701
- let w = i.getElementById(e);
1702
- return w && n.contains(w) ? { block: w, exact: true } : { block: null, exact: false };
1703
- }
1704
- let [, o, u, d] = s, f = o === Me ? null : i.getElementById(o), p = r.filter((w) => je(w) === u), v = p.filter((w) => Ke(w, n) === f), y = v[Number(d) - 1], T = /* @__PURE__ */ __name((w) => !!t && _t(w) === t, "T");
1705
- if (y && (!t || T(y))) return { block: y, exact: true };
1706
- let h = v.find(T) ?? p.find(T) ?? y;
1707
- return h ? { block: h, exact: false } : { block: f && n.contains(f) ? f : null, exact: false };
1708
- }
1709
- __name(En, "En");
1710
- function ta(n) {
1711
- return at(Mt(n).map((e) => e.text).join(""));
1712
- }
1713
- __name(ta, "ta");
1714
- function An(n, e, t) {
1715
- let r = "";
1716
- for (let i of Mt(n)) {
1717
- if (i.node === e) return at(`${r}${i.text.slice(0, t)}x`).length - 1;
1718
- r += i.text;
1719
- }
1720
- return 0;
1721
- }
1722
- __name(An, "An");
1723
- function vn(n, e, t = 0) {
1724
- let r = at(e);
1725
- if (!r) return null;
1726
- let i = [], s = true;
1727
- for (let p of Mt(n)) for (let v = 0; v < p.text.length; v++) {
1728
- let y = /\s/.test(p.text[v]);
1729
- y && s || (i.push({ char: y ? " " : p.text[v], node: p.node, at: v }), s = y);
1730
- }
1731
- let o = i.map((p) => p.char).join(""), u = -1;
1732
- for (let p = o.indexOf(r); p >= 0; p = o.indexOf(r, p + 1)) (u < 0 || Math.abs(p - t) < Math.abs(u - t)) && (u = p);
1733
- if (u < 0) return null;
1734
- let d = i[u], f = i[u + r.length - 1];
1735
- return { start: [d.node, d.at], end: [f.node, f.at + 1] };
1736
- }
1737
- __name(vn, "vn");
1738
- function Mt(n) {
1739
- let e = [], t = /* @__PURE__ */ __name((r) => {
1740
- if (r.nodeType === 3) return e.push({ node: r, text: r.textContent });
1741
- if (r.nodeType !== 1 || r !== n && r.matches(Dn)) return;
1742
- let i = r.localName === "ui-markdown" ? r.shadowRoot?.querySelector('[part~="body"]') : null;
1743
- for (let s of (i ?? r).childNodes) t(s);
1744
- e.push({ node: null, text: " " });
1745
- }, "t");
1746
- return t(n), e;
1747
- }
1748
- __name(Mt, "Mt");
1749
- function at(n) {
1750
- return String(n ?? "").replace(/\s+/g, " ").trim();
1751
- }
1752
- __name(at, "at");
1753
- function Cn(n, { keep: e = "" } = {}) {
1754
- let t = e.normalize("NFC").toLowerCase();
1755
- return n.normalize("NFC").replace(/\P{ASCII}/gu, (r) => t.includes(r.toLowerCase()) ? r : r.normalize("NFD").replace(/\p{M}+/gu, ""));
1756
- }
1757
- __name(Cn, "Cn");
1758
- var xe = class {
1759
- static {
1760
- __name(this, "xe");
1761
- }
1762
- values = /* @__PURE__ */ new Map();
1763
- get length() {
1764
- return this.values.size;
1765
- }
1766
- key(e) {
1767
- return [...this.values.keys()][e] ?? null;
1768
- }
1769
- getItem(e) {
1770
- return this.values.get(e) ?? null;
1771
- }
1772
- setItem(e, t) {
1773
- this.values.set(e, String(t));
1774
- }
1775
- removeItem(e) {
1776
- this.values.delete(e);
1777
- }
1778
- };
1779
- var Se = class {
1780
- static {
1781
- __name(this, "Se");
1782
- }
1783
- async load(e, t) {
1784
- return this.read(e, t);
1785
- }
1786
- async save(e, t, r) {
1787
- r === void 0 ? this.remove(e, t) : this.write(e, t, r);
1788
- }
1789
- async loadKeys(e) {
1790
- return this.keys(e);
1791
- }
1792
- async update(e, t, r) {
1793
- let i = r(await this.load(e, t));
1794
- return await this.save(e, t, i), i;
1795
- }
1796
- async removeUnder(e, t) {
1797
- for (let r of this.keys(e)) r.startsWith(t) && this.remove(e, r);
1798
- }
1799
- };
1800
- var bn = /^(?:["{[]|-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$|true$|false$|null$)/;
1801
- function Fn(n) {
1802
- if (typeof n == "string" && !bn.test(n)) return n;
1803
- let e = JSON.stringify(n);
1804
- if (e === void 0) throw new TypeError(`textForValue(): can't keep a ${typeof n} as text; pass plain data`);
1805
- return e;
1806
- }
1807
- __name(Fn, "Fn");
1808
- function xn(n) {
1809
- return bn.test(n) ? JSON.parse(n) : n;
1810
- }
1811
- __name(xn, "xn");
1812
- var na = /* @__PURE__ */ new Map([["number", 0], ["text", ""], ["choice", false]]), ra = /* @__PURE__ */ new Map([["number", "number"], ["text", "string"], ["choice", "boolean"]]);
1813
- function jt(n) {
1814
- if (!n) return;
1815
- if (n.default !== void 0) return n.default;
1816
- let e = ut(n);
1817
- return e?.length ? e[0] : n.type === void 0 ? void 0 : na.get(n.type);
1818
- }
1819
- __name(jt, "jt");
1820
- function Kt(n, e) {
1821
- if (!n) return true;
1822
- let t = ut(n);
1823
- if (t && !t.includes(e)) return false;
1824
- let r = n.type === void 0 ? void 0 : ra.get(n.type);
1825
- return r === void 0 || typeof e === r;
1826
- }
1827
- __name(Kt, "Kt");
1828
- function ut(n) {
1829
- return typeof n.oneOf == "function" ? n.oneOf() : n.oneOf;
1830
- }
1831
- __name(ut, "ut");
1832
- var we = class extends Se {
1833
- static {
1834
- __name(this, "we");
1835
- }
1836
- isAsync = false;
1837
- description;
1838
- constructor({ storage: e, description: t }) {
1839
- super(), this.findStorage = typeof e == "function" ? e : () => e, this.description = t;
1840
- }
1841
- read(e, t) {
1842
- let r = this.attempt("read", e, t, (i) => i.getItem(ye(e, t)));
1843
- if (r != null) try {
1844
- return xn(r);
1845
- } catch (i) {
1846
- console.error(`StoragePlace.read(): \`${ye(e, t)}\` holds no value it can read; answering none:`, r), console.error(i);
1847
- return;
1848
- }
1849
- }
1850
- write(e, t, r) {
1851
- let i = Fn(r);
1852
- this.attempt("write", e, t, (s) => s.setItem(ye(e, t), i));
1853
- }
1854
- remove(e, t) {
1855
- this.attempt("remove", e, t, (r) => r.removeItem(ye(e, t)));
1856
- }
1857
- keys(e) {
1858
- let t = `${e}:`;
1859
- return this.attempt("keys", e, "", (i) => {
1860
- let s = [];
1861
- for (let o = 0; o < i.length; o++) {
1862
- let u = i.key(o);
1863
- u?.startsWith(t) && s.push(u.slice(t.length));
1864
- }
1865
- return s;
1866
- }) ?? [];
1867
- }
1868
- moveText(e, t, r) {
1869
- this.attempt("moveText", t, r, (i) => {
1870
- let s = i.getItem(e);
1871
- s !== null && (i.getItem(ye(t, r)) === null && i.setItem(ye(t, r), s), i.removeItem(e));
1872
- });
1873
- }
1874
- get storage() {
1875
- return this._storage ??= this.storageOrMemory();
1876
- }
1877
- _storage;
1878
- findStorage;
1879
- storageOrMemory() {
1880
- try {
1881
- let e = this.findStorage();
1882
- if (e) return e;
1883
- } catch (e) {
1884
- console.error(`StoragePlace: ${this.description} is blocked; keeping its values in memory for this visit:`), console.error(e);
1885
- }
1886
- return new xe();
1887
- }
1888
- attempt(e, t, r, i) {
1889
- try {
1890
- return i(this.storage);
1891
- } catch (s) {
1892
- console.error(`StoragePlace.${e}(): ${this.description} refused \`${ye(t, r)}\`:`), console.error(s);
1893
- return;
1894
- }
1895
- }
1896
- };
1897
- function ye(n, e) {
1898
- return `${n}:${e}`;
1899
- }
1900
- __name(ye, "ye");
1901
- var J = class n {
1902
- static {
1903
- __name(this, "n");
1904
- }
1905
- name;
1906
- place;
1907
- constructor(e, { place: t = "local" } = {}) {
1908
- if (!e || e.includes(":")) throw new TypeError(`new PrefStore(): \`${e}\` can't name a store; give it a name with no colon, e.g. "spell-site"`);
1909
- this.name = e, this.place = kn(t);
1910
- }
1911
- static splitKey(e) {
1912
- let t = e.indexOf(":");
1913
- if (t < 1) throw new TypeError(`PrefStore.splitKey(): \`${e}\` has no store; name it "<store>:<key>"`);
1914
- return [e.slice(0, t), e.slice(t + 1)];
1915
- }
1916
- static getAt(e, t = "local") {
1917
- let [r, i] = n.splitKey(e);
1918
- return new n(r, { place: t }).get(i);
1919
- }
1920
- static moveOldKey(e, t, r = "local") {
1921
- let [i, s] = n.splitKey(t);
1922
- kn(r).moveText(e, i, s);
1923
- }
1924
- static setAt(e, t, r = "local") {
1925
- let [i, s] = n.splitKey(e);
1926
- new n(i, { place: r }).set(s, t);
1927
- }
1928
- declare(e, t) {
1929
- return this.checkKey("declare", e), this.declared.set(e, t), this;
1930
- }
1931
- defaultFor(e) {
1932
- return jt(this.declared.get(e));
1933
- }
1934
- has(e) {
1935
- return this.checkQuickRead("has", e), this.place.read(this.name, e) !== void 0;
1936
- }
1937
- get(e, t) {
1938
- return this.checkQuickRead("get", e), this.keptOrDefault("get", e, this.place.read(this.name, e), t);
1939
- }
1940
- set(e, t) {
1941
- return this.checkWrite("set", e, t), t === void 0 ? this.place.remove(this.name, e) : this.place.write(this.name, e, t), t;
1942
- }
1943
- forget(e) {
1944
- this.set(e, void 0);
1945
- }
1946
- keysUnder(e = "") {
1947
- return this.checkQuickRead("keysUnder"), this.place.keys(this.name).filter((t) => t.startsWith(e));
1948
- }
1949
- forgetUnder(e) {
1950
- return this.place.removeUnder(this.name, e);
1951
- }
1952
- forgetAll() {
1953
- return this.forgetUnder("");
1954
- }
1955
- rename(e, t) {
1956
- this.checkQuickRead("rename", e), this.checkKey("rename", t);
1957
- let r = this.place.read(this.name, e);
1958
- return r === void 0 ? this : (this.place.read(this.name, t) === void 0 && this.place.write(this.name, t, r), this.place.remove(this.name, e), this);
1959
- }
1960
- async load(e, t) {
1961
- return this.checkKey("load", e), this.keptOrDefault("load", e, await this.place.load(this.name, e), t);
1962
- }
1963
- async save(e, t) {
1964
- return this.checkWrite("save", e, t), await this.place.save(this.name, e, t), t;
1965
- }
1966
- update(e, t) {
1967
- this.checkKey("update", e);
1968
- let i = (this.updating.get(e) ?? Promise.resolve()).then(async () => await this.place.update(this.name, e, (o) => {
1969
- let u = t(this.keptOrDefault("update", e, o, void 0));
1970
- return this.checkWrite("update", e, u), u;
1971
- })), s = i.then(() => {
1972
- }, () => {
1973
- });
1974
- return this.updating.set(e, s), s.then(() => {
1975
- this.updating.get(e) === s && this.updating.delete(e);
1976
- }), i;
1977
- }
1978
- async loadKeysUnder(e = "") {
1979
- return (await this.place.loadKeys(this.name)).filter((t) => t.startsWith(e));
1980
- }
1981
- keptOrDefault(e, t, r, i) {
1982
- let s = this.declared.get(t);
1983
- if (r !== void 0) {
1984
- if (Kt(s, r)) return r;
1985
- console.error(`PrefStore.${e}(): \`${this.name}:${t}\` isn't ${Tn(s)}; answering its default:`, r);
1986
- }
1987
- return i !== void 0 ? i : jt(s);
1988
- }
1989
- checkKey(e, t) {
1990
- if (!t) throw new TypeError(`PrefStore.${e}(): no key; pass the pref's name, e.g. "scheme"`);
1991
- }
1992
- checkQuickRead(e, t) {
1993
- if (t !== void 0 && this.checkKey(e, t), !!this.place.isAsync) throw new TypeError(`PrefStore.${e}(): \`${this.name}\` keeps its values in ${this.place.description}, which must be waited on; use \`load()\` or \`loadKeysUnder()\``);
1994
- }
1995
- checkWrite(e, t, r) {
1996
- this.checkKey(e, t);
1997
- let i = this.declared.get(t);
1998
- if (!(r === void 0 || Kt(i, r))) throw new TypeError(`PrefStore.${e}(): \`${t}\` is ${Tn(i)}; not \`${Pn(r)}\``);
1999
- }
2000
- declared = /* @__PURE__ */ new Map();
2001
- updating = /* @__PURE__ */ new Map();
2002
- }, ia = { local: { storage: /* @__PURE__ */ __name(() => globalThis.localStorage, "storage"), description: "the browser's storage" }, session: { storage: /* @__PURE__ */ __name(() => globalThis.sessionStorage, "storage"), description: "the browser's per-tab storage" } }, Sn = /* @__PURE__ */ new Map();
2003
- function kn(n) {
2004
- if (n instanceof Se) return n;
2005
- if (n === "memory") return new we({ storage: new xe(), description: "memory" });
2006
- let e = Sn.get(n);
2007
- return e || Sn.set(n, e = new we(ia[n])), e;
2008
- }
2009
- __name(kn, "kn");
2010
- function Tn(n) {
2011
- let e = n && ut(n);
2012
- return e ? `one of ${e.map(Pn).join(", ")}` : n?.type ? `a ${n.type}` : "anything";
2013
- }
2014
- __name(Tn, "Tn");
2015
- function Pn(n) {
2016
- return typeof n == "string" ? n : typeof n == "object" && JSON.stringify(n) || String(n);
2017
- }
2018
- __name(Pn, "Pn");
2019
- function On(n = /* @__PURE__ */ new Date()) {
2020
- return `${n.getFullYear()}-${ct(n.getMonth() + 1)}-${ct(n.getDate())}`;
2021
- }
2022
- __name(On, "On");
2023
- function ke(n = /* @__PURE__ */ new Date()) {
2024
- return `${ct(n.getHours())}:${ct(n.getMinutes())}`;
2025
- }
2026
- __name(ke, "ke");
2027
- function ct(n) {
2028
- return String(n).padStart(2, "0");
2029
- }
2030
- __name(ct, "ct");
2031
- var Bn = /\/(?:packages\/docs\/content\/)?epics\/([^/]+)\/\1\.plan\.html$/, In = /\/sagas\/([^/]+)\/\1\.saga\.html$/;
2032
- var Rn = 4e3;
2033
- var sa = oa() ? "Airplane mode: queued for when you land (/airplane land)" : "No Claude session is reviewing this doc: Send wakes one";
2034
- function oa() {
2035
- return typeof window < "u" && !!window.SPELL_SERVER?.airplane;
2036
- }
2037
- __name(oa, "oa");
2038
- var Nn = /window\.SPELL_SERVER = (\{.*?\})<\/script>/;
2039
- var aa = 8 * 1024 * 1024;
2040
- function lt(n) {
2041
- return (typeof n == "function" ? n() : n) ?? void 0;
2042
- }
2043
- __name(lt, "lt");
2044
- var Te = class extends Error {
2045
- static {
2046
- __name(this, "Te");
2047
- }
2048
- };
2049
- Te.prototype.name = "ServerWriteError";
2050
- var ua = "see my comments in its text: ", gf = new RegExp(`(?:^|\\n+)${ua}[^\\n]*$`);
2051
- var vl = qe(Pi()), Cl = qe(Wi()), Es = qe(cs());
2052
- var ds = qe(ls(), 1);
2053
- function fs(n, e = "random text", t) {
2054
- try {
2055
- return JSON.parse(n);
2056
- } catch (r) {
2057
- let s = (r instanceof Error ? r.message : String(r)).match(/at position (\d+)/);
2058
- if (s) {
2059
- let o = parseInt(s[1], 10), u = n.substring(0, o), d = Math.max(0, u.split(`
2060
- `).length - 2);
2061
- console.error(`Error parsing JSON near line ${d} of ${e}`);
2062
- let f = Math.max(0, d - 3), p = f + 6;
2063
- console.log(n.split(`
2064
- `).slice(f, p).join(`
2065
- `));
2066
- }
2067
- if (!t) throw r;
2068
- return;
2069
- }
2070
- }
2071
- __name(fs, "fs");
2072
- function ps(n, e = "random text", t) {
2073
- try {
2074
- return ds.default.parse(n);
2075
- } catch (r) {
2076
- let s = (r instanceof Error ? r.message : String(r)).match(/at position (\d+)/);
2077
- if (s) {
2078
- let o = parseInt(s[1], 10), u = n.substring(0, o), d = Math.max(0, u.split(`
2079
- `).length - 2);
2080
- console.error(`Error parsing JSON near line ${d} of ${e}`);
2081
- let f = Math.max(0, d - 3), p = f + 6;
2082
- console.log(n.split(`
2083
- `).slice(f, p).join(`
2084
- `));
2085
- }
2086
- if (!t) throw r;
2087
- return;
2088
- }
2089
- }
2090
- __name(ps, "ps");
2091
- var ms = qe(gs(), 1);
2092
- function Ds(n) {
2093
- return n.name === "AbortError";
2094
- }
2095
- __name(Ds, "Ds");
2096
- function ys(n, e = {}, t = fetch) {
2097
- let r = false, i = new ms.default.AbortController();
2098
- function s(u) {
2099
- return Object.assign(u, { cancel() {
2100
- return r || (console.warn(`Cancelling abortable fetch to ${n}:`), i.abort()), this;
2101
- }, then(d, f) {
2102
- return s(Promise.prototype.then.apply(this, [d, f]));
2103
- }, catch(d) {
2104
- return s(Promise.prototype.catch.apply(this, [d]));
2105
- }, finally(d) {
2106
- return s(Promise.prototype.finally.apply(this, [d]));
2107
- } });
2108
- }
2109
- __name(s, "s");
2110
- e.signal = i.signal;
2111
- let o = t(n, e);
2112
- return o.finally(() => {
2113
- r = true;
2114
- }), s(o);
2115
- }
2116
- __name(ys, "ys");
2117
- var Ae = { text: "text/plain", json: "application/json", json5: "application/json5", gif: "image/gif", png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", svg: "image/svg+xml", binary: "binary" }, ws = ["binary", "blob", Ae.gif, Ae.png, Ae.jpeg, Ae.binary];
2118
- var Dt = class extends Error {
2119
- static {
2120
- __name(this, "Dt");
2121
- }
2122
- props;
2123
- constructor(e, t) {
2124
- typeof e == "string" ? (super(e), this.props = { message: e }) : (super(e.message), this.props = e);
2125
- let { captureStackTrace: r } = Error;
2126
- r && r(this, t || this.constructor), Object.setPrototypeOf(this, new.target.prototype);
2127
- }
2128
- get name() {
2129
- return this.constructor.name;
2130
- }
2131
- get header() {
2132
- return this.props.activity ? `${this.name} ${this.props.activity}` : this.name;
2133
- }
2134
- };
2135
- var te = class extends Dt {
2136
- static {
2137
- __name(this, "te");
2138
- }
2139
- get status() {
2140
- if (this.props.response) return this.props.response.status;
2141
- }
2142
- }, yt = class extends te {
2143
- static {
2144
- __name(this, "yt");
2145
- }
2146
- constructor(e) {
2147
- super({ message: "You must be online to do this.", ...e });
2148
- }
2149
- }, Ie = class extends te {
2150
- static {
2151
- __name(this, "Ie");
2152
- }
2153
- constructor(e) {
2154
- super({ message: "There was a problem loading this thing.", ...e });
2155
- }
2156
- }, wt = class extends te {
2157
- static {
2158
- __name(this, "wt");
2159
- }
2160
- constructor(e) {
2161
- super({ message: "You are not authorized to do this.", ...e });
2162
- }
2163
- }, Et = class extends te {
2164
- static {
2165
- __name(this, "Et");
2166
- }
2167
- constructor(e) {
2168
- super({ message: "There was an error understanding the response.", ...e });
2169
- }
2170
- }, At = class extends te {
2171
- static {
2172
- __name(this, "At");
2173
- }
2174
- constructor(e) {
2175
- super({ message: "The action was cancelled.", ...e });
2176
- }
2177
- };
2178
- function As(n) {
2179
- let { url: e, query: t, contents: r, method: i = r != null ? "POST" : "GET", headers: s = {}, requestFormat: o, format: u = "text/plain", defaultContents: d, cache: f, fetch: p } = n, v = { method: i, ...f && { cache: f } };
2180
- o && (s["Content-Type"] = o), v.headers = s, r != null && (v.body = typeof r == "string" ? r : JSON.stringify(r));
2181
- let y = e;
2182
- typeof t == "string" ? y += `?${t}` : t && (y += `?${Es.default.stringify(t)}`);
2183
- let T = ys(y, v, p);
2184
- async function h(P) {
2185
- let R = { url: e, status: P.status, ...v };
2186
- if (!P.ok) {
2187
- let $ = await P.text();
2188
- switch (P.status) {
2189
- case 404:
2190
- if (d !== void 0) return d;
2191
- throw new Ie({ ...R, message: $ });
2192
- case 401:
2193
- case 403:
2194
- throw new wt({ ...R, message: $ });
2195
- default:
2196
- throw new te({ ...R, message: $ });
2197
- }
2198
- }
2199
- try {
2200
- if (ws.includes(u)) return await P.blob();
2201
- let $ = await P.text();
2202
- return u === Ae.json || u.toLowerCase() === "json" ? fs($) : u === Ae.json5 || u.toLowerCase() === "json5" ? ps($) : $;
2203
- } catch ($) {
2204
- throw new Et({ ...R, error: $ });
2205
- }
2206
- }
2207
- __name(h, "h");
2208
- async function w(P) {
2209
- if (d !== void 0) return d;
2210
- throw Ds(P) ? new At({ url: e, error: P, ...v }) : new yt({ url: e, error: P, ...v });
2211
- }
2212
- __name(w, "w");
2213
- return T.then(h, w);
2214
- }
2215
- __name(As, "As");
2216
- var K = class n {
2217
- static {
2218
- __name(this, "n");
2219
- }
2220
- constructor(e) {
2221
- this.options = e;
2222
- this.info = e.server ? { ...e.server } : void 0;
2223
- }
2224
- options;
2225
- info;
2226
- static current;
2227
- static forPage() {
2228
- return n.current ??= new n(n.pageOptions()), n.current;
2229
- }
2230
- static pageOptions() {
2231
- return { page: location.pathname, server: window.SPELL_SERVER, protocol: location.protocol, fetch: /* @__PURE__ */ __name((e, t) => window.fetch(e, t), "fetch"), readServed: /* @__PURE__ */ __name((e) => n.readInFrame(window.document, e), "readServed") };
2232
- }
2233
- static readInFrame(e, t, r = bl) {
2234
- return new Promise((i, s) => {
2235
- let o = e.createElement("iframe");
2236
- o.setAttribute("sandbox", "allow-same-origin"), o.setAttribute("aria-hidden", "true"), o.hidden = true;
2237
- let u = /* @__PURE__ */ __name((p) => {
2238
- clearTimeout(f);
2239
- try {
2240
- i(p());
2241
- } catch (v) {
2242
- s(v);
2243
- } finally {
2244
- o.remove();
2245
- }
2246
- }, "u"), d = /* @__PURE__ */ __name(() => {
2247
- throw new Error("the page didn't load");
2248
- }, "d"), f = setTimeout(() => u(d), r);
2249
- o.addEventListener("load", () => {
2250
- o.contentDocument?.URL !== "about:blank" && u(() => o.contentDocument.documentElement.outerHTML);
2251
- }), o.src = `${t}${t.includes("?") ? "&" : "?"}spell-token=${Date.now()}`, e.body.append(o);
2252
- });
2253
- }
2254
- static isServed(e = globalThis.SPELL_SERVER, t = globalThis.location?.protocol) {
2255
- return !!e?.token && n.canRead(t);
2256
- }
2257
- static canRead(e = globalThis.location?.protocol) {
2258
- return e !== "file:";
2259
- }
2260
- get isServed() {
2261
- return n.isServed(this.info, this.options.protocol);
2262
- }
2263
- get servesPlanDoc() {
2264
- return this.isServed && Bn.test(this.options.page);
2265
- }
2266
- get servesReviews() {
2267
- return this.servesPlanDoc ? true : this.isServed && In.test(this.options.page);
2268
- }
2269
- get file() {
2270
- return this.info?.file ?? this.options.page;
2271
- }
2272
- async get(e, { query: t, missing: r, format: i = "json" } = {}) {
2273
- if (!n.canRead(this.options.protocol)) return r;
2274
- try {
2275
- let s = t && new URLSearchParams(t).toString();
2276
- return await As({ url: e, query: s, format: i, cache: "no-store", fetch: this.options.fetch }) ?? r;
2277
- } catch (s) {
2278
- if (s instanceof Ie) return r;
2279
- throw s instanceof te && (s.message = Fl(s.message) ?? s.message), s;
2280
- }
2281
- }
2282
- async getFile(e, { format: t = "json" } = {}) {
2283
- for (let r of typeof e == "string" ? [e] : e) {
2284
- let i;
2285
- try {
2286
- i = await this.get(r, { format: t });
2287
- } catch (s) {
2288
- throw new Error(`${r.split("/").pop()}: ${s.message}`, { cause: s });
2289
- }
2290
- if (i !== void 0) return i;
2291
- }
2292
- }
2293
- static dataFileNames(e) {
2294
- let t = e.replace(/\.json5?$/, "");
2295
- return t === e ? [e] : [`${t}.json5`, `${t}.json`];
2296
- }
2297
- getForPage(e, { missing: t } = {}) {
2298
- return this.get(e, { query: { page: this.options.page }, missing: t });
2299
- }
2300
- async post(e, t, { keepalive: r = false } = {}) {
2301
- for (let i = 0; ; i++) {
2302
- let s;
2303
- try {
2304
- s = await this.options.fetch(e, { method: "POST", headers: { "content-type": "application/json", "x-server-token": this.info?.token ?? "" }, body: JSON.stringify(t), keepalive: r });
2305
- } catch (d) {
2306
- throw new Te(`couldn't reach the page server (${d.message})`);
2307
- }
2308
- let o = await s.json().catch(() => ({}));
2309
- if (s.ok) return o;
2310
- let u = s.status === 403 && /token/i.test(o.error ?? "");
2311
- if (!(u && i === 0 && await this.refreshToken())) throw new Te(u ? "the page server restarted since this page loaded: reload the page" : o.error ?? `couldn't save (${s.status})`);
2312
- }
2313
- }
2314
- static watch(e, t, r, { every: i = Rn, polls: s } = {}) {
2315
- let { document: o } = e, u = typeof t == "function" ? t : xl(t), d = i ? e.setInterval(() => {
2316
- o.visibilityState === "visible" && (s?.() ?? true) && r();
2317
- }, i) : void 0, f = /* @__PURE__ */ __name(() => {
2318
- o.visibilityState === "visible" && r();
2319
- }, "f"), p = /* @__PURE__ */ __name((v) => {
2320
- let y = v.detail?.path;
2321
- y && u(decodeURIComponent(y)) && r();
2322
- }, "p");
2323
- return o.addEventListener("visibilitychange", f), e.addEventListener("spell-server:changed", p), () => {
2324
- d !== void 0 && e.clearInterval(d), o.removeEventListener("visibilitychange", f), e.removeEventListener("spell-server:changed", p);
2325
- };
2326
- }
2327
- async refreshToken() {
2328
- try {
2329
- let { page: e, readServed: t } = this.options, r = t ? await t(e) : await (await this.options.fetch(e, { cache: "no-store" })).text(), i = JSON.parse(Nn.exec(r)?.[1] ?? "null")?.token;
2330
- return !i || !this.info || i === this.info.token ? false : (this.info.token = i, true);
2331
- } catch {
2332
- return false;
2333
- }
2334
- }
2335
- }, bl = 1e4;
2336
- function Fl(n) {
2337
- try {
2338
- let e = JSON.parse(n)?.error;
2339
- return typeof e == "string" ? e : void 0;
2340
- } catch {
2341
- return;
2342
- }
2343
- }
2344
- __name(Fl, "Fl");
2345
- function xl(n) {
2346
- if (!n) return () => false;
2347
- let e = K.dataFileNames(n);
2348
- return (t) => e.includes(t);
2349
- }
2350
- __name(xl, "xl");
2351
- var vt = class n {
2352
- static {
2353
- __name(this, "n");
2354
- }
2355
- static show(e, { tone: t = "plain", ms: r = Sl, actions: i = [] } = {}) {
2356
- if (typeof document > "u") return;
2357
- let s = n.list();
2358
- if (t === "plain") for (let d of s.querySelectorAll('[data-tone="plain"]')) d.remove();
2359
- let o = document.createElement("div");
2360
- o.className = "notice", o.dataset.tone = t;
2361
- let u = document.createElement("p");
2362
- u.textContent = e, o.append(u);
2363
- for (let d of i) {
2364
- let f = document.createElement("ui-button");
2365
- f.setAttribute("appearance", "basic inverted compact"), f.setAttribute("size", "mini"), d.icon && f.setAttribute("icon", d.icon), f.textContent = d.text, f.addEventListener("click", () => {
2366
- o.remove(), d.click();
2367
- }), o.append(f);
2368
- }
2369
- s.append(o), setTimeout(() => o.remove(), r);
2370
- }
2371
- static list() {
2372
- let e = document.querySelector(`[${vs}]`);
2373
- return e || (e = document.createElement("div"), e.setAttribute(vs, ""), e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.attachShadow({ mode: "open" }).innerHTML = `<style>${kl}</style><div class="list"></div>`, document.body.append(e)), e.shadowRoot.querySelector(".list");
2374
- }
2375
- }, Sl = 6e3, vs = "data-spell-notices", kl = `
1
+ "use strict";(()=>{var Ko=Object.create;var mn=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var Vo=Object.getPrototypeOf,Ho=Object.prototype.hasOwnProperty;var m=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var Go=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Wo(e))!Ho.call(n,i)&&i!==t&&mn(n,i,{get:()=>e[i],enumerable:!(r=Uo(e,i))||r.enumerable});return n};var qe=(n,e,t)=>(t=n!=null?Ko(Vo(n)):{},Go(e||!n||!n.__esModule?mn(t,"default",{value:n,enumerable:!0}):t,n));var dt=m((Df,Ln)=>{var ca=Array.isArray;Ln.exports=ca});var _n=m((yf,$n)=>{var la=typeof global=="object"&&global&&global.Object===Object&&global;$n.exports=la});var ft=m((wf,qn)=>{var da=_n(),fa=typeof self=="object"&&self&&self.Object===Object&&self,pa=da||fa||Function("return this")();qn.exports=pa});var pt=m((Ef,Mn)=>{var ha=ft(),ga=ha.Symbol;Mn.exports=ga});var Wn=m((Af,Un)=>{var jn=pt(),Kn=Object.prototype,ma=Kn.hasOwnProperty,Da=Kn.toString,He=jn?jn.toStringTag:void 0;function ya(n){var e=ma.call(n,He),t=n[He];try{n[He]=void 0;var r=!0}catch{}var i=Da.call(n);return r&&(e?n[He]=t:delete n[He]),i}Un.exports=ya});var Hn=m((vf,Vn)=>{var wa=Object.prototype,Ea=wa.toString;function Aa(n){return Ea.call(n)}Vn.exports=Aa});var Ut=m((Cf,Yn)=>{var Gn=pt(),va=Wn(),Ca=Hn(),ba="[object Null]",Fa="[object Undefined]",zn=Gn?Gn.toStringTag:void 0;function xa(n){return n==null?n===void 0?Fa:ba:zn&&zn in Object(n)?va(n):Ca(n)}Yn.exports=xa});var Xn=m((bf,Jn)=>{function Sa(n){return n!=null&&typeof n=="object"}Jn.exports=Sa});var ht=m((Ff,Qn)=>{var ka=Ut(),Ta=Xn(),Pa="[object Symbol]";function Oa(n){return typeof n=="symbol"||Ta(n)&&ka(n)==Pa}Qn.exports=Oa});var er=m((xf,Zn)=>{var Ba=dt(),Ia=ht(),Ra=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Na=/^\w*$/;function La(n,e){if(Ba(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||Ia(n)?!0:Na.test(n)||!Ra.test(n)||e!=null&&n in Object(e)}Zn.exports=La});var gt=m((Sf,tr)=>{function $a(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}tr.exports=$a});var rr=m((kf,nr)=>{var _a=Ut(),qa=gt(),Ma="[object AsyncFunction]",ja="[object Function]",Ka="[object GeneratorFunction]",Ua="[object Proxy]";function Wa(n){if(!qa(n))return!1;var e=_a(n);return e==ja||e==Ka||e==Ma||e==Ua}nr.exports=Wa});var sr=m((Tf,ir)=>{var Va=ft(),Ha=Va["__core-js_shared__"];ir.exports=Ha});var ur=m((Pf,ar)=>{var Wt=sr(),or=(function(){var n=/[^.]+$/.exec(Wt&&Wt.keys&&Wt.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function Ga(n){return!!or&&or in n}ar.exports=Ga});var lr=m((Of,cr)=>{var za=Function.prototype,Ya=za.toString;function Ja(n){if(n!=null){try{return Ya.call(n)}catch{}try{return n+""}catch{}}return""}cr.exports=Ja});var fr=m((Bf,dr)=>{var Xa=rr(),Qa=ur(),Za=gt(),eu=lr(),tu=/[\\^$.*+?()[\]{}|]/g,nu=/^\[object .+?Constructor\]$/,ru=Function.prototype,iu=Object.prototype,su=ru.toString,ou=iu.hasOwnProperty,au=RegExp("^"+su.call(ou).replace(tu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function uu(n){if(!Za(n)||Qa(n))return!1;var e=Xa(n)?au:nu;return e.test(eu(n))}dr.exports=uu});var hr=m((If,pr)=>{function cu(n,e){return n?.[e]}pr.exports=cu});var mt=m((Rf,gr)=>{var lu=fr(),du=hr();function fu(n,e){var t=du(n,e);return lu(t)?t:void 0}gr.exports=fu});var Ge=m((Nf,mr)=>{var pu=mt(),hu=pu(Object,"create");mr.exports=hu});var wr=m((Lf,yr)=>{var Dr=Ge();function gu(){this.__data__=Dr?Dr(null):{},this.size=0}yr.exports=gu});var Ar=m(($f,Er)=>{function mu(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}Er.exports=mu});var Cr=m((_f,vr)=>{var Du=Ge(),yu="__lodash_hash_undefined__",wu=Object.prototype,Eu=wu.hasOwnProperty;function Au(n){var e=this.__data__;if(Du){var t=e[n];return t===yu?void 0:t}return Eu.call(e,n)?e[n]:void 0}vr.exports=Au});var Fr=m((qf,br)=>{var vu=Ge(),Cu=Object.prototype,bu=Cu.hasOwnProperty;function Fu(n){var e=this.__data__;return vu?e[n]!==void 0:bu.call(e,n)}br.exports=Fu});var Sr=m((Mf,xr)=>{var xu=Ge(),Su="__lodash_hash_undefined__";function ku(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=xu&&e===void 0?Su:e,this}xr.exports=ku});var Tr=m((jf,kr)=>{var Tu=wr(),Pu=Ar(),Ou=Cr(),Bu=Fr(),Iu=Sr();function Pe(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Pe.prototype.clear=Tu;Pe.prototype.delete=Pu;Pe.prototype.get=Ou;Pe.prototype.has=Bu;Pe.prototype.set=Iu;kr.exports=Pe});var Or=m((Kf,Pr)=>{function Ru(){this.__data__=[],this.size=0}Pr.exports=Ru});var Vt=m((Uf,Br)=>{function Nu(n,e){return n===e||n!==n&&e!==e}Br.exports=Nu});var ze=m((Wf,Ir)=>{var Lu=Vt();function $u(n,e){for(var t=n.length;t--;)if(Lu(n[t][0],e))return t;return-1}Ir.exports=$u});var Nr=m((Vf,Rr)=>{var _u=ze(),qu=Array.prototype,Mu=qu.splice;function ju(n){var e=this.__data__,t=_u(e,n);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():Mu.call(e,t,1),--this.size,!0}Rr.exports=ju});var $r=m((Hf,Lr)=>{var Ku=ze();function Uu(n){var e=this.__data__,t=Ku(e,n);return t<0?void 0:e[t][1]}Lr.exports=Uu});var qr=m((Gf,_r)=>{var Wu=ze();function Vu(n){return Wu(this.__data__,n)>-1}_r.exports=Vu});var jr=m((zf,Mr)=>{var Hu=ze();function Gu(n,e){var t=this.__data__,r=Hu(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}Mr.exports=Gu});var Ur=m((Yf,Kr)=>{var zu=Or(),Yu=Nr(),Ju=$r(),Xu=qr(),Qu=jr();function Oe(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Oe.prototype.clear=zu;Oe.prototype.delete=Yu;Oe.prototype.get=Ju;Oe.prototype.has=Xu;Oe.prototype.set=Qu;Kr.exports=Oe});var Vr=m((Jf,Wr)=>{var Zu=mt(),ec=ft(),tc=Zu(ec,"Map");Wr.exports=tc});var zr=m((Xf,Gr)=>{var Hr=Tr(),nc=Ur(),rc=Vr();function ic(){this.size=0,this.__data__={hash:new Hr,map:new(rc||nc),string:new Hr}}Gr.exports=ic});var Jr=m((Qf,Yr)=>{function sc(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}Yr.exports=sc});var Ye=m((Zf,Xr)=>{var oc=Jr();function ac(n,e){var t=n.__data__;return oc(e)?t[typeof e=="string"?"string":"hash"]:t.map}Xr.exports=ac});var Zr=m((ep,Qr)=>{var uc=Ye();function cc(n){var e=uc(this,n).delete(n);return this.size-=e?1:0,e}Qr.exports=cc});var ti=m((tp,ei)=>{var lc=Ye();function dc(n){return lc(this,n).get(n)}ei.exports=dc});var ri=m((np,ni)=>{var fc=Ye();function pc(n){return fc(this,n).has(n)}ni.exports=pc});var si=m((rp,ii)=>{var hc=Ye();function gc(n,e){var t=hc(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this}ii.exports=gc});var ai=m((ip,oi)=>{var mc=zr(),Dc=Zr(),yc=ti(),wc=ri(),Ec=si();function Be(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Be.prototype.clear=mc;Be.prototype.delete=Dc;Be.prototype.get=yc;Be.prototype.has=wc;Be.prototype.set=Ec;oi.exports=Be});var li=m((sp,ci)=>{var ui=ai(),Ac="Expected a function";function Ht(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(Ac);var t=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=t.cache;if(s.has(i))return s.get(i);var o=n.apply(this,r);return t.cache=s.set(i,o)||s,o};return t.cache=new(Ht.Cache||ui),t}Ht.Cache=ui;ci.exports=Ht});var fi=m((op,di)=>{var vc=li(),Cc=500;function bc(n){var e=vc(n,function(r){return t.size===Cc&&t.clear(),r}),t=e.cache;return e}di.exports=bc});var hi=m((ap,pi)=>{var Fc=fi(),xc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sc=/\\(\\)?/g,kc=Fc(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(xc,function(t,r,i,s){e.push(i?s.replace(Sc,"$1"):r||t)}),e});pi.exports=kc});var mi=m((up,gi)=>{function Tc(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t<r;)i[t]=e(n[t],t,n);return i}gi.exports=Tc});var vi=m((cp,Ai)=>{var Di=pt(),Pc=mi(),Oc=dt(),Bc=ht(),Ic=1/0,yi=Di?Di.prototype:void 0,wi=yi?yi.toString:void 0;function Ei(n){if(typeof n=="string")return n;if(Oc(n))return Pc(n,Ei)+"";if(Bc(n))return wi?wi.call(n):"";var e=n+"";return e=="0"&&1/n==-Ic?"-0":e}Ai.exports=Ei});var bi=m((lp,Ci)=>{var Rc=vi();function Nc(n){return n==null?"":Rc(n)}Ci.exports=Nc});var Gt=m((dp,Fi)=>{var Lc=dt(),$c=er(),_c=hi(),qc=bi();function Mc(n,e){return Lc(n)?n:$c(n,e)?[n]:_c(qc(n))}Fi.exports=Mc});var zt=m((fp,xi)=>{var jc=ht(),Kc=1/0;function Uc(n){if(typeof n=="string"||jc(n))return n;var e=n+"";return e=="0"&&1/n==-Kc?"-0":e}xi.exports=Uc});var ki=m((pp,Si)=>{var Wc=Gt(),Vc=zt();function Hc(n,e){e=Wc(e,n);for(var t=0,r=e.length;n!=null&&t<r;)n=n[Vc(e[t++])];return t&&t==r?n:void 0}Si.exports=Hc});var Pi=m((hp,Ti)=>{var Gc=ki();function zc(n,e,t){var r=n==null?void 0:Gc(n,e);return r===void 0?t:r}Ti.exports=zc});var Bi=m((gp,Oi)=>{var Yc=mt(),Jc=(function(){try{var n=Yc(Object,"defineProperty");return n({},"",{}),n}catch{}})();Oi.exports=Jc});var Ni=m((mp,Ri)=>{var Ii=Bi();function Xc(n,e,t){e=="__proto__"&&Ii?Ii(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}Ri.exports=Xc});var $i=m((Dp,Li)=>{var Qc=Ni(),Zc=Vt(),el=Object.prototype,tl=el.hasOwnProperty;function nl(n,e,t){var r=n[e];(!(tl.call(n,e)&&Zc(r,t))||t===void 0&&!(e in n))&&Qc(n,e,t)}Li.exports=nl});var qi=m((yp,_i)=>{var rl=9007199254740991,il=/^(?:0|[1-9]\d*)$/;function sl(n,e){var t=typeof n;return e=e??rl,!!e&&(t=="number"||t!="symbol"&&il.test(n))&&n>-1&&n%1==0&&n<e}_i.exports=sl});var Ki=m((wp,ji)=>{var ol=$i(),al=Gt(),ul=qi(),Mi=gt(),cl=zt();function ll(n,e,t,r){if(!Mi(n))return n;e=al(e,n);for(var i=-1,s=e.length,o=s-1,u=n;u!=null&&++i<s;){var d=cl(e[i]),f=t;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(i!=o){var p=u[d];f=r?r(p,d,u):void 0,f===void 0&&(f=Mi(p)?p:ul(e[i+1])?[]:{})}ol(u,d,f),u=u[d]}return n}ji.exports=ll});var Wi=m((Ep,Ui)=>{var dl=Ki();function fl(n,e,t){return n==null?n:dl(n,e,t)}Ui.exports=fl});var Hi=m((Ap,Vi)=>{"use strict";Vi.exports=n=>encodeURIComponent(n).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var Xi=m((vp,Ji)=>{"use strict";var Yi="%[a-f0-9]{2}",Gi=new RegExp("("+Yi+")|([^%]+?)","gi"),zi=new RegExp("("+Yi+")+","gi");function Yt(n,e){try{return[decodeURIComponent(n.join(""))]}catch{}if(n.length===1)return n;e=e||1;var t=n.slice(0,e),r=n.slice(e);return Array.prototype.concat.call([],Yt(t),Yt(r))}function pl(n){try{return decodeURIComponent(n)}catch{for(var e=n.match(Gi)||[],t=1;t<e.length;t++)n=Yt(e,t).join(""),e=n.match(Gi)||[];return n}}function hl(n){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=zi.exec(n);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var r=pl(t[0]);r!==t[0]&&(e[t[0]]=r)}t=zi.exec(n)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var o=i[s];n=n.replace(new RegExp(o,"g"),e[o])}return n}Ji.exports=function(n){if(typeof n!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof n+"`");try{return n=n.replace(/\+/g," "),decodeURIComponent(n)}catch{return hl(n)}}});var Zi=m((Cp,Qi)=>{"use strict";Qi.exports=(n,e)=>{if(!(typeof n=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[n];let t=n.indexOf(e);return t===-1?[n]:[n.slice(0,t),n.slice(t+e.length)]}});var ts=m((bp,es)=>{"use strict";es.exports=function(n,e){for(var t={},r=Object.keys(n),i=Array.isArray(e),s=0;s<r.length;s++){var o=r[s],u=n[o];(i?e.indexOf(o)!==-1:e(o,u,n))&&(t[o]=u)}return t}});var cs=m(J=>{"use strict";var gl=Hi(),ml=Xi(),rs=Zi(),Dl=ts(),yl=n=>n==null;function wl(n){switch(n.arrayFormat){case"index":return e=>(t,r)=>{let i=t.length;return r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?t:r===null?[...t,[j(e,n),"[",i,"]"].join("")]:[...t,[j(e,n),"[",j(i,n),"]=",j(r,n)].join("")]};case"bracket":return e=>(t,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?t:r===null?[...t,[j(e,n),"[]"].join("")]:[...t,[j(e,n),"[]=",j(r,n)].join("")];case"comma":case"separator":return e=>(t,r)=>r==null||r.length===0?t:t.length===0?[[j(e,n),"=",j(r,n)].join("")]:[[t,j(r,n)].join(n.arrayFormatSeparator)];default:return e=>(t,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?t:r===null?[...t,j(e,n)]:[...t,[j(e,n),"=",j(r,n)].join("")]}}function El(n){let e;switch(n.arrayFormat){case"index":return(t,r,i)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){i[t]=r;return}i[t]===void 0&&(i[t]={}),i[t][e[1]]=r};case"bracket":return(t,r,i)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){i[t]=r;return}if(i[t]===void 0){i[t]=[r];return}i[t]=[].concat(i[t],r)};case"comma":case"separator":return(t,r,i)=>{let s=typeof r=="string"&&r.includes(n.arrayFormatSeparator),o=typeof r=="string"&&!s&&Ee(r,n).includes(n.arrayFormatSeparator);r=o?Ee(r,n):r;let u=s||o?r.split(n.arrayFormatSeparator).map(d=>Ee(d,n)):r===null?r:Ee(r,n);i[t]=u};default:return(t,r,i)=>{if(i[t]===void 0){i[t]=r;return}i[t]=[].concat(i[t],r)}}}function is(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function j(n,e){return e.encode?e.strict?gl(n):encodeURIComponent(n):n}function Ee(n,e){return e.decode?ml(n):n}function ss(n){return Array.isArray(n)?n.sort():typeof n=="object"?ss(Object.keys(n)).sort((e,t)=>Number(e)-Number(t)).map(e=>n[e]):n}function os(n){let e=n.indexOf("#");return e!==-1&&(n=n.slice(0,e)),n}function Al(n){let e="",t=n.indexOf("#");return t!==-1&&(e=n.slice(t)),e}function as(n){n=os(n);let e=n.indexOf("?");return e===-1?"":n.slice(e+1)}function ns(n,e){return e.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):e.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function us(n,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),is(e.arrayFormatSeparator);let t=El(e),r=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return r;for(let i of n.split("&")){if(i==="")continue;let[s,o]=rs(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator"].includes(e.arrayFormat)?o:Ee(o,e),t(Ee(s,e),o,r)}for(let i of Object.keys(r)){let s=r[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=ns(s[o],e);else r[i]=ns(s,e)}return e.sort===!1?r:(e.sort===!0?Object.keys(r).sort():Object.keys(r).sort(e.sort)).reduce((i,s)=>{let o=r[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=ss(o):i[s]=o,i},Object.create(null))}J.extract=as;J.parse=us;J.stringify=(n,e)=>{if(!n)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),is(e.arrayFormatSeparator);let t=o=>e.skipNull&&yl(n[o])||e.skipEmptyString&&n[o]==="",r=wl(e),i={};for(let o of Object.keys(n))t(o)||(i[o]=n[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let u=n[o];return u===void 0?"":u===null?j(o,e):Array.isArray(u)?u.reduce(r(o),[]).join("&"):j(o,e)+"="+j(u,e)}).filter(o=>o.length>0).join("&")};J.parseUrl=(n,e)=>{e=Object.assign({decode:!0},e);let[t,r]=rs(n,"#");return Object.assign({url:t.split("?")[0]||"",query:us(as(n),e)},e&&e.parseFragmentIdentifier&&r?{fragmentIdentifier:Ee(r,e)}:{})};J.stringifyUrl=(n,e)=>{e=Object.assign({encode:!0,strict:!0},e);let t=os(n.url).split("?")[0]||"",r=J.extract(n.url),i=J.parse(r,{sort:!1}),s=Object.assign(i,n.query),o=J.stringify(s,e);o&&(o=`?${o}`);let u=Al(n.url);return n.fragmentIdentifier&&(u=`#${j(n.fragmentIdentifier,e)}`),`${t}${o}${u}`};J.pick=(n,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0},t);let{url:r,query:i,fragmentIdentifier:s}=J.parseUrl(n,t);return J.stringifyUrl({url:r,query:Dl(i,e),fragmentIdentifier:s},t)};J.exclude=(n,e,t)=>{let r=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return J.pick(n,r,t)}});var ls=m((Jt,Xt)=>{(function(n,e){typeof Jt=="object"&&typeof Xt<"u"?Xt.exports=e():typeof define=="function"&&define.amd?define(e):n.JSON5=e()})(Jt,(function(){"use strict";function n(a,c){return c={exports:{}},a(c,c.exports),c.exports}var e=n(function(a){var c=a.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=c)}),t=n(function(a){var c=a.exports={version:"2.6.5"};typeof __e=="number"&&(__e=c)}),r=t.version,i=function(a){return typeof a=="object"?a!==null:typeof a=="function"},s=function(a){if(!i(a))throw TypeError(a+" is not an object!");return a},o=function(a){try{return!!a()}catch{return!0}},u=!o(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),d=e.document,f=i(d)&&i(d.createElement),p=function(a){return f?d.createElement(a):{}},v=!u&&!o(function(){return Object.defineProperty(p("div"),"a",{get:function(){return 7}}).a!=7}),y=function(a,c){if(!i(a))return a;var D,g;if(c&&typeof(D=a.toString)=="function"&&!i(g=D.call(a))||typeof(D=a.valueOf)=="function"&&!i(g=D.call(a))||!c&&typeof(D=a.toString)=="function"&&!i(g=D.call(a)))return g;throw TypeError("Can't convert object to primitive value")},T=Object.defineProperty,h=u?Object.defineProperty:function(c,D,g){if(s(c),D=y(D,!0),s(g),v)try{return T(c,D,g)}catch{}if("get"in g||"set"in g)throw TypeError("Accessors not supported!");return"value"in g&&(c[D]=g.value),c},w={f:h},P=function(a,c){return{enumerable:!(a&1),configurable:!(a&2),writable:!(a&4),value:c}},R=u?function(a,c,D){return w.f(a,c,P(1,D))}:function(a,c,D){return a[c]=D,a},$={}.hasOwnProperty,Ce=function(a,c){return $.call(a,c)},co=0,lo=Math.random(),fo=function(a){return"Symbol(".concat(a===void 0?"":a,")_",(++co+lo).toString(36))},po=!1,ho=n(function(a){var c="__core-js_shared__",D=e[c]||(e[c]={});(a.exports=function(g,A){return D[g]||(D[g]=A!==void 0?A:{})})("versions",[]).push({version:t.version,mode:po?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),kt=ho("native-function-to-string",Function.toString),go=n(function(a){var c=fo("src"),D="toString",g=(""+kt).split(D);t.inspectSource=function(A){return kt.call(A)},(a.exports=function(A,x,k,G){var _=typeof k=="function";_&&(Ce(k,"name")||R(k,"name",x)),A[x]!==k&&(_&&(Ce(k,c)||R(k,c,A[x]?""+A[x]:g.join(String(x)))),A===e?A[x]=k:G?A[x]?A[x]=k:R(A,x,k):(delete A[x],R(A,x,k)))})(Function.prototype,D,function(){return typeof this=="function"&&this[c]||kt.call(this)})}),mo=function(a){if(typeof a!="function")throw TypeError(a+" is not a function!");return a},cn=function(a,c,D){if(mo(a),c===void 0)return a;switch(D){case 1:return function(g){return a.call(c,g)};case 2:return function(g,A){return a.call(c,g,A)};case 3:return function(g,A,x){return a.call(c,g,A,x)}}return function(){return a.apply(c,arguments)}},Tt="prototype",V=function(a,c,D){var g=a&V.F,A=a&V.G,x=a&V.S,k=a&V.P,G=a&V.B,_=A?e:x?e[c]||(e[c]={}):(e[c]||{})[Tt],he=A?t:t[c]||(t[c]={}),be=he[Tt]||(he[Tt]={}),Z,ne,z,Fe;A&&(D=c);for(Z in D)ne=!g&&_&&_[Z]!==void 0,z=(ne?_:D)[Z],Fe=G&&ne?cn(z,e):k&&typeof z=="function"?cn(Function.call,z):z,_&&go(_,Z,z,a&V.U),he[Z]!=z&&R(he,Z,Fe),k&&be[Z]!=z&&(be[Z]=z)};e.core=t,V.F=1,V.G=2,V.S=4,V.P=8,V.B=16,V.W=32,V.U=64,V.R=128;var Le=V,Do=Math.ceil,yo=Math.floor,ln=function(a){return isNaN(a=+a)?0:(a>0?yo:Do)(a)},wo=function(a){if(a==null)throw TypeError("Can't call method on "+a);return a},Eo=function(a){return function(c,D){var g=String(wo(c)),A=ln(D),x=g.length,k,G;return A<0||A>=x?a?"":void 0:(k=g.charCodeAt(A),k<55296||k>56319||A+1===x||(G=g.charCodeAt(A+1))<56320||G>57343?a?g.charAt(A):k:a?g.slice(A,A+2):(k-55296<<10)+(G-56320)+65536)}},Ao=Eo(!1);Le(Le.P,"String",{codePointAt:function(c){return Ao(this,c)}});var Gd=t.String.codePointAt,vo=Math.max,Co=Math.min,bo=function(a,c){return a=ln(a),a<0?vo(a+c,0):Co(a,c)},dn=String.fromCharCode,fn=String.fromCodePoint;Le(Le.S+Le.F*(!!fn&&fn.length!=1),"String",{fromCodePoint:function(c){for(var D=arguments,g=[],A=arguments.length,x=0,k;A>x;){if(k=+D[x++],bo(k,1114111)!==k)throw RangeError(k+" is not a valid code point");g.push(k<65536?dn(k):dn(((k-=65536)>>10)+55296,k%1024+56320))}return g.join("")}});var zd=t.String.fromCodePoint,Fo=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,xo=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,So=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Pt={Space_Separator:Fo,ID_Start:xo,ID_Continue:So},L={isSpaceSeparator:function(c){return typeof c=="string"&&Pt.Space_Separator.test(c)},isIdStartChar:function(c){return typeof c=="string"&&(c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="$"||c==="_"||Pt.ID_Start.test(c))},isIdContinueChar:function(c){return typeof c=="string"&&(c>="a"&&c<="z"||c>="A"&&c<="Z"||c>="0"&&c<="9"||c==="$"||c==="_"||c==="\u200C"||c==="\u200D"||Pt.ID_Continue.test(c))},isDigit:function(c){return typeof c=="string"&&/[0-9]/.test(c)},isHexDigit:function(c){return typeof c=="string"&&/[0-9A-Fa-f]/.test(c)}},Ot,H,re,tt,ae,Q,q,Bt,$e,ko=function(c,D){Ot=String(c),H="start",re=[],tt=0,ae=1,Q=0,q=void 0,Bt=void 0,$e=void 0;do q=To(),Bo[H]();while(q.type!=="eof");return typeof D=="function"?It({"":$e},"",D):$e};function It(a,c,D){var g=a[c];if(g!=null&&typeof g=="object")if(Array.isArray(g))for(var A=0;A<g.length;A++){var x=String(A),k=It(g,x,D);k===void 0?delete g[x]:Object.defineProperty(g,x,{value:k,writable:!0,enumerable:!0,configurable:!0})}else for(var G in g){var _=It(g,G,D);_===void 0?delete g[G]:Object.defineProperty(g,G,{value:_,writable:!0,enumerable:!0,configurable:!0})}return D.call(a,c,g)}var F,C,_e,ie,S;function To(){for(F="default",C="",_e=!1,ie=1;;){S=se();var a=pn[F]();if(a)return a}}function se(){if(Ot[tt])return String.fromCodePoint(Ot.codePointAt(tt))}function l(){var a=se();return a===`
2
+ `?(ae++,Q=0):a?Q+=a.length:Q++,a&&(tt+=a.length),a}var pn={default:function(){switch(S){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
3
+ `:case"\r":case"\u2028":case"\u2029":l();return;case"/":l(),F="comment";return;case void 0:return l(),B("eof")}if(L.isSpaceSeparator(S)){l();return}return pn[H]()},comment:function(){switch(S){case"*":l(),F="multiLineComment";return;case"/":l(),F="singleLineComment";return}throw I(l())},multiLineComment:function(){switch(S){case"*":l(),F="multiLineCommentAsterisk";return;case void 0:throw I(l())}l()},multiLineCommentAsterisk:function(){switch(S){case"*":l();return;case"/":l(),F="default";return;case void 0:throw I(l())}l(),F="multiLineComment"},singleLineComment:function(){switch(S){case`
4
+ `:case"\r":case"\u2028":case"\u2029":l(),F="default";return;case void 0:return l(),B("eof")}l()},value:function(){switch(S){case"{":case"[":return B("punctuator",l());case"n":return l(),fe("ull"),B("null",null);case"t":return l(),fe("rue"),B("boolean",!0);case"f":return l(),fe("alse"),B("boolean",!1);case"-":case"+":l()==="-"&&(ie=-1),F="sign";return;case".":C=l(),F="decimalPointLeading";return;case"0":C=l(),F="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":C=l(),F="decimalInteger";return;case"I":return l(),fe("nfinity"),B("numeric",1/0);case"N":return l(),fe("aN"),B("numeric",NaN);case'"':case"'":_e=l()==='"',C="",F="string";return}throw I(l())},identifierNameStartEscape:function(){if(S!=="u")throw I(l());l();var c=Rt();switch(c){case"$":case"_":break;default:if(!L.isIdStartChar(c))throw hn();break}C+=c,F="identifierName"},identifierName:function(){switch(S){case"$":case"_":case"\u200C":case"\u200D":C+=l();return;case"\\":l(),F="identifierNameEscape";return}if(L.isIdContinueChar(S)){C+=l();return}return B("identifier",C)},identifierNameEscape:function(){if(S!=="u")throw I(l());l();var c=Rt();switch(c){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!L.isIdContinueChar(c))throw hn();break}C+=c,F="identifierName"},sign:function(){switch(S){case".":C=l(),F="decimalPointLeading";return;case"0":C=l(),F="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":C=l(),F="decimalInteger";return;case"I":return l(),fe("nfinity"),B("numeric",ie*(1/0));case"N":return l(),fe("aN"),B("numeric",NaN)}throw I(l())},zero:function(){switch(S){case".":C+=l(),F="decimalPoint";return;case"e":case"E":C+=l(),F="decimalExponent";return;case"x":case"X":C+=l(),F="hexadecimal";return}return B("numeric",ie*0)},decimalInteger:function(){switch(S){case".":C+=l(),F="decimalPoint";return;case"e":case"E":C+=l(),F="decimalExponent";return}if(L.isDigit(S)){C+=l();return}return B("numeric",ie*Number(C))},decimalPointLeading:function(){if(L.isDigit(S)){C+=l(),F="decimalFraction";return}throw I(l())},decimalPoint:function(){switch(S){case"e":case"E":C+=l(),F="decimalExponent";return}if(L.isDigit(S)){C+=l(),F="decimalFraction";return}return B("numeric",ie*Number(C))},decimalFraction:function(){switch(S){case"e":case"E":C+=l(),F="decimalExponent";return}if(L.isDigit(S)){C+=l();return}return B("numeric",ie*Number(C))},decimalExponent:function(){switch(S){case"+":case"-":C+=l(),F="decimalExponentSign";return}if(L.isDigit(S)){C+=l(),F="decimalExponentInteger";return}throw I(l())},decimalExponentSign:function(){if(L.isDigit(S)){C+=l(),F="decimalExponentInteger";return}throw I(l())},decimalExponentInteger:function(){if(L.isDigit(S)){C+=l();return}return B("numeric",ie*Number(C))},hexadecimal:function(){if(L.isHexDigit(S)){C+=l(),F="hexadecimalInteger";return}throw I(l())},hexadecimalInteger:function(){if(L.isHexDigit(S)){C+=l();return}return B("numeric",ie*Number(C))},string:function(){switch(S){case"\\":l(),C+=Po();return;case'"':if(_e)return l(),B("string",C);C+=l();return;case"'":if(!_e)return l(),B("string",C);C+=l();return;case`
5
+ `:case"\r":throw I(l());case"\u2028":case"\u2029":Io(S);break;case void 0:throw I(l())}C+=l()},start:function(){switch(S){case"{":case"[":return B("punctuator",l())}F="value"},beforePropertyName:function(){switch(S){case"$":case"_":C=l(),F="identifierName";return;case"\\":l(),F="identifierNameStartEscape";return;case"}":return B("punctuator",l());case'"':case"'":_e=l()==='"',F="string";return}if(L.isIdStartChar(S)){C+=l(),F="identifierName";return}throw I(l())},afterPropertyName:function(){if(S===":")return B("punctuator",l());throw I(l())},beforePropertyValue:function(){F="value"},afterPropertyValue:function(){switch(S){case",":case"}":return B("punctuator",l())}throw I(l())},beforeArrayValue:function(){if(S==="]")return B("punctuator",l());F="value"},afterArrayValue:function(){switch(S){case",":case"]":return B("punctuator",l())}throw I(l())},end:function(){throw I(l())}};function B(a,c){return{type:a,value:c,line:ae,column:Q}}function fe(a){for(var c=0,D=a;c<D.length;c+=1){var g=D[c],A=se();if(A!==g)throw I(l());l()}}function Po(){var a=se();switch(a){case"b":return l(),"\b";case"f":return l(),"\f";case"n":return l(),`
6
+ `;case"r":return l(),"\r";case"t":return l()," ";case"v":return l(),"\v";case"0":if(l(),L.isDigit(se()))throw I(l());return"\0";case"x":return l(),Oo();case"u":return l(),Rt();case`
7
+ `:case"\u2028":case"\u2029":return l(),"";case"\r":return l(),se()===`
8
+ `&&l(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw I(l());case void 0:throw I(l())}return l()}function Oo(){var a="",c=se();if(!L.isHexDigit(c)||(a+=l(),c=se(),!L.isHexDigit(c)))throw I(l());return a+=l(),String.fromCodePoint(parseInt(a,16))}function Rt(){for(var a="",c=4;c-- >0;){var D=se();if(!L.isHexDigit(D))throw I(l());a+=l()}return String.fromCodePoint(parseInt(a,16))}var Bo={start:function(){if(q.type==="eof")throw pe();Nt()},beforePropertyName:function(){switch(q.type){case"identifier":case"string":Bt=q.value,H="afterPropertyName";return;case"punctuator":nt();return;case"eof":throw pe()}},afterPropertyName:function(){if(q.type==="eof")throw pe();H="beforePropertyValue"},beforePropertyValue:function(){if(q.type==="eof")throw pe();Nt()},beforeArrayValue:function(){if(q.type==="eof")throw pe();if(q.type==="punctuator"&&q.value==="]"){nt();return}Nt()},afterPropertyValue:function(){if(q.type==="eof")throw pe();switch(q.value){case",":H="beforePropertyName";return;case"}":nt()}},afterArrayValue:function(){if(q.type==="eof")throw pe();switch(q.value){case",":H="beforeArrayValue";return;case"]":nt()}},end:function(){}};function Nt(){var a;switch(q.type){case"punctuator":switch(q.value){case"{":a={};break;case"[":a=[];break}break;case"null":case"boolean":case"numeric":case"string":a=q.value;break}if($e===void 0)$e=a;else{var c=re[re.length-1];Array.isArray(c)?c.push(a):Object.defineProperty(c,Bt,{value:a,writable:!0,enumerable:!0,configurable:!0})}if(a!==null&&typeof a=="object")re.push(a),Array.isArray(a)?H="beforeArrayValue":H="beforePropertyName";else{var D=re[re.length-1];D==null?H="end":Array.isArray(D)?H="afterArrayValue":H="afterPropertyValue"}}function nt(){re.pop();var a=re[re.length-1];a==null?H="end":Array.isArray(a)?H="afterArrayValue":H="afterPropertyValue"}function I(a){return rt(a===void 0?"JSON5: invalid end of input at "+ae+":"+Q:"JSON5: invalid character '"+gn(a)+"' at "+ae+":"+Q)}function pe(){return rt("JSON5: invalid end of input at "+ae+":"+Q)}function hn(){return Q-=5,rt("JSON5: invalid identifier character at "+ae+":"+Q)}function Io(a){console.warn("JSON5: '"+gn(a)+"' in strings is not valid ECMAScript; consider escaping")}function gn(a){var c={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(c[a])return c[a];if(a<" "){var D=a.charCodeAt(0).toString(16);return"\\x"+("00"+D).substring(D.length)}return a}function rt(a){var c=new SyntaxError(a);return c.lineNumber=ae,c.columnNumber=Q,c}var Ro=function(c,D,g){var A=[],x="",k,G,_="",he;if(D!=null&&typeof D=="object"&&!Array.isArray(D)&&(g=D.space,he=D.quote,D=D.replacer),typeof D=="function")G=D;else if(Array.isArray(D)){k=[];for(var be=0,Z=D;be<Z.length;be+=1){var ne=Z[be],z=void 0;typeof ne=="string"?z=ne:(typeof ne=="number"||ne instanceof String||ne instanceof Number)&&(z=String(ne)),z!==void 0&&k.indexOf(z)<0&&k.push(z)}}return g instanceof Number?g=Number(g):g instanceof String&&(g=String(g)),typeof g=="number"?g>0&&(g=Math.min(10,Math.floor(g)),_=" ".substr(0,g)):typeof g=="string"&&(_=g.substr(0,10)),Fe("",{"":c});function Fe(O,U){var b=U[O];switch(b!=null&&(typeof b.toJSON5=="function"?b=b.toJSON5(O):typeof b.toJSON=="function"&&(b=b.toJSON(O))),G&&(b=G.call(U,O,b)),b instanceof Number?b=Number(b):b instanceof String?b=String(b):b instanceof Boolean&&(b=b.valueOf()),b){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof b=="string")return it(b,!1);if(typeof b=="number")return String(b);if(typeof b=="object")return Array.isArray(b)?Mo(b):_o(b)}function it(O){for(var U={"'":.1,'"':.2},b={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},M="",ee=0;ee<O.length;ee++){var W=O[ee];switch(W){case"'":case'"':U[W]++,M+=W;continue;case"\0":if(L.isDigit(O[ee+1])){M+="\\x00";continue}}if(b[W]){M+=b[W];continue}if(W<" "){var ge=W.charCodeAt(0).toString(16);M+="\\x"+("00"+ge).substring(ge.length);continue}M+=W}var oe=he||Object.keys(U).reduce(function(ue,me){return U[ue]<U[me]?ue:me});return M=M.replace(new RegExp(oe,"g"),b[oe]),oe+M+oe}function _o(O){if(A.indexOf(O)>=0)throw TypeError("Converting circular structure to JSON5");A.push(O);var U=x;x=x+_;for(var b=k||Object.keys(O),M=[],ee=0,W=b;ee<W.length;ee+=1){var ge=W[ee],oe=Fe(ge,O);if(oe!==void 0){var ue=qo(ge)+":";_!==""&&(ue+=" "),ue+=oe,M.push(ue)}}var me;if(M.length===0)me="{}";else{var st;if(_==="")st=M.join(","),me="{"+st+"}";else{var jo=`,
9
+ `+x;st=M.join(jo),me=`{
10
+ `+x+st+`,
11
+ `+U+"}"}}return A.pop(),x=U,me}function qo(O){if(O.length===0)return it(O,!0);var U=String.fromCodePoint(O.codePointAt(0));if(!L.isIdStartChar(U))return it(O,!0);for(var b=U.length;b<O.length;b++)if(!L.isIdContinueChar(String.fromCodePoint(O.codePointAt(b))))return it(O,!0);return O}function Mo(O){if(A.indexOf(O)>=0)throw TypeError("Converting circular structure to JSON5");A.push(O);var U=x;x=x+_;for(var b=[],M=0;M<O.length;M++){var ee=Fe(String(M),O);b.push(ee!==void 0?ee:"null")}var W;if(b.length===0)W="[]";else if(_===""){var ge=b.join(",");W="["+ge+"]"}else{var oe=`,
12
+ `+x,ue=b.join(oe);W=`[
13
+ `+x+ue+`,
14
+ `+U+"]"}return A.pop(),x=U,W}},No={parse:ko,stringify:Ro},Lo=No,$o=Lo;return $o}))});var gs=m((Sp,hs)=>{var Je;typeof window<"u"?Je=window:typeof global<"u"?Je=global:typeof self<"u"?Je=self:Je={};hs.exports=Je});async function De(n=1){let e=performance.now();for(let t=n;t>0;t--)e=await new Promise(r=>requestAnimationFrame(r));return e}function ot(n,e,t){return Math.min(t,Math.max(e,n))}var Lt=[["section","ui-section"],["overview","epic-overview"],["item","epic-item"],["field","epic-field"],["update","epic-update[at]"],["summary","epic-summary"],["prose","epic-section > p, epic-overview > p"],["markdown","ui-markdown"],["table","ui-table, table"],["aside","ui-accordion.spell-aside, epic-aside"],["code","ui-accordion.spell-code, ui-code, epic-code, pre"],["message","ui-message"],["cards","ui-cards, epic-list"],["steps","ui-steps"],["list","ui-list, ul, ol"]],zo="ui-section[id], epic-overview[id], epic-section[id], epic-phase[id], epic-item[id]",Me="page";var Yo=Lt.map(([,n])=>n).join(", "),Jo="epic-update[at]",Xo=["section","overview"],Qo=Lt.filter(([n])=>!Xo.includes(n)).map(([,n])=>n).join(", "),Dn="spell-notes, [data-spell-added], .spell-page-head, ui-sticky.spell-h1, .site-masthead, nav, footer",Zo="epic-event, epic-commit, epic-updated[slot], [slot='status']",ea=/^(.+)#([a-z][a-z-]*)-(\d+)$/;function je(n){return Lt.find(([,e])=>n.matches(e))?.[0]}function Ue(n){return Array.from(n.querySelectorAll(Yo)).filter(e=>{if(e.closest(Dn)||e.closest(Zo))return!1;let t=e.parentElement?.closest(Qo);return!t||!n.contains(t)||e.matches(Jo)})}function yn(n,e){let t=new Set(e);for(let r=n.nodeType===1?n:n.parentElement;r;r=r.parentElement??We(r))if(t.has(r))return r;return null}function We(n){return n.getRootNode().host}function $t(n,e){for(let t=e;t;t=We(t))if(n.contains(t))return!0;return!1}function Ve(n){return n.querySelector("ui-sticky.spell-h1")??n.querySelector(".spell-page-head")??n.querySelector(":scope > .site-masthead")}function Ke(n,e){let t=n.parentElement?.closest(zo);return t&&e.contains(t)?t:null}function wn(n,e,t=Ue(e)){if(n.id)return n.id;let r=je(n),i=Ke(n,e),s=t.filter(o=>je(o)===r&&Ke(o,e)===i);return`${i?.id??Me}#${r}-${s.indexOf(n)+1}`}function _t(n){return n.matches("ui-section, epic-overview, epic-item, epic-section, epic-phase")?qt(n):ta(n).slice(0,80).trim()}function qt(n){let e=Array.from(n.children).find(t=>/^(label|title)$/.test(t.getAttribute("slot")));return at(n.getAttribute("label")??n.getAttribute("title")??e?.textContent??"")}function En(n,{anchor:e,excerpt:t=""},r=Ue(n)){if(e===Me)return{block:Ve(n),exact:!0};let i=n.ownerDocument,s=ea.exec(e);if(!s){let w=i.getElementById(e);return w&&n.contains(w)?{block:w,exact:!0}:{block:null,exact:!1}}let[,o,u,d]=s,f=o===Me?null:i.getElementById(o),p=r.filter(w=>je(w)===u),v=p.filter(w=>Ke(w,n)===f),y=v[Number(d)-1],T=w=>!!t&&_t(w)===t;if(y&&(!t||T(y)))return{block:y,exact:!0};let h=v.find(T)??p.find(T)??y;return h?{block:h,exact:!1}:{block:f&&n.contains(f)?f:null,exact:!1}}function ta(n){return at(Mt(n).map(e=>e.text).join(""))}function An(n,e,t){let r="";for(let i of Mt(n)){if(i.node===e)return at(`${r}${i.text.slice(0,t)}x`).length-1;r+=i.text}return 0}function vn(n,e,t=0){let r=at(e);if(!r)return null;let i=[],s=!0;for(let p of Mt(n))for(let v=0;v<p.text.length;v++){let y=/\s/.test(p.text[v]);y&&s||(i.push({char:y?" ":p.text[v],node:p.node,at:v}),s=y)}let o=i.map(p=>p.char).join(""),u=-1;for(let p=o.indexOf(r);p>=0;p=o.indexOf(r,p+1))(u<0||Math.abs(p-t)<Math.abs(u-t))&&(u=p);if(u<0)return null;let d=i[u],f=i[u+r.length-1];return{start:[d.node,d.at],end:[f.node,f.at+1]}}function Mt(n){let e=[],t=r=>{if(r.nodeType===3)return e.push({node:r,text:r.textContent});if(r.nodeType!==1||r!==n&&r.matches(Dn))return;let i=r.localName==="ui-markdown"?r.shadowRoot?.querySelector('[part~="body"]'):null;for(let s of(i??r).childNodes)t(s);e.push({node:null,text:" "})};return t(n),e}function at(n){return String(n??"").replace(/\s+/g," ").trim()}function Cn(n,{keep:e=""}={}){let t=e.normalize("NFC").toLowerCase();return n.normalize("NFC").replace(/\P{ASCII}/gu,r=>t.includes(r.toLowerCase())?r:r.normalize("NFD").replace(/\p{M}+/gu,""))}var xe=class{values=new Map;get length(){return this.values.size}key(e){return[...this.values.keys()][e]??null}getItem(e){return this.values.get(e)??null}setItem(e,t){this.values.set(e,String(t))}removeItem(e){this.values.delete(e)}};var Se=class{async load(e,t){return this.read(e,t)}async save(e,t,r){r===void 0?this.remove(e,t):this.write(e,t,r)}async loadKeys(e){return this.keys(e)}async update(e,t,r){let i=r(await this.load(e,t));return await this.save(e,t,i),i}async removeUnder(e,t){for(let r of this.keys(e))r.startsWith(t)&&this.remove(e,r)}};var bn=/^(?:["{[]|-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$|true$|false$|null$)/;function Fn(n){if(typeof n=="string"&&!bn.test(n))return n;let e=JSON.stringify(n);if(e===void 0)throw new TypeError(`textForValue(): can't keep a ${typeof n} as text; pass plain data`);return e}function xn(n){return bn.test(n)?JSON.parse(n):n}var na=new Map([["number",0],["text",""],["choice",!1]]),ra=new Map([["number","number"],["text","string"],["choice","boolean"]]);function jt(n){if(!n)return;if(n.default!==void 0)return n.default;let e=ut(n);return e?.length?e[0]:n.type===void 0?void 0:na.get(n.type)}function Kt(n,e){if(!n)return!0;let t=ut(n);if(t&&!t.includes(e))return!1;let r=n.type===void 0?void 0:ra.get(n.type);return r===void 0||typeof e===r}function ut(n){return typeof n.oneOf=="function"?n.oneOf():n.oneOf}var we=class extends Se{isAsync=!1;description;constructor({storage:e,description:t}){super(),this.findStorage=typeof e=="function"?e:()=>e,this.description=t}read(e,t){let r=this.attempt("read",e,t,i=>i.getItem(ye(e,t)));if(r!=null)try{return xn(r)}catch(i){console.error(`StoragePlace.read(): \`${ye(e,t)}\` holds no value it can read; answering none:`,r),console.error(i);return}}write(e,t,r){let i=Fn(r);this.attempt("write",e,t,s=>s.setItem(ye(e,t),i))}remove(e,t){this.attempt("remove",e,t,r=>r.removeItem(ye(e,t)))}keys(e){let t=`${e}:`;return this.attempt("keys",e,"",i=>{let s=[];for(let o=0;o<i.length;o++){let u=i.key(o);u?.startsWith(t)&&s.push(u.slice(t.length))}return s})??[]}moveText(e,t,r){this.attempt("moveText",t,r,i=>{let s=i.getItem(e);s!==null&&(i.getItem(ye(t,r))===null&&i.setItem(ye(t,r),s),i.removeItem(e))})}get storage(){return this._storage??=this.storageOrMemory()}_storage;findStorage;storageOrMemory(){try{let e=this.findStorage();if(e)return e}catch(e){console.error(`StoragePlace: ${this.description} is blocked; keeping its values in memory for this visit:`),console.error(e)}return new xe}attempt(e,t,r,i){try{return i(this.storage)}catch(s){console.error(`StoragePlace.${e}(): ${this.description} refused \`${ye(t,r)}\`:`),console.error(s);return}}};function ye(n,e){return`${n}:${e}`}var Y=class n{name;place;constructor(e,{place:t="local"}={}){if(!e||e.includes(":"))throw new TypeError(`new PrefStore(): \`${e}\` can't name a store; give it a name with no colon, e.g. "spell-site"`);this.name=e,this.place=kn(t)}static splitKey(e){let t=e.indexOf(":");if(t<1)throw new TypeError(`PrefStore.splitKey(): \`${e}\` has no store; name it "<store>:<key>"`);return[e.slice(0,t),e.slice(t+1)]}static getAt(e,t="local"){let[r,i]=n.splitKey(e);return new n(r,{place:t}).get(i)}static moveOldKey(e,t,r="local"){let[i,s]=n.splitKey(t);kn(r).moveText(e,i,s)}static setAt(e,t,r="local"){let[i,s]=n.splitKey(e);new n(i,{place:r}).set(s,t)}declare(e,t){return this.checkKey("declare",e),this.declared.set(e,t),this}defaultFor(e){return jt(this.declared.get(e))}has(e){return this.checkQuickRead("has",e),this.place.read(this.name,e)!==void 0}get(e,t){return this.checkQuickRead("get",e),this.keptOrDefault("get",e,this.place.read(this.name,e),t)}set(e,t){return this.checkWrite("set",e,t),t===void 0?this.place.remove(this.name,e):this.place.write(this.name,e,t),t}forget(e){this.set(e,void 0)}keysUnder(e=""){return this.checkQuickRead("keysUnder"),this.place.keys(this.name).filter(t=>t.startsWith(e))}forgetUnder(e){return this.place.removeUnder(this.name,e)}forgetAll(){return this.forgetUnder("")}rename(e,t){this.checkQuickRead("rename",e),this.checkKey("rename",t);let r=this.place.read(this.name,e);return r===void 0?this:(this.place.read(this.name,t)===void 0&&this.place.write(this.name,t,r),this.place.remove(this.name,e),this)}async load(e,t){return this.checkKey("load",e),this.keptOrDefault("load",e,await this.place.load(this.name,e),t)}async save(e,t){return this.checkWrite("save",e,t),await this.place.save(this.name,e,t),t}update(e,t){this.checkKey("update",e);let i=(this.updating.get(e)??Promise.resolve()).then(async()=>await this.place.update(this.name,e,o=>{let u=t(this.keptOrDefault("update",e,o,void 0));return this.checkWrite("update",e,u),u})),s=i.then(()=>{},()=>{});return this.updating.set(e,s),s.then(()=>{this.updating.get(e)===s&&this.updating.delete(e)}),i}async loadKeysUnder(e=""){return(await this.place.loadKeys(this.name)).filter(t=>t.startsWith(e))}keptOrDefault(e,t,r,i){let s=this.declared.get(t);if(r!==void 0){if(Kt(s,r))return r;console.error(`PrefStore.${e}(): \`${this.name}:${t}\` isn't ${Tn(s)}; answering its default:`,r)}return i!==void 0?i:jt(s)}checkKey(e,t){if(!t)throw new TypeError(`PrefStore.${e}(): no key; pass the pref's name, e.g. "scheme"`)}checkQuickRead(e,t){if(t!==void 0&&this.checkKey(e,t),!!this.place.isAsync)throw new TypeError(`PrefStore.${e}(): \`${this.name}\` keeps its values in ${this.place.description}, which must be waited on; use \`load()\` or \`loadKeysUnder()\``)}checkWrite(e,t,r){this.checkKey(e,t);let i=this.declared.get(t);if(!(r===void 0||Kt(i,r)))throw new TypeError(`PrefStore.${e}(): \`${t}\` is ${Tn(i)}; not \`${Pn(r)}\``)}declared=new Map;updating=new Map},ia={local:{storage:()=>globalThis.localStorage,description:"the browser's storage"},session:{storage:()=>globalThis.sessionStorage,description:"the browser's per-tab storage"}},Sn=new Map;function kn(n){if(n instanceof Se)return n;if(n==="memory")return new we({storage:new xe,description:"memory"});let e=Sn.get(n);return e||Sn.set(n,e=new we(ia[n])),e}function Tn(n){let e=n&&ut(n);return e?`one of ${e.map(Pn).join(", ")}`:n?.type?`a ${n.type}`:"anything"}function Pn(n){return typeof n=="string"?n:typeof n=="object"&&JSON.stringify(n)||String(n)}function On(n=new Date){return`${n.getFullYear()}-${ct(n.getMonth()+1)}-${ct(n.getDate())}`}function ke(n=new Date){return`${ct(n.getHours())}:${ct(n.getMinutes())}`}function ct(n){return String(n).padStart(2,"0")}var Bn=/\/(?:packages\/docs\/content\/)?epics\/([^/]+)\/\1\.plan\.html$/,In=/\/sagas\/([^/]+)\/\1\.saga\.html$/;var Rn=4e3;var sa=oa()?"Airplane mode: queued for when you land (/airplane land)":"No Claude session is reviewing this doc: Send wakes one";function oa(){return typeof window<"u"&&!!window.SPELL_SERVER?.airplane}var Nn=/window\.SPELL_SERVER = (\{.*?\})<\/script>/;var aa=8*1024*1024;function lt(n){return(typeof n=="function"?n():n)??void 0}var Te=class extends Error{};Te.prototype.name="ServerWriteError";var ua="see my comments in its text: ",gf=new RegExp(`(?:^|\\n+)${ua}[^\\n]*$`);var vl=qe(Pi()),Cl=qe(Wi()),Es=qe(cs());var ds=qe(ls(),1);function fs(n,e="random text",t){try{return JSON.parse(n)}catch(r){let s=(r instanceof Error?r.message:String(r)).match(/at position (\d+)/);if(s){let o=parseInt(s[1],10),u=n.substring(0,o),d=Math.max(0,u.split(`
15
+ `).length-2);console.error(`Error parsing JSON near line ${d} of ${e}`);let f=Math.max(0,d-3),p=f+6;console.log(n.split(`
16
+ `).slice(f,p).join(`
17
+ `))}if(!t)throw r;return}}function ps(n,e="random text",t){try{return ds.default.parse(n)}catch(r){let s=(r instanceof Error?r.message:String(r)).match(/at position (\d+)/);if(s){let o=parseInt(s[1],10),u=n.substring(0,o),d=Math.max(0,u.split(`
18
+ `).length-2);console.error(`Error parsing JSON near line ${d} of ${e}`);let f=Math.max(0,d-3),p=f+6;console.log(n.split(`
19
+ `).slice(f,p).join(`
20
+ `))}if(!t)throw r;return}}var ms=qe(gs(),1);function Ds(n){return n.name==="AbortError"}function ys(n,e={},t=fetch){let r=!1,i=new ms.default.AbortController;function s(u){return Object.assign(u,{cancel(){return r||(console.warn(`Cancelling abortable fetch to ${n}:`),i.abort()),this},then(d,f){return s(Promise.prototype.then.apply(this,[d,f]))},catch(d){return s(Promise.prototype.catch.apply(this,[d]))},finally(d){return s(Promise.prototype.finally.apply(this,[d]))}})}e.signal=i.signal;let o=t(n,e);return o.finally(()=>{r=!0}),s(o)}var Ae={text:"text/plain",json:"application/json",json5:"application/json5",gif:"image/gif",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",svg:"image/svg+xml",binary:"binary"},ws=["binary","blob",Ae.gif,Ae.png,Ae.jpeg,Ae.binary];var Dt=class extends Error{props;constructor(e,t){typeof e=="string"?(super(e),this.props={message:e}):(super(e.message),this.props=e);let{captureStackTrace:r}=Error;r&&r(this,t||this.constructor),Object.setPrototypeOf(this,new.target.prototype)}get name(){return this.constructor.name}get header(){return this.props.activity?`${this.name} ${this.props.activity}`:this.name}};var te=class extends Dt{get status(){if(this.props.response)return this.props.response.status}},yt=class extends te{constructor(e){super({message:"You must be online to do this.",...e})}},Ie=class extends te{constructor(e){super({message:"There was a problem loading this thing.",...e})}},wt=class extends te{constructor(e){super({message:"You are not authorized to do this.",...e})}},Et=class extends te{constructor(e){super({message:"There was an error understanding the response.",...e})}},At=class extends te{constructor(e){super({message:"The action was cancelled.",...e})}};function As(n){let{url:e,query:t,contents:r,method:i=r!=null?"POST":"GET",headers:s={},requestFormat:o,format:u="text/plain",defaultContents:d,cache:f,fetch:p}=n,v={method:i,...f&&{cache:f}};o&&(s["Content-Type"]=o),v.headers=s,r!=null&&(v.body=typeof r=="string"?r:JSON.stringify(r));let y=e;typeof t=="string"?y+=`?${t}`:t&&(y+=`?${Es.default.stringify(t)}`);let T=ys(y,v,p);async function h(P){let R={url:e,status:P.status,...v};if(!P.ok){let $=await P.text();switch(P.status){case 404:if(d!==void 0)return d;throw new Ie({...R,message:$});case 401:case 403:throw new wt({...R,message:$});default:throw new te({...R,message:$})}}try{if(ws.includes(u))return await P.blob();let $=await P.text();return u===Ae.json||u.toLowerCase()==="json"?fs($):u===Ae.json5||u.toLowerCase()==="json5"?ps($):$}catch($){throw new Et({...R,error:$})}}async function w(P){if(d!==void 0)return d;throw Ds(P)?new At({url:e,error:P,...v}):new yt({url:e,error:P,...v})}return T.then(h,w)}var K=class n{constructor(e){this.options=e;this.info=e.server?{...e.server}:void 0}options;info;static current;static forPage(){return n.current??=new n(n.pageOptions()),n.current}static pageOptions(){return{page:location.pathname,server:window.SPELL_SERVER,protocol:location.protocol,fetch:(e,t)=>window.fetch(e,t),readServed:e=>n.readInFrame(window.document,e)}}static readInFrame(e,t,r=bl){return new Promise((i,s)=>{let o=e.createElement("iframe");o.setAttribute("sandbox","allow-same-origin"),o.setAttribute("aria-hidden","true"),o.hidden=!0;let u=p=>{clearTimeout(f);try{i(p())}catch(v){s(v)}finally{o.remove()}},d=()=>{throw new Error("the page didn't load")},f=setTimeout(()=>u(d),r);o.addEventListener("load",()=>{o.contentDocument?.URL!=="about:blank"&&u(()=>o.contentDocument.documentElement.outerHTML)}),o.src=`${t}${t.includes("?")?"&":"?"}spell-token=${Date.now()}`,e.body.append(o)})}static isServed(e=globalThis.SPELL_SERVER,t=globalThis.location?.protocol){return!!e?.token&&n.canRead(t)}static canRead(e=globalThis.location?.protocol){return e!=="file:"}get isServed(){return n.isServed(this.info,this.options.protocol)}get servesPlanDoc(){return this.isServed&&Bn.test(this.options.page)}get servesReviews(){return this.servesPlanDoc?!0:this.isServed&&In.test(this.options.page)}get file(){return this.info?.file??this.options.page}async get(e,{query:t,missing:r,format:i="json"}={}){if(!n.canRead(this.options.protocol))return r;try{let s=t&&new URLSearchParams(t).toString();return await As({url:e,query:s,format:i,cache:"no-store",fetch:this.options.fetch})??r}catch(s){if(s instanceof Ie)return r;throw s instanceof te&&(s.message=Fl(s.message)??s.message),s}}async getFile(e,{format:t="json"}={}){for(let r of typeof e=="string"?[e]:e){let i;try{i=await this.get(r,{format:t})}catch(s){throw new Error(`${r.split("/").pop()}: ${s.message}`,{cause:s})}if(i!==void 0)return i}}static dataFileNames(e){let t=e.replace(/\.json5?$/,"");return t===e?[e]:[`${t}.json5`,`${t}.json`]}getForPage(e,{missing:t}={}){return this.get(e,{query:{page:this.options.page},missing:t})}async post(e,t,{keepalive:r=!1}={}){for(let i=0;;i++){let s;try{s=await this.options.fetch(e,{method:"POST",headers:{"content-type":"application/json","x-server-token":this.info?.token??""},body:JSON.stringify(t),keepalive:r})}catch(d){throw new Te(`couldn't reach the page server (${d.message})`)}let o=await s.json().catch(()=>({}));if(s.ok)return o;let u=s.status===403&&/token/i.test(o.error??"");if(!(u&&i===0&&await this.refreshToken()))throw new Te(u?"the page server restarted since this page loaded: reload the page":o.error??`couldn't save (${s.status})`)}}static watch(e,t,r,{every:i=Rn,polls:s}={}){let{document:o}=e,u=typeof t=="function"?t:xl(t),d=i?e.setInterval(()=>{o.visibilityState==="visible"&&(s?.()??!0)&&r()},i):void 0,f=()=>{o.visibilityState==="visible"&&r()},p=v=>{let y=v.detail?.path;y&&u(decodeURIComponent(y))&&r()};return o.addEventListener("visibilitychange",f),e.addEventListener("spell-server:changed",p),()=>{d!==void 0&&e.clearInterval(d),o.removeEventListener("visibilitychange",f),e.removeEventListener("spell-server:changed",p)}}async refreshToken(){try{let{page:e,readServed:t}=this.options,r=t?await t(e):await(await this.options.fetch(e,{cache:"no-store"})).text(),i=JSON.parse(Nn.exec(r)?.[1]??"null")?.token;return!i||!this.info||i===this.info.token?!1:(this.info.token=i,!0)}catch{return!1}}},bl=1e4;function Fl(n){try{let e=JSON.parse(n)?.error;return typeof e=="string"?e:void 0}catch{return}}function xl(n){if(!n)return()=>!1;let e=K.dataFileNames(n);return t=>e.includes(t)}var vt=class n{static show(e,{tone:t="plain",ms:r=Sl,actions:i=[]}={}){if(typeof document>"u")return;let s=n.list();if(t==="plain")for(let d of s.querySelectorAll('[data-tone="plain"]'))d.remove();let o=document.createElement("div");o.className="notice",o.dataset.tone=t;let u=document.createElement("p");u.textContent=e,o.append(u);for(let d of i){let f=document.createElement("ui-button");f.setAttribute("appearance","basic inverted compact"),f.setAttribute("size","mini"),d.icon&&f.setAttribute("icon",d.icon),f.textContent=d.text,f.addEventListener("click",()=>{o.remove(),d.click()}),o.append(f)}s.append(o),setTimeout(()=>o.remove(),r)}static list(){let e=document.querySelector(`[${vs}]`);return e||(e=document.createElement("div"),e.setAttribute(vs,""),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.attachShadow({mode:"open"}).innerHTML=`<style>${kl}</style><div class="list"></div>`,document.body.append(e)),e.shadowRoot.querySelector(".list")}},Sl=6e3,vs="data-spell-notices",kl=`
2376
21
  :host { position: fixed; z-index: 1000; inset-inline: 12px; inset-block-end: 12px; display: block; pointer-events: none; }
2377
22
  .list { display: flex; flex-direction: column; align-items: center; gap: 8px; }
2378
23
  .notice {
@@ -2385,1344 +30,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
2385
30
  .notice[data-tone="error"] { background: var(--ui-red, #db2828); color: #fff; }
2386
31
  .notice[data-tone="warning"] { background: var(--ui-orange, #f2711c); color: #fff; }
2387
32
  p { margin: 0; }
2388
- ui-button { flex: none; }`;
2389
- var Ss = "input, textarea, select, ui-input, ui-select, ui-dropdown";
2390
- function le(n) {
2391
- let e = J.getAt(n);
2392
- return e && typeof e == "object" ? e : {};
2393
- }
2394
- __name(le, "le");
2395
- function Qe(n, e) {
2396
- J.setAt(n, e);
2397
- }
2398
- __name(Qe, "Qe");
2399
- function Cs(n, e) {
2400
- let t = n.querySelector(":scope > .spell-toolbar");
2401
- t ? t.before(e) : n.append(e);
2402
- }
2403
- __name(Cs, "Cs");
2404
- function Zt(n, e, t) {
2405
- if (e.dataset.headTool = t, !n.matches(".spell-page-head")) return Cs(n, e);
2406
- let r = n.querySelector(":scope > .spell-head-tools");
2407
- r || (r = E("span", { class: "spell-head-tools", "data-spell-added": true }), Cs(n, r));
2408
- let i = bs.indexOf(t), s = [...r.children].find((o) => bs.indexOf(o.dataset.headTool) > i);
2409
- r.insertBefore(e, s ?? null);
2410
- }
2411
- __name(Zt, "Zt");
2412
- var bs = ["send", "page", "comment"];
2413
- function ks(n, e, t) {
2414
- let r = n.previousElementSibling;
2415
- r?.matches(ce) || (r = E(ce, { "data-spell-added": true }), n.slot && (r.slot = n.slot), n.before(r)), e.dataset.action = t;
2416
- let i = Fs.indexOf(t), s = [...r.children].find((o) => Fs.indexOf(o.dataset.action) > i);
2417
- return r.insertBefore(e, s ?? null), en(r), r;
2418
- }
2419
- __name(ks, "ks");
2420
- function Ts(n) {
2421
- let e = n.closest(ce);
2422
- n.remove(), e && !e.querySelector("[data-action]") && e.remove();
2423
- }
2424
- __name(Ts, "Ts");
2425
- var ce = "epic-actions", Fs = ["comment", "expand"];
2426
- function en(n) {
2427
- let e = n.matches?.(ce) ? [n] : [...n.querySelectorAll(ce)], t = e.map((r) => {
2428
- let i = r.nextElementSibling;
2429
- if (!i || !r.getClientRects().length || !i.getClientRects().length) return;
2430
- let s = i.querySelector("tr")?.getBoundingClientRect(), o = s?.height ? s.top : i.getBoundingClientRect().top;
2431
- return { gap: xs(o - r.getBoundingClientRect().top), head: s?.height ? xs(s.height) : void 0 };
2432
- });
2433
- e.forEach((r, i) => {
2434
- let s = t[i];
2435
- if (s) {
2436
- for (let [o, u] of [["--spell-block-gap", s.gap], ["--spell-block-head", s.head]]) u === void 0 ? r.style.removeProperty(o) : r.style.getPropertyValue(o) !== u && r.style.setProperty(o, u);
2437
- r.toggleAttribute("head-row", !!s.head);
2438
- }
2439
- });
2440
- }
2441
- __name(en, "en");
2442
- function xs(n) {
2443
- return `${Math.round(n * 100) / 100}px`;
2444
- }
2445
- __name(xs, "xs");
2446
- function Re(n, e = "button") {
2447
- let t = /* @__PURE__ */ __name(() => {
2448
- let r = n.shadowRoot?.querySelector(`[part~="${e}"]`);
2449
- return r && (r.title = n.title), !!r;
2450
- }, "t");
2451
- t() || customElements.whenDefined(n.localName).then(() => requestAnimationFrame(t));
2452
- }
2453
- __name(Re, "Re");
2454
- function E(n, e = {}, ...t) {
2455
- let r = document.createElement(n);
2456
- for (let [i, s] of Object.entries(e)) s !== void 0 && s !== false && r.setAttribute(i, s === true ? "" : String(s));
2457
- return r.append(...t.filter((i) => i != null && i !== false && i !== "")), r;
2458
- }
2459
- __name(E, "E");
2460
- function Ne(n) {
2461
- n.style.height = "auto", n.style.height = `${n.scrollHeight + 2}px`;
2462
- }
2463
- __name(Ne, "Ne");
2464
- function X(n, e, { displayTime: t = 3e3, actions: r } = {}) {
2465
- vt.show(n, { tone: e ?? "plain", ms: t, actions: r });
2466
- }
2467
- __name(X, "X");
2468
- var Ze = class n {
2469
- static {
2470
- __name(this, "n");
2471
- }
2472
- static NAMES = ["red", "orange", "yellow", "olive", "green", "teal", "blue", "violet", "purple", "pink", "brown", "grey", "black"];
2473
- static isColor(e) {
2474
- return typeof e == "string" && Tl.test(e.trim());
2475
- }
2476
- static cssOf(e) {
2477
- let t = e.trim().toLowerCase();
2478
- return n.NAMES.includes(t) ? `var(--ui-${t})` : e;
2479
- }
2480
- }, Tl = /^[#\w][\w\s#%.,()/+-]{0,60}$/;
2481
- var N = class n {
2482
- static {
2483
- __name(this, "n");
2484
- }
2485
- static agentOf(e) {
2486
- if (!e) return;
2487
- let t = n.field(e, "agent")?.trim();
2488
- return t || (n.isOldClaudes(e) ? Pl : void 0);
2489
- }
2490
- static isAgents(e) {
2491
- return n.agentOf(e) !== void 0;
2492
- }
2493
- static isOldClaudes(e) {
2494
- if (n.field(e, "agent")?.trim() || !ve(n.authorOf(e), tn)) return false;
2495
- let t = n.field(e, "at") ?? "";
2496
- return !t || t < n.AGENTS_MARKED;
2497
- }
2498
- static authorOf(e) {
2499
- return (n.field(e, "from") ?? n.field(e, "by") ?? "").trim();
2500
- }
2501
- static speakerOf(e, t = n.viewer()) {
2502
- let r = n.agentOf(e), i = n.authorOf(e), o = !i || r !== void 0 && (ve(i, tn) || ve(i, n.agentLabel(r))) ? void 0 : i;
2503
- return { person: o, agent: r, mine: !!o && !!t && ve(o, t) };
2504
- }
2505
- static viewer(e = globalThis) {
2506
- let t = e?.SPELL_SERVER?.person;
2507
- return typeof t == "string" && t.trim() ? t.trim() : void 0;
2508
- }
2509
- static agentLabel(e) {
2510
- let t = (e ?? "").trim();
2511
- return t ? Ol[t.toLowerCase()] ?? t.charAt(0).toUpperCase() + t.slice(1) : tn;
2512
- }
2513
- static voiceOf({ person: e, agent: t }, r = n.colors()) {
2514
- let [i, s, o] = t ? ["agent", t, Os(r.agents, t)] : ["person", e, Os(r.people, e)], u = ql(s);
2515
- if (u) return `var(--epic-voice-${i}-${u}${o ? `, ${Ze.cssOf(o)}` : ""})`;
2516
- }
2517
- static colors(e = globalThis) {
2518
- let t = e?.SPELL_SERVER?.colors;
2519
- return { people: Bs(t?.people), agents: Bs(t?.agents) };
2520
- }
2521
- static sameName(e, t) {
2522
- return ve(e ?? "", t ?? "");
2523
- }
2524
- static field(e, t) {
2525
- if (typeof e.getAttribute == "function") return e.getAttribute(t) ?? void 0;
2526
- let r = e[t];
2527
- return typeof r == "string" ? r : void 0;
2528
- }
2529
- static turnOf(e) {
2530
- if (e.done) return "done";
2531
- let t = e.replies?.at(-1);
2532
- return t ? n.isAgents(t) ? "person" : "agent" : e.status === "answered" ? "person" : "agent";
2533
- }
2534
- static asTurn(e) {
2535
- return e === Il ? "person" : e === Rl ? "agent" : Bl.includes(e) ? e : void 0;
2536
- }
2537
- static isAgentsTurn(e) {
2538
- return (n.asTurn(e.turn) ?? n.turnOf(e)) === "agent";
2539
- }
2540
- static withTurns(e = []) {
2541
- return e.map((t) => ({ ...t, turn: n.asTurn(t.turn) ?? n.turnOf(t) }));
2542
- }
2543
- static lastPersonReply(e) {
2544
- return e.replies?.findLast((t) => !n.isAgents(t));
2545
- }
2546
- static latestAgentAt(e) {
2547
- return e.replies?.findLast((t) => n.isAgents(t) && t.at)?.at ?? "";
2548
- }
2549
- static isWaiting(e) {
2550
- if (n.turnOf(e) !== "agent") return false;
2551
- let t = n.lastPersonReply(e)?.at ?? e.at, r = Rs(e);
2552
- return !r || r < t;
2553
- }
2554
- static lastWordsAt(e) {
2555
- let t = [e.at, e.edited];
2556
- for (let r of e.replies ?? []) n.isAgents(r) || t.push(r.at, r.edited);
2557
- return t.filter((r) => !!r).reduce((r, i) => Date.parse(i) > Date.parse(r) ? i : r);
2558
- }
2559
- static pendingOf(e, t) {
2560
- return e.done ? null : e.status === "new" && !e.replies?.length ? e.working || !Is(e.by, t) ? null : "edit" : n.pendingReplyOf(e, t) ? "reply" : null;
2561
- }
2562
- static pendingReplyOf(e, t) {
2563
- let r = e.replies?.at(-1);
2564
- if (!r || n.isAgents(r) || !Is(r.by, t)) return null;
2565
- let i = Rs(e);
2566
- return i && i >= r.at ? null : r;
2567
- }
2568
- static numberOf(e) {
2569
- let t = Nl.exec((e ?? "").trim())?.[1];
2570
- return t === void 0 ? void 0 : Number(t);
2571
- }
2572
- static label(e) {
2573
- let t = n.numberOf(e);
2574
- return t === void 0 ? String(e) : `C${t}`;
2575
- }
2576
- static headline(e) {
2577
- let t = (e.text ?? "").replace(/\s+/g, " ").trim();
2578
- if (t) return n.quoted(t);
2579
- if (e.kind === "page") return "This page";
2580
- let r = (e.quote || e.excerpt || e.label || "").replace(/\s+/g, " ").trim();
2581
- return r ? n.quoted(r) : `This ${n.kindName(e.kind)}`;
2582
- }
2583
- static quoted(e) {
2584
- return `“${e.length > Ps ? `${e.slice(0, Ps).trimEnd()}…` : e}”`;
2585
- }
2586
- static aboutTip({ id: e, place: t }) {
2587
- let r = $l.includes(t.kind) ? `the ${n.kindName(t.kind)}` : `a ${n.kindName(t.kind)}`, i = t.kind === "section" || t.kind === "item", s = i && t.label ? `“${t.label}”` : r, o = t.kind === "page" || i || !t.label ? "" : ` in “${t.label}”`, u = t.quote ? `: “${t.quote}”` : "";
2588
- return `${e ? `Comment ${n.label(e)}, on` : "On"} ${s}${o}${u}`;
2589
- }
2590
- static kindName(e) {
2591
- return _l[e] ?? e;
2592
- }
2593
- static localStamp(e) {
2594
- let t = new Date(e ?? "");
2595
- return Number.isNaN(t.getTime()) ? e ?? "" : `${On(t)} ${ke(t)}`;
2596
- }
2597
- static shortStamp(e) {
2598
- let t = Ll.exec(e ?? "");
2599
- return t ? `${Number(t[1])}/${Number(t[2])} ${t[3]}` : e ?? "";
2600
- }
2601
- static takenInto({ epic: e, phase: t, phaseId: r, title: i }) {
2602
- return { hash: r || `p${t}`, label: r && i ? `${e} · ${i}` : `${e} P${t}` };
2603
- }
2604
- static AGENTS_MARKED = "2026-11-01";
2605
- }, Pl = "claude", tn = "Claude", Ol = { claude: "Claude", codex: "Codex" }, Bl = ["person", "agent", "done"], Il = "owen", Rl = "claude", Nl = /^#?cm?(\d+)$/i, Ps = 40, Ll = /^\d{4}-(\d\d)-(\d\d)[ T](\d\d:\d\d)/, $l = ["page", "overview"], _l = { overview: "Overview", prose: "paragraph", code: "code block" };
2606
- function ve(n, e) {
2607
- return !!n.trim() && n.trim().localeCompare(e.trim(), void 0, { sensitivity: "accent" }) === 0;
2608
- }
2609
- __name(ve, "ve");
2610
- function Os(n, e) {
2611
- if (!e) return;
2612
- let t = Object.keys(n).find((r) => ve(r, e));
2613
- return t === void 0 ? void 0 : n[t];
2614
- }
2615
- __name(Os, "Os");
2616
- function Bs(n) {
2617
- return !n || typeof n != "object" || Array.isArray(n) ? {} : Object.fromEntries(Object.entries(n).filter(([, e]) => Ze.isColor(e)).map(([e, t]) => [e, t.trim()]));
2618
- }
2619
- __name(Bs, "Bs");
2620
- function ql(n) {
2621
- return (n ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
2622
- }
2623
- __name(ql, "ql");
2624
- function Is(n, e) {
2625
- return !e || !n || ve(n, e);
2626
- }
2627
- __name(Is, "Is");
2628
- function Ml(n) {
2629
- return n.taken?.at ?? (n.status === "taken" ? n.at : void 0);
2630
- }
2631
- __name(Ml, "Ml");
2632
- function Rs(n) {
2633
- return [Ml(n), n.working].filter((t) => !!t).sort().at(-1);
2634
- }
2635
- __name(Rs, "Rs");
2636
- function $s(n, e) {
2637
- let t = n.map(({ label: i }) => Ns.test(i) ? i : Jl(i)), r = jl(t);
2638
- return n.map(({ element: i, id: s, label: o, glyph: u }, d) => {
2639
- let f = o.match(Ns)?.[1], p = o.match(/^\d+/)?.[0];
2640
- return zl({ id: s, tip: o, glyph: f ? void 0 : u, mark: f ? E("b", { slot: "icon", class: "spell-toolbar-number" }, f) : u ? void 0 : p ? E("b", { slot: "icon" }, p) : E("b", { slot: "icon", class: "spell-toolbar-letter" }, (r[d] ?? o.charAt(0)).toUpperCase()), title: t[d], letter: r[d], state: i.dataset.state, badges: e(i) });
2641
- });
2642
- }
2643
- __name($s, "$s");
2644
- var Ns = /^[A-Z](\d+)\b/;
2645
- function jl(n) {
2646
- let e = /* @__PURE__ */ new Set();
2647
- return n.map((t) => {
2648
- let i = Cn(t).toLowerCase().replace(/[^a-z]/g, "").split("").find((s) => !e.has(s));
2649
- return i && e.add(i), i;
2650
- });
2651
- }
2652
- __name(jl, "jl");
2653
- function Kl(n, e) {
2654
- let t = e ? [...n.normalize("NFD")].findIndex((i) => i.toLowerCase() === e) : -1;
2655
- if (t < 0) return [n];
2656
- let r = [...n.normalize("NFD")];
2657
- return [r.slice(0, t).join(""), E("u", { class: "spell-toolbar-key" }, r[t]), r.slice(t + 1).join("")];
2658
- }
2659
- __name(Kl, "Kl");
2660
- function _s(n, { titled: e, segmented: t = false }) {
2661
- let r = Yl(), i = customElements.get("ui-toolbar") ? "ui-toolbar" : "ui-menu", s = E(i, { class: ["spell-toolbar", e && "spell-toolbar-titled", t && "spell-toolbar-segmented"].filter(Boolean).join(" "), ...t ? { appearance: "segmented" } : { appearance: "secondary" }, shrinkable: e && !t, "scroll-first": e && !t, "aria-label": "Sections", "data-spell-added": true });
2662
- return s.append(...n, ...r), e && (Ul(), Wl(s)), new MutationObserver((o) => {
2663
- for (let { target: u } of o) u.hasAttribute("selected") && Zl(u);
2664
- }).observe(s, { attributeFilter: ["selected"], subtree: true }), s;
2665
- }
2666
- __name(_s, "_s");
2667
- function qs(n) {
2668
- if (!n?.classList.contains("spell-toolbar-titled")) return;
2669
- let e = n.querySelector(":scope > .spell-toolbar-tools");
2670
- return e || (e = E("span", { class: "spell-toolbar-tools", slot: "right" }), n.append(e)), e;
2671
- }
2672
- __name(qs, "qs");
2673
- function Ul() {
2674
- Ls || (Ls = true, document.addEventListener("keydown", (n) => {
2675
- if (n.metaKey || n.ctrlKey || n.altKey || n.repeat || n.isComposing || n.defaultPrevented || !/^[a-z]$/i.test(n.key) || js(n) || document.querySelector("dialog[open], ui-modal:not([hidden])")) return;
2676
- let e = document.querySelector(".spell-toolbar-titled"), t = document.activeElement;
2677
- if (!e || t && t !== document.body && !e.contains(t) && Gl(t)) return;
2678
- let i = e.querySelector(`:scope > [data-key="${n.key.toLowerCase()}"]`)?.shadowRoot?.querySelector('[part~="item"]');
2679
- i && (n.preventDefault(), i.click());
2680
- }));
2681
- }
2682
- __name(Ul, "Ul");
2683
- var Ls = false;
2684
- function Wl(n) {
2685
- let e = Hl(), t, r = /* @__PURE__ */ __name((o) => {
2686
- let u = o.target.closest?.("ui-item[data-key]");
2687
- !u || !n.contains(u) || (clearTimeout(t), o.type === "pointerover" ? t = setTimeout(() => i(u), Vl) : i(u));
2688
- }, "r"), i = /* @__PURE__ */ __name((o) => {
2689
- let u = o.shadowRoot?.querySelector('[part~="item"]')?.getBoundingClientRect() ?? o.getBoundingClientRect();
2690
- e.querySelector("kbd").textContent = o.dataset.key.toUpperCase(), e.matches(":popover-open") || e.showPopover();
2691
- let d = e.offsetWidth;
2692
- e.style.left = `${ot(u.left + u.width / 2 - d / 2, 8, innerWidth - d - 8)}px`, e.style.top = `${u.bottom + 6}px`;
2693
- }, "i"), s = /* @__PURE__ */ __name(() => {
2694
- clearTimeout(t), e.matches(":popover-open") && e.hidePopover();
2695
- }, "s");
2696
- n.addEventListener("pointerover", r), n.addEventListener("focusin", r), n.addEventListener("pointerleave", s), n.addEventListener("focusout", s), n.addEventListener("click", s);
2697
- }
2698
- __name(Wl, "Wl");
2699
- var Vl = 1e3;
2700
- function Hl() {
2701
- let n = document.querySelector("body > .spell-toolbar-tip");
2702
- if (n) return n;
2703
- let e = E("div", { class: "spell-toolbar-tip", popover: "manual", "aria-hidden": "true", "data-spell-added": true }, "Type ", E("kbd"), " to jump to this section");
2704
- return document.body.append(e), addEventListener("scroll", () => e.matches(":popover-open") && e.hidePopover(), { passive: true }), e;
2705
- }
2706
- __name(Hl, "Hl");
2707
- function Gl(n) {
2708
- return n.matches('[role="menu"], [role="menubar"], [role="listbox"], [role="combobox"], [role="grid"], [role="tree"], [role="slider"], [role="tablist"], ui-dropdown, ui-select, ui-search, ui-calendar, ui-menu, ui-tabs, ui-example *, ui-example');
2709
- }
2710
- __name(Gl, "Gl");
2711
- function zl({ id: n, tip: e, glyph: t, mark: r, title: i, letter: s, state: o, badges: u }) {
2712
- let d = [e, ...u.map(([, , p]) => p)].join(" · "), f = E("ui-item", { class: "spell-toolbar-item", link: `#${n}`, "data-rail": n, icon: t, title: s ? "" : d, "aria-label": d, "aria-keyshortcuts": s?.toUpperCase(), "data-key": s, "data-state": o }, r, i && E("span", {}, ...Kl(i, s)), ...u.map(([p, v]) => E("ui-label", { class: `spell-toolbar-count ${p}`, slot: "badge", appearance: "circular", size: "mini" }, String(v))));
2713
- return Re(f, "item"), f;
2714
- }
2715
- __name(zl, "zl");
2716
- function Yl() {
2717
- let n = [];
2718
- for (let e of document.querySelectorAll(".spell-toc-open, .spell-toolbar")) n.push(...[...e.children].filter((t) => !t.hasAttribute("data-rail"))), e.remove();
2719
- return n;
2720
- }
2721
- __name(Yl, "Yl");
2722
- function nn(n, e) {
2723
- for (let t of n?.querySelectorAll("[data-rail]") ?? []) t.toggleAttribute("selected", t.dataset.rail === e);
2724
- }
2725
- __name(nn, "nn");
2726
- function Jl(n) {
2727
- return n.replace(/^\d+(?:\.\d+)*\.?\s+/, "");
2728
- }
2729
- __name(Jl, "Jl");
2730
- function Xl(n) {
2731
- return n.shadowRoot?.querySelector('[part~="menu"]') ?? void 0;
2732
- }
2733
- __name(Xl, "Xl");
2734
- function Ql(n) {
2735
- return (n.shadowRoot?.querySelector('[part~="item"]') ?? n).getBoundingClientRect();
2736
- }
2737
- __name(Ql, "Ql");
2738
- function Zl(n) {
2739
- let e = Xl(n.parentElement);
2740
- if (!e || e.scrollWidth <= e.clientWidth) return;
2741
- let t = Ql(n), r = t.left - e.getBoundingClientRect().left + e.scrollLeft;
2742
- r >= e.scrollLeft && r + t.width <= e.scrollLeft + e.clientWidth || e.scrollTo({ left: r - (e.clientWidth - t.width) / 2, behavior: "smooth" });
2743
- }
2744
- __name(Zl, "Zl");
2745
- var ed = /^#?[a-z]{1,2}\d+$/i;
2746
- function Ms(n, e, { search: t, host: r, first: i = false } = {}) {
2747
- let s = /* @__PURE__ */ __name((o) => {
2748
- if (!(o.metaKey || o.ctrlKey) || o.altKey || o.shiftKey || o.defaultPrevented) return;
2749
- let u = document.body.classList.contains("plan-doc");
2750
- o.key.toLowerCase() !== "k" || o.isComposing || !(u || et()) || document.querySelector("dialog[open], ui-modal:not([hidden])") || js(o) || (o.preventDefault(), o.stopPropagation(), td(n, e, { search: t, host: typeof r == "function" ? r() : r }));
2751
- }, "s");
2752
- i ? addEventListener("keydown", s, { capture: true }) : document.addEventListener("keydown", s);
2753
- }
2754
- __name(Ms, "Ms");
2755
- function td(n, e, { search: t, host: r } = {}) {
2756
- let i = document.body.classList.contains("plan-doc"), s = i ? "Jump to which item?" : t ? "Jump to a comment, or search" : "Jump to which comment?", o = E("input", { type: "text", autofocus: true, autocomplete: "off", spellcheck: "false" }), u = E("p", { class: "spell-jump-miss", role: "alert", hidden: true }), d = E("ui-button", { class: "approve", color: "primary" }, "Go"), f = nd((h) => {
2757
- o.value = h, d.click();
2758
- }), p = E("ui-modal", { size: "tiny", closedby: "closerequest", heading: s, "data-spell-added": true }, E("ui-content", {}, E("label", { class: "ui-native spell-jump" }, i ? "Its id: J7, q3, P2, C3 ..." : t ? "A comment's id (C3), any id on the page, or words to search the site" : "Its id: C3, or any id on the page", o), u, f), E("ui-actions", {}, E("ui-button", { class: "cancel" }, "Cancel"), d)), v = "", y = "", T = "";
2759
- o.addEventListener("keydown", (h) => {
2760
- h.key === "Enter" && (h.preventDefault(), d.click());
2761
- }), o.addEventListener("input", () => u.hidden = true), p.addEventListener("ui-approving", (h) => {
2762
- let w = o.value.trim(), P = w.replace(/^#/, "").toLowerCase(), R = et()?.find(P);
2763
- if (R) {
2764
- y = R.id;
2765
- return;
2766
- }
2767
- if (P && e(P)) {
2768
- v = P;
2769
- return;
2770
- }
2771
- if (t && w && !ed.test(w)) {
2772
- T = w;
2773
- return;
2774
- }
2775
- h.preventDefault(), u.textContent = P ? `No ${w} on this page.` : "Type an id first.", u.hidden = false, o.select();
2776
- }), p.addEventListener("ui-closed", () => {
2777
- p.remove(), y ? et()?.landOn(y) : v ? n(v) : T && t(T);
2778
- }, { once: true }), (r ?? document.body).append(p), p.visible = true, customElements.whenDefined("ui-modal").then(() => (p.visible = true, De(2))).then(() => o.focus());
2779
- }
2780
- __name(td, "td");
2781
- function nd(n) {
2782
- let e = et()?.waitingInPageOrder() ?? [];
2783
- if (!e.length) return;
2784
- let t = e.length === 1 ? "Waiting on you:" : `${e.length} waiting on you:`, r = e.map((i) => {
2785
- let s = N.label(i.id), o = `${N.aboutTip({ id: i.id, place: i })}
2786
- (Jump there)`, u = E("ui-item", { class: "spell-jump-thread", title: o }, E("b", {}, s), " · ", E("span", {}, Ks(i.text)));
2787
- return u.addEventListener("click", () => n(s)), Re(u, "item"), u;
2788
- });
2789
- return E("ui-menu", { class: "spell-jump-waiting", direction: "vertical", appearance: "secondary link", fluid: true, "aria-label": t }, E("ui-item", { class: "spell-jump-waiting-title", kind: "header" }, t), ...r);
2790
- }
2791
- __name(nd, "nd");
2792
- function js(n) {
2793
- return n.composedPath().some((e) => e instanceof Element && (e.isContentEditable || e.matches(`${Ss}, textarea, input`)));
2794
- }
2795
- __name(js, "js");
2796
- var rd = 3e3, rn = class {
2797
- static {
2798
- __name(this, "rn");
2799
- }
2800
- constructor(e) {
2801
- this.props = e;
2802
- }
2803
- props;
2804
- keep(e) {
2805
- this.props.key && J.setAt(this.props.key, e, this.place);
2806
- }
2807
- kept() {
2808
- return this.props.key ? J.getAt(this.props.key, this.place) : void 0;
2809
- }
2810
- drop() {
2811
- this.props.key && J.setAt(this.props.key, void 0, this.place);
2812
- }
2813
- place = new we({ storage: /* @__PURE__ */ __name(() => this.props.storage ? this.props.storage() : globalThis.localStorage, "storage"), description: "this browser" });
2814
- }, Ct = class {
2815
- static {
2816
- __name(this, "Ct");
2817
- }
2818
- constructor(e) {
2819
- this.props = e;
2820
- this.copy = new rn({ ...e.key !== void 0 && { key: e.key }, ...e.storage && { storage: e.storage } });
2821
- }
2822
- props;
2823
- state = { kind: "idle" };
2824
- isUnsaved = false;
2825
- timer;
2826
- retryTimer;
2827
- saving = Promise.resolve(true);
2828
- inFlight = 0;
2829
- round = 0;
2830
- copy;
2831
- changed({ now: e = false } = {}) {
2832
- if (this.isUnsaved = true, this.cancelTimer(), e) {
2833
- this.save();
2834
- return;
2835
- }
2836
- this.timer = setTimeout(() => {
2837
- this.save();
2838
- }, this.props.wait), this.state.kind !== "failed" && this.state.kind !== "off server" && this.setState({ kind: "unsaved" });
2839
- }
2840
- save({ keepalive: e = false } = {}) {
2841
- this.cancelTimer();
2842
- let t = /* @__PURE__ */ __name(() => this.saveQueued(e), "t"), r = this.inFlight ? this.saving.then(t) : t();
2843
- return this.inFlight++, r.finally(() => this.inFlight--), this.saving = r, r;
2844
- }
2845
- get settled() {
2846
- return this.saving;
2847
- }
2848
- get isPending() {
2849
- return !!this.timer || this.state.kind === "saving";
2850
- }
2851
- done() {
2852
- this.round++, this.stop(), this.isUnsaved = false, this.drop(), this.setState({ kind: "idle" });
2853
- }
2854
- stop() {
2855
- this.cancelTimer(), this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = void 0;
2856
- }
2857
- tell(e, { isError: t = false } = {}) {
2858
- this.setState({ kind: "told", text: e, ...t && { isError: t } });
2859
- }
2860
- watch(e) {
2861
- let t = /* @__PURE__ */ __name(() => {
2862
- this.save({ keepalive: true });
2863
- }, "t"), r = /* @__PURE__ */ __name(() => {
2864
- e.document.visibilityState === "hidden" && t();
2865
- }, "r");
2866
- return e.addEventListener("pagehide", t), e.document.addEventListener("visibilitychange", r), () => {
2867
- e.removeEventListener("pagehide", t), e.document.removeEventListener("visibilitychange", r), this.stop();
2868
- };
2869
- }
2870
- keep(e) {
2871
- this.copy.keep(e);
2872
- }
2873
- kept() {
2874
- return this.copy.kept();
2875
- }
2876
- drop() {
2877
- this.copy.drop();
2878
- }
2879
- get text() {
2880
- let e = this.state;
2881
- switch (e.kind) {
2882
- case "idle":
2883
- return "";
2884
- case "unsaved":
2885
- return "not saved yet";
2886
- case "saving":
2887
- return "saving…";
2888
- case "saved":
2889
- return `saved ${id(e.at)}`;
2890
- case "told":
2891
- return e.text;
2892
- case "off server":
2893
- return "kept in this browser only: this page isn't on the page server";
2894
- default:
2895
- return `kept in this browser only: ${e.why}; trying again every ${this.retry / 1e3}s`;
2896
- }
2897
- }
2898
- get isError() {
2899
- let e = this.state;
2900
- return e.kind === "failed" || e.kind === "off server" || e.kind === "told" && !!e.isError;
2901
- }
2902
- async saveQueued(e) {
2903
- if (this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = void 0, !this.isUnsaved) return true;
2904
- if (this.props.isOffServer?.()) return this.setState({ kind: "off server" }), false;
2905
- let t = this.round;
2906
- this.isUnsaved = false, this.state.kind !== "failed" && this.setState({ kind: "saving" });
2907
- try {
2908
- let r = await this.props.save({ keepalive: e });
2909
- return t !== this.round ? true : (this.setState({ kind: "saved", at: r ?? (/* @__PURE__ */ new Date()).toISOString() }), !this.isUnsaved);
2910
- } catch (r) {
2911
- return t !== this.round ? true : (this.isUnsaved = true, this.setState({ kind: "failed", why: r.message.replace(/[.!]$/, "") }), this.retryTimer = setTimeout(() => {
2912
- this.save();
2913
- }, this.retry), false);
2914
- }
2915
- }
2916
- get retry() {
2917
- return this.props.retry ?? rd;
2918
- }
2919
- cancelTimer() {
2920
- this.timer && clearTimeout(this.timer), this.timer = void 0;
2921
- }
2922
- setState(e) {
2923
- this.state = e, this.props.onChange?.();
2924
- }
2925
- };
2926
- function id(n) {
2927
- let e = new Date(n);
2928
- return isNaN(e.getTime()) ? "" : ke(e);
2929
- }
2930
- __name(id, "id");
2931
- var de = class extends Ct {
2932
- static {
2933
- __name(this, "de");
2934
- }
2935
- constructor(e) {
2936
- let { link: t, storage: r, retry: i = 3e3, ...s } = e;
2937
- super({ ...s, retry: i, ...t && { isOffServer: /* @__PURE__ */ __name(() => !t.isServed, "isOffServer") }, storage: /* @__PURE__ */ __name(() => "storage" in e ? lt(r) : globalThis.localStorage, "storage") });
2938
- }
2939
- };
2940
- var Tg = 1440 * 60 * 1e3;
2941
- var bt = "/api/docs/comments", St = null;
2942
- function et() {
2943
- return St;
2944
- }
2945
- __name(et, "et");
2946
- var od = "spell-comment-draft:", ad = "spell-comment-read:", ud = 1200, cd = "p, li, dt, dd, td, th, blockquote, pre, figcaption, h4, h5, h6", Ws = /^(li|dt|dd|td|th)$/, to = "spell-comment-quote", Ft = "spell-promoted", ld = 8, no = "spell-comment-quote-waiting", Vs = 600, Hs = 150, dd = 3e4, fd = /\.(plan|saga)\.html$/, pd = "epic-overview, epic-item, epic-update[at], epic-aside, epic-code", hd = /^(ui-section|epic-overview)$/;
2947
- async function ro(n, { go: e, pageFolds: t, signal: r } = {}) {
2948
- if (!K.isServed()) return;
2949
- let i = new on(n, { go: e, pageFolds: t, signal: r });
2950
- if (!await i.load() || r?.aborted) return;
2951
- St = i, i.draw();
2952
- let s = /* @__PURE__ */ __name(() => {
2953
- i.load().then((v) => v && !r?.aborted && i.draw());
2954
- }, "s"), o = { signal: r };
2955
- addEventListener("spell-doc:updated", () => i.draw(), o);
2956
- let u = fd.test(location.pathname), d = K.watch(window, (v) => i.inboxPaths.includes(v), s, { every: dd, polls: /* @__PURE__ */ __name(() => !!i.send || u, "polls") }), f = /* @__PURE__ */ __name(() => {
2957
- i.open?.flush?.();
2958
- for (let v of i.fields()) v.flush?.();
2959
- }, "f");
2960
- addEventListener("pagehide", f, o);
2961
- let p = typeof ResizeObserver == "function" ? new ResizeObserver(() => i.makeRoom()) : null;
2962
- p?.observe(n), i.watchContent(), i.watchFolds(), i.wireSelection(), r?.addEventListener("abort", () => {
2963
- f(), d(), p?.disconnect(), i.stop(), St === i && (St = null);
2964
- }, { once: true });
2965
- }
2966
- __name(ro, "ro");
2967
- function Gs(n) {
2968
- let e = [n, n.replace(/^\/worktrees\/[^/]+(?=\/)/, "")];
2969
- return [...new Set(e.flatMap((t) => K.dataFileNames(t)))];
2970
- }
2971
- __name(Gs, "Gs");
2972
- var on = class {
2973
- static {
2974
- __name(this, "on");
2975
- }
2976
- constructor(e, { go: t, pageFolds: r, signal: i } = {}) {
2977
- this.main = e, this.go = t, this.pageFolds = r, this.signal = i, this.contentWatch = null, this.lastWaiting = "", this.list = [], this.open = null, this.pane = null, this.threads = /* @__PURE__ */ new Map(), this.replyBoxes = /* @__PURE__ */ new Map(), this.editing = null, this.quotes = [], this.folds = /* @__PURE__ */ new Map();
2978
- let o = decodeURIComponent(location.pathname).replace(/(\.plan|\.saga)?\.html$/, ".inbox.json5");
2979
- this.inboxPaths = Gs(o), this.draftKey = `${od}${location.pathname}`, this.readKey = `${ad}${location.pathname}`, this.read = {}, this.seenWatch = null, this.seenTimers = /* @__PURE__ */ new Map(), this.send = null;
2980
- }
2981
- unseen(e) {
2982
- return e.turn === "person" && !!N.latestAgentAt(e);
2983
- }
2984
- markSeen(e) {
2985
- let t = this.list.find((s) => s.id === e);
2986
- if (!t || !this.unseen(t)) return;
2987
- let r = le(this.readKey), i = N.latestAgentAt(t);
2988
- (r[e] ?? "") >= i || (r[e] = i, Qe(this.readKey, r), this.draw());
2989
- }
2990
- watchSeen() {
2991
- this.seenWatch?.disconnect();
2992
- let e = this.main.querySelectorAll("epic-thread[unseen][open]");
2993
- for (let [t, r] of this.seenTimers) [...e].some((i) => i.id === `comment-${t}`) || (clearTimeout(r), this.seenTimers.delete(t));
2994
- if (!(!e.length || typeof IntersectionObserver != "function")) {
2995
- this.seenWatch = new IntersectionObserver((t) => {
2996
- for (let r of t) {
2997
- let i = r.target.id.replace(/^comment-/, ""), s = r.rootBounds?.height ?? innerHeight;
2998
- r.isIntersecting && (r.intersectionRatio >= 0.5 || r.intersectionRect.height >= s / 2) ? this.seenTimers.has(i) || this.seenTimers.set(i, setTimeout(() => {
2999
- this.seenTimers.delete(i), document.visibilityState === "visible" ? this.markSeen(i) : this.watchSeen();
3000
- }, ud)) : (clearTimeout(this.seenTimers.get(i)), this.seenTimers.delete(i));
3001
- }
3002
- }, { threshold: [0, 0.25, 0.5, 0.75, 1] });
3003
- for (let t of e) this.seenWatch.observe(t);
3004
- }
3005
- }
3006
- makeRoom() {
3007
- en(this.main);
3008
- let e = [...this.main.querySelectorAll(`${ce} ui-button`)].filter((t) => t?.checkVisibility?.({ contentVisibilityAuto: true }) !== false).map((t) => t?.getBoundingClientRect()).filter((t) => t?.width);
3009
- for (let t of this.threads.values()) {
3010
- t.style.removeProperty(Xs);
3011
- let r = t.isConnected ? t.header : void 0;
3012
- if (!r) continue;
3013
- let i = r.getBoundingClientRect();
3014
- if (!i.width || r.checkVisibility?.({ contentVisibilityAuto: true }) === false) continue;
3015
- let s = e.filter((o) => o.left < i.right && o.right > i.left && o.top < i.bottom && o.bottom > i.top);
3016
- s.length && t.style.setProperty(Xs, `${Math.ceil(i.right - Math.min(...s.map((o) => o.left))) + 4}px`);
3017
- }
3018
- }
3019
- async load() {
3020
- try {
3021
- let e = await K.forPage().get(bt, { query: { page: location.pathname }, missing: {} });
3022
- return e.takesComments !== true ? false : (this.list = N.withTurns(e.comments), this.keepSend(e), true);
3023
- } catch {
3024
- return false;
3025
- }
3026
- }
3027
- keepSend(e) {
3028
- if (!e?.send) return;
3029
- this.send = e.send;
3030
- let t = `/epics/${e.send.epic}/${e.send.epic}.inbox.json5`;
3031
- for (let r of Gs(t)) this.inboxPaths.includes(r) || this.inboxPaths.push(r);
3032
- }
3033
- drawSend() {
3034
- let e = Ve(this.main), t = e?.matches(".spell-page-head") ? e : e?.querySelector(".spell-page-head") ?? e;
3035
- t?.querySelector(":scope > .spell-send, :scope > .spell-head-tools > .spell-send")?.remove();
3036
- let r = this.send;
3037
- if (!t || !r) return;
3038
- let i = r.unsent.length, s = i ? "unsent" : r.waiting.length ? "sent" : "idle", o = E(bd, { state: s, count: i || void 0, "send-tip": gd(r, s) });
3039
- o.addEventListener(Fd, () => {
3040
- this.sendNow();
3041
- });
3042
- let u = E("span", { class: "spell-send-who", "data-listening": r.listening ? "yes" : "no", title: Dd(r) }, md(r));
3043
- Zt(t, E("span", { class: "spell-send", "data-spell-added": true, "data-state": s }, o, u), "send");
3044
- }
3045
- async sendNow() {
3046
- let e = this.send;
3047
- if (e) {
3048
- if (!e.unsent.length) return X("Nothing new to send: every comment here went with an earlier Send.");
3049
- try {
3050
- let t = await K.forPage().post(`${bt}/send`, { page: location.pathname });
3051
- this.list = t.comments ? N.withTurns(t.comments) : this.list, this.keepSend(t);
3052
- let r = `${e.unsent.length} comment${e.unsent.length === 1 ? "" : "s"}`, i = this.send.listening ? "" : t.wake?.message ? `. ${t.wake.message.replace(/\.$/, "")}` : e.wakes ? `: nobody is listening, so they wait for /epic review ${e.epic}` : `: nobody is listening, so /airplane land gathers them into ${e.epic}`;
3053
- X(`Sent ${r} to ${e.epic}${i}.`, i ? "warning" : "success"), this.draw();
3054
- } catch (t) {
3055
- X(`Couldn't send: ${t.message}`, "error");
3056
- }
3057
- }
3058
- }
3059
- draw() {
3060
- let { main: e } = this, t = this.fields().find((h) => document.activeElement === h.field)?.field, [r, i] = t ? [t.selectionStart, t.selectionEnd] : [0, 0], s = [...this.threads.values()].find((h) => h.isFoldFocused);
3061
- this.read = le(this.readKey);
3062
- let o = Ue(e), u = Ve(e), d = new Set(u ? [u, ...o] : o), f = /* @__PURE__ */ new Set();
3063
- for (let h of e.querySelectorAll(".spell-comment-mark")) {
3064
- let w = eo.get(h);
3065
- w && d.has(w) && !f.has(w) && kd(h, w) ? f.add(w) : Ts(h);
3066
- }
3067
- let p = /* @__PURE__ */ new Map(), v = [];
3068
- for (let h of this.list) {
3069
- let { block: w, exact: P } = En(e, h, o), R = w ?? u;
3070
- if (!R) continue;
3071
- let $ = w && h.quote && vn(w, h.quote, h.offset);
3072
- if ($ && v.push({ ...$, id: h.id, waiting: h.turn === "agent" }), this.open?.id === h.id) continue;
3073
- let Ce = $ ? yd(w, $) : R;
3074
- p.has(Ce) || p.set(Ce, []), p.get(Ce).push({ comment: h, exact: P && !!w });
3075
- }
3076
- let y = new Set(this.list.map((h) => h.id));
3077
- this.editing && !y.has(this.editing.id) && (this.editing = null);
3078
- for (let h of this.replyBoxes.keys()) y.has(h) || this.replyBoxes.delete(h);
3079
- for (let [h, w] of this.threads) (!y.has(h) || this.open?.id === h) && (w.remove(), this.threads.delete(h));
3080
- for (let h of d) f.has(h) || this.addBullhorn(h);
3081
- this.drawSend();
3082
- let T = /* @__PURE__ */ new Map();
3083
- for (let [h, w] of p) {
3084
- let P = this.boxFor(h);
3085
- T.set(P, w.length), w.forEach((R, $) => xd(P, this.thread(R), $));
3086
- }
3087
- for (let [h, w] of T) for (; h.children.length > w; ) h.lastElementChild.remove();
3088
- for (let h of e.querySelectorAll(`${xt}[data-spell-added]`)) T.has(h) || h.remove();
3089
- this.quotes = wd(v), this.makeRoom(), this.watchSeen(), this.drawWaiting(), this.drawPromoted(), requestAnimationFrame(() => this.growFields()), s?.isConnected && !s.isFoldFocused && s.focusFold(), !(!t?.isConnected || document.activeElement === t) && (t.focus({ preventScroll: true }), t.setSelectionRange(r, i));
3090
- }
3091
- growFields() {
3092
- for (let e of this.fields()) e.field.getClientRects().length && Ne(e.field);
3093
- }
3094
- get waitingOnOwen() {
3095
- return this.list.filter((e) => e.turn === "person");
3096
- }
3097
- waitingInPageOrder() {
3098
- return this.inPageOrder(this.waitingOnOwen);
3099
- }
3100
- jumpTargets() {
3101
- let e = this.waitingInPageOrder();
3102
- return e.length ? e : this.inPageOrder(this.list.filter((t) => !t.done));
3103
- }
3104
- inPageOrder(e) {
3105
- return e.map((t) => ({ comment: t, thread: this.threadOf(t.id) })).filter((t) => t.thread).sort((t, r) => t.thread.compareDocumentPosition(r.thread) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1).map((t) => t.comment);
3106
- }
3107
- threadOf(e) {
3108
- return this.main.querySelector(`#comment-${CSS.escape(e)}`);
3109
- }
3110
- find(e) {
3111
- let t = N.numberOf(e);
3112
- return t === void 0 ? void 0 : this.list.find((r) => N.numberOf(r.id) === t);
3113
- }
3114
- drawWaiting() {
3115
- let e = this.waitingHome();
3116
- if (!e) return;
3117
- let t = e.querySelector(":scope > .spell-toolbar-waiting");
3118
- if (!t) {
3119
- let f = E("ui-label", { class: "spell-toolbar-count replied", slot: "badge", appearance: "circular", size: "mini" });
3120
- t = e.matches(".spell-toolbar-tools") ? E("span", { class: "spell-toolbar-waiting", hidden: true }, E("ui-button", { appearance: "circular basic", size: "mini", icon: "bullhorn" }), f) : E("ui-item", { class: "spell-toolbar-item spell-toolbar-waiting", appearance: "link", icon: "bullhorn", hidden: true }, f), t.addEventListener("click", () => this.nextWaiting());
3121
- }
3122
- e.lastElementChild !== t && e.append(t);
3123
- let r = this.waitingInPageOrder().length, i = this.jumpTargets().length, s = r ? `${r} ${r === 1 ? "thread waits" : "threads wait"} on you: jump to the next` : `${i} ${i === 1 ? "comment" : "comments"}: jump to the next`, u = document.querySelector("ui-markdown[editable]:not([editable=tabs])") ? `${s}. ⌥-click text to edit it` : s, d = t.querySelector(".spell-toolbar-count");
3124
- d.textContent = String(r), d.hidden = !r, t.title = u, t.setAttribute("aria-label", u), t.localName === "ui-item" && Re(t, "item"), t.hidden = !i;
3125
- }
3126
- waitingHome() {
3127
- let e = document.querySelector(".spell-toolbar");
3128
- return qs(e) ?? e;
3129
- }
3130
- nextWaiting() {
3131
- let e = this.jumpTargets();
3132
- if (!e.length) return;
3133
- let t = e.findIndex((r) => r.id === this.lastWaiting);
3134
- this.landOn(e[(t + 1) % e.length].id);
3135
- }
3136
- async landOn(e) {
3137
- if (!this.list.some((r) => r.id === e)) return;
3138
- this.lastWaiting = e, this.folds.set(e, true), this.draw(), this.markSeen(e);
3139
- let t = `comment-${e}`;
3140
- this.go ? await this.go(t) : document.getElementById(t)?.scrollIntoView({ block: "start" }), this.threadOf(e)?.focusFold?.();
3141
- }
3142
- drawPromoted() {
3143
- if (!this.pageFolds) return;
3144
- let e = /* @__PURE__ */ new Map();
3145
- for (let t of this.inPageOrder(this.list.filter((r) => !r.done))) {
3146
- let r = this.pageFolds.outermostFolded(this.threadOf(t.id));
3147
- r && (e.has(r) || e.set(r, []), e.get(r).push(t));
3148
- }
3149
- for (let t of this.main.querySelectorAll(`.${Ft}`)) e.has(t.previousElementSibling) || t.remove();
3150
- for (let [t, r] of e) {
3151
- let i = t.nextElementSibling;
3152
- i?.classList.contains(Ft) || (i = E("div", { class: Ft, "data-spell-added": true }), t.after(i));
3153
- let s = r.map((o) => `${o.id}:${o.turn}:${N.headline(o)}`).join("|");
3154
- i.dataset.shows !== s && (i.dataset.shows = s, i.replaceChildren(...r.map((o) => this.promotedRow(o))));
3155
- }
3156
- }
3157
- promotedRow(e) {
3158
- let t = `C${N.numberOf(e.id)}`, r = E("button", { type: "button", class: `${Ft}-row`, title: `${t}: show this comment` }, E("ui-icon", { name: "bullhorn" }), E("b", {}, t), E("span", {}, N.headline(e)));
3159
- return r.classList.toggle("waiting", e.turn === "person"), r.addEventListener("click", () => this.showPromoted(e.id, r)), r;
3160
- }
3161
- async showPromoted(e, t) {
3162
- let r = t.getBoundingClientRect().top;
3163
- this.lastWaiting = e, this.folds.set(e, true), this.draw(), this.markSeen(e);
3164
- let i = this.threadOf(e);
3165
- if (i) {
3166
- this.pageFolds.reveal(i, { self: true });
3167
- for (let s = 0; s < ld; s++) scrollBy({ top: i.getBoundingClientRect().top - r, behavior: "instant" }), await De(1);
3168
- history.replaceState(history.state, "", `#comment-${e}`), i.focusFold?.();
3169
- }
3170
- }
3171
- watchFolds() {
3172
- if (!this.pageFolds) return;
3173
- let e = false;
3174
- this.foldWatch = new MutationObserver((t) => {
3175
- e || t.every((r) => r.target.localName === Js) || (e = true, requestAnimationFrame(() => {
3176
- e = false, this.drawPromoted();
3177
- }));
3178
- }), this.foldWatch.observe(this.main, { attributes: true, attributeFilter: ["open", "class"], subtree: true });
3179
- }
3180
- fields() {
3181
- return [...this.replyBoxes.values(), ...this.editing ? [this.editing] : []];
3182
- }
3183
- watchContent() {
3184
- let e = 0, t = /* @__PURE__ */ __name((r) => r.nodeType === 1 && (r.matches("[data-spell-added]") || r.closest("[data-spell-added]")), "t");
3185
- this.contentWatch = new MutationObserver((r) => {
3186
- r.some((s) => !t(s.target) && [...s.addedNodes, ...s.removedNodes].some((o) => o.nodeType === 1 && !t(o))) && (clearTimeout(e), e = setTimeout(() => this.draw(), Hs));
3187
- }).observe(this.main, { childList: true, subtree: true }), this.main.addEventListener("ui-drawn", () => {
3188
- clearTimeout(e), e = setTimeout(() => this.draw(), Hs);
3189
- }, { signal: this.signal }), this.signal?.addEventListener("abort", () => clearTimeout(e), { once: true });
3190
- }
3191
- stop() {
3192
- this.contentWatch?.disconnect(), this.foldWatch?.disconnect(), this.seenWatch?.disconnect();
3193
- for (let e of this.seenTimers.values()) clearTimeout(e);
3194
- this.seenTimers.clear(), this.floating?.remove(), this.floating = null, this.pane?.remove(), this.pane = null, this.open = null, document.documentElement.classList.remove("spell-over-quote");
3195
- }
3196
- addBullhorn(e) {
3197
- let t = this.placeOf(e), i = `Comment on ${t.kind === "page" ? "this page" : `this ${N.kindName(t.kind)}`}`, s = t.kind === "section" || t.kind === "page" ? t.kind : e.matches(pd) ? "title" : "block", o = Ys("bullhorn", i), u = E("span", { class: `spell-comment-mark at-${s}`, "data-spell-added": true }, o);
3198
- if (eo.set(u, e), o.addEventListener("click", (d) => {
3199
- d.stopPropagation();
3200
- let f = this.placeOf(e);
3201
- this.openBox({ key: f.anchor, place: f }, d.currentTarget.getBoundingClientRect());
3202
- }), s === "section" || s === "title") u.slot = "actions", e.append(u);
3203
- else if (s === "page") {
3204
- let d = e.querySelector(".spell-page-head");
3205
- d ? Zt(d, u, "comment") : e.append(u);
3206
- } else ks(e, u, "comment");
3207
- }
3208
- placeOf(e) {
3209
- if (e === Ve(this.main)) return { anchor: Me, kind: "page", label: "", excerpt: "" };
3210
- let t = je(e), r = t === "section" || t === "item" ? e : Ke(e, this.main);
3211
- return { anchor: wn(e, this.main), kind: t, label: r ? qt(r) : "", excerpt: _t(e) };
3212
- }
3213
- boxFor(e) {
3214
- if (We(e)?.localName === "ui-markdown") return this.boxInMarkdown(e);
3215
- let t = hd.test(e.localName) ? "first" : Ws.test(e.localName) ? "last" : "after", r = t === "first" ? vd(e) : t === "last" ? e.lastElementChild : e.nextElementSibling;
3216
- if (r?.localName === xt && r.hasAttribute("data-spell-added")) return r;
3217
- let i = E(xt, { "data-spell-added": true });
3218
- return t === "after" ? e.after(i) : t === "last" ? e.append(i) : r ? r.before(i) : e.append(i), i;
3219
- }
3220
- boxInMarkdown(e) {
3221
- let t = We(e), r = Ws.test(e.localName), i = r ? e.lastElementChild : e.nextElementSibling, s = i?.matches("slot[data-spell-added]") ? i : null;
3222
- s || (s = E("slot", { name: `spell-threads-${++Ad}`, "data-spell-added": true }), r ? e.append(s) : e.after(s));
3223
- let o = t.querySelector(`:scope > [slot="${s.name}"]`);
3224
- if (o) return o;
3225
- let u = E(xt, { slot: s.name, "data-spell-added": true });
3226
- return t.append(u), u;
3227
- }
3228
- wireSelection() {
3229
- let e = 0, t = { signal: this.signal };
3230
- document.addEventListener("selectionchange", () => {
3231
- clearTimeout(e), e = setTimeout(() => this.showFloating(), 120);
3232
- }, t), document.addEventListener("click", (i) => {
3233
- if (!getSelection()?.isCollapsed || i.target.closest?.("a, button, ui-button, input, textarea, [data-spell-added]")) return;
3234
- let s = this.quoteAt(i.clientX, i.clientY);
3235
- s && this.openComment(s.id);
3236
- }, t);
3237
- let r = false;
3238
- document.addEventListener("pointermove", (i) => {
3239
- r || !this.quotes.length || (r = true, requestAnimationFrame(() => {
3240
- r = false, document.documentElement.classList.toggle("spell-over-quote", !!this.quoteAt(i.clientX, i.clientY));
3241
- }));
3242
- }, { passive: true, ...t }), addEventListener("scroll", () => this.floating?.setAttribute("hidden", ""), { passive: true, ...t }), document.addEventListener("keydown", (i) => {
3243
- if (!(i.metaKey || i.ctrlKey) || i.altKey || i.shiftKey || i.key.toLowerCase() !== "i") return;
3244
- let s = this.selected();
3245
- s && (i.preventDefault(), this.commentOn(s));
3246
- }, t), this.signal?.addEventListener("abort", () => clearTimeout(e), { once: true });
3247
- }
3248
- selected() {
3249
- let e = getSelection(), t = e && this.selectedRange(e);
3250
- if (!t || t.collapsed) return null;
3251
- let r = t.startContainer;
3252
- if (!$t(this.main, r) || (r.nodeType === 1 ? r : r.parentElement)?.closest("[data-spell-added], textarea, input")) return null;
3253
- let s = yn(r, Ue(this.main)), o = (e.toString() || t.toString()).trim();
3254
- return !s || !o ? null : { block: s, quote: o, offset: An(s, r, t.startOffset), range: t };
3255
- }
3256
- selectedRange(e) {
3257
- if (!e.rangeCount) return null;
3258
- if (!e.getComposedRanges) return e.getRangeAt(0);
3259
- let t = [...this.main.querySelectorAll("ui-markdown")].flatMap((s) => s.shadowRoot ?? []), [r] = e.getComposedRanges({ shadowRoots: t });
3260
- if (!r || r.startContainer.getRootNode() !== r.endContainer.getRootNode()) return null;
3261
- let i = document.createRange();
3262
- return i.setStart(r.startContainer, r.startOffset), i.setEnd(r.endContainer, r.endOffset), i;
3263
- }
3264
- commentOn({ block: e, quote: t, offset: r, range: i }) {
3265
- this.floating?.setAttribute("hidden", "");
3266
- let s = i.getClientRects(), o = s[s.length - 1] ?? i.getBoundingClientRect(), u = { ...this.placeOf(e), quote: t.slice(0, 2e3), offset: r };
3267
- this.openBox({ key: `${u.anchor}~${r}`, place: u }, o);
3268
- }
3269
- quoteAt(e, t) {
3270
- for (let { id: r, range: i } of this.quotes) {
3271
- let s = Array.from(i.getClientRects()).find((o) => e >= o.left && e <= o.right && t >= o.top && t <= o.bottom);
3272
- if (s) return { id: r, rect: s };
3273
- }
3274
- return null;
3275
- }
3276
- openComment(e) {
3277
- if (this.open?.id === e && this.pane) return this.focusPane();
3278
- if (!this.list.some((r) => r.id === e)) return;
3279
- this.folds.set(e, true), this.draw(), this.markSeen(e);
3280
- let t = this.threadOf(e);
3281
- t?.header?.scrollIntoView({ block: "nearest" }), t?.focusFold?.();
3282
- }
3283
- showFloating() {
3284
- let e = this.selected(), t = this.floatingBullhorn();
3285
- if (!e) return t.setAttribute("hidden", "");
3286
- let r = e.range.getClientRects(), i = r[r.length - 1] ?? e.range.getBoundingClientRect();
3287
- t.style.left = `${Math.min(innerWidth - 36, i.right + 6)}px`, t.style.top = `${Math.max(4, i.top - 4)}px`, t.removeAttribute("hidden");
3288
- }
3289
- floatingBullhorn() {
3290
- if (this.floating) return this.floating;
3291
- let e = `Comment on this text (${/Mac|iPhone|iPad/.test(navigator.platform) ? "⌘" : "Ctrl "}I)`, t = Ys("bullhorn", e);
3292
- return t.classList.add("spell-comment-float"), t.hidden = true, t.addEventListener("pointerdown", (r) => r.preventDefault()), t.addEventListener("click", () => {
3293
- let r = this.selected();
3294
- r && this.commentOn(r);
3295
- }), document.body.append(t), this.floating = t;
3296
- }
3297
- thread({ comment: e, exact: t }) {
3298
- let r = this.threads.get(e.id);
3299
- r || (r = E(Js, { id: `comment-${e.id}` }), this.wireThread(r, e.id), this.threads.set(e.id, r));
3300
- let i = this.editing?.id === e.id ? this.editing : null, s = i ?? (e.turn === "done" ? null : this.replyBoxFor(e)), o = !!s && (s.busy() || !!i);
3301
- e.turn === "done" && this.replyBoxes.delete(e.id);
3302
- let u = !!e.working && e.turn !== "done", d = o || (this.folds.get(e.id) ?? (e.turn === "person" || u));
3303
- r.comment = e, r.toggleAttribute("open", d), r.toggleAttribute("unseen", this.unseen(e)), r.toggleAttribute("moved", !t), sn(r, "boxed", i ? "first" : s?.saved() ? "pending" : void 0), this.showFloppy(r, s);
3304
- let f = s?.box;
3305
- return (f ? r.firstElementChild !== f || r.childElementCount !== 1 : r.childElementCount) && r.replaceChildren(...f ? [f] : []), r;
3306
- }
3307
- showFloppy(e, t) {
3308
- sn(e, "saved", t?.floppy?.tip), e.toggleAttribute("failed", !!t?.floppy?.failed);
3309
- }
3310
- replyBoxFor(e) {
3311
- let t = N.pendingReplyOf(e)?.text ?? "", r = this.replyBoxes.get(e.id);
3312
- if (r && (r.busy() || r.saved() === t)) return r;
3313
- r?.drop();
3314
- let i = this.makeBox(e.id, "reply", t);
3315
- return this.replyBoxes.set(e.id, i), i;
3316
- }
3317
- makeBox(e, t, r) {
3318
- let i = E("textarea", { class: "spell-comment-field", rows: 1, "aria-label": t === "edit" ? "Your comment" : "Your reply" }), s = { id: e, how: t, box: i, field: i, floppy: null };
3319
- return this.wireReply(s, r), s;
3320
- }
3321
- wireThread(e, t) {
3322
- let r = /* @__PURE__ */ __name((i) => {
3323
- let s = !!i.detail?.open;
3324
- this.folds.set(t, s), s && (requestAnimationFrame(() => this.growFields()), this.markSeen(t));
3325
- }, "r");
3326
- e.addEventListener("epic-thread-opened", r), e.addEventListener("epic-thread-closed", r), e.addEventListener("epic-thread-answered", (i) => {
3327
- let s = i.detail?.act;
3328
- s === "reply" ? this.focusReply(t) : s === "reopen" ? this.reopen(t) : (s === "good" || s === "skip") && this.resolve(t, s);
3329
- }), e.addEventListener("epic-thread-editing", () => this.startEdit(t)), e.addEventListener("epic-thread-removing", () => {
3330
- this.remove(t);
3331
- });
3332
- }
3333
- async resolve(e, t) {
3334
- if (!(this.editing?.id === e && !await this.closeEdit()) && !(this.replyBoxes.has(e) && !await this.replyBoxes.get(e).finish())) try {
3335
- await this.post({ action: "resolve", id: e, how: t }), this.folds.delete(e), this.draw();
3336
- let r = false;
3337
- X(t === "skip" ? "Skipped: nothing more to do" : "Done: that's good", "success", { displayTime: zs, actions: [{ text: "Undo", icon: "rotate left", click: /* @__PURE__ */ __name(() => {
3338
- r || (r = true, this.reopen(e));
3339
- }, "click") }] });
3340
- } catch (r) {
3341
- X(`Couldn't close the thread: ${r.message}`, "error");
3342
- }
3343
- }
3344
- async reopen(e) {
3345
- try {
3346
- await this.post({ action: "reopen", id: e }), this.folds.delete(e), this.draw();
3347
- } catch (t) {
3348
- X(`Couldn't reopen the thread: ${t.message}`, "error");
3349
- }
3350
- }
3351
- async post(e, t) {
3352
- let r = await K.forPage().post(bt, { page: location.pathname, ...e }, t);
3353
- return this.list = r.comments ? N.withTurns(r.comments) : this.list, this.keepSend(r), r;
3354
- }
3355
- async focusReply(e) {
3356
- this.folds.set(e, true), this.draw(), await De();
3357
- let r = (this.editing?.id === e ? this.editing : this.replyBoxes.get(e))?.field;
3358
- r?.isConnected && (Ne(r), r.scrollIntoView({ block: "nearest" }), r.focus({ preventScroll: true }), r.setSelectionRange(r.value.length, r.value.length));
3359
- }
3360
- startEdit(e) {
3361
- if (this.editing?.id === e) return void this.focusReply(e);
3362
- this.closeEdit();
3363
- let t = this.list.find((r) => r.id === e);
3364
- t && (this.editing = this.makeBox(e, "edit", t.text), this.focusReply(e));
3365
- }
3366
- async closeEdit() {
3367
- let e = this.editing;
3368
- return e ? await e.finish() ? (this.editing === e && (this.editing = null), this.draw(), true) : (X(e.floppy?.tip ?? "Not saved", "error"), false) : true;
3369
- }
3370
- wireReply(e, t) {
3371
- let { id: r, how: i, box: s, field: o } = e, u = `${r}~${i}`, d = /* @__PURE__ */ __name((y) => {
3372
- e.floppy = y;
3373
- let T = this.threads.get(r);
3374
- T && s.parentElement === T && this.showFloppy(T, e);
3375
- }, "d");
3376
- o.value = le(this.draftKey)[u] ?? t;
3377
- let f = /* @__PURE__ */ __name(() => {
3378
- let y = le(this.draftKey);
3379
- o.value.trim() !== t ? y[u] = o.value : delete y[u], Qe(this.draftKey, y);
3380
- }, "f"), p = new de({ wait: Vs, save: /* @__PURE__ */ __name(async ({ keepalive: y }) => {
3381
- let T = o.value.trim();
3382
- T === t || !T && i === "edit" || (await this.post({ action: i, id: r, text: T }, { keepalive: y }), t = T, f(), d(T ? { tip: Qs() } : null), (this.replyBoxes.get(r) === e || this.editing === e) && this.draw());
3383
- }, "save"), onChange: /* @__PURE__ */ __name(() => {
3384
- p.state.kind === "failed" && d({ tip: Zs(p.state.why), failed: true });
3385
- }, "onChange") });
3386
- p.isUnsaved = o.value.trim() !== t;
3387
- let v = /* @__PURE__ */ __name(() => p.save(), "v");
3388
- e.saved = () => t, e.busy = () => document.activeElement === o || o.value.trim() !== t || p.isPending || p.isUnsaved, e.drop = () => p.stop(), e.finish = async () => {
3389
- if (i === "edit" && !o.value.trim()) return p.stop(), this.forget(u), this.editing === e && (this.editing = null), await this.remove(r), true;
3390
- let y = await v();
3391
- return y && this.forget(u), y;
3392
- }, e.flush = () => {
3393
- p.save({ keepalive: true });
3394
- }, o.addEventListener("input", () => {
3395
- Ne(o), f(), p.changed();
3396
- }), o.addEventListener("keydown", (y) => {
3397
- (y.key === "Escape" || y.key === "Enter" && (y.metaKey || y.ctrlKey)) && (y.preventDefault(), y.stopPropagation(), i === "edit" ? this.closeEdit() : o.blur());
3398
- }), o.addEventListener("blur", () => {
3399
- setTimeout(() => {
3400
- !s.isConnected || document.activeElement === o || (i === "edit" ? this.editing === e && this.closeEdit() : this.replyBoxes.get(r) === e && v());
3401
- });
3402
- });
3403
- }
3404
- async remove(e) {
3405
- let t = this.waiting(e) ? "delete" : "clear", r = this.list.find((i) => i.id === e);
3406
- try {
3407
- await this.post({ action: t, id: e }), this.forget(e), this.forget(`${e}~reply`), this.editing?.id === e && (this.editing = null), this.replyBoxes.get(e)?.drop(), this.replyBoxes.delete(e), this.open?.id === e ? this.closePane() : this.draw();
3408
- let i = false;
3409
- X("Comment deleted", "success", { displayTime: zs, actions: r ? [{ text: "Undo", icon: "rotate left", click: /* @__PURE__ */ __name(() => {
3410
- i || (i = true, this.restore(r));
3411
- }, "click") }] : void 0 });
3412
- } catch (i) {
3413
- X(`Couldn't delete the comment: ${i.message}`, "error");
3414
- }
3415
- }
3416
- async restore(e) {
3417
- try {
3418
- let { id: t, ...r } = e;
3419
- await this.post({ action: "restore", id: t, comment: r }), this.draw();
3420
- } catch (t) {
3421
- X(`Couldn't bring the comment back: ${t.message}`, "error");
3422
- }
3423
- }
3424
- openBox(e, t) {
3425
- if (this.pane && this.open?.key === e.key) return this.focusPane();
3426
- this.open?.finish?.(), this.pane?.remove(), this.open = e, this.draw(), this.showPane(t);
3427
- }
3428
- closePane() {
3429
- this.pane?.remove(), this.pane = null, this.open = null, this.draw();
3430
- }
3431
- showPane(e) {
3432
- let t = this.open, r = E("textarea", { class: "spell-comment-field", rows: 3, "aria-label": "Your comment" }), i = this.pane = E(Cd, { "data-spell-added": true, headline: N.headline(t.place), about: N.aboutTip(t) }, r);
3433
- i.near = e ? { left: e.left, top: e.top, bottom: e.bottom } : void 0, this.wirePane(i, r, t), this.main.append(i), Sd(i).then(() => {
3434
- this.pane === i && (Ne(r), this.focusPane());
3435
- });
3436
- }
3437
- focusPane() {
3438
- let e = this.pane?.querySelector(":scope > textarea");
3439
- e && (e.focus({ preventScroll: true }), e.setSelectionRange(e.value.length, e.value.length));
3440
- }
3441
- wirePane(e, t, r) {
3442
- let i = this.wireField(e, t, r);
3443
- e.addEventListener("epic-comment-closing", () => {
3444
- i();
3445
- }), e.addEventListener("keydown", (s) => {
3446
- (s.key === "Escape" || s.key === "Enter" && (s.metaKey || s.ctrlKey)) && (s.preventDefault(), s.stopPropagation(), i());
3447
- }), e.addEventListener("focusout", () => {
3448
- setTimeout(() => {
3449
- this.pane !== e || e.contains(document.activeElement) || i();
3450
- });
3451
- }), e.addEventListener("epic-comment-removing", () => {
3452
- r.discard ? r.discard() : this.remove(r.id);
3453
- });
3454
- }
3455
- wireField(e, t, r) {
3456
- let { key: i, place: s } = r, o = "", u = (r.text ?? "").trim(), d = false, f = /* @__PURE__ */ __name(() => r.id ?? i, "f");
3457
- t.value = this.draftOf(r) ?? r.text ?? "";
3458
- let p = /* @__PURE__ */ __name((h = f()) => {
3459
- let w = le(this.draftKey);
3460
- delete w[h];
3461
- let P = t.value.trim();
3462
- P && P !== u ? w[f()] = t.value : delete w[f()], Qe(this.draftKey, w);
3463
- }, "p"), v = /* @__PURE__ */ __name(async ({ keepalive: h }) => {
3464
- let w = t.value.trim();
3465
- if (d || w === u || !w && !r.id) return;
3466
- let P = w ? r.id ? { action: "edit", id: r.id, text: w } : { action: "add", ...s, text: w } : { action: this.waiting(r.id) ? "delete" : "clear", id: r.id }, R = await K.forPage().post(bt, { page: location.pathname, ...P }, { keepalive: h }), $ = f();
3467
- r.id = w ? r.id ?? R.id : void 0, u = w, this.list = R.comments ? N.withTurns(R.comments) : this.list, this.keepSend(R), p($), o = w ? Qs() : "", sn(e, "saved", o || void 0), e.removeAttribute("failed"), e.toggleAttribute("deletable", !!r.id), this.open === r && this.draw();
3468
- }, "v"), y = new de({ wait: Vs, save: v, onChange: /* @__PURE__ */ __name(() => {
3469
- y.state.kind === "failed" && (o = Zs(y.state.why), e.setAttribute("saved", o), e.setAttribute("failed", ""));
3470
- }, "onChange") });
3471
- y.isUnsaved = t.value.trim() !== u;
3472
- let T = /* @__PURE__ */ __name(() => y.save(), "T");
3473
- return r.finish = async () => await T() ? (this.forget(f()), this.forget(i), true) : false, r.flush = () => {
3474
- y.save({ keepalive: true });
3475
- }, r.discard = async () => {
3476
- if (y.stop(), await y.settled, d = true, this.forget(f()), this.forget(i), r.id) return this.remove(r.id);
3477
- this.open === r && this.closePane();
3478
- }, t.addEventListener("input", () => {
3479
- Ne(t), p(), y.changed();
3480
- }), t.addEventListener("blur", () => {
3481
- T();
3482
- }), async () => {
3483
- if (!await r.finish()) return X(o, "error");
3484
- this.open === r && this.closePane();
3485
- };
3486
- }
3487
- draftOf(e) {
3488
- let t = e.id ?? e.key, r = le(this.draftKey)[t];
3489
- if (typeof r != "string" || !r.trim()) return;
3490
- let { anchor: i, quote: s } = e.place;
3491
- if (!(!e.id && this.list.some((u) => u.anchor === i && (u.quote ?? "") === (s ?? "") && u.text === r.trim()))) return r;
3492
- this.forget(t);
3493
- }
3494
- waiting(e) {
3495
- let t = this.list.find((r) => r.id === e);
3496
- return !t || t.status === "new";
3497
- }
3498
- forget(e) {
3499
- let t = le(this.draftKey);
3500
- delete t[e], Qe(this.draftKey, t);
3501
- }
3502
- };
3503
- function gd({ epic: n, unsent: e, waiting: t }, r) {
3504
- let i = /* @__PURE__ */ __name((s) => `${s} comment${s === 1 ? "" : "s"}`, "i");
3505
- return r === "unsent" ? `Send ${i(e.length)} to epic ${n}` : r === "sent" ? `Sent to ${n}: ${i(t.length)} waiting for Claude` : "Nothing to send: no comment here is waiting for Claude";
3506
- }
3507
- __name(gd, "gd");
3508
- function md({ epic: n, owned: e, wakes: t, listening: r }) {
3509
- return r ? `${n} is listening` : e ? "nobody is listening" : t ? `nobody is listening: Send wakes ${n}` : "no epic owns this page";
3510
- }
3511
- __name(md, "md");
3512
- function Dd({ epic: n, owned: e, wakes: t, listening: r }) {
3513
- let i = e ? `epic ${n}` : `epic ${n}, the standing epic for every page no epic owns (no epic's See Also lists this one)`;
3514
- return r ? `A Claude session is reviewing ${i}: Send hands it these comments now` : t ? `No Claude session is reviewing ${i}: Send wakes its session` : `No epic's See Also lists this page, and epic ${n} isn't made yet: /airplane land gathers its comments`;
3515
- }
3516
- __name(Dd, "Dd");
3517
- function Ks(n) {
3518
- let e = String(n ?? "").split(`
3519
- `)[0].trim();
3520
- return e.length > 60 ? `${e.slice(0, 60).trimEnd()}…` : e;
3521
- }
3522
- __name(Ks, "Ks");
3523
- function yd(n, { start: e, end: t }) {
3524
- try {
3525
- let r = document.createRange();
3526
- r.setStart(...e), r.setEnd(...t);
3527
- let i = r.commonAncestorContainer, s = (i.nodeType === 1 ? i : i.parentElement)?.closest(cd);
3528
- if (!s || s === n || !$t(n, s)) return n;
3529
- let o = s.parentElement?.shadowRoot;
3530
- return o && !o.querySelector("slot:not([name])") ? n : s;
3531
- } catch {
3532
- return n;
3533
- }
3534
- }
3535
- __name(yd, "yd");
3536
- function wd(n) {
3537
- let e = n.flatMap(({ id: t, start: r, end: i, waiting: s }) => {
3538
- try {
3539
- let o = document.createRange();
3540
- return o.setStart(...r), o.setEnd(...i), [{ id: t, range: o, waiting: s }];
3541
- } catch {
3542
- return [];
3543
- }
3544
- });
3545
- if (globalThis.Highlight && globalThis.CSS?.highlights) {
3546
- for (let { range: r } of e) Ed(r.startContainer.getRootNode());
3547
- let t = /* @__PURE__ */ __name((r) => e.filter((i) => !!i.waiting === r).map(({ range: i }) => i), "t");
3548
- CSS.highlights.set(to, new Highlight(...t(false))), CSS.highlights.set(no, new Highlight(...t(true)));
3549
- }
3550
- return e;
3551
- }
3552
- __name(wd, "wd");
3553
- function Ed(n) {
3554
- n === document || n.querySelector("style[data-spell-quotes]") || n.append(E("style", { "data-spell-quotes": true }, `::highlight(${to}) { background-color: var(--spell-quote-color); }
3555
- ::highlight(${no}) { background-color: var(--spell-quote-waiting-color); }`));
3556
- }
3557
- __name(Ed, "Ed");
3558
- var Ad = 0, zs = 6e3;
3559
- function Ys(n, e, { size: t = "mini" } = {}) {
3560
- let r = E("ui-button", { appearance: "circular basic", size: t, icon: n, title: e, "aria-label": e });
3561
- return Re(r), r;
3562
- }
3563
- __name(Ys, "Ys");
3564
- function vd(n) {
3565
- return Array.from(n.children).find((e) => !e.hasAttribute("slot")) ?? null;
3566
- }
3567
- __name(vd, "vd");
3568
- var xt = "epic-threads", Js = "epic-thread", Cd = "epic-comment-pane", bd = "epic-send-buttons", Fd = "epic-send-saving", Xs = "--epic-thread-head-room";
3569
- function xd(n, e, t) {
3570
- let r = n.children[t];
3571
- r !== e && n.insertBefore(e, r ?? null);
3572
- }
3573
- __name(xd, "xd");
3574
- function sn(n, e, t) {
3575
- t === void 0 ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t);
3576
- }
3577
- __name(sn, "sn");
3578
- async function Sd(n) {
3579
- await customElements.whenDefined(n.localName), await n.ready?.catch(() => {
3580
- });
3581
- }
3582
- __name(Sd, "Sd");
3583
- function Qs() {
3584
- return `Saved ${N.localStamp((/* @__PURE__ */ new Date()).toISOString()).slice(11)} · waiting for Claude`;
3585
- }
3586
- __name(Qs, "Qs");
3587
- function Zs(n) {
3588
- return `Not saved: ${n} (kept in this browser)`;
3589
- }
3590
- __name(Zs, "Zs");
3591
- var eo = /* @__PURE__ */ new WeakMap();
3592
- function kd(n, e) {
3593
- if (!n.isConnected || !e.isConnected) return false;
3594
- if (n.parentElement === e || n.classList.contains("at-page")) return true;
3595
- let t = n.closest(ce);
3596
- return !!t && t.nextElementSibling === e;
3597
- }
3598
- __name(kd, "kd");
3599
- var un = "main#main", Td = "spell-site:navigated", io = "site-mounted", Pd = 1e4, so = "site-sticky-bar", Od = "--site-sections-top", Bd = 350, Id = 0.2, Rd = 200, Nd = 2e3, Ld = ["spell-comments.css", "spell-toolbar.css"].map((n) => new URL(n, document.currentScript?.src ?? location.href).href), oo = null;
3600
- Hd();
3601
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
3602
- an();
3603
- }, { once: true }) : an();
3604
- document.addEventListener(Td, () => {
3605
- an();
3606
- });
3607
- Ms(uo, Ud, { search: Wd, host: /* @__PURE__ */ __name(() => document.querySelector("ui-root.site"), "host"), first: true });
3608
- async function an() {
3609
- oo?.abort();
3610
- let n = oo = new AbortController(), { signal: e } = n;
3611
- await Vd();
3612
- let t = document.querySelector(un);
3613
- !t || e.aborted || ($d(t, { signal: e }), await ro(t, { signal: e, go: uo }));
3614
- }
3615
- __name(an, "an");
3616
- function $d(n, { signal: e }) {
3617
- let t = qd(n), r = t[0]?.parentElement?.closest("ui-tab")?.closest("ui-tabs");
3618
- if (!r) return ao(t, { signal: e });
3619
- let i = null, s = /* @__PURE__ */ __name(() => {
3620
- i?.abort(), i = new AbortController(), e.addEventListener("abort", () => i.abort(), { once: true, signal: i.signal });
3621
- let o = [...r.querySelectorAll(":scope > ui-tab")].find(_d);
3622
- ao(t.filter((u) => u.parentElement.closest("ui-tab") === o), { signal: i.signal });
3623
- }, "s");
3624
- r.addEventListener("ui-opened", (o) => o.target.parentElement === r && requestAnimationFrame(s), { signal: e }), s();
3625
- }
3626
- __name($d, "$d");
3627
- function ao(n, { signal: e }) {
3628
- if (!n.length) return;
3629
- let t = n.map((h) => ({ element: h, id: h.id, label: Md(h), glyph: h.querySelector(':scope > ui-icon[slot="icon"]')?.getAttribute("name") ?? h.getAttribute("icon") ?? void 0 })), r = _s($s(t, () => []), { titled: true, segmented: !!n[0].closest("ui-tabs") });
3630
- for (let h of document.querySelectorAll(`.${so}.spell-site-toolbar`)) h.remove();
3631
- let i = E("ui-sticky", { class: `${so} spell-site-toolbar`, "data-spell-added": true }, r);
3632
- n[0].parentElement.prepend(i), r.addEventListener("click", Kd, { signal: e });
3633
- let o = /* @__PURE__ */ __name(() => !e.aborted && dispatchEvent(new Event("resize")), "o");
3634
- Promise.all(["ui-sticky", "ui-menu", "ui-item"].map((h) => customElements.whenDefined(h))).then(() => De(2)).then(o);
3635
- let u = false, d, f = 0, p = 0, v = /* @__PURE__ */ __name(() => {
3636
- d = void 0, T();
3637
- }, "v"), y = /* @__PURE__ */ __name(() => {
3638
- clearTimeout(f), f = setTimeout(v, ot(p + Nd - Date.now(), 0, Rd));
3639
- }, "y");
3640
- r.addEventListener("click", (h) => {
3641
- let w = h.composedPath().find((P) => P.localName === "ui-item" && P.hasAttribute("data-rail"));
3642
- w && (d = w.dataset.rail, p = Date.now(), nn(r, d), y());
3643
- }, { signal: e });
3644
- let T = /* @__PURE__ */ __name(() => {
3645
- if (d !== void 0) return y();
3646
- u || (u = true, requestAnimationFrame(() => {
3647
- u = false, e.aborted || nn(r, jd(document.querySelector(un), n)?.id ?? n[0].id);
3648
- }));
3649
- }, "T");
3650
- e.addEventListener("abort", () => clearTimeout(f), { once: true }), addEventListener("scroll", T, { passive: true, signal: e }), addEventListener("resize", T, { passive: true, signal: e }), T();
3651
- }
3652
- __name(ao, "ao");
3653
- function _d(n) {
3654
- try {
3655
- return n.matches(":state(selected)");
3656
- } catch {
3657
- return !n.hidden;
3658
- }
3659
- }
3660
- __name(_d, "_d");
3661
- function qd(n) {
3662
- let e = n.querySelector(".site-article"), t = e ? [...e.querySelectorAll(":scope > ui-section[id]")] : [];
3663
- return t.length ? t : [...n.querySelectorAll("ui-section[id]")].filter((r) => !r.parentElement?.closest("ui-section, ui-example, template"));
3664
- }
3665
- __name(qd, "qd");
3666
- function Md(n) {
3667
- let e = n.getAttribute("label")?.trim();
3668
- return e || (n.querySelector(':scope > [slot="label"]')?.textContent.replace(/\s+/g, " ").trim() ?? n.id);
3669
- }
3670
- __name(Md, "Md");
3671
- function jd(n, e) {
3672
- let t = parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop) || 0, r = (parseFloat(n.style.getPropertyValue(Od)) || 0) + 4, i = Math.max(r, t + innerHeight * Id), s = scrollY + innerHeight >= document.documentElement.scrollHeight - 2, o;
3673
- for (let u of e) {
3674
- let d = u.getBoundingClientRect();
3675
- if (!(!d.height && !d.width)) {
3676
- if (d.top > (s ? innerHeight - 1 : i)) break;
3677
- o = u;
3678
- }
3679
- }
3680
- return o;
3681
- }
3682
- __name(jd, "jd");
3683
- function Kd(n) {
3684
- if (n.defaultPrevented || n.button !== 0 || n.metaKey || n.ctrlKey || n.shiftKey || n.altKey) return;
3685
- let t = n.composedPath().find((i) => i.localName === "ui-item" && i.hasAttribute("data-rail"))?.getAttribute("href");
3686
- if (!t?.startsWith("#")) return;
3687
- n.preventDefault();
3688
- let r = location.href;
3689
- history.pushState(history.state, "", t), dispatchEvent(new HashChangeEvent("hashchange", { oldURL: r, newURL: location.href }));
3690
- }
3691
- __name(Kd, "Kd");
3692
- async function uo(n) {
3693
- decodeURIComponent(location.hash.slice(1)) === n && history.replaceState(history.state, "", `${location.pathname}${location.search}`), location.hash = n, await new Promise((e) => setTimeout(e, Bd));
3694
- }
3695
- __name(uo, "uo");
3696
- function Ud(n) {
3697
- let e = document.getElementById(n);
3698
- return !!e && !!document.querySelector(un)?.contains(e);
3699
- }
3700
- __name(Ud, "Ud");
3701
- async function Wd(n) {
3702
- let e = [...document.querySelectorAll("ui-docs-nav")].map((i) => i.shadowRoot?.querySelector("ui-docs-search") ?? i.querySelector("ui-docs-search")).filter(Boolean), t = e.find((i) => i.checkVisibility()) ?? e[0];
3703
- if (!t?.summon) return;
3704
- await t.summon();
3705
- let r = t.shadowRoot?.querySelector('input[part~="input"]') ?? t.shadowRoot?.querySelector("input");
3706
- r && (r.value = n, r.dispatchEvent(new InputEvent("input", { bubbles: true, composed: true, inputType: "insertText", data: n })));
3707
- }
3708
- __name(Wd, "Wd");
3709
- function Vd() {
3710
- let e = new Promise((t) => {
3711
- if (document.documentElement.classList.contains(io)) return t();
3712
- let r = new MutationObserver(() => {
3713
- document.documentElement.classList.contains(io) && (r.disconnect(), t());
3714
- });
3715
- r.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
3716
- }).then(() => customElements.whenDefined("ui-root"));
3717
- return Promise.race([e, new Promise((t) => setTimeout(t, Pd))]);
3718
- }
3719
- __name(Vd, "Vd");
3720
- function Hd() {
3721
- for (let n of Ld) {
3722
- if (document.querySelector(`link[rel="stylesheet"][href="${CSS.escape(n)}"]`)) continue;
3723
- let e = document.createElement("link");
3724
- e.rel = "stylesheet", e.href = n, document.head.append(e);
3725
- }
3726
- }
3727
- __name(Hd, "Hd");
3728
- })();
33
+ ui-button { flex: none; }`;var Ss="input, textarea, select, ui-input, ui-select, ui-dropdown";function le(n){let e=Y.getAt(n);return e&&typeof e=="object"?e:{}}function Qe(n,e){Y.setAt(n,e)}function Cs(n,e){let t=n.querySelector(":scope > .spell-toolbar");t?t.before(e):n.append(e)}function Zt(n,e,t){if(e.dataset.headTool=t,!n.matches(".spell-page-head"))return Cs(n,e);let r=n.querySelector(":scope > .spell-head-tools");r||(r=E("span",{class:"spell-head-tools","data-spell-added":!0}),Cs(n,r));let i=bs.indexOf(t),s=[...r.children].find(o=>bs.indexOf(o.dataset.headTool)>i);r.insertBefore(e,s??null)}var bs=["send","page","comment"];function ks(n,e,t){let r=n.previousElementSibling;r?.matches(ce)||(r=E(ce,{"data-spell-added":!0}),n.slot&&(r.slot=n.slot),n.before(r)),e.dataset.action=t;let i=Fs.indexOf(t),s=[...r.children].find(o=>Fs.indexOf(o.dataset.action)>i);return r.insertBefore(e,s??null),en(r),r}function Ts(n){let e=n.closest(ce);n.remove(),e&&!e.querySelector("[data-action]")&&e.remove()}var ce="epic-actions",Fs=["comment","expand"];function en(n){let e=n.matches?.(ce)?[n]:[...n.querySelectorAll(ce)],t=e.map(r=>{let i=r.nextElementSibling;if(!i||!r.getClientRects().length||!i.getClientRects().length)return;let s=i.querySelector("tr")?.getBoundingClientRect(),o=s?.height?s.top:i.getBoundingClientRect().top;return{gap:xs(o-r.getBoundingClientRect().top),head:s?.height?xs(s.height):void 0}});e.forEach((r,i)=>{let s=t[i];if(s){for(let[o,u]of[["--spell-block-gap",s.gap],["--spell-block-head",s.head]])u===void 0?r.style.removeProperty(o):r.style.getPropertyValue(o)!==u&&r.style.setProperty(o,u);r.toggleAttribute("head-row",!!s.head)}})}function xs(n){return`${Math.round(n*100)/100}px`}function Re(n,e="button"){let t=()=>{let r=n.shadowRoot?.querySelector(`[part~="${e}"]`);return r&&(r.title=n.title),!!r};t()||customElements.whenDefined(n.localName).then(()=>requestAnimationFrame(t))}function E(n,e={},...t){let r=document.createElement(n);for(let[i,s]of Object.entries(e))s!==void 0&&s!==!1&&r.setAttribute(i,s===!0?"":String(s));return r.append(...t.filter(i=>i!=null&&i!==!1&&i!=="")),r}function Ne(n){n.style.height="auto",n.style.height=`${n.scrollHeight+2}px`}function X(n,e,{displayTime:t=3e3,actions:r}={}){vt.show(n,{tone:e??"plain",ms:t,actions:r})}var Ze=class n{static NAMES=["red","orange","yellow","olive","green","teal","blue","violet","purple","pink","brown","grey","black"];static isColor(e){return typeof e=="string"&&Tl.test(e.trim())}static cssOf(e){let t=e.trim().toLowerCase();return n.NAMES.includes(t)?`var(--ui-${t})`:e}},Tl=/^[#\w][\w\s#%.,()/+-]{0,60}$/;var N=class n{static agentOf(e){if(!e)return;let t=n.field(e,"agent")?.trim();return t||(n.isOldClaudes(e)?Pl:void 0)}static isAgents(e){return n.agentOf(e)!==void 0}static isOldClaudes(e){if(n.field(e,"agent")?.trim()||!ve(n.authorOf(e),tn))return!1;let t=n.field(e,"at")??"";return!t||t<n.AGENTS_MARKED}static authorOf(e){return(n.field(e,"from")??n.field(e,"by")??"").trim()}static speakerOf(e,t=n.viewer()){let r=n.agentOf(e),i=n.authorOf(e),o=!i||r!==void 0&&(ve(i,tn)||ve(i,n.agentLabel(r)))?void 0:i;return{person:o,agent:r,mine:!!o&&!!t&&ve(o,t)}}static viewer(e=globalThis){let t=e?.SPELL_SERVER?.person;return typeof t=="string"&&t.trim()?t.trim():void 0}static agentLabel(e){let t=(e??"").trim();return t?Ol[t.toLowerCase()]??t.charAt(0).toUpperCase()+t.slice(1):tn}static voiceOf({person:e,agent:t},r=n.colors()){let[i,s,o]=t?["agent",t,Os(r.agents,t)]:["person",e,Os(r.people,e)],u=ql(s);if(u)return`var(--epic-voice-${i}-${u}${o?`, ${Ze.cssOf(o)}`:""})`}static colors(e=globalThis){let t=e?.SPELL_SERVER?.colors;return{people:Bs(t?.people),agents:Bs(t?.agents)}}static sameName(e,t){return ve(e??"",t??"")}static field(e,t){if(typeof e.getAttribute=="function")return e.getAttribute(t)??void 0;let r=e[t];return typeof r=="string"?r:void 0}static turnOf(e){if(e.done)return"done";let t=e.replies?.at(-1);return t?n.isAgents(t)?"person":"agent":e.status==="answered"?"person":"agent"}static asTurn(e){return e===Il?"person":e===Rl?"agent":Bl.includes(e)?e:void 0}static isAgentsTurn(e){return(n.asTurn(e.turn)??n.turnOf(e))==="agent"}static withTurns(e=[]){return e.map(t=>({...t,turn:n.asTurn(t.turn)??n.turnOf(t)}))}static lastPersonReply(e){return e.replies?.findLast(t=>!n.isAgents(t))}static latestAgentAt(e){return e.replies?.findLast(t=>n.isAgents(t)&&t.at)?.at??""}static isWaiting(e){if(n.turnOf(e)!=="agent")return!1;let t=n.lastPersonReply(e)?.at??e.at,r=Rs(e);return!r||r<t}static lastWordsAt(e){let t=[e.at,e.edited];for(let r of e.replies??[])n.isAgents(r)||t.push(r.at,r.edited);return t.filter(r=>!!r).reduce((r,i)=>Date.parse(i)>Date.parse(r)?i:r)}static pendingOf(e,t){return e.done?null:e.status==="new"&&!e.replies?.length?e.working||!Is(e.by,t)?null:"edit":n.pendingReplyOf(e,t)?"reply":null}static pendingReplyOf(e,t){let r=e.replies?.at(-1);if(!r||n.isAgents(r)||!Is(r.by,t))return null;let i=Rs(e);return i&&i>=r.at?null:r}static numberOf(e){let t=Nl.exec((e??"").trim())?.[1];return t===void 0?void 0:Number(t)}static label(e){let t=n.numberOf(e);return t===void 0?String(e):`C${t}`}static headline(e){let t=(e.text??"").replace(/\s+/g," ").trim();if(t)return n.quoted(t);if(e.kind==="page")return"This page";let r=(e.quote||e.excerpt||e.label||"").replace(/\s+/g," ").trim();return r?n.quoted(r):`This ${n.kindName(e.kind)}`}static quoted(e){return`\u201C${e.length>Ps?`${e.slice(0,Ps).trimEnd()}\u2026`:e}\u201D`}static aboutTip({id:e,place:t}){let r=$l.includes(t.kind)?`the ${n.kindName(t.kind)}`:`a ${n.kindName(t.kind)}`,i=t.kind==="section"||t.kind==="item",s=i&&t.label?`\u201C${t.label}\u201D`:r,o=t.kind==="page"||i||!t.label?"":` in \u201C${t.label}\u201D`,u=t.quote?`: \u201C${t.quote}\u201D`:"";return`${e?`Comment ${n.label(e)}, on`:"On"} ${s}${o}${u}`}static kindName(e){return _l[e]??e}static localStamp(e){let t=new Date(e??"");return Number.isNaN(t.getTime())?e??"":`${On(t)} ${ke(t)}`}static shortStamp(e){let t=Ll.exec(e??"");return t?`${Number(t[1])}/${Number(t[2])} ${t[3]}`:e??""}static takenInto({epic:e,phase:t,phaseId:r,title:i}){return{hash:r||`p${t}`,label:r&&i?`${e} \xB7 ${i}`:`${e} P${t}`}}static AGENTS_MARKED="2026-11-01"},Pl="claude",tn="Claude",Ol={claude:"Claude",codex:"Codex"},Bl=["person","agent","done"],Il="owen",Rl="claude",Nl=/^#?cm?(\d+)$/i,Ps=40,Ll=/^\d{4}-(\d\d)-(\d\d)[ T](\d\d:\d\d)/,$l=["page","overview"],_l={overview:"Overview",prose:"paragraph",code:"code block"};function ve(n,e){return!!n.trim()&&n.trim().localeCompare(e.trim(),void 0,{sensitivity:"accent"})===0}function Os(n,e){if(!e)return;let t=Object.keys(n).find(r=>ve(r,e));return t===void 0?void 0:n[t]}function Bs(n){return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([,e])=>Ze.isColor(e)).map(([e,t])=>[e,t.trim()]))}function ql(n){return(n??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Is(n,e){return!e||!n||ve(n,e)}function Ml(n){return n.taken?.at??(n.status==="taken"?n.at:void 0)}function Rs(n){return[Ml(n),n.working].filter(t=>!!t).sort().at(-1)}function $s(n,e){let t=n.map(({label:i})=>Ns.test(i)?i:Jl(i)),r=jl(t);return n.map(({element:i,id:s,label:o,glyph:u},d)=>{let f=o.match(Ns)?.[1],p=o.match(/^\d+/)?.[0];return zl({id:s,tip:o,glyph:f?void 0:u,mark:f?E("b",{slot:"icon",class:"spell-toolbar-number"},f):u?void 0:p?E("b",{slot:"icon"},p):E("b",{slot:"icon",class:"spell-toolbar-letter"},(r[d]??o.charAt(0)).toUpperCase()),title:t[d],letter:r[d],state:i.dataset.state,badges:e(i)})})}var Ns=/^[A-Z](\d+)\b/;function jl(n){let e=new Set;return n.map(t=>{let i=Cn(t).toLowerCase().replace(/[^a-z]/g,"").split("").find(s=>!e.has(s));return i&&e.add(i),i})}function Kl(n,e){let t=e?[...n.normalize("NFD")].findIndex(i=>i.toLowerCase()===e):-1;if(t<0)return[n];let r=[...n.normalize("NFD")];return[r.slice(0,t).join(""),E("u",{class:"spell-toolbar-key"},r[t]),r.slice(t+1).join("")]}function _s(n,{titled:e,segmented:t=!1}){let r=Yl(),i=customElements.get("ui-toolbar")?"ui-toolbar":"ui-menu",s=E(i,{class:["spell-toolbar",e&&"spell-toolbar-titled",t&&"spell-toolbar-segmented"].filter(Boolean).join(" "),...t?{appearance:"segmented"}:{appearance:"secondary"},shrinkable:e&&!t,"scroll-first":e&&!t,"aria-label":"Sections","data-spell-added":!0});return s.append(...n,...r),e&&(Ul(),Wl(s)),new MutationObserver(o=>{for(let{target:u}of o)u.hasAttribute("selected")&&Zl(u)}).observe(s,{attributeFilter:["selected"],subtree:!0}),s}function qs(n){if(!n?.classList.contains("spell-toolbar-titled"))return;let e=n.querySelector(":scope > .spell-toolbar-tools");return e||(e=E("span",{class:"spell-toolbar-tools",slot:"right"}),n.append(e)),e}function Ul(){Ls||(Ls=!0,document.addEventListener("keydown",n=>{if(n.metaKey||n.ctrlKey||n.altKey||n.repeat||n.isComposing||n.defaultPrevented||!/^[a-z]$/i.test(n.key)||js(n)||document.querySelector("dialog[open], ui-modal:not([hidden])"))return;let e=document.querySelector(".spell-toolbar-titled"),t=document.activeElement;if(!e||t&&t!==document.body&&!e.contains(t)&&Gl(t))return;let i=e.querySelector(`:scope > [data-key="${n.key.toLowerCase()}"]`)?.shadowRoot?.querySelector('[part~="item"]');i&&(n.preventDefault(),i.click())}))}var Ls=!1;function Wl(n){let e=Hl(),t,r=o=>{let u=o.target.closest?.("ui-item[data-key]");!u||!n.contains(u)||(clearTimeout(t),o.type==="pointerover"?t=setTimeout(()=>i(u),Vl):i(u))},i=o=>{let u=o.shadowRoot?.querySelector('[part~="item"]')?.getBoundingClientRect()??o.getBoundingClientRect();e.querySelector("kbd").textContent=o.dataset.key.toUpperCase(),e.matches(":popover-open")||e.showPopover();let d=e.offsetWidth;e.style.left=`${ot(u.left+u.width/2-d/2,8,innerWidth-d-8)}px`,e.style.top=`${u.bottom+6}px`},s=()=>{clearTimeout(t),e.matches(":popover-open")&&e.hidePopover()};n.addEventListener("pointerover",r),n.addEventListener("focusin",r),n.addEventListener("pointerleave",s),n.addEventListener("focusout",s),n.addEventListener("click",s)}var Vl=1e3;function Hl(){let n=document.querySelector("body > .spell-toolbar-tip");if(n)return n;let e=E("div",{class:"spell-toolbar-tip",popover:"manual","aria-hidden":"true","data-spell-added":!0},"Type ",E("kbd")," to jump to this section");return document.body.append(e),addEventListener("scroll",()=>e.matches(":popover-open")&&e.hidePopover(),{passive:!0}),e}function Gl(n){return n.matches('[role="menu"], [role="menubar"], [role="listbox"], [role="combobox"], [role="grid"], [role="tree"], [role="slider"], [role="tablist"], ui-dropdown, ui-select, ui-search, ui-calendar, ui-menu, ui-tabs, ui-example *, ui-example')}function zl({id:n,tip:e,glyph:t,mark:r,title:i,letter:s,state:o,badges:u}){let d=[e,...u.map(([,,p])=>p)].join(" \xB7 "),f=E("ui-item",{class:"spell-toolbar-item",link:`#${n}`,"data-rail":n,icon:t,title:s?"":d,"aria-label":d,"aria-keyshortcuts":s?.toUpperCase(),"data-key":s,"data-state":o},r,i&&E("span",{},...Kl(i,s)),...u.map(([p,v])=>E("ui-label",{class:`spell-toolbar-count ${p}`,slot:"badge",appearance:"circular",size:"mini"},String(v))));return Re(f,"item"),f}function Yl(){let n=[];for(let e of document.querySelectorAll(".spell-toc-open, .spell-toolbar"))n.push(...[...e.children].filter(t=>!t.hasAttribute("data-rail"))),e.remove();return n}function nn(n,e){for(let t of n?.querySelectorAll("[data-rail]")??[])t.toggleAttribute("selected",t.dataset.rail===e)}function Jl(n){return n.replace(/^\d+(?:\.\d+)*\.?\s+/,"")}function Xl(n){return n.shadowRoot?.querySelector('[part~="menu"]')??void 0}function Ql(n){return(n.shadowRoot?.querySelector('[part~="item"]')??n).getBoundingClientRect()}function Zl(n){let e=Xl(n.parentElement);if(!e||e.scrollWidth<=e.clientWidth)return;let t=Ql(n),r=t.left-e.getBoundingClientRect().left+e.scrollLeft;r>=e.scrollLeft&&r+t.width<=e.scrollLeft+e.clientWidth||e.scrollTo({left:r-(e.clientWidth-t.width)/2,behavior:"smooth"})}var ed=/^#?[a-z]{1,2}\d+$/i;function Ms(n,e,{search:t,host:r,first:i=!1}={}){let s=o=>{if(!(o.metaKey||o.ctrlKey)||o.altKey||o.shiftKey||o.defaultPrevented)return;let u=document.body.classList.contains("plan-doc");o.key.toLowerCase()!=="k"||o.isComposing||!(u||et())||document.querySelector("dialog[open], ui-modal:not([hidden])")||js(o)||(o.preventDefault(),o.stopPropagation(),td(n,e,{search:t,host:typeof r=="function"?r():r}))};i?addEventListener("keydown",s,{capture:!0}):document.addEventListener("keydown",s)}function td(n,e,{search:t,host:r}={}){let i=document.body.classList.contains("plan-doc"),s=i?"Jump to which item?":t?"Jump to a comment, or search":"Jump to which comment?",o=E("input",{type:"text",autofocus:!0,autocomplete:"off",spellcheck:"false"}),u=E("p",{class:"spell-jump-miss",role:"alert",hidden:!0}),d=E("ui-button",{class:"approve",color:"primary"},"Go"),f=nd(h=>{o.value=h,d.click()}),p=E("ui-modal",{size:"tiny",closedby:"closerequest",heading:s,"data-spell-added":!0},E("ui-content",{},E("label",{class:"ui-native spell-jump"},i?"Its id: J7, q3, P2, C3 ...":t?"A comment's id (C3), any id on the page, or words to search the site":"Its id: C3, or any id on the page",o),u,f),E("ui-actions",{},E("ui-button",{class:"cancel"},"Cancel"),d)),v="",y="",T="";o.addEventListener("keydown",h=>{h.key==="Enter"&&(h.preventDefault(),d.click())}),o.addEventListener("input",()=>u.hidden=!0),p.addEventListener("ui-approving",h=>{let w=o.value.trim(),P=w.replace(/^#/,"").toLowerCase(),R=et()?.find(P);if(R){y=R.id;return}if(P&&e(P)){v=P;return}if(t&&w&&!ed.test(w)){T=w;return}h.preventDefault(),u.textContent=P?`No ${w} on this page.`:"Type an id first.",u.hidden=!1,o.select()}),p.addEventListener("ui-closed",()=>{p.remove(),y?et()?.landOn(y):v?n(v):T&&t(T)},{once:!0}),(r??document.body).append(p),p.visible=!0,customElements.whenDefined("ui-modal").then(()=>(p.visible=!0,De(2))).then(()=>o.focus())}function nd(n){let e=et()?.waitingInPageOrder()??[];if(!e.length)return;let t=e.length===1?"Waiting on you:":`${e.length} waiting on you:`,r=e.map(i=>{let s=N.label(i.id),o=`${N.aboutTip({id:i.id,place:i})}
34
+ (Jump there)`,u=E("ui-item",{class:"spell-jump-thread",title:o},E("b",{},s)," \xB7 ",E("span",{},Ks(i.text)));return u.addEventListener("click",()=>n(s)),Re(u,"item"),u});return E("ui-menu",{class:"spell-jump-waiting",direction:"vertical",appearance:"secondary link",fluid:!0,"aria-label":t},E("ui-item",{class:"spell-jump-waiting-title",kind:"header"},t),...r)}function js(n){return n.composedPath().some(e=>e instanceof Element&&(e.isContentEditable||e.matches(`${Ss}, textarea, input`)))}var rd=3e3,rn=class{constructor(e){this.props=e}props;keep(e){this.props.key&&Y.setAt(this.props.key,e,this.place)}kept(){return this.props.key?Y.getAt(this.props.key,this.place):void 0}drop(){this.props.key&&Y.setAt(this.props.key,void 0,this.place)}keysStartingHere(){if(!this.props.key)return[];let[e,t]=Y.splitKey(this.props.key);return new Y(e,{place:this.place}).keysUnder(t).map(r=>`${e}:${r}`)}place=new we({storage:()=>this.props.storage?this.props.storage():globalThis.localStorage,description:"this browser"})},Ct=class{constructor(e){this.props=e;this.copy=new rn({...e.key!==void 0&&{key:e.key},...e.storage&&{storage:e.storage}})}props;state={kind:"idle"};isUnsaved=!1;timer;retryTimer;saving=Promise.resolve(!0);inFlight=0;round=0;copy;changed({now:e=!1}={}){if(this.isUnsaved=!0,this.cancelTimer(),e){this.save();return}this.timer=setTimeout(()=>{this.save()},this.props.wait),this.state.kind!=="failed"&&this.state.kind!=="off server"&&this.setState({kind:"unsaved"})}save({keepalive:e=!1}={}){this.cancelTimer();let t=()=>this.saveQueued(e),r=this.inFlight?this.saving.then(t):t();return this.inFlight++,r.finally(()=>this.inFlight--),this.saving=r,r}get settled(){return this.saving}get isPending(){return!!this.timer||this.state.kind==="saving"}done(){this.round++,this.stop(),this.isUnsaved=!1,this.drop(),this.setState({kind:"idle"})}stop(){this.cancelTimer(),this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=void 0}tell(e,{isError:t=!1}={}){this.setState({kind:"told",text:e,...t&&{isError:t}})}watch(e){let t=()=>{this.save({keepalive:!0})},r=()=>{e.document.visibilityState==="hidden"&&t()};return e.addEventListener("pagehide",t),e.document.addEventListener("visibilitychange",r),()=>{e.removeEventListener("pagehide",t),e.document.removeEventListener("visibilitychange",r),this.stop()}}keep(e){this.copy.keep(e)}kept(){return this.copy.kept()}drop(){this.copy.drop()}get text(){let e=this.state;switch(e.kind){case"idle":return"";case"unsaved":return"not saved yet";case"saving":return"saving\u2026";case"saved":return`saved ${id(e.at)}`;case"told":return e.text;case"off server":return"kept in this browser only: this page isn't on the page server";default:return`kept in this browser only: ${e.why}; trying again every ${this.retry/1e3}s`}}get isError(){let e=this.state;return e.kind==="failed"||e.kind==="off server"||e.kind==="told"&&!!e.isError}async saveQueued(e){if(this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=void 0,!this.isUnsaved)return!0;if(this.props.isOffServer?.())return this.setState({kind:"off server"}),!1;let t=this.round;this.isUnsaved=!1,this.state.kind!=="failed"&&this.setState({kind:"saving"});try{let r=await this.props.save({keepalive:e});return t!==this.round?!0:(this.setState({kind:"saved",at:r??new Date().toISOString()}),!this.isUnsaved)}catch(r){return t!==this.round?!0:(this.isUnsaved=!0,this.setState({kind:"failed",why:r.message.replace(/[.!]$/,"")}),this.retryTimer=setTimeout(()=>{this.save()},this.retry),!1)}}get retry(){return this.props.retry??rd}cancelTimer(){this.timer&&clearTimeout(this.timer),this.timer=void 0}setState(e){this.state=e,this.props.onChange?.()}};function id(n){let e=new Date(n);return isNaN(e.getTime())?"":ke(e)}var de=class extends Ct{constructor(e){let{link:t,storage:r,retry:i=3e3,...s}=e;super({...s,retry:i,...t&&{isOffServer:()=>!t.isServed},storage:()=>"storage"in e?lt(r):globalThis.localStorage})}};var Tg=1440*60*1e3;var bt="/api/docs/comments",St=null;function et(){return St}var od="spell-comment-draft:",ad="spell-comment-read:",ud=1200,cd="p, li, dt, dd, td, th, blockquote, pre, figcaption, h4, h5, h6",Ws=/^(li|dt|dd|td|th)$/,to="spell-comment-quote",Ft="spell-promoted",ld=8,no="spell-comment-quote-waiting",Vs=600,Hs=150,dd=3e4,fd=/\.(plan|saga)\.html$/,pd="epic-overview, epic-item, epic-update[at], epic-aside, epic-code",hd=/^(ui-section|epic-overview)$/;async function ro(n,{go:e,pageFolds:t,signal:r}={}){if(!K.isServed())return;let i=new on(n,{go:e,pageFolds:t,signal:r});if(!await i.load()||r?.aborted)return;St=i,i.draw();let s=()=>{i.load().then(v=>v&&!r?.aborted&&i.draw())},o={signal:r};addEventListener("spell-doc:updated",()=>i.draw(),o);let u=fd.test(location.pathname),d=K.watch(window,v=>i.inboxPaths.includes(v),s,{every:dd,polls:()=>!!i.send||u}),f=()=>{i.open?.flush?.();for(let v of i.fields())v.flush?.()};addEventListener("pagehide",f,o);let p=typeof ResizeObserver=="function"?new ResizeObserver(()=>i.makeRoom()):null;p?.observe(n),i.watchContent(),i.watchFolds(),i.wireSelection(),r?.addEventListener("abort",()=>{f(),d(),p?.disconnect(),i.stop(),St===i&&(St=null)},{once:!0})}function Gs(n){let e=[n,n.replace(/^\/worktrees\/[^/]+(?=\/)/,"")];return[...new Set(e.flatMap(t=>K.dataFileNames(t)))]}var on=class{constructor(e,{go:t,pageFolds:r,signal:i}={}){this.main=e,this.go=t,this.pageFolds=r,this.signal=i,this.contentWatch=null,this.lastWaiting="",this.list=[],this.open=null,this.pane=null,this.threads=new Map,this.replyBoxes=new Map,this.editing=null,this.quotes=[],this.folds=new Map;let o=decodeURIComponent(location.pathname).replace(/(\.plan|\.saga)?\.html$/,".inbox.json5");this.inboxPaths=Gs(o),this.draftKey=`${od}${location.pathname}`,this.readKey=`${ad}${location.pathname}`,this.read={},this.seenWatch=null,this.seenTimers=new Map,this.send=null}unseen(e){return e.turn==="person"&&!!N.latestAgentAt(e)}markSeen(e){let t=this.list.find(s=>s.id===e);if(!t||!this.unseen(t))return;let r=le(this.readKey),i=N.latestAgentAt(t);(r[e]??"")>=i||(r[e]=i,Qe(this.readKey,r),this.draw())}watchSeen(){this.seenWatch?.disconnect();let e=this.main.querySelectorAll("epic-thread[unseen][open]");for(let[t,r]of this.seenTimers)[...e].some(i=>i.id===`comment-${t}`)||(clearTimeout(r),this.seenTimers.delete(t));if(!(!e.length||typeof IntersectionObserver!="function")){this.seenWatch=new IntersectionObserver(t=>{for(let r of t){let i=r.target.id.replace(/^comment-/,""),s=r.rootBounds?.height??innerHeight;r.isIntersecting&&(r.intersectionRatio>=.5||r.intersectionRect.height>=s/2)?this.seenTimers.has(i)||this.seenTimers.set(i,setTimeout(()=>{this.seenTimers.delete(i),document.visibilityState==="visible"?this.markSeen(i):this.watchSeen()},ud)):(clearTimeout(this.seenTimers.get(i)),this.seenTimers.delete(i))}},{threshold:[0,.25,.5,.75,1]});for(let t of e)this.seenWatch.observe(t)}}makeRoom(){en(this.main);let e=[...this.main.querySelectorAll(`${ce} ui-button`)].filter(t=>t?.checkVisibility?.({contentVisibilityAuto:!0})!==!1).map(t=>t?.getBoundingClientRect()).filter(t=>t?.width);for(let t of this.threads.values()){t.style.removeProperty(Xs);let r=t.isConnected?t.header:void 0;if(!r)continue;let i=r.getBoundingClientRect();if(!i.width||r.checkVisibility?.({contentVisibilityAuto:!0})===!1)continue;let s=e.filter(o=>o.left<i.right&&o.right>i.left&&o.top<i.bottom&&o.bottom>i.top);s.length&&t.style.setProperty(Xs,`${Math.ceil(i.right-Math.min(...s.map(o=>o.left)))+4}px`)}}async load(){try{let e=await K.forPage().get(bt,{query:{page:location.pathname},missing:{}});return e.takesComments!==!0?!1:(this.list=N.withTurns(e.comments),this.keepSend(e),!0)}catch{return!1}}keepSend(e){if(!e?.send)return;this.send=e.send;let t=`/epics/${e.send.epic}/${e.send.epic}.inbox.json5`;for(let r of Gs(t))this.inboxPaths.includes(r)||this.inboxPaths.push(r)}drawSend(){let e=Ve(this.main),t=e?.matches(".spell-page-head")?e:e?.querySelector(".spell-page-head")??e;t?.querySelector(":scope > .spell-send, :scope > .spell-head-tools > .spell-send")?.remove();let r=this.send;if(!t||!r)return;let i=r.unsent.length,s=i?"unsent":r.waiting.length?"sent":"idle",o=E(bd,{state:s,count:i||void 0,"send-tip":gd(r,s)});o.addEventListener(Fd,()=>{this.sendNow()});let u=E("span",{class:"spell-send-who","data-listening":r.listening?"yes":"no",title:Dd(r)},md(r));Zt(t,E("span",{class:"spell-send","data-spell-added":!0,"data-state":s},o,u),"send")}async sendNow(){let e=this.send;if(e){if(!e.unsent.length)return X("Nothing new to send: every comment here went with an earlier Send.");try{let t=await K.forPage().post(`${bt}/send`,{page:location.pathname});this.list=t.comments?N.withTurns(t.comments):this.list,this.keepSend(t);let r=`${e.unsent.length} comment${e.unsent.length===1?"":"s"}`,i=this.send.listening?"":t.wake?.message?`. ${t.wake.message.replace(/\.$/,"")}`:e.wakes?`: nobody is listening, so they wait for /epic review ${e.epic}`:`: nobody is listening, so /airplane land gathers them into ${e.epic}`;X(`Sent ${r} to ${e.epic}${i}.`,i?"warning":"success"),this.draw()}catch(t){X(`Couldn't send: ${t.message}`,"error")}}}draw(){let{main:e}=this,t=this.fields().find(h=>document.activeElement===h.field)?.field,[r,i]=t?[t.selectionStart,t.selectionEnd]:[0,0],s=[...this.threads.values()].find(h=>h.isFoldFocused);this.read=le(this.readKey);let o=Ue(e),u=Ve(e),d=new Set(u?[u,...o]:o),f=new Set;for(let h of e.querySelectorAll(".spell-comment-mark")){let w=eo.get(h);w&&d.has(w)&&!f.has(w)&&kd(h,w)?f.add(w):Ts(h)}let p=new Map,v=[];for(let h of this.list){let{block:w,exact:P}=En(e,h,o),R=w??u;if(!R)continue;let $=w&&h.quote&&vn(w,h.quote,h.offset);if($&&v.push({...$,id:h.id,waiting:h.turn==="agent"}),this.open?.id===h.id)continue;let Ce=$?yd(w,$):R;p.has(Ce)||p.set(Ce,[]),p.get(Ce).push({comment:h,exact:P&&!!w})}let y=new Set(this.list.map(h=>h.id));this.editing&&!y.has(this.editing.id)&&(this.editing=null);for(let h of this.replyBoxes.keys())y.has(h)||this.replyBoxes.delete(h);for(let[h,w]of this.threads)(!y.has(h)||this.open?.id===h)&&(w.remove(),this.threads.delete(h));for(let h of d)f.has(h)||this.addBullhorn(h);this.drawSend();let T=new Map;for(let[h,w]of p){let P=this.boxFor(h);T.set(P,w.length),w.forEach((R,$)=>xd(P,this.thread(R),$))}for(let[h,w]of T)for(;h.children.length>w;)h.lastElementChild.remove();for(let h of e.querySelectorAll(`${xt}[data-spell-added]`))T.has(h)||h.remove();this.quotes=wd(v),this.makeRoom(),this.watchSeen(),this.drawWaiting(),this.drawPromoted(),requestAnimationFrame(()=>this.growFields()),s?.isConnected&&!s.isFoldFocused&&s.focusFold(),!(!t?.isConnected||document.activeElement===t)&&(t.focus({preventScroll:!0}),t.setSelectionRange(r,i))}growFields(){for(let e of this.fields())e.field.getClientRects().length&&Ne(e.field)}get waitingOnOwen(){return this.list.filter(e=>e.turn==="person")}waitingInPageOrder(){return this.inPageOrder(this.waitingOnOwen)}jumpTargets(){let e=this.waitingInPageOrder();return e.length?e:this.inPageOrder(this.list.filter(t=>!t.done))}inPageOrder(e){return e.map(t=>({comment:t,thread:this.threadOf(t.id)})).filter(t=>t.thread).sort((t,r)=>t.thread.compareDocumentPosition(r.thread)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1).map(t=>t.comment)}threadOf(e){return this.main.querySelector(`#comment-${CSS.escape(e)}`)}find(e){let t=N.numberOf(e);return t===void 0?void 0:this.list.find(r=>N.numberOf(r.id)===t)}drawWaiting(){let e=this.waitingHome();if(!e)return;let t=e.querySelector(":scope > .spell-toolbar-waiting");if(!t){let f=E("ui-label",{class:"spell-toolbar-count replied",slot:"badge",appearance:"circular",size:"mini"});t=e.matches(".spell-toolbar-tools")?E("span",{class:"spell-toolbar-waiting",hidden:!0},E("ui-button",{appearance:"circular basic",size:"mini",icon:"bullhorn"}),f):E("ui-item",{class:"spell-toolbar-item spell-toolbar-waiting",appearance:"link",icon:"bullhorn",hidden:!0},f),t.addEventListener("click",()=>this.nextWaiting())}e.lastElementChild!==t&&e.append(t);let r=this.waitingInPageOrder().length,i=this.jumpTargets().length,s=r?`${r} ${r===1?"thread waits":"threads wait"} on you: jump to the next`:`${i} ${i===1?"comment":"comments"}: jump to the next`,u=document.querySelector("ui-markdown[editable]:not([editable=tabs])")?`${s}. \u2325-click text to edit it`:s,d=t.querySelector(".spell-toolbar-count");d.textContent=String(r),d.hidden=!r,t.title=u,t.setAttribute("aria-label",u),t.localName==="ui-item"&&Re(t,"item"),t.hidden=!i}waitingHome(){let e=document.querySelector(".spell-toolbar");return qs(e)??e}nextWaiting(){let e=this.jumpTargets();if(!e.length)return;let t=e.findIndex(r=>r.id===this.lastWaiting);this.landOn(e[(t+1)%e.length].id)}async landOn(e){if(!this.list.some(r=>r.id===e))return;this.lastWaiting=e,this.folds.set(e,!0),this.draw(),this.markSeen(e);let t=`comment-${e}`;this.go?await this.go(t):document.getElementById(t)?.scrollIntoView({block:"start"}),this.threadOf(e)?.focusFold?.()}drawPromoted(){if(!this.pageFolds)return;let e=new Map;for(let t of this.inPageOrder(this.list.filter(r=>!r.done))){let r=this.pageFolds.outermostFolded(this.threadOf(t.id));r&&(e.has(r)||e.set(r,[]),e.get(r).push(t))}for(let t of this.main.querySelectorAll(`.${Ft}`))e.has(t.previousElementSibling)||t.remove();for(let[t,r]of e){let i=t.nextElementSibling;i?.classList.contains(Ft)||(i=E("div",{class:Ft,"data-spell-added":!0}),t.after(i));let s=r.map(o=>`${o.id}:${o.turn}:${N.headline(o)}`).join("|");i.dataset.shows!==s&&(i.dataset.shows=s,i.replaceChildren(...r.map(o=>this.promotedRow(o))))}}promotedRow(e){let t=`C${N.numberOf(e.id)}`,r=E("button",{type:"button",class:`${Ft}-row`,title:`${t}: show this comment`},E("ui-icon",{name:"bullhorn"}),E("b",{},t),E("span",{},N.headline(e)));return r.classList.toggle("waiting",e.turn==="person"),r.addEventListener("click",()=>this.showPromoted(e.id,r)),r}async showPromoted(e,t){let r=t.getBoundingClientRect().top;this.lastWaiting=e,this.folds.set(e,!0),this.draw(),this.markSeen(e);let i=this.threadOf(e);if(i){this.pageFolds.reveal(i,{self:!0});for(let s=0;s<ld;s++)scrollBy({top:i.getBoundingClientRect().top-r,behavior:"instant"}),await De(1);history.replaceState(history.state,"",`#comment-${e}`),i.focusFold?.()}}watchFolds(){if(!this.pageFolds)return;let e=!1;this.foldWatch=new MutationObserver(t=>{e||t.every(r=>r.target.localName===Js)||(e=!0,requestAnimationFrame(()=>{e=!1,this.drawPromoted()}))}),this.foldWatch.observe(this.main,{attributes:!0,attributeFilter:["open","class"],subtree:!0})}fields(){return[...this.replyBoxes.values(),...this.editing?[this.editing]:[]]}watchContent(){let e=0,t=r=>r.nodeType===1&&(r.matches("[data-spell-added]")||r.closest("[data-spell-added]"));this.contentWatch=new MutationObserver(r=>{r.some(s=>!t(s.target)&&[...s.addedNodes,...s.removedNodes].some(o=>o.nodeType===1&&!t(o)))&&(clearTimeout(e),e=setTimeout(()=>this.draw(),Hs))}).observe(this.main,{childList:!0,subtree:!0}),this.main.addEventListener("ui-drawn",()=>{clearTimeout(e),e=setTimeout(()=>this.draw(),Hs)},{signal:this.signal}),this.signal?.addEventListener("abort",()=>clearTimeout(e),{once:!0})}stop(){this.contentWatch?.disconnect(),this.foldWatch?.disconnect(),this.seenWatch?.disconnect();for(let e of this.seenTimers.values())clearTimeout(e);this.seenTimers.clear(),this.floating?.remove(),this.floating=null,this.pane?.remove(),this.pane=null,this.open=null,document.documentElement.classList.remove("spell-over-quote")}addBullhorn(e){let t=this.placeOf(e),i=`Comment on ${t.kind==="page"?"this page":`this ${N.kindName(t.kind)}`}`,s=t.kind==="section"||t.kind==="page"?t.kind:e.matches(pd)?"title":"block",o=Ys("bullhorn",i),u=E("span",{class:`spell-comment-mark at-${s}`,"data-spell-added":!0},o);if(eo.set(u,e),o.addEventListener("click",d=>{d.stopPropagation();let f=this.placeOf(e);this.openBox({key:f.anchor,place:f},d.currentTarget.getBoundingClientRect())}),s==="section"||s==="title")u.slot="actions",e.append(u);else if(s==="page"){let d=e.querySelector(".spell-page-head");d?Zt(d,u,"comment"):e.append(u)}else ks(e,u,"comment")}placeOf(e){if(e===Ve(this.main))return{anchor:Me,kind:"page",label:"",excerpt:""};let t=je(e),r=t==="section"||t==="item"?e:Ke(e,this.main);return{anchor:wn(e,this.main),kind:t,label:r?qt(r):"",excerpt:_t(e)}}boxFor(e){if(We(e)?.localName==="ui-markdown")return this.boxInMarkdown(e);let t=hd.test(e.localName)?"first":Ws.test(e.localName)?"last":"after",r=t==="first"?vd(e):t==="last"?e.lastElementChild:e.nextElementSibling;if(r?.localName===xt&&r.hasAttribute("data-spell-added"))return r;let i=E(xt,{"data-spell-added":!0});return t==="after"?e.after(i):t==="last"?e.append(i):r?r.before(i):e.append(i),i}boxInMarkdown(e){let t=We(e),r=Ws.test(e.localName),i=r?e.lastElementChild:e.nextElementSibling,s=i?.matches("slot[data-spell-added]")?i:null;s||(s=E("slot",{name:`spell-threads-${++Ad}`,"data-spell-added":!0}),r?e.append(s):e.after(s));let o=t.querySelector(`:scope > [slot="${s.name}"]`);if(o)return o;let u=E(xt,{slot:s.name,"data-spell-added":!0});return t.append(u),u}wireSelection(){let e=0,t={signal:this.signal};document.addEventListener("selectionchange",()=>{clearTimeout(e),e=setTimeout(()=>this.showFloating(),120)},t),document.addEventListener("click",i=>{if(!getSelection()?.isCollapsed||i.target.closest?.("a, button, ui-button, input, textarea, [data-spell-added]"))return;let s=this.quoteAt(i.clientX,i.clientY);s&&this.openComment(s.id)},t);let r=!1;document.addEventListener("pointermove",i=>{r||!this.quotes.length||(r=!0,requestAnimationFrame(()=>{r=!1,document.documentElement.classList.toggle("spell-over-quote",!!this.quoteAt(i.clientX,i.clientY))}))},{passive:!0,...t}),addEventListener("scroll",()=>this.floating?.setAttribute("hidden",""),{passive:!0,...t}),document.addEventListener("keydown",i=>{if(!(i.metaKey||i.ctrlKey)||i.altKey||i.shiftKey||i.key.toLowerCase()!=="i")return;let s=this.selected();s&&(i.preventDefault(),this.commentOn(s))},t),this.signal?.addEventListener("abort",()=>clearTimeout(e),{once:!0})}selected(){let e=getSelection(),t=e&&this.selectedRange(e);if(!t||t.collapsed)return null;let r=t.startContainer;if(!$t(this.main,r)||(r.nodeType===1?r:r.parentElement)?.closest("[data-spell-added], textarea, input"))return null;let s=yn(r,Ue(this.main)),o=(e.toString()||t.toString()).trim();return!s||!o?null:{block:s,quote:o,offset:An(s,r,t.startOffset),range:t}}selectedRange(e){if(!e.rangeCount)return null;if(!e.getComposedRanges)return e.getRangeAt(0);let t=[...this.main.querySelectorAll("ui-markdown")].flatMap(s=>s.shadowRoot??[]),[r]=e.getComposedRanges({shadowRoots:t});if(!r||r.startContainer.getRootNode()!==r.endContainer.getRootNode())return null;let i=document.createRange();return i.setStart(r.startContainer,r.startOffset),i.setEnd(r.endContainer,r.endOffset),i}commentOn({block:e,quote:t,offset:r,range:i}){this.floating?.setAttribute("hidden","");let s=i.getClientRects(),o=s[s.length-1]??i.getBoundingClientRect(),u={...this.placeOf(e),quote:t.slice(0,2e3),offset:r};this.openBox({key:`${u.anchor}~${r}`,place:u},o)}quoteAt(e,t){for(let{id:r,range:i}of this.quotes){let s=Array.from(i.getClientRects()).find(o=>e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom);if(s)return{id:r,rect:s}}return null}openComment(e){if(this.open?.id===e&&this.pane)return this.focusPane();if(!this.list.some(r=>r.id===e))return;this.folds.set(e,!0),this.draw(),this.markSeen(e);let t=this.threadOf(e);t?.header?.scrollIntoView({block:"nearest"}),t?.focusFold?.()}showFloating(){let e=this.selected(),t=this.floatingBullhorn();if(!e)return t.setAttribute("hidden","");let r=e.range.getClientRects(),i=r[r.length-1]??e.range.getBoundingClientRect();t.style.left=`${Math.min(innerWidth-36,i.right+6)}px`,t.style.top=`${Math.max(4,i.top-4)}px`,t.removeAttribute("hidden")}floatingBullhorn(){if(this.floating)return this.floating;let e=`Comment on this text (${/Mac|iPhone|iPad/.test(navigator.platform)?"\u2318":"Ctrl "}I)`,t=Ys("bullhorn",e);return t.classList.add("spell-comment-float"),t.hidden=!0,t.addEventListener("pointerdown",r=>r.preventDefault()),t.addEventListener("click",()=>{let r=this.selected();r&&this.commentOn(r)}),document.body.append(t),this.floating=t}thread({comment:e,exact:t}){let r=this.threads.get(e.id);r||(r=E(Js,{id:`comment-${e.id}`}),this.wireThread(r,e.id),this.threads.set(e.id,r));let i=this.editing?.id===e.id?this.editing:null,s=i??(e.turn==="done"?null:this.replyBoxFor(e)),o=!!s&&(s.busy()||!!i);e.turn==="done"&&this.replyBoxes.delete(e.id);let u=!!e.working&&e.turn!=="done",d=o||(this.folds.get(e.id)??(e.turn==="person"||u));r.comment=e,r.toggleAttribute("open",d),r.toggleAttribute("unseen",this.unseen(e)),r.toggleAttribute("moved",!t),sn(r,"boxed",i?"first":s?.saved()?"pending":void 0),this.showFloppy(r,s);let f=s?.box;return(f?r.firstElementChild!==f||r.childElementCount!==1:r.childElementCount)&&r.replaceChildren(...f?[f]:[]),r}showFloppy(e,t){sn(e,"saved",t?.floppy?.tip),e.toggleAttribute("failed",!!t?.floppy?.failed)}replyBoxFor(e){let t=N.pendingReplyOf(e)?.text??"",r=this.replyBoxes.get(e.id);if(r&&(r.busy()||r.saved()===t))return r;r?.drop();let i=this.makeBox(e.id,"reply",t);return this.replyBoxes.set(e.id,i),i}makeBox(e,t,r){let i=E("textarea",{class:"spell-comment-field",rows:1,"aria-label":t==="edit"?"Your comment":"Your reply"}),s={id:e,how:t,box:i,field:i,floppy:null};return this.wireReply(s,r),s}wireThread(e,t){let r=i=>{let s=!!i.detail?.open;this.folds.set(t,s),s&&(requestAnimationFrame(()=>this.growFields()),this.markSeen(t))};e.addEventListener("epic-thread-opened",r),e.addEventListener("epic-thread-closed",r),e.addEventListener("epic-thread-answered",i=>{let s=i.detail?.act;s==="reply"?this.focusReply(t):s==="reopen"?this.reopen(t):(s==="good"||s==="skip")&&this.resolve(t,s)}),e.addEventListener("epic-thread-editing",()=>this.startEdit(t)),e.addEventListener("epic-thread-removing",()=>{this.remove(t)})}async resolve(e,t){if(!(this.editing?.id===e&&!await this.closeEdit())&&!(this.replyBoxes.has(e)&&!await this.replyBoxes.get(e).finish()))try{await this.post({action:"resolve",id:e,how:t}),this.folds.delete(e),this.draw();let r=!1;X(t==="skip"?"Skipped: nothing more to do":"Done: that's good","success",{displayTime:zs,actions:[{text:"Undo",icon:"rotate left",click:()=>{r||(r=!0,this.reopen(e))}}]})}catch(r){X(`Couldn't close the thread: ${r.message}`,"error")}}async reopen(e){try{await this.post({action:"reopen",id:e}),this.folds.delete(e),this.draw()}catch(t){X(`Couldn't reopen the thread: ${t.message}`,"error")}}async post(e,t){let r=await K.forPage().post(bt,{page:location.pathname,...e},t);return this.list=r.comments?N.withTurns(r.comments):this.list,this.keepSend(r),r}async focusReply(e){this.folds.set(e,!0),this.draw(),await De();let r=(this.editing?.id===e?this.editing:this.replyBoxes.get(e))?.field;r?.isConnected&&(Ne(r),r.scrollIntoView({block:"nearest"}),r.focus({preventScroll:!0}),r.setSelectionRange(r.value.length,r.value.length))}startEdit(e){if(this.editing?.id===e)return void this.focusReply(e);this.closeEdit();let t=this.list.find(r=>r.id===e);t&&(this.editing=this.makeBox(e,"edit",t.text),this.focusReply(e))}async closeEdit(){let e=this.editing;return e?await e.finish()?(this.editing===e&&(this.editing=null),this.draw(),!0):(X(e.floppy?.tip??"Not saved","error"),!1):!0}wireReply(e,t){let{id:r,how:i,box:s,field:o}=e,u=`${r}~${i}`,d=y=>{e.floppy=y;let T=this.threads.get(r);T&&s.parentElement===T&&this.showFloppy(T,e)};o.value=le(this.draftKey)[u]??t;let f=()=>{let y=le(this.draftKey);o.value.trim()!==t?y[u]=o.value:delete y[u],Qe(this.draftKey,y)},p=new de({wait:Vs,save:async({keepalive:y})=>{let T=o.value.trim();T===t||!T&&i==="edit"||(await this.post({action:i,id:r,text:T},{keepalive:y}),t=T,f(),d(T?{tip:Qs()}:null),(this.replyBoxes.get(r)===e||this.editing===e)&&this.draw())},onChange:()=>{p.state.kind==="failed"&&d({tip:Zs(p.state.why),failed:!0})}});p.isUnsaved=o.value.trim()!==t;let v=()=>p.save();e.saved=()=>t,e.busy=()=>document.activeElement===o||o.value.trim()!==t||p.isPending||p.isUnsaved,e.drop=()=>p.stop(),e.finish=async()=>{if(i==="edit"&&!o.value.trim())return p.stop(),this.forget(u),this.editing===e&&(this.editing=null),await this.remove(r),!0;let y=await v();return y&&this.forget(u),y},e.flush=()=>{p.save({keepalive:!0})},o.addEventListener("input",()=>{Ne(o),f(),p.changed()}),o.addEventListener("keydown",y=>{(y.key==="Escape"||y.key==="Enter"&&(y.metaKey||y.ctrlKey))&&(y.preventDefault(),y.stopPropagation(),i==="edit"?this.closeEdit():o.blur())}),o.addEventListener("blur",()=>{setTimeout(()=>{!s.isConnected||document.activeElement===o||(i==="edit"?this.editing===e&&this.closeEdit():this.replyBoxes.get(r)===e&&v())})})}async remove(e){let t=this.waiting(e)?"delete":"clear",r=this.list.find(i=>i.id===e);try{await this.post({action:t,id:e}),this.forget(e),this.forget(`${e}~reply`),this.editing?.id===e&&(this.editing=null),this.replyBoxes.get(e)?.drop(),this.replyBoxes.delete(e),this.open?.id===e?this.closePane():this.draw();let i=!1;X("Comment deleted","success",{displayTime:zs,actions:r?[{text:"Undo",icon:"rotate left",click:()=>{i||(i=!0,this.restore(r))}}]:void 0})}catch(i){X(`Couldn't delete the comment: ${i.message}`,"error")}}async restore(e){try{let{id:t,...r}=e;await this.post({action:"restore",id:t,comment:r}),this.draw()}catch(t){X(`Couldn't bring the comment back: ${t.message}`,"error")}}openBox(e,t){if(this.pane&&this.open?.key===e.key)return this.focusPane();this.open?.finish?.(),this.pane?.remove(),this.open=e,this.draw(),this.showPane(t)}closePane(){this.pane?.remove(),this.pane=null,this.open=null,this.draw()}showPane(e){let t=this.open,r=E("textarea",{class:"spell-comment-field",rows:3,"aria-label":"Your comment"}),i=this.pane=E(Cd,{"data-spell-added":!0,headline:N.headline(t.place),about:N.aboutTip(t)},r);i.near=e?{left:e.left,top:e.top,bottom:e.bottom}:void 0,this.wirePane(i,r,t),this.main.append(i),Sd(i).then(()=>{this.pane===i&&(Ne(r),this.focusPane())})}focusPane(){let e=this.pane?.querySelector(":scope > textarea");e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))}wirePane(e,t,r){let i=this.wireField(e,t,r);e.addEventListener("epic-comment-closing",()=>{i()}),e.addEventListener("keydown",s=>{(s.key==="Escape"||s.key==="Enter"&&(s.metaKey||s.ctrlKey))&&(s.preventDefault(),s.stopPropagation(),i())}),e.addEventListener("focusout",()=>{setTimeout(()=>{this.pane!==e||e.contains(document.activeElement)||i()})}),e.addEventListener("epic-comment-removing",()=>{r.discard?r.discard():this.remove(r.id)})}wireField(e,t,r){let{key:i,place:s}=r,o="",u=(r.text??"").trim(),d=!1,f=()=>r.id??i;t.value=this.draftOf(r)??r.text??"";let p=(h=f())=>{let w=le(this.draftKey);delete w[h];let P=t.value.trim();P&&P!==u?w[f()]=t.value:delete w[f()],Qe(this.draftKey,w)},v=async({keepalive:h})=>{let w=t.value.trim();if(d||w===u||!w&&!r.id)return;let P=w?r.id?{action:"edit",id:r.id,text:w}:{action:"add",...s,text:w}:{action:this.waiting(r.id)?"delete":"clear",id:r.id},R=await K.forPage().post(bt,{page:location.pathname,...P},{keepalive:h}),$=f();r.id=w?r.id??R.id:void 0,u=w,this.list=R.comments?N.withTurns(R.comments):this.list,this.keepSend(R),p($),o=w?Qs():"",sn(e,"saved",o||void 0),e.removeAttribute("failed"),e.toggleAttribute("deletable",!!r.id),this.open===r&&this.draw()},y=new de({wait:Vs,save:v,onChange:()=>{y.state.kind==="failed"&&(o=Zs(y.state.why),e.setAttribute("saved",o),e.setAttribute("failed",""))}});y.isUnsaved=t.value.trim()!==u;let T=()=>y.save();return r.finish=async()=>await T()?(this.forget(f()),this.forget(i),!0):!1,r.flush=()=>{y.save({keepalive:!0})},r.discard=async()=>{if(y.stop(),await y.settled,d=!0,this.forget(f()),this.forget(i),r.id)return this.remove(r.id);this.open===r&&this.closePane()},t.addEventListener("input",()=>{Ne(t),p(),y.changed()}),t.addEventListener("blur",()=>{T()}),async()=>{if(!await r.finish())return X(o,"error");this.open===r&&this.closePane()}}draftOf(e){let t=e.id??e.key,r=le(this.draftKey)[t];if(typeof r!="string"||!r.trim())return;let{anchor:i,quote:s}=e.place;if(!(!e.id&&this.list.some(u=>u.anchor===i&&(u.quote??"")===(s??"")&&u.text===r.trim())))return r;this.forget(t)}waiting(e){let t=this.list.find(r=>r.id===e);return!t||t.status==="new"}forget(e){let t=le(this.draftKey);delete t[e],Qe(this.draftKey,t)}};function gd({epic:n,unsent:e,waiting:t},r){let i=s=>`${s} comment${s===1?"":"s"}`;return r==="unsent"?`Send ${i(e.length)} to epic ${n}`:r==="sent"?`Sent to ${n}: ${i(t.length)} waiting for Claude`:"Nothing to send: no comment here is waiting for Claude"}function md({epic:n,owned:e,wakes:t,listening:r}){return r?`${n} is listening`:e?"nobody is listening":t?`nobody is listening: Send wakes ${n}`:"no epic owns this page"}function Dd({epic:n,owned:e,wakes:t,listening:r}){let i=e?`epic ${n}`:`epic ${n}, the standing epic for every page no epic owns (no epic's See Also lists this one)`;return r?`A Claude session is reviewing ${i}: Send hands it these comments now`:t?`No Claude session is reviewing ${i}: Send wakes its session`:`No epic's See Also lists this page, and epic ${n} isn't made yet: /airplane land gathers its comments`}function Ks(n){let e=String(n??"").split(`
35
+ `)[0].trim();return e.length>60?`${e.slice(0,60).trimEnd()}\u2026`:e}function yd(n,{start:e,end:t}){try{let r=document.createRange();r.setStart(...e),r.setEnd(...t);let i=r.commonAncestorContainer,s=(i.nodeType===1?i:i.parentElement)?.closest(cd);if(!s||s===n||!$t(n,s))return n;let o=s.parentElement?.shadowRoot;return o&&!o.querySelector("slot:not([name])")?n:s}catch{return n}}function wd(n){let e=n.flatMap(({id:t,start:r,end:i,waiting:s})=>{try{let o=document.createRange();return o.setStart(...r),o.setEnd(...i),[{id:t,range:o,waiting:s}]}catch{return[]}});if(globalThis.Highlight&&globalThis.CSS?.highlights){for(let{range:r}of e)Ed(r.startContainer.getRootNode());let t=r=>e.filter(i=>!!i.waiting===r).map(({range:i})=>i);CSS.highlights.set(to,new Highlight(...t(!1))),CSS.highlights.set(no,new Highlight(...t(!0)))}return e}function Ed(n){n===document||n.querySelector("style[data-spell-quotes]")||n.append(E("style",{"data-spell-quotes":!0},`::highlight(${to}) { background-color: var(--spell-quote-color); }
36
+ ::highlight(${no}) { background-color: var(--spell-quote-waiting-color); }`))}var Ad=0,zs=6e3;function Ys(n,e,{size:t="mini"}={}){let r=E("ui-button",{appearance:"circular basic",size:t,icon:n,title:e,"aria-label":e});return Re(r),r}function vd(n){return Array.from(n.children).find(e=>!e.hasAttribute("slot"))??null}var xt="epic-threads",Js="epic-thread",Cd="epic-comment-pane",bd="epic-send-buttons",Fd="epic-send-saving",Xs="--epic-thread-head-room";function xd(n,e,t){let r=n.children[t];r!==e&&n.insertBefore(e,r??null)}function sn(n,e,t){t===void 0?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}async function Sd(n){await customElements.whenDefined(n.localName),await n.ready?.catch(()=>{})}function Qs(){return`Saved ${N.localStamp(new Date().toISOString()).slice(11)} \xB7 waiting for Claude`}function Zs(n){return`Not saved: ${n} (kept in this browser)`}var eo=new WeakMap;function kd(n,e){if(!n.isConnected||!e.isConnected)return!1;if(n.parentElement===e||n.classList.contains("at-page"))return!0;let t=n.closest(ce);return!!t&&t.nextElementSibling===e}var un="main#main",Td="spell-site:navigated",io="site-mounted",Pd=1e4,so="site-sticky-bar",Od="--site-sections-top",Bd=350,Id=.2,Rd=200,Nd=2e3,Ld=["spell-comments.css","spell-toolbar.css"].map(n=>new URL(n,document.currentScript?.src??location.href).href),oo=null;Hd();document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{an()},{once:!0}):an();document.addEventListener(Td,()=>{an()});Ms(uo,Ud,{search:Wd,host:()=>document.querySelector("ui-root.site"),first:!0});async function an(){oo?.abort();let n=oo=new AbortController,{signal:e}=n;await Vd();let t=document.querySelector(un);!t||e.aborted||($d(t,{signal:e}),await ro(t,{signal:e,go:uo}))}function $d(n,{signal:e}){let t=qd(n),r=t[0]?.parentElement?.closest("ui-tab")?.closest("ui-tabs");if(!r)return ao(t,{signal:e});let i=null,s=()=>{i?.abort(),i=new AbortController,e.addEventListener("abort",()=>i.abort(),{once:!0,signal:i.signal});let o=[...r.querySelectorAll(":scope > ui-tab")].find(_d);ao(t.filter(u=>u.parentElement.closest("ui-tab")===o),{signal:i.signal})};r.addEventListener("ui-opened",o=>o.target.parentElement===r&&requestAnimationFrame(s),{signal:e}),s()}function ao(n,{signal:e}){if(!n.length)return;let t=n.map(h=>({element:h,id:h.id,label:Md(h),glyph:h.querySelector(':scope > ui-icon[slot="icon"]')?.getAttribute("name")??h.getAttribute("icon")??void 0})),r=_s($s(t,()=>[]),{titled:!0,segmented:!!n[0].closest("ui-tabs")});for(let h of document.querySelectorAll(`.${so}.spell-site-toolbar`))h.remove();let i=E("ui-sticky",{class:`${so} spell-site-toolbar`,"data-spell-added":!0},r);n[0].parentElement.prepend(i),r.addEventListener("click",Kd,{signal:e});let o=()=>!e.aborted&&dispatchEvent(new Event("resize"));Promise.all(["ui-sticky","ui-menu","ui-item"].map(h=>customElements.whenDefined(h))).then(()=>De(2)).then(o);let u=!1,d,f=0,p=0,v=()=>{d=void 0,T()},y=()=>{clearTimeout(f),f=setTimeout(v,ot(p+Nd-Date.now(),0,Rd))};r.addEventListener("click",h=>{let w=h.composedPath().find(P=>P.localName==="ui-item"&&P.hasAttribute("data-rail"));w&&(d=w.dataset.rail,p=Date.now(),nn(r,d),y())},{signal:e});let T=()=>{if(d!==void 0)return y();u||(u=!0,requestAnimationFrame(()=>{u=!1,e.aborted||nn(r,jd(document.querySelector(un),n)?.id??n[0].id)}))};e.addEventListener("abort",()=>clearTimeout(f),{once:!0}),addEventListener("scroll",T,{passive:!0,signal:e}),addEventListener("resize",T,{passive:!0,signal:e}),T()}function _d(n){try{return n.matches(":state(selected)")}catch{return!n.hidden}}function qd(n){let e=n.querySelector(".site-article"),t=e?[...e.querySelectorAll(":scope > ui-section[id]")]:[];return t.length?t:[...n.querySelectorAll("ui-section[id]")].filter(r=>!r.parentElement?.closest("ui-section, ui-example, template"))}function Md(n){let e=n.getAttribute("label")?.trim();return e||(n.querySelector(':scope > [slot="label"]')?.textContent.replace(/\s+/g," ").trim()??n.id)}function jd(n,e){let t=parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop)||0,r=(parseFloat(n.style.getPropertyValue(Od))||0)+4,i=Math.max(r,t+innerHeight*Id),s=scrollY+innerHeight>=document.documentElement.scrollHeight-2,o;for(let u of e){let d=u.getBoundingClientRect();if(!(!d.height&&!d.width)){if(d.top>(s?innerHeight-1:i))break;o=u}}return o}function Kd(n){if(n.defaultPrevented||n.button!==0||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey)return;let t=n.composedPath().find(i=>i.localName==="ui-item"&&i.hasAttribute("data-rail"))?.getAttribute("href");if(!t?.startsWith("#"))return;n.preventDefault();let r=location.href;history.pushState(history.state,"",t),dispatchEvent(new HashChangeEvent("hashchange",{oldURL:r,newURL:location.href}))}async function uo(n){decodeURIComponent(location.hash.slice(1))===n&&history.replaceState(history.state,"",`${location.pathname}${location.search}`),location.hash=n,await new Promise(e=>setTimeout(e,Bd))}function Ud(n){let e=document.getElementById(n);return!!e&&!!document.querySelector(un)?.contains(e)}async function Wd(n){let e=[...document.querySelectorAll("ui-docs-nav")].map(i=>i.shadowRoot?.querySelector("ui-docs-search")??i.querySelector("ui-docs-search")).filter(Boolean),t=e.find(i=>i.checkVisibility())??e[0];if(!t?.summon)return;await t.summon();let r=t.shadowRoot?.querySelector('input[part~="input"]')??t.shadowRoot?.querySelector("input");r&&(r.value=n,r.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0,inputType:"insertText",data:n})))}function Vd(){let e=new Promise(t=>{if(document.documentElement.classList.contains(io))return t();let r=new MutationObserver(()=>{document.documentElement.classList.contains(io)&&(r.disconnect(),t())});r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}).then(()=>customElements.whenDefined("ui-root"));return Promise.race([e,new Promise(t=>setTimeout(t,Pd))])}function Hd(){for(let n of Ld){if(document.querySelector(`link[rel="stylesheet"][href="${CSS.escape(n)}"]`))continue;let e=document.createElement("link");e.rel="stylesheet",e.href=n,document.head.append(e)}}})();