@fileverse-dev/ddoc 1.8.5 → 2.0.0-beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.es.js +85666 -50821
  4. package/dist/package/common/toolbar-button.d.ts +9 -0
  5. package/dist/package/common/toolbar.d.ts +13 -0
  6. package/dist/{packages/ddoc → package}/components/bottom-toolbar.d.ts +3 -1
  7. package/dist/package/components/editor-toolbar.d.ts +9 -0
  8. package/dist/{packages/ddoc → package}/components/editor-utils.d.ts +1 -0
  9. package/dist/{packages/ddoc → package}/components/utils-modal.d.ts +1 -1
  10. package/dist/{packages/ddoc → package}/types.d.ts +1 -5
  11. package/dist/{packages/ddoc → package}/use-ddoc-editor.d.ts +4 -3
  12. package/dist/style.css +1 -1
  13. package/package.json +8 -7
  14. package/dist/App.d.ts +0 -2
  15. package/dist/index.umd.js +0 -604
  16. package/dist/main.d.ts +0 -1
  17. package/dist/packages/ddoc/common/button.d.ts +0 -22
  18. package/dist/packages/ddoc/common/dialog.d.ts +0 -19
  19. package/dist/packages/ddoc/common/drawer.d.ts +0 -25
  20. package/dist/packages/ddoc/common/textfield.d.ts +0 -28
  21. package/dist/packages/ddoc/common/toolbar.d.ts +0 -28
  22. package/dist/packages/ddoc/components/dynamic-modal.d.ts +0 -26
  23. package/dist/packages/ddoc/components/editor-toolbar.d.ts +0 -7
  24. package/dist/packages/ddoc/utils/CollaborationCursor.d.ts +0 -83
  25. /package/dist/{packages/ddoc → package}/common/carousel.d.ts +0 -0
  26. /package/dist/{packages/ddoc → package}/common/cutsom-tooltip.d.ts +0 -0
  27. /package/dist/{packages/ddoc → package}/common/dropdown.d.ts +0 -0
  28. /package/dist/{packages/ddoc → package}/common/icon.d.ts +0 -0
  29. /package/dist/{packages/ddoc → package}/common/spinner.d.ts +0 -0
  30. /package/dist/{packages/ddoc → package}/common/surface.d.ts +0 -0
  31. /package/dist/{packages/ddoc → package}/common/types.d.ts +0 -0
  32. /package/dist/{packages/ddoc → package}/components/color-selector.d.ts +0 -0
  33. /package/dist/{packages/ddoc → package}/components/editor-bubble-menu.d.ts +0 -0
  34. /package/dist/{packages/ddoc → package}/components/node-selector.d.ts +0 -0
  35. /package/dist/{packages/ddoc → package}/components/slash-comand.d.ts +0 -0
  36. /package/dist/{packages/ddoc → package}/ddoc-editor.d.ts +0 -0
  37. /package/dist/{packages/ddoc → package}/extensions/action-button/action-button-node-view.d.ts +0 -0
  38. /package/dist/{packages/ddoc → package}/extensions/action-button/action-button.d.ts +0 -0
  39. /package/dist/{packages/ddoc → package}/extensions/action-button/index.d.ts +0 -0
  40. /package/dist/{packages/ddoc → package}/extensions/action-button/modal.d.ts +0 -0
  41. /package/dist/{packages/ddoc → package}/extensions/custom-keymap.d.ts +0 -0
  42. /package/dist/{packages/ddoc → package}/extensions/d-block/dblock-node-view.d.ts +0 -0
  43. /package/dist/{packages/ddoc → package}/extensions/d-block/dblock.d.ts +0 -0
  44. /package/dist/{packages/ddoc → package}/extensions/d-block/index.d.ts +0 -0
  45. /package/dist/{packages/ddoc → package}/extensions/default-extension.d.ts +0 -0
  46. /package/dist/{packages/ddoc → package}/extensions/doc.d.ts +0 -0
  47. /package/dist/{packages/ddoc → package}/extensions/document/document.d.ts +0 -0
  48. /package/dist/{packages/ddoc → package}/extensions/document/index.d.ts +0 -0
  49. /package/dist/{packages/ddoc → package}/extensions/horizontal-rule.d.ts +0 -0
  50. /package/dist/{packages/ddoc → package}/extensions/iframe/iframe.d.ts +0 -0
  51. /package/dist/{packages/ddoc → package}/extensions/iframe/index.d.ts +0 -0
  52. /package/dist/{packages/ddoc → package}/extensions/mardown-paste-handler/index.d.ts +0 -0
  53. /package/dist/{packages/ddoc → package}/extensions/multi-column/column-selection.d.ts +0 -0
  54. /package/dist/{packages/ddoc → package}/extensions/multi-column/column.d.ts +0 -0
  55. /package/dist/{packages/ddoc → package}/extensions/multi-column/columns.d.ts +0 -0
  56. /package/dist/{packages/ddoc → package}/extensions/multi-column/index.d.ts +0 -0
  57. /package/dist/{packages/ddoc → package}/extensions/multi-column/menus/columns-menu.d.ts +0 -0
  58. /package/dist/{packages/ddoc → package}/extensions/multi-column/menus/index.d.ts +0 -0
  59. /package/dist/{packages/ddoc → package}/extensions/multi-column/utils.d.ts +0 -0
  60. /package/dist/{packages/ddoc → package}/extensions/resizable-media/index.d.ts +0 -0
  61. /package/dist/{packages/ddoc → package}/extensions/resizable-media/media-paste-drop-plugin/index.d.ts +0 -0
  62. /package/dist/{packages/ddoc → package}/extensions/resizable-media/media-paste-drop-plugin/media-paste-drop-plugin.d.ts +0 -0
  63. /package/dist/{packages/ddoc → package}/extensions/resizable-media/resizable-media-menu-util.d.ts +0 -0
  64. /package/dist/{packages/ddoc → package}/extensions/resizable-media/resizable-media-node-view.d.ts +0 -0
  65. /package/dist/{packages/ddoc → package}/extensions/resizable-media/resizable-media.d.ts +0 -0
  66. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/index.d.ts +0 -0
  67. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/table-view.d.ts +0 -0
  68. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/table.d.ts +0 -0
  69. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/utilities/create-cell.d.ts +0 -0
  70. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/utilities/create-table.d.ts +0 -0
  71. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/utilities/delete-table-when-all-cells-selected.d.ts +0 -0
  72. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/utilities/get-table-node-types.d.ts +0 -0
  73. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table/utilities/is-cell-selection.d.ts +0 -0
  74. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-cell/index.d.ts +0 -0
  75. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-cell/table-cell-node-view.d.ts +0 -0
  76. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-cell/table-cell.d.ts +0 -0
  77. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-header/index.d.ts +0 -0
  78. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-header/table-header.d.ts +0 -0
  79. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-row/index.d.ts +0 -0
  80. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-row/table-row-node-view.d.ts +0 -0
  81. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/extension-table-row/table-row.d.ts +0 -0
  82. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/index.d.ts +0 -0
  83. /package/dist/{packages/ddoc → package}/extensions/supercharged-table/supercharged-table-kit.d.ts +0 -0
  84. /package/dist/{packages/ddoc → package}/extensions/trailing-node/index.d.ts +0 -0
  85. /package/dist/{packages/ddoc → package}/extensions/trailing-node/trailing-node.d.ts +0 -0
  86. /package/dist/{packages/ddoc → package}/extensions/twitter-embed/embedded-tweet.d.ts +0 -0
  87. /package/dist/{packages/ddoc → package}/extensions/twitter-embed/index.d.ts +0 -0
  88. /package/dist/{packages/ddoc → package}/extensions/twitter-embed/tweet-component-node-view.d.ts +0 -0
  89. /package/dist/{packages/ddoc → package}/hooks/use-content-item-actions.d.ts +0 -0
  90. /package/dist/{packages/ddoc → package}/hooks/use-editing-context.d.ts +0 -0
  91. /package/dist/{packages/ddoc → package}/hooks/use-visibility.d.ts +0 -0
  92. /package/dist/{packages/ddoc → package}/utils/cursor.d.ts +0 -0
  93. /package/dist/{packages/ddoc → package}/utils/debounce.d.ts +0 -0
  94. /package/dist/{packages/ddoc → package}/utils/get-render-container.d.ts +0 -0
  95. /package/dist/{packages/ddoc → package}/utils/getAddressName.d.ts +0 -0
  96. /package/dist/{packages/ddoc → package}/utils/upload-images.d.ts +0 -0
package/dist/index.umd.js DELETED
@@ -1,604 +0,0 @@
1
- (function(At,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],_):(At=typeof globalThis<"u"?globalThis:At||self,_(At.ddoc={},At.React,At.ReactDOM))})(this,function(At,_,Zt){"use strict";var L1e=Object.defineProperty;var q9=At=>{throw TypeError(At)};var B1e=(At,_,Zt)=>_ in At?L1e(At,_,{enumerable:!0,configurable:!0,writable:!0,value:Zt}):At[_]=Zt;var W=(At,_,Zt)=>B1e(At,typeof _!="symbol"?_+"":_,Zt),DC=(At,_,Zt)=>_.has(At)||q9("Cannot "+Zt);var T=(At,_,Zt)=>(DC(At,_,"read from private field"),Zt?Zt.call(At):_.get(At)),ae=(At,_,Zt)=>_.has(At)?q9("Cannot add the same private member more than once"):_ instanceof WeakSet?_.add(At):_.set(At,Zt),L=(At,_,Zt,kl)=>(DC(At,_,"write to private field"),kl?kl.call(At,Zt):_.set(At,Zt),Zt),Te=(At,_,Zt)=>(DC(At,_,"access private method"),Zt);var Y0=(At,_,Zt,kl)=>({set _(Y){L(At,_,Y,Zt)},get _(){return T(At,_,kl)}});var rd,Bu,rl,id,sd,ps,jo,od,ad,Xn,yi,Ho,Fu,Uu,ju,Ys,ms,il,Hu,X0,L0,B0,F0,bi,ld,Vu,ud,Vo,zu,fd,fw,Zr,wi,$u,Gu,sl,Wu,PC,J9,dd,hd,pd,Ku,zo,Qu,Xs,md,gd,yd,bd,wd,vd,Ad,xd,Ed,kd,Sd,Ju,ol,Go,al,Cd,dw,U0,Ko,Dd,sw,Y9,dr,ys,j0,IC,Td,hw,ll,qd,Zs,eo,to,xr,no,pw,mw,qo,H0,ul,Od,V0,z0,$9,cl,Xu,fl,Qd,lw,X9,G0,W0,Md,Nd,dl,Qo,Vi,hl,ro,Id,gw,Zu,ec,pl,Rd,Jo,uw,Ld,Yo,Bd,Fd,ml,zi,cw,Z9,Er,gl,kr,Ud,vi,tc,yl,Xo,K0,$i,jd,Hd,yt,Ai,RC,LC,Z0,BC,em,yw,Ur,io,nc,bl,rc,Vd,wl,FC,UC,ic,sc,zd,Zo,so,bs,Gi,ei,q0,jC,vl,$d,Gd,oo,Q0,Al,oc,xl,J0,ac,Wd,El,lc,ws,ti,ea,Kd,ni,e7,HC,t7,n7,VC,G9;function kl(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Y=kl(_),bw=kl(Zt);var Sl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r7(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var ww={exports:{}},Yd={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var $C;function i7(){if($C)return Yd;$C=1;var t=_,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,u){var c,f={},d=null,h=null;u!==void 0&&(d=""+u),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(h=l.ref);for(c in l)r.call(l,c)&&!s.hasOwnProperty(c)&&(f[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)f[c]===void 0&&(f[c]=l[c]);return{$$typeof:e,type:a,key:d,ref:h,props:f,_owner:i.current}}return Yd.Fragment=n,Yd.jsx=o,Yd.jsxs=o,Yd}var Xd={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var GC;function s7(){return GC||(GC=1,process.env.NODE_ENV!=="production"&&function(){var t=_,e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,m="@@iterator";function g(j){if(j===null||typeof j!="object")return null;var ve=p&&j[p]||j[m];return typeof ve=="function"?ve:null}var y=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(j){{for(var ve=arguments.length,Re=new Array(ve>1?ve-1:0),Ye=1;Ye<ve;Ye++)Re[Ye-1]=arguments[Ye];w("error",j,Re)}}function w(j,ve,Re){{var Ye=y.ReactDebugCurrentFrame,Tt=Ye.getStackAddendum();Tt!==""&&(ve+="%s",Re=Re.concat([Tt]));var Ft=Re.map(function(vt){return String(vt)});Ft.unshift("Warning: "+ve),Function.prototype.apply.call(console[j],console,Ft)}}var b=!1,E=!1,x=!1,O=!1,S=!1,D;D=Symbol.for("react.module.reference");function I(j){return!!(typeof j=="string"||typeof j=="function"||j===r||j===s||S||j===i||j===u||j===c||O||j===h||b||E||x||typeof j=="object"&&j!==null&&(j.$$typeof===d||j.$$typeof===f||j.$$typeof===o||j.$$typeof===a||j.$$typeof===l||j.$$typeof===D||j.getModuleId!==void 0))}function F(j,ve,Re){var Ye=j.displayName;if(Ye)return Ye;var Tt=ve.displayName||ve.name||"";return Tt!==""?Re+"("+Tt+")":Re}function Q(j){return j.displayName||"Context"}function V(j){if(j==null)return null;if(typeof j.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof j=="function")return j.displayName||j.name||null;if(typeof j=="string")return j;switch(j){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof j=="object")switch(j.$$typeof){case a:var ve=j;return Q(ve)+".Consumer";case o:var Re=j;return Q(Re._context)+".Provider";case l:return F(j,j.render,"ForwardRef");case f:var Ye=j.displayName||null;return Ye!==null?Ye:V(j.type)||"Memo";case d:{var Tt=j,Ft=Tt._payload,vt=Tt._init;try{return V(vt(Ft))}catch{return null}}}return null}var B=Object.assign,N=0,H,K,J,X,ie,le,Pe;function xe(){}xe.__reactDisabledLog=!0;function Ie(){{if(N===0){H=console.log,K=console.info,J=console.warn,X=console.error,ie=console.group,le=console.groupCollapsed,Pe=console.groupEnd;var j={configurable:!0,enumerable:!0,value:xe,writable:!0};Object.defineProperties(console,{info:j,log:j,warn:j,error:j,group:j,groupCollapsed:j,groupEnd:j})}N++}}function ke(){{if(N--,N===0){var j={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},j,{value:H}),info:B({},j,{value:K}),warn:B({},j,{value:J}),error:B({},j,{value:X}),group:B({},j,{value:ie}),groupCollapsed:B({},j,{value:le}),groupEnd:B({},j,{value:Pe})})}N<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=y.ReactCurrentDispatcher,ne;function G(j,ve,Re){{if(ne===void 0)try{throw Error()}catch(Tt){var Ye=Tt.stack.trim().match(/\n( *(at )?)/);ne=Ye&&Ye[1]||""}return`
18
- `+ne+j}}var Z=!1,A;{var P=typeof WeakMap=="function"?WeakMap:Map;A=new P}function ue(j,ve){if(!j||Z)return"";{var Re=A.get(j);if(Re!==void 0)return Re}var Ye;Z=!0;var Tt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ft;Ft=$.current,$.current=null,Ie();try{if(ve){var vt=function(){throw Error()};if(Object.defineProperty(vt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(vt,[])}catch(Vt){Ye=Vt}Reflect.construct(j,[],vt)}else{try{vt.call()}catch(Vt){Ye=Vt}j.call(vt.prototype)}}else{try{throw Error()}catch(Vt){Ye=Vt}j()}}catch(Vt){if(Vt&&Ye&&typeof Vt.stack=="string"){for(var Ee=Vt.stack.split(`
19
- `),q=Ye.stack.split(`
20
- `),be=Ee.length-1,_e=q.length-1;be>=1&&_e>=0&&Ee[be]!==q[_e];)_e--;for(;be>=1&&_e>=0;be--,_e--)if(Ee[be]!==q[_e]){if(be!==1||_e!==1)do if(be--,_e--,_e<0||Ee[be]!==q[_e]){var mt=`
21
- `+Ee[be].replace(" at new "," at ");return j.displayName&&mt.includes("<anonymous>")&&(mt=mt.replace("<anonymous>",j.displayName)),typeof j=="function"&&A.set(j,mt),mt}while(be>=1&&_e>=0);break}}}finally{Z=!1,$.current=Ft,ke(),Error.prepareStackTrace=Tt}var pn=j?j.displayName||j.name:"",sn=pn?G(pn):"";return typeof j=="function"&&A.set(j,sn),sn}function de(j,ve,Re){return ue(j,!1)}function oe(j){var ve=j.prototype;return!!(ve&&ve.isReactComponent)}function we(j,ve,Re){if(j==null)return"";if(typeof j=="function")return ue(j,oe(j));if(typeof j=="string")return G(j);switch(j){case u:return G("Suspense");case c:return G("SuspenseList")}if(typeof j=="object")switch(j.$$typeof){case l:return de(j.render);case f:return we(j.type,ve,Re);case d:{var Ye=j,Tt=Ye._payload,Ft=Ye._init;try{return we(Ft(Tt),ve,Re)}catch{}}}return""}var De=Object.prototype.hasOwnProperty,pe={},Ke=y.ReactDebugCurrentFrame;function qe(j){if(j){var ve=j._owner,Re=we(j.type,j._source,ve?ve.type:null);Ke.setExtraStackFrame(Re)}else Ke.setExtraStackFrame(null)}function tt(j,ve,Re,Ye,Tt){{var Ft=Function.call.bind(De);for(var vt in j)if(Ft(j,vt)){var Ee=void 0;try{if(typeof j[vt]!="function"){var q=Error((Ye||"React class")+": "+Re+" type `"+vt+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof j[vt]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw q.name="Invariant Violation",q}Ee=j[vt](ve,vt,Ye,Re,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(be){Ee=be}Ee&&!(Ee instanceof Error)&&(qe(Tt),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Ye||"React class",Re,vt,typeof Ee),qe(null)),Ee instanceof Error&&!(Ee.message in pe)&&(pe[Ee.message]=!0,qe(Tt),v("Failed %s type: %s",Re,Ee.message),qe(null))}}}var lt=Array.isArray;function ft(j){return lt(j)}function Ze(j){{var ve=typeof Symbol=="function"&&Symbol.toStringTag,Re=ve&&j[Symbol.toStringTag]||j.constructor.name||"Object";return Re}}function Se(j){try{return Ue(j),!1}catch{return!0}}function Ue(j){return""+j}function C(j){if(Se(j))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ze(j)),Ue(j)}var M=y.ReactCurrentOwner,R={key:!0,ref:!0,__self:!0,__source:!0},z,se,te;te={};function fe(j){if(De.call(j,"ref")){var ve=Object.getOwnPropertyDescriptor(j,"ref").get;if(ve&&ve.isReactWarning)return!1}return j.ref!==void 0}function he(j){if(De.call(j,"key")){var ve=Object.getOwnPropertyDescriptor(j,"key").get;if(ve&&ve.isReactWarning)return!1}return j.key!==void 0}function U(j,ve){if(typeof j.ref=="string"&&M.current&&ve&&M.current.stateNode!==ve){var Re=V(M.current.type);te[Re]||(v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',V(M.current.type),j.ref),te[Re]=!0)}}function re(j,ve){{var Re=function(){z||(z=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ve))};Re.isReactWarning=!0,Object.defineProperty(j,"key",{get:Re,configurable:!0})}}function ce(j,ve){{var Re=function(){se||(se=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ve))};Re.isReactWarning=!0,Object.defineProperty(j,"ref",{get:Re,configurable:!0})}}var ye=function(j,ve,Re,Ye,Tt,Ft,vt){var Ee={$$typeof:e,type:j,key:ve,ref:Re,props:vt,_owner:Ft};return Ee._store={},Object.defineProperty(Ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ee,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ye}),Object.defineProperty(Ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Tt}),Object.freeze&&(Object.freeze(Ee.props),Object.freeze(Ee)),Ee};function ge(j,ve,Re,Ye,Tt){{var Ft,vt={},Ee=null,q=null;Re!==void 0&&(C(Re),Ee=""+Re),he(ve)&&(C(ve.key),Ee=""+ve.key),fe(ve)&&(q=ve.ref,U(ve,Tt));for(Ft in ve)De.call(ve,Ft)&&!R.hasOwnProperty(Ft)&&(vt[Ft]=ve[Ft]);if(j&&j.defaultProps){var be=j.defaultProps;for(Ft in be)vt[Ft]===void 0&&(vt[Ft]=be[Ft])}if(Ee||q){var _e=typeof j=="function"?j.displayName||j.name||"Unknown":j;Ee&&re(vt,_e),q&&ce(vt,_e)}return ye(j,Ee,q,Tt,Ye,M.current,vt)}}var Le=y.ReactCurrentOwner,Ve=y.ReactDebugCurrentFrame;function pt(j){if(j){var ve=j._owner,Re=we(j.type,j._source,ve?ve.type:null);Ve.setExtraStackFrame(Re)}else Ve.setExtraStackFrame(null)}var nt;nt=!1;function et(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function Lt(){{if(Le.current){var j=V(Le.current.type);if(j)return`
22
-
23
- Check the render method of \``+j+"`."}return""}}function Ct(j){return""}var kt={};function Jt(j){{var ve=Lt();if(!ve){var Re=typeof j=="string"?j:j.displayName||j.name;Re&&(ve=`
24
-
25
- Check the top-level render call using <`+Re+">.")}return ve}}function Yt(j,ve){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var Re=Jt(ve);if(kt[Re])return;kt[Re]=!0;var Ye="";j&&j._owner&&j._owner!==Le.current&&(Ye=" It was passed a child from "+V(j._owner.type)+"."),pt(j),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Re,Ye),pt(null)}}function Xt(j,ve){{if(typeof j!="object")return;if(ft(j))for(var Re=0;Re<j.length;Re++){var Ye=j[Re];et(Ye)&&Yt(Ye,ve)}else if(et(j))j._store&&(j._store.validated=!0);else if(j){var Tt=g(j);if(typeof Tt=="function"&&Tt!==j.entries)for(var Ft=Tt.call(j),vt;!(vt=Ft.next()).done;)et(vt.value)&&Yt(vt.value,ve)}}}function Dn(j){{var ve=j.type;if(ve==null||typeof ve=="string")return;var Re;if(typeof ve=="function")Re=ve.propTypes;else if(typeof ve=="object"&&(ve.$$typeof===l||ve.$$typeof===f))Re=ve.propTypes;else return;if(Re){var Ye=V(ve);tt(Re,j.props,"prop",Ye,j)}else if(ve.PropTypes!==void 0&&!nt){nt=!0;var Tt=V(ve);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Tt||"Unknown")}typeof ve.getDefaultProps=="function"&&!ve.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tn(j){{for(var ve=Object.keys(j.props),Re=0;Re<ve.length;Re++){var Ye=ve[Re];if(Ye!=="children"&&Ye!=="key"){pt(j),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ye),pt(null);break}}j.ref!==null&&(pt(j),v("Invalid attribute `ref` supplied to `React.Fragment`."),pt(null))}}var On={};function Bt(j,ve,Re,Ye,Tt,Ft){{var vt=I(j);if(!vt){var Ee="";(j===void 0||typeof j=="object"&&j!==null&&Object.keys(j).length===0)&&(Ee+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var q=Ct();q?Ee+=q:Ee+=Lt();var be;j===null?be="null":ft(j)?be="array":j!==void 0&&j.$$typeof===e?(be="<"+(V(j.type)||"Unknown")+" />",Ee=" Did you accidentally export a JSX literal instead of a component?"):be=typeof j,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",be,Ee)}var _e=ge(j,ve,Re,Tt,Ft);if(_e==null)return _e;if(vt){var mt=ve.children;if(mt!==void 0)if(Ye)if(ft(mt)){for(var pn=0;pn<mt.length;pn++)Xt(mt[pn],j);Object.freeze&&Object.freeze(mt)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Xt(mt,j)}if(De.call(ve,"key")){var sn=V(j),Vt=Object.keys(ve).filter(function(hr){return hr!=="key"}),ri=Vt.length>0?"{key: someKey, "+Vt.join(": ..., ")+": ...}":"{key: someKey}";if(!On[sn+ri]){var uc=Vt.length>0?"{"+Vt.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
29
- let props = %s;
30
- <%s key={someKey} {...props} />`,ri,sn,uc,sn),On[sn+ri]=!0}}return j===r?Tn(_e):Dn(_e),_e}}function hn(j,ve,Re){return Bt(j,ve,Re,!0)}function _n(j,ve,Re){return Bt(j,ve,Re,!1)}var Mn=_n,Nn=hn;Xd.Fragment=r,Xd.jsx=Mn,Xd.jsxs=Nn}()),Xd}process.env.NODE_ENV==="production"?ww.exports=i7():ww.exports=s7();var k=ww.exports;function Zn(t){this.content=t}Zn.prototype={constructor:Zn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Zn(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Zn(n)},addToStart:function(t,e){return new Zn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Zn(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Zn(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Zn.from(t),t.size?new Zn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Zn.from(t),t.size?new Zn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Zn.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Zn.from=function(t){if(t instanceof Zn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Zn(e)};function WC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=WC(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function KC(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let u=0,c=Math.min(o.text.length,a.text.length);for(;u<c&&o.text[o.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let u=KC(o.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}let Ae=class jr{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],u=a+l.nodeSize;if(u>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new jr(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new jr(r,i)}cutByIndex(e,n){return e==n?jr.empty:e==0&&n==this.content.length?this:new jr(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new jr(i,s)}addToStart(e){return new jr([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new jr(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return WC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return KC(this,e,n,r)}findIndex(e,n=-1){if(e==0)return tm(0,e);if(e==this.size)return tm(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||n>0?tm(r+1,o):tm(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return jr.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new jr(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return jr.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new jr(n||e,r)}static from(e){if(!e)return jr.empty;if(e instanceof jr)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new jr([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Ae.empty=new Ae([],0);const vw={index:0,offset:0};function tm(t,e){return vw.index=t,vw.offset=e,vw}function nm(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!nm(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!nm(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Nt=class TC{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&nm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return TC.none;if(e instanceof TC)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Nt.none=[];class rm extends Error{}class Ce{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=QC(this.content,e+this.openStart,n);return r&&new Ce(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ce(qC(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ce.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ce(Ae.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new Ce(e,r,i)}}Ce.empty=new Ce(Ae.empty,0,0);function qC(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(qC(s.content,e-i-1,n-i-1)))}function QC(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=QC(o.content,e-s-1,n);return a&&t.replaceChild(i,o.copy(a))}function o7(t,e,n){if(n.openStart>t.depth)throw new rm("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new rm("Inconsistent open depths");return JC(t,e,n,0)}function JC(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=JC(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return Dl(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=a7(n,t);return Dl(s,XC(t,o,a,e,r))}else return Dl(s,im(t,e,r))}function YC(t,e){if(!e.type.compatibleContent(t.type))throw new rm("Cannot join "+e.type.name+" onto "+t.type.name)}function Aw(t,e,n){let r=t.node(n);return YC(r,e.node(n)),r}function Cl(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Zd(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Cl(t.nodeAfter,r),s++));for(let a=s;a<o;a++)Cl(i.child(a),r);e&&e.depth==n&&e.textOffset&&Cl(e.nodeBefore,r)}function Dl(t,e){return t.type.checkContent(e),t.copy(e)}function XC(t,e,n,r,i){let s=t.depth>i&&Aw(t,e,i+1),o=r.depth>i&&Aw(n,r,i+1),a=[];return Zd(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(YC(s,o),Cl(Dl(s,XC(t,e,n,r,i+1)),a)):(s&&Cl(Dl(s,im(t,e,i+1)),a),Zd(e,n,i,a),o&&Cl(Dl(o,im(n,r,i+1)),a)),Zd(r,null,i,a),new Ae(a)}function im(t,e,n){let r=[];if(Zd(null,t,n,r),t.depth>n){let i=Aw(t,e,n+1);Cl(Dl(i,im(t,e,n+1)),r)}return Zd(e,null,n,r),new Ae(r)}function a7(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(Ae.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class eh{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Nt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new sm(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),u=s-l;if(r.push(o,a,i+l),!u||(o=o.child(a),o.isText))break;s=u-1,i+=l+1}return new eh(n,r,s)}static resolveCached(e,n){let r=ZC.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else ZC.set(e,r=new l7);let i=r.elts[r.i]=eh.resolve(e,n);return r.i=(r.i+1)%u7,i}}class l7{constructor(){this.elts=[],this.i=0}}const u7=12,ZC=new WeakMap;class sm{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const c7=Object.create(null);let Tl=class OC{constructor(e,n,r,i=Nt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||Ae.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&nm(this.attrs,n||e.defaultAttrs||c7)&&Nt.sameSet(this.marks,r||Nt.none)}copy(e=null){return e==this.content?this:new OC(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new OC(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Ce.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),u=i.node(o).content.cut(i.pos-a,s.pos-a);return new Ce(u,i.depth-o,s.depth-o)}replace(e,n,r){return o7(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return eh.resolveCached(this,e)}resolveNoCache(e){return eh.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),e3(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ae.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Nt.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Nt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=Ae.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Tl.prototype.text=void 0;class om extends Tl{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):e3(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new om(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new om(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function e3(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ol{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new f7(e,n);if(r.next==null)return Ol.empty;let i=t3(r);r.next&&r.err("Unexpected trailing text");let s=b7(y7(i));return w7(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return Ae.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:f}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=s(f,a.concat(c));if(d)return d}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
31
- `)}}Ol.empty=new Ol(!0);class f7{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function t3(t){let e=[];do e.push(d7(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function d7(t){let e=[];do e.push(h7(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function h7(t){let e=g7(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=p7(t,e);else break;return e}function n3(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function p7(t,e){let n=n3(t),r=n;return t.eat(",")&&(t.next!="}"?r=n3(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function m7(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function g7(t){if(t.eat("(")){let e=t3(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=m7(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function y7(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(s(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=s(o.exprs[l],a);if(l==o.exprs.length-1)return u;i(u,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let u=0;u<o.min;u++){let c=n();i(s(o.expr,l),c),l=c}if(o.max==-1)i(s(o.expr,l),l);else for(let u=o.min;u<o.max;u++){let c=n();r(l,c),i(s(o.expr,l),c),l=c}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function r3(t,e){return e-t}function i3(t,e){let n=[];return r(e),n.sort(r3);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function b7(t){let e=Object.create(null);return n(i3(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);i3(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[r.join(",")]=new Ol(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(r3);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function w7(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function s3(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function o3(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function a3(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function l3(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new A7(t,r,e[r]);return n}let u3=class Q9{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=l3(e,r.attrs),this.defaultAttrs=s3(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ol.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:o3(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Tl(this,this.computeAttrs(e),Ae.from(n),Nt.setFrom(r))}createChecked(e=null,n,r){return n=Ae.from(n),this.checkContent(n),new Tl(this,this.computeAttrs(e),n,Nt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ae.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(Ae.empty,!0);return s?new Tl(this,e,n.append(s),Nt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){a3(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Nt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Q9(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function v7(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class A7{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?v7(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class am{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=l3(e,i.attrs),this.excluded=null;let s=s3(this.attrs);this.instance=s?new Nt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Nt(this,o3(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new am(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){a3(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class xw{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Zn.from(e.nodes),n.marks=Zn.from(e.marks||{}),this.nodes=u3.compile(this.spec.nodes,this),this.marks=am.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Ol.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?c3(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:c3(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof u3){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new om(r,r.defaultAttrs,e,Nt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Tl.fromJSON(this,e)}markFromJSON(e){return Nt.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function c3(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function x7(t){return t.tag!=null}function E7(t){return t.style!=null}let th=class _C{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(x7(i))this.tags.push(i);else if(E7(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new p3(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new p3(this,n,!0);return r.addAll(e,n.from,n.to),Ce.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(C7(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=m3(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=m3(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _C(e,_C.schemaRules(e)))}};const f3={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},k7={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},d3={ol:!0,ul:!0},lm=1,um=2,nh=4;function h3(t,e,n){return e!=null?(e?lm:0)|(e==="full"?um:0):t&&t.whitespace=="pre"?lm|um:n&~nh}class cm{constructor(e,n,r,i,s,o,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=Nt.none,this.stashMarks=[],this.match=o||(a&nh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ae.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&lm)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=Ae.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ae.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;n<r.length;n++){let i=r[n];(this.type?this.type.allowsMarkType(i.type):D7(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!f3.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class p3{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,s,o=h3(null,n.preserveWhitespace,0)|(r?nh:0);i?s=new cm(i.type,i.attrs,Nt.none,Nt.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new cm(null,null,Nt.none,Nt.none,!0,null,o):s=new cm(e.schema.topNodeType,null,Nt.none,Nt.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,n){let r=e.style;if(!r||!r.length)return n();let i=this.readStyles(e.style);if(!i)return;let[s,o]=i,a=this.top;for(let l=0;l<o.length;l++)this.removePendingMark(o[l],a);for(let l=0;l<s.length;l++)this.addPendingMark(s[l]);n();for(let l=0;l<s.length;l++)this.removePendingMark(s[l],a);for(let l=0;l<o.length;l++)this.addPendingMark(o[l])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&um||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&lm)r.options&um?n=n.replace(/\r\n?/g,`
32
- `):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(e)}else this.findInside(e)}addElement(e,n){let r=e.nodeName.toLowerCase(),i;d3.hasOwnProperty(r)&&this.parser.normalizeLists&&S7(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));if(s?s.ignore:k7.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,a=this.top,l=this.needsBlock;if(f3.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),o=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
33
- `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=Nt.none,r=Nt.none;if(e.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=e.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(u=>{l.clearMark(u)&&(r=u.addToSet(r))}):n=this.parser.schema.marks[l.mark].create(l.attrs).addToSet(n),l.consuming===!1)a=l;else break}}return[n,r]}addElementByRule(e,n,r){let i,s,o;n.node?(s=this.parser.schema.nodes[n.node],s.isLeaf?this.insertNode(s.create(n.attrs))||this.leafFallback(e):i=this.enter(s,n.attrs||null,n.preserveWhitespace)):(o=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(o));let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,n,r){let i=n||0;for(let s=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let n,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!n||n.length>o.length)&&(n=o,r=s,!o.length)||s.solid)break}if(!n)return!1;this.sync(r);for(let i=0;i<n.length;i++)this.enterInner(n[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let i=0;i<e.marks.length;i++)(!n.type||n.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let i=this.findPlace(e.create(n));return i&&this.enterInner(e,n,!0,r),i}enterInner(e,n=null,r=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=h3(e,i,s.options);s.options&nh&&s.content.length==0&&(o|=nh),this.nodes.push(new cm(e,n,s.activeMarks,s.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=T7(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==n)break}}}function S7(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&d3.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function C7(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function m3(t){let e={};for(let n in t)e[n]=t[n];return e}function D7(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}function T7(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class _l{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ew(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let u=o.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(s[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let u=o.marks[l++],c=this.serializeMark(u,o.isInline,n);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=fm(Ew(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&fm(Ew(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return fm(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new _l(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=g3(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return g3(e.marks)}}function g3(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ew(t){return t.document||window.document}const y3=new WeakMap;function O7(t){let e=y3.get(t);return e===void 0&&y3.set(t,e=_7(t)),e}function _7(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function fm(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=O7(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let f in u)if(u[f]!=null){let d=f.indexOf(" ");d>0?l.setAttributeNS(f.slice(0,d),f.slice(d+1),u[f]):l.setAttribute(f,u[f])}}for(let f=c;f<e.length;f++){let d=e[f];if(d===0){if(f<e.length-1||f>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=fm(t,d,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const b3=65535,w3=Math.pow(2,16);function M7(t,e){return t+e*w3}function v3(t){return t&b3}function N7(t){return(t-(t&b3))/w3}const A3=1,x3=2,dm=4,E3=8;class kw{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&E3)>0}get deletedBefore(){return(this.delInfo&(A3|dm))>0}get deletedAfter(){return(this.delInfo&(x3|dm))>0}get deletedAcross(){return(this.delInfo&dm)>0}}class ii{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ii.empty)return ii.empty}recover(e){let n=0,r=v3(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+N7(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],f=l+u;if(e<=f){let d=u?e==l?-1:e==f?1:n:n,h=l+i+(d<0?0:c);if(r)return h;let p=e==(n<0?l:f)?null:M7(a/3,e-l),m=e==l?x3:e==f?A3:dm;return(n<0?e!=l:e!=f)&&(m|=E3),new kw(h,m,p)}i+=c-u}return r?e+i:new kw(e+i,0,null)}touches(e,n){let r=0,i=v3(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+n],c=this.ranges[i+r];e(a,a+u,l,l+c),s+=c-u}}invert(){return new ii(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ii.empty:new ii(e<0?[0,-e,0]:[0,0,e])}}ii.empty=new ii([]);class fc{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new fc(this.maps,this.mirror,e,n)}copy(){return new fc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new fc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new kw(e,i,null)}}const Sw=Object.create(null);class pr{getMap(){return ii.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Sw[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Sw)throw new RangeError("Duplicate use of step JSON ID "+e);return Sw[e]=n,n.prototype.jsonID=e,n}}class Pn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Pn(e,null)}static fail(e){return new Pn(null,e)}static fromReplace(e,n,r,i){try{return Pn.ok(e.replace(n,r,i))}catch(s){if(s instanceof rm)return Pn.fail(s.message);throw s}}}function Cw(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Cw(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Ae.fromArray(r)}class ta extends pr{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new Ce(Cw(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,s)}invert(){return new As(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ta(n.pos,r.pos,this.mark)}merge(e){return e instanceof ta&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ta(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ta(n.from,n.to,e.markFromJSON(n.mark))}}pr.jsonID("addMark",ta);class As extends pr{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Ce(Cw(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,r)}invert(){return new ta(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new As(n.pos,r.pos,this.mark)}merge(e){return e instanceof As&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new As(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new As(n.from,n.to,e.markFromJSON(n.mark))}}pr.jsonID("removeMark",As);class na extends pr{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new Ce(Ae.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new na(this.pos,n.marks[i]);return new na(this.pos,this.mark)}}return new dc(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new na(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new na(n.pos,e.markFromJSON(n.mark))}}pr.jsonID("addNodeMark",na);class dc extends pr{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new Ce(Ae.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new na(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new dc(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new dc(n.pos,e.markFromJSON(n.mark))}}pr.jsonID("removeNodeMark",dc);class Hn extends pr{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Dw(e,this.from,this.to)?Pn.fail("Structure replace would overwrite content"):Pn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ii([this.from,this.to-this.from,this.slice.size])}invert(e){return new Hn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Hn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Hn)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Ce.empty:new Ce(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Hn(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Ce.empty:new Ce(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Hn(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Hn(n.from,n.to,Ce.fromJSON(e,n.slice),!!n.structure)}}pr.jsonID("replace",Hn);class Vn extends pr{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Dw(e,this.from,this.gapFrom)||Dw(e,this.gapTo,this.to)))return Pn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Pn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Pn.fromReplace(e,this.from,this.to,r):Pn.fail("Content does not fit in gap")}getMap(){return new ii([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Vn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Vn(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Vn(n.from,n.to,n.gapFrom,n.gapTo,Ce.fromJSON(e,n.slice),n.insert,!!n.structure)}}pr.jsonID("replaceAround",Vn);function Dw(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function P7(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let d=Math.max(u,e),h=Math.min(u+l.nodeSize,n),p=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(p)||(o&&o.to==d&&o.mark.eq(f[m])?o.to=h:i.push(o=new As(d,h,f[m])));a&&a.to==d?a.to=h:s.push(a=new ta(d,h,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function I7(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof am){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,n);for(let c=0;c<l.length;c++){let f=l[c],d;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&f.eq(i[h].style)&&(d=p)}d?(d.to=u,d.step=s):i.push({style:f,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>t.step(new As(o.from,o.to,o.style)))}function k3(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let u=s.child(l),c=a+u.nodeSize,f=r.matchType(u.type);if(!f)o.push(new Hn(a,c,Ce.empty));else{r=f;for(let d=0;d<u.marks.length;d++)n.allowsMarkType(u.marks[d].type)||t.step(new As(a,c,u.marks[d]));if(i&&u.isText&&n.whitespace!="pre"){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(u.text);)p||(p=new Ce(Ae.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new Hn(a+d.index,a+d.index+d[0].length,p))}}a=c}if(!r.validEnd){let l=r.fillBefore(Ae.empty,!0);t.replace(a,a,new Ce(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function R7(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function hc(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),s=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(s,o,n))return r;if(r==0||i.type.spec.isolating||!R7(i,s,o))break}return null}function L7(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,u=a,c=Ae.empty,f=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=Ae.from(r.node(p).copy(c)),f++):l--;let d=Ae.empty,h=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,d=Ae.from(i.node(p).copy(d)),h++):u++;t.step(new Vn(l,u,o,a,new Ce(c.append(d),f,h),c.size-f,!0))}function Tw(t,e,n=null,r=t){let i=B7(t,e),s=i&&F7(r,e);return s?i.map(S3).concat({type:e,attrs:n}).concat(s.map(S3)):null}function S3(t){return{type:t,attrs:null}}function B7(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function F7(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:o}function U7(t,e,n){let r=Ae.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ae.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Vn(i,s,i,s,new Ce(r,0,0),n.length,!0))}function j7(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&z7(t.doc,t.mapping.slice(s).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!h?l=!1:!d&&h&&(l=!0)}l===!1&&V7(t,o,a,s),k3(t,t.mapping.slice(s).map(a,1),r,void 0,l===null);let u=t.mapping.slice(s),c=u.map(a,1),f=u.map(a+o.nodeSize,1);return t.step(new Vn(c,f,c+1,f-1,new Ce(Ae.from(r.create(i,null,o.marks)),0,0),1,!0)),l===!0&&H7(t,o,a,s),!1}})}function H7(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function V7(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
34
- `))}})}function z7(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function $7(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Vn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Ce(Ae.from(o),0,0),1,!0))}function pc(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>s;u--,c--){let f=i.node(u),d=i.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function G7(t,e,n=1,r){let i=t.doc.resolve(e),s=Ae.empty,o=Ae.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){s=Ae.from(i.node(a).copy(s));let c=r&&r[u];o=Ae.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}t.step(new Hn(e,e,new Ce(s.append(o),n,n),!0))}function ra(t,e){let n=t.resolve(e),r=n.index();return C3(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function C3(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function hm(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&C3(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function W7(t,e,n){let r=new Hn(e-n,e+n,Ce.empty,!0);t.step(r)}function K7(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function D3(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),u=r.node(o),c=!1;if(s==1)c=u.canReplace(l,l,i);else{let f=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=f&&u.canReplaceWith(l,l,f[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function pm(t,e,n=e,r=Ce.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return T3(i,s,r)?new Hn(e,n,r):new q7(i,s,r).fit()}function T3(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class q7{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ae.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Ae.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new Ce(s,o,a);return e>-1?new Vn(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Hn(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ow(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,f=null;if(n==1&&(o?u.matchType(o.type)||(f=u.fillBefore(Ae.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ow(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Ce(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ow(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new Ce(rh(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Ce(rh(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,u=0,c=[],{match:f,type:d}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));f=f.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let m=a.child(u),g=f.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(f=g,c.push(O3(m.mark(d.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?h:-1)))}let p=u==a.childCount;p||(h=-1),this.placed=ih(this.placed,n,Ae.from(c)),this.frontier[n].match=f,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?Ce.empty:new Ce(rh(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new Ce(rh(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!_w(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=_w(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=_w(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ih(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ih(this.placed,this.depth,Ae.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ae.empty,!0);n.childCount&&(this.placed=ih(this.placed,this.frontier.length,n))}}function rh(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(rh(t.firstChild.content,e-1,n)))}function ih(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ih(t.lastChild.content,e-1,n)))}function Ow(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function O3(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,O3(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ae.empty,!0)))),t.copy(r)}function _w(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Q7(n,s.content,o)?a:null}function Q7(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function J7(t){return t.spec.defining||t.spec.definingForContent}function Y7(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(T3(i,s,r))return t.step(new Hn(e,n,r));let o=M3(i,t.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let d=i.depth,h=i.pos-1;d>0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(d)>-1?a=d:i.before(d)==h&&o.splice(1,0,-d)}let l=o.indexOf(a),u=[],c=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(u.push(p),h==r.openStart)break;d=p.content}for(let d=c-1;d>=0;d--){let h=u[d],p=J7(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))c=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+c+1)%(r.openStart+1),p=u[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let v=i.node(g-1),w=i.index(g-1);if(v.canReplaceWith(w,w,p.type,p.marks))return t.replace(i.before(g),y?s.after(g):n,new Ce(_3(r.content,0,r.openStart,h),h,r.openEnd))}}let f=t.steps.length;for(let d=o.length-1;d>=0&&(t.replace(e,n,r),!(t.steps.length>f));d--){let h=o[d];h<0||(e=i.before(h),n=s.after(h))}}function _3(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(_3(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(Ae.empty,!0))}return t}function X7(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=K7(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Ce(Ae.from(r),0,0))}function Z7(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=M3(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function M3(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class mc extends pr{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Pn.fromReplace(e,this.pos,this.pos+1,new Ce(Ae.from(i),0,n.isLeaf?0:1))}getMap(){return ii.empty}invert(e){return new mc(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new mc(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new mc(n.pos,n.attr,n.value)}}pr.jsonID("attr",mc);class sh extends pr{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Pn.ok(r)}getMap(){return ii.empty}invert(e){return new sh(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new sh(n.attr,n.value)}}pr.jsonID("docAttr",sh);let gc=class extends Error{};gc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},gc.prototype=Object.create(Error.prototype),gc.prototype.constructor=gc,gc.prototype.name="TransformError";class Mw{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new gc(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Ce.empty){let i=pm(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Ce(Ae.from(r),0,0))}delete(e,n){return this.replace(e,n,Ce.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Y7(this,e,n,r),this}replaceRangeWith(e,n,r){return X7(this,e,n,r),this}deleteRange(e,n){return Z7(this,e,n),this}lift(e,n){return L7(this,e,n),this}join(e,n=1){return W7(this,e,n),this}wrap(e,n){return U7(this,e,n),this}setBlockType(e,n=e,r,i=null){return j7(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return $7(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new mc(e,n,r)),this}setDocAttribute(e,n){return this.step(new sh(e,n)),this}addNodeMark(e,n){return this.step(new na(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Nt)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new dc(e,n)),this}split(e,n=1,r){return G7(this,e,n,r),this}addMark(e,n,r){return P7(this,e,n,r),this}removeMark(e,n,r){return I7(this,e,n,r),this}clearIncompatible(e,n,r){return k3(this,e,n,r),this}}const Nw=Object.create(null);class Qe{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Pw(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Ce.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:u}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(l.pos),c.map(u.pos),a?Ce.empty:n),a==0&&I3(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),u=l.map(o.pos),c=l.map(a.pos);s?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),I3(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new We(e):yc(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?yc(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):yc(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Wi(e.node(0))}static atStart(e){return yc(e,e,0,0,1)||new Wi(e)}static atEnd(e){return yc(e,e,e.content.size,e.childCount,-1)||new Wi(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Nw[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Nw)throw new RangeError("Duplicate use of selection JSON ID "+e);return Nw[e]=n,n.prototype.jsonID=e,n}getBookmark(){return We.between(this.$anchor,this.$head).getBookmark()}}Qe.prototype.visible=!0;class Pw{constructor(e,n){this.$from=e,this.$to=n}}let N3=!1;function P3(t){!N3&&!t.parent.inlineContent&&(N3=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class We extends Qe{constructor(e,n=e){P3(e),P3(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Qe.near(r);let i=e.resolve(n.map(this.anchor));return new We(i.parent.inlineContent?i:r,r)}replace(e,n=Ce.empty){if(super.replace(e,n),n==Ce.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof We&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new mm(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new We(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Qe.findFrom(n,r,!0)||Qe.findFrom(n,-r,!0);if(s)n=s.$head;else return Qe.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Qe.findFrom(e,-r,!0)||Qe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new We(e,n)}}Qe.jsonID("text",We);class mm{constructor(e,n){this.anchor=e,this.head=n}map(e){return new mm(e.map(this.anchor),e.map(this.head))}resolve(e){return We.between(e.resolve(this.anchor),e.resolve(this.head))}}class ze extends Qe{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Qe.near(s):new ze(s)}content(){return new Ce(Ae.from(this.node),0,0)}eq(e){return e instanceof ze&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Iw(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ze(e.resolve(n.anchor))}static create(e,n){return new ze(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ze.prototype.visible=!1,Qe.jsonID("node",ze);class Iw{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new mm(r,r):new Iw(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ze.isSelectable(r)?new ze(n):Qe.near(n)}}class Wi extends Qe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Ce.empty){if(n==Ce.empty){e.delete(0,e.doc.content.size);let r=Qe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Wi(e)}map(e){return new Wi(e)}eq(e){return e instanceof Wi}getBookmark(){return eU}}Qe.jsonID("all",Wi);const eU={map(){return this},resolve(t){return new Wi(t)}};function yc(t,e,n,r,i,s=!1){if(e.inlineContent)return We.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&ze.isSelectable(a))return ze.create(t,n-(i<0?a.nodeSize:0))}else{let l=yc(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function I3(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Hn||i instanceof Vn))return;let s=t.mapping.maps[r],o;s.forEach((a,l,u,c)=>{o==null&&(o=c)}),t.setSelection(Qe.near(t.doc.resolve(o),n))}const R3=1,gm=2,L3=4;let tU=class extends Mw{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|R3)&~gm,this.storedMarks=null,this}get selectionSet(){return(this.updated&R3)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=gm,this}ensureMarks(e){return Nt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&gm)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~gm,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Nt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),this.selection.empty||this.setSelection(Qe.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=L3,this}get scrolledIntoView(){return(this.updated&L3)>0}};function B3(t,e){return!e||!t?t:t.bind(e)}class oh{constructor(e,n,r){this.name=e,this.init=B3(n.init,r),this.apply=B3(n.apply,r)}}const nU=[new oh("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new oh("selection",{init(t,e){return t.selection||Qe.atStart(e.doc)},apply(t){return t.selection}}),new oh("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new oh("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Rw{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=nU.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new oh(r.key,r.spec.state,r))})}}class bc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,u=i?i[o].state:this,c=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,u,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new bc(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new tU(this)}static create(e){let n=new Rw(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new bc(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Rw(this.schema,e.plugins),r=n.fields,i=new bc(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Rw(e.schema,e.plugins),s=new bc(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Tl.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Qe.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=u.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function F3(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=F3(i,e,{})),n[r]=i}return n}class Ut{constructor(e){this.spec=e,this.props={},e.props&&F3(e.props,this,this.props),this.key=e.key?e.key.key:U3("plugin")}getState(e){return e[this.key]}}const Lw=Object.create(null);function U3(t){return t in Lw?t+"$"+ ++Lw[t]:(Lw[t]=0,t+"$")}class en{constructor(e="key"){this.key=U3(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const er=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ah=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Bw=null;const ao=function(t,e,n){let r=Bw||(Bw=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},rU=function(){Bw=null},Ml=function(t,e,n,r){return n&&(j3(t,e,n,r,-1)||j3(t,e,n,r,1))},iU=/^(img|br|input|textarea|hr)$/i;function j3(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:xs(t))){let s=t.parentNode;if(!s||s.nodeType!=1||lh(t)||iU.test(t.nodeName)||t.contentEditable=="false")return!1;e=er(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?xs(t):0}else return!1}}function xs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function sU(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=xs(t)}else if(t.parentNode&&!lh(t))e=er(t),t=t.parentNode;else return null}}function oU(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!lh(t))e=er(t)+1,t=t.parentNode;else return null}}function aU(t,e,n){for(let r=e==0,i=e==xs(t);r||i;){if(t==n)return!0;let s=er(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==xs(t)}}function lh(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ym=function(t){return t.focusNode&&Ml(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Nl(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function lU(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function uU(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Es=typeof navigator<"u"?navigator:null,H3=typeof document<"u"?document:null,ia=Es&&Es.userAgent||"",Fw=/Edge\/(\d+)/.exec(ia),V3=/MSIE \d/.exec(ia),Uw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ia),Hr=!!(V3||Uw||Fw),sa=V3?document.documentMode:Uw?+Uw[1]:Fw?+Fw[1]:0,Ki=!Hr&&/gecko\/(\d+)/i.test(ia);Ki&&+(/Firefox\/(\d+)/.exec(ia)||[0,0])[1];const jw=!Hr&&/Chrome\/(\d+)/.exec(ia),mr=!!jw,z3=jw?+jw[1]:0,Sr=!Hr&&!!Es&&/Apple Computer/.test(Es.vendor),wc=Sr&&(/Mobile\/\w+/.test(ia)||!!Es&&Es.maxTouchPoints>2),xi=wc||(Es?/Mac/.test(Es.platform):!1),cU=Es?/Win/.test(Es.platform):!1,qi=/Android \d/.test(ia),uh=!!H3&&"webkitFontSmoothing"in H3.documentElement.style,fU=uh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function dU(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function lo(t,e){return typeof t=="number"?t:t[e]}function hU(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function $3(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;o=ah(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,u=l?dU(s):hU(a),c=0,f=0;if(e.top<u.top+lo(r,"top")?f=-(u.top-e.top+lo(i,"top")):e.bottom>u.bottom-lo(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+lo(i,"top")-u.top:e.bottom-u.bottom+lo(i,"bottom")),e.left<u.left+lo(r,"left")?c=-(u.left-e.left+lo(i,"left")):e.right>u.right-lo(r,"right")&&(c=e.right-u.right+lo(i,"right")),c||f)if(l)s.defaultView.scrollBy(c,f);else{let d=a.scrollLeft,h=a.scrollTop;f&&(a.scrollTop+=f),c&&(a.scrollLeft+=c);let p=a.scrollLeft-d,m=a.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function pU(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:G3(t.dom)}}function G3(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ah(r));return e}function mU({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;W3(n,r==0?0:r-e)}function W3(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let vc=null;function gU(t){if(t.setActive)return t.setActive();if(vc)return t.focus(vc);let e=G3(t);t.focus(vc==null?{get preventScroll(){return vc={preventScroll:!0},!0}}:void 0),vc||(vc=!1,W3(e,0))}function K3(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,u;for(let c=t.firstChild,f=0;c;c=c.nextSibling,f++){let d;if(c.nodeType==1)d=c.getClientRects();else if(c.nodeType==3)d=ao(c).getClientRects();else continue;for(let h=0;h<d.length;h++){let p=d[h];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(s=f+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=f+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?yU(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:K3(n,i)}function yU(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=oa(r,1);if(s.top!=s.bottom&&Hw(e,s))return{node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Hw(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function bU(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function wU(t,e,n){let{node:r,offset:i}=K3(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function vU(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function q3(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(Hw(e,u))return q3(o,e,u)}}if((s=(s+1)%r)==i)break}return t}function AU(t,e){let n=t.dom.ownerDocument,r,i=0,s=uU(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!Hw(e,u)||(o=q3(t.dom,e,u),!o))return null}if(Sr)for(let u=o;r&&u;u=ah(u))u.draggable&&(r=void 0);if(o=bU(o,e),r){if(Ki&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],f;c.nodeName=="IMG"&&(f=c.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;uh&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=vU(t,r,i,e))}a==null&&(a=wU(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Q3(t){return t.top<t.bottom||t.left<t.right}function oa(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Q3(r))return r}return Array.prototype.find.call(n,Q3)||t.getBoundingClientRect()}const xU=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function J3(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=uh||Ki;if(r.nodeType==3)if(o&&(xU.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=oa(ao(r,i,i),n);if(Ki&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=oa(ao(r,i-1,i-1),-1);if(u.top==l.top){let c=oa(ao(r,i,i+1),-1);if(c.top!=l.top)return ch(c,c.left<u.left)}}return l}else{let l=i,u=i,c=n<0?1:-1;return n<0&&!i?(u++,c=-1):n>=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:u++,ch(oa(ao(r,l,u),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==xs(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Vw(l.getBoundingClientRect(),!1)}if(s==null&&i<xs(r)){let l=r.childNodes[i];if(l.nodeType==1)return Vw(l.getBoundingClientRect(),!0)}return Vw(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==xs(r))){let l=r.childNodes[i-1],u=l.nodeType==3?ao(l,xs(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return ch(oa(u,1),!1)}if(s==null&&i<xs(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?ao(l,0,o?0:1):l.nodeType==1?l:null:null;if(u)return ch(oa(u,-1),!0)}return ch(oa(r.nodeType==3?ao(r):r,-n),n>=0)}function ch(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Vw(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Y3(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function EU(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Y3(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=J3(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ao(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const kU=/[\u0590-\u08ac]/;function SU(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return!kU.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:Y3(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),d=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&u==m;try{a.collapse(c,f),l&&(l!=c||u!=f)&&a.extend&&a.extend(l,u)}catch{}return d!=null&&(a.caretBidiLevel=d),g})}let X3=null,Z3=null,eD=!1;function CU(t,e,n){return X3==e&&Z3==n?eD:(X3=e,Z3=n,eD=n=="up"||n=="down"?EU(t,e,n):SU(t,e,n))}const Ei=0,tD=1,Pl=2,ks=3;class fh{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ei,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>er(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof iD){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof nD&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?er(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?er(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],u=o+l.size;if(i==-1&&e<=u){let c=o+l.border;if(e>=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=o;for(let f=a;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=er(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;c<this.children.length;c++){let f=this.children[c];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=er(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let d=0,h=0;d<this.children.length;d++){let p=this.children[d],m=h+p.size;if(s>h&&o<m)return p.setSelection(e-h-p.border,n-h-p.border,r,i);h=m}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),u=r.getSelection(),c=!1;if((Ki||Sr)&&e==n){let{node:d,offset:h}=a;if(d.nodeType==3){if(c=!!(h&&d.nodeValue[h-1]==`
35
- `),c&&h==d.nodeValue.length)for(let p=d,m;p;p=p.parentNode){if(m=p.nextSibling){m.nodeName=="BR"&&(a=l={node:m.parentNode,offset:er(m)+1});break}let g=p.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let p=d.childNodes[h-1];c=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(Ki&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let d=u.focusNode.childNodes[u.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||c&&Sr)&&Ml(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Ml(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((u.extend||e==n)&&!c){u.collapse(a.node,a.offset);try{e!=n&&u.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let h=a;a=l,l=h}let d=document.createRange();d.setEnd(l.node,l.offset),d.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Pl:tD,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ks:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Pl:ks}r=o}this.dirty=Pl}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Pl:tD;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class nD extends fh{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ei&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class DU extends fh{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Il extends fh{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=_l.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Il(e,n,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&ks||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ks&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ei){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ei}}slice(e,n,r){let i=Il.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=Gw(s,n,o,r)),e>0&&(s=Gw(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}}class aa extends fh{constructor(e,n,r,i,s,o,a,l,u){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,u=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,f=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=_l.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=aD(c,r,n),u?l=new TU(e,n,r,i,c,f||null,d,u,s,o+1):n.isText?new bm(e,n,r,i,c,d,s):new aa(e,n,r,i,c,f||null,d,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ae.empty)}return e}matchesNode(e,n,r){return this.dirty==Ei&&e.eq(this.node)&&$w(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new _U(this,o&&o.node,e);PU(this.node,this.innerDeco,(u,c,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!f&&l.syncToMarks(c==this.node.childCount?Nt.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,i)},(u,c,f,d)=>{l.syncToMarks(u.marks,r,e);let h;l.findNodeMatch(u,c,f,d)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(u,c,f,h,e)||l.updateNextNode(u,c,f,e,d,i)||l.addNode(u,c,f,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Pl)&&(o&&this.protectLocalComposition(e,o),sD(this.contentDOM,this.children,e),wc&&IU(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof We)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=RU(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new DU(this,s,n,i);e.input.compositionNodes.push(o),this.children=Gw(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==ks||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ei}updateOuterDeco(e){if($w(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=oD(this.dom,this.nodeDOM,zw(this.outerDeco,this.node,n),zw(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function rD(t,e,n,r,i){aD(r,e,t);let s=new aa(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class bm extends aa{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==ks||this.dirty!=Ei&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ei||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ei,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new bm(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ks)}get domAtom(){return!1}isText(e){return this.node.text==e}}class iD extends fh{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ei&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class TU extends aa{constructor(e,n,r,i,s,o,a,l,u,c){super(e,n,r,i,s,o,a,u,c),this.spec=l}update(e,n,r,i){if(this.dirty==ks)return!1;if(this.spec.update){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function sD(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=lD(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof Il){let l=r?r.previousSibling:t.lastChild;sD(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=lD(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const dh=function(t){t&&(this.nodeName=t)};dh.prototype=Object.create(null);const Rl=[new dh];function zw(t,e,n){if(t.length==0)return Rl;let r=n?Rl[0]:new dh,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new dh(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new dh(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function oD(t,e,n,r){if(n==Rl&&r==Rl)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Rl[0]),i=l}OU(i,a||Rl[0],o)}return i}function OU(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function aD(t,e,n){return oD(t,t,Rl,zw(e,n,t.nodeType!=1))}function $w(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function lD(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class _U{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=MU(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Ei,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(e[s])&&!this.isLocked(u.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Il.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==ks&&o.dom==o.contentDOM&&(o.dirty=Pl),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof aa){let u=this.preMatch.matched.get(l);if(u!=null&&u!=s)return!1;let c=l.dom,f,d=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=ks&&$w(n,l.outerDeco));if(!d&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(l,e,n,r,i,o)))return this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Pl,f.updateChildren(i,o+1),f.dirty=Ei),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content))return null;let a=aa.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=aa.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new nD(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Il;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof bm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Sr||mr)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new iD(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function MU(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof Il)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function NU(t,e){return t.type.side-e.type.side}function PU(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,i,e.forChild(s,c),u),s+=c.nodeSize}return}let o=0,a=[],l=null;for(let u=0;;){let c,f;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(c?(f||(f=[c])).push(g):c=g)}if(c)if(f){f.sort(NU);for(let g=0;g<f.length;g++)n(f[g],u,!!l)}else n(c,u,!!l);let d,h;if(l)h=-1,d=l,l=null;else if(u<t.childCount)h=u,d=t.child(u++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=d.cut(g-s),d=d.cut(0,g-s),p=g,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=d.isInline&&!d.isLeaf?a.filter(g=>!g.inline):a.slice();r(d,m,e.forChild(s,d),h),s=p}}function IU(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function RU(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let u=t.child(i++);if(s+=u.nodeSize,!u.isText)break;l+=u.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?l.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Gw(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],u=a,c=a+=l.size;u>=n||c<=e?s.push(l):(u<e&&s.push(l.slice(0,e-u,r)),i&&(s.push(i),i=void 0),c>n&&s.push(l.slice(n-u,l.size,r)))}return s}function Ww(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,u;if(ym(n)){for(l=a;i&&!i.node;)i=i.parent;let c=i.node;if(i&&c.isAtom&&ze.isSelectable(c)&&i.parent&&!(c.isInline&&aU(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;u=new ze(o==f?a:r.resolve(f))}}else{let c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null;l=r.resolve(c)}if(!u){let c=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;u=qw(t,l,a,c)}return u}function uD(t){return t.editable?t.hasFocus():gD(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function uo(t,e=!1){let n=t.state.selection;if(hD(t,n),!!uD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&mr){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Ml(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)BU(t);else{let{anchor:r,head:i}=n,s,o;cD&&!(n instanceof We)&&(n.$from.parent.inlineContent||(s=fD(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=fD(t,n.to))),t.docView.setSelection(r,i,t.root,e),cD&&(s&&dD(s),o&&dD(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&LU(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const cD=Sr||mr&&z3<63;function fD(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Sr&&i&&i.contentEditable=="false")return Kw(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Kw(i);if(s)return Kw(s)}}function Kw(t){return t.contentEditable="true",Sr&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function dD(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function LU(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!uD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function BU(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,er(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&Hr&&sa<=11&&(r.disabled=!0,r.disabled=!1)}function hD(t,e){if(e instanceof ze){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(pD(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else pD(t)}function pD(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function qw(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||We.between(e,n,r)}function mD(t){return t.editable&&!t.hasFocus()?!1:gD(t)}function gD(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function FU(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ml(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Qw(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Qe.findFrom(s,e)}function la(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function yD(t,e,n){let r=t.state.selection;if(r instanceof We)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return la(t,new We(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Qw(t.state,e);return i&&i instanceof ze?la(t,i):!1}else if(!(xi&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?ze.isSelectable(s)?la(t,new ze(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):uh?la(t,new We(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ze&&r.node.isInline)return la(t,new We(e>0?r.$to:r.$from));{let i=Qw(t.state,e);return i?la(t,i):!1}}}function wm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function hh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ac(t,e){return e<0?UU(t):jU(t)}function UU(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Ki&&n.nodeType==1&&r<wm(n)&&hh(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(hh(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(bD(n))break;{let a=n.previousSibling;for(;a&&hh(a,-1);)i=n.parentNode,s=er(a),a=a.previousSibling;if(a)n=a,r=wm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Jw(t,n,r):i&&Jw(t,i,s)}function jU(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=wm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(hh(a,1))s=n,o=++r;else break}else{if(bD(n))break;{let a=n.nextSibling;for(;a&&hh(a,1);)s=a.parentNode,o=er(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=wm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Jw(t,s,o)}function bD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function HU(t,e){for(;t&&e==t.childNodes.length&&!lh(t);)e=er(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function VU(t,e){for(;t&&!e&&!lh(t);)e=er(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Jw(t,e,n){if(e.nodeType!=3){let s,o;(o=HU(e,n))?(e=o,n=0):(s=VU(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(ym(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&uo(t)},50)}function wD(t,e){let n=t.state.doc.resolve(e);if(!(mr||cU)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function vD(t,e,n){let r=t.state.selection;if(r instanceof We&&!r.empty||n.indexOf("s")>-1||xi&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Qw(t.state,e);if(o&&o instanceof ze)return la(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Wi?Qe.near(o,e):Qe.findFrom(o,e);return a?la(t,a):!1}return!1}function AD(t,e){if(!(t.state.selection instanceof We))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function xD(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function zU(t){if(!Sr||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;xD(t,r,"true"),setTimeout(()=>xD(t,r,"false"),20)}return!1}function $U(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function GU(t,e){let n=e.keyCode,r=$U(e);if(n==8||xi&&n==72&&r=="c")return AD(t,-1)||Ac(t,-1);if(n==46&&!e.shiftKey||xi&&n==68&&r=="c")return AD(t,1)||Ac(t,1);if(n==13||n==27)return!0;if(n==37||xi&&n==66&&r=="c"){let i=n==37?wD(t,t.state.selection.from)=="ltr"?-1:1:-1;return yD(t,i,r)||Ac(t,i)}else if(n==39||xi&&n==70&&r=="c"){let i=n==39?wD(t,t.state.selection.from)=="ltr"?1:-1:1;return yD(t,i,r)||Ac(t,i)}else{if(n==38||xi&&n==80&&r=="c")return vD(t,-1,r)||Ac(t,-1);if(n==40||xi&&n==78&&r=="c")return zU(t)||vD(t,1,r)||Ac(t,1);if(r==(xi?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ED(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||_l.fromSchema(t.state.schema),a=MD(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let u=l.firstChild,c,f=0;for(;u&&u.nodeType==1&&(c=OD[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=a.createElement(c[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
36
-
37
- `);return{dom:l,text:d,slice:e}}function kD(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",d=>{e=d(e,s||r,t)}),s)return e?new Ce(Ae.from(t.state.schema.text(e.replace(/\r\n?/g,`
38
- `))),0,0):Ce.empty;let f=t.someProp("clipboardTextParser",d=>d(e,i,r,t));if(f)a=f;else{let d=i.marks(),{schema:h}=t.state,p=_l.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=qU(n),uh&&QU(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||th.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!WU.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)a=JU(TD(a,+c[1],+c[2]),c[4]);else if(a=Ce.maxOpen(KU(a.content,i),!0),a.openStart||a.openEnd){let f=0,d=0;for(let h=a.content.firstChild;f<a.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=a.content.lastChild;d<a.openEnd&&!h.type.spec.isolating;d++,h=h.lastChild);a=TD(a,f,d)}return t.someProp("transformPasted",f=>{a=f(a,t)}),a}const WU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function KU(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&s.length&&CD(l,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=DD(o[o.length-1],s.length));let c=SD(a,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return Ae.from(o)}return t}function SD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ae.from(t));return t}function CD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=CD(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(Ae.from(SD(n,t,i+1))))}}function DD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,DD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Ae.empty,!0);return t.copy(n.append(r))}function Yw(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=Yw(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(Ae.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function TD(t,e,n){return e<t.openStart&&(t=new Ce(Yw(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Ce(Yw(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const OD={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let _D=null;function MD(){return _D||(_D=document.implementation.createHTMLDocument("title"))}function qU(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=MD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&OD[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=t,i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function QU(t){let e=t.querySelectorAll(mr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function JU(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=Ae.from(l.create(r[a+1],i)),s++,o++}return new Ce(i,s,o)}const Cr={},Dr={},YU={touchstart:!0,touchmove:!0};class XU{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ZU(t){for(let e in Cr){let n=Cr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{tj(t,r)&&!Zw(t,r)&&(t.editable||!(r.type in Dr))&&n(t,r)},YU[e]?{passive:!0}:void 0)}Sr&&t.dom.addEventListener("input",()=>null),Xw(t)}function ua(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function ej(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Xw(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Zw(t,r))})}function Zw(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function tj(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function nj(t,e){!Zw(t,e)&&Cr[e.type]&&(t.editable||!(e.type in Dr))&&Cr[e.type](t,e)}Dr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!PD(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(qi&&mr&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),wc&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Nl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||GU(t,n)?n.preventDefault():ua(t,"key")},Dr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Dr.keypress=(t,e)=>{let n=e;if(PD(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||xi&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof We)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function vm(t){return{left:t.clientX,top:t.clientY}}function rj(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ev(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function xc(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function ij(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ze.isSelectable(r)?(xc(t,new ze(n)),!0):!1}function sj(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ze&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ze.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(xc(t,ze.create(t.state.doc,i)),!0):!1}function oj(t,e,n,r,i){return ev(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?sj(t,n):ij(t,n))}function aj(t,e,n,r){return ev(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function lj(t,e,n,r){return ev(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||uj(t,n,r)}function uj(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(xc(t,We.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)xc(t,We.create(r,a+1,a+1+o.content.size));else if(ze.isSelectable(o))xc(t,ze.create(r,a));else continue;return!0}}function tv(t){return Am(t)}const ND=xi?"metaKey":"ctrlKey";Cr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=tv(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&rj(n,t.input.lastClick)&&!n[ND]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=t.posAtCoords(vm(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new cj(t,o,n,!!r)):(s=="doubleClick"?aj:lj)(t,o.pos,o.inside,n)?n.preventDefault():ua(t,"pointer"))};class cj{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[ND],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:u}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof ze&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ki&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ua(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>uo(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(vm(e))),this.updateAllowDefault(e),this.allowDefault||!n?ua(this.view,"pointer"):oj(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Sr&&this.mightDrag&&!this.mightDrag.node.isAtom||mr&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(xc(this.view,Qe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ua(this.view,"pointer")}move(e){this.updateAllowDefault(e),ua(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Cr.touchstart=t=>{t.input.lastTouch=Date.now(),tv(t),ua(t,"pointer")},Cr.touchmove=t=>{t.input.lastTouch=Date.now(),ua(t,"pointer")},Cr.contextmenu=t=>tv(t);function PD(t,e){return t.composing?!0:Sr&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const fj=qi?5e3:-1;Dr.compositionstart=Dr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Am(t,!0),t.markCursor=null;else if(Am(t),Ki&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){t.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}ID(t,fj)},Dr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,ID(t,20))};function ID(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Am(t),e))}function RD(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hj());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function dj(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=sU(e.focusNode,e.focusOffset),r=oU(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function hj(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Am(t,e=!1){if(!(qi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),RD(t),e||t.docView&&t.docView.dirty){let n=Ww(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function pj(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ph=Hr&&sa<15||wc&&fU<604;Cr.copy=Dr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=ph?null:n.clipboardData,o=r.content(),{dom:a,text:l}=ED(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):pj(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function mj(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function gj(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?mh(t,r.value,null,i,e):mh(t,r.textContent,r.innerHTML,i,e)},50)}function mh(t,e,n,r,i){let s=kD(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||Ce.empty)))return!0;if(!s)return!1;let o=mj(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function LD(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Dr.paste=(t,e)=>{let n=e;if(t.composing&&!qi)return;let r=ph?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&mh(t,LD(r),r.getData("text/html"),i,n)?n.preventDefault():gj(t,n)};class BD{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const FD=xi?"altKey":"ctrlKey";Cr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(vm(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ze?i.to-1:i.to))){if(r&&r.mightDrag)o=ze.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=ze.create(t.state.doc,f.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:u,slice:c}=ED(t,a);(!n.dataTransfer.files.length||!mr||z3>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ph?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ph||n.dataTransfer.setData("text/plain",u),t.dragging=new BD(c,!n[FD],o)},Cr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Dr.dragover=Dr.dragenter=(t,e)=>e.preventDefault(),Dr.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(vm(n));if(!i)return;let s=t.state.doc.resolve(i.pos),o=r&&r.slice;o?t.someProp("transformPasted",p=>{o=p(o,t)}):o=kD(t,LD(n.dataTransfer),ph?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!n[FD]);if(t.someProp("handleDrop",p=>p(t,n,o||Ce.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?D3(t.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let u=t.state.tr;if(a){let{node:p}=r;p?p.replace(u):u.deleteSelection()}let c=u.mapping.map(l),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=u.doc;if(f?u.replaceRangeWith(c,c,o.content.firstChild):u.replaceRange(c,c,o),u.doc.eq(d))return;let h=u.doc.resolve(c);if(f&&ze.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new ze(h));else{let p=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,y,v)=>p=v),u.setSelection(qw(t,h,u.doc.resolve(p)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))},Cr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&uo(t)},20))},Cr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Cr.beforeinput=(t,e)=>{if(mr&&qi&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Nl(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Dr)Cr[t]=Dr[t];function gh(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class xm{constructor(e,n){this.toDOM=e,this.spec=n||Ll,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Un(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof xm&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ca{constructor(e,n){this.attrs=e,this.spec=n||Ll}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Un(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ca&&gh(this.attrs,e.attrs)&&gh(this.spec,e.spec)}static is(e){return e.type instanceof ca}destroy(){}}class nv{constructor(e,n){this.attrs=e,this.spec=n||Ll}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Un(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof nv&&gh(this.attrs,e.attrs)&&gh(this.spec,e.spec)}destroy(){}}class Un{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Un(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Un(e,e,new xm(n,r))}static inline(e,n,r,i){return new Un(e,n,new ca(r,i))}static node(e,n,r,i){return new Un(e,n,new nv(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ca}get widget(){return this.type instanceof xm}}const Ec=[],Ll={};class Wt{constructor(e,n){this.local=e.length?e:Ec,this.children=n.length?n:Ec}static create(e,n){return n.length?Em(n,e,0,Ll):gr}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==gr||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ll)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?yj(this.children,o||[],e,n,r,i,s):o?new Wt(o.sort(Bl),Ec):gr}add(e,n){return n.length?this==gr?Wt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let u=l+r,c;if(c=jD(n,a,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,c,u+1):i.splice(s,0,l,l+a.nodeSize,Em(c,a,u+1,Ll)),s+=3}});let o=UD(s?HD(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Wt(o.length?this.local.concat(o).sort(Bl):this.local,i||this.children)}remove(e){return e.length==0||this==gr?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let c=0,f;c<e.length;c++)(f=e[c])&&f.from>a&&f.to<l&&(e[c]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,a+1);u!=gr?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Wt(i,r):gr}forChild(e,n){if(this==gr)return this;if(n.isLeaf)return Wt.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof ca){let u=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Wt(i.sort(Bl),Ec);return r?new fa([a,r]):a}return r||gr}eq(e){if(this==e)return!0;if(!(e instanceof Wt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return rv(this.localsInner(e))}localsInner(e){if(this==gr)return Ec;if(e.inlineContent||!this.local.some(ca.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ca||n.push(this.local[r]);return n}}Wt.empty=new Wt([],[]),Wt.removeOverlap=rv;const gr=Wt.empty;class fa{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Ll));return fa.from(r)}forChild(e,n){if(n.isLeaf)return Wt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=gr&&(s instanceof fa?r=r.concat(s.members):r.push(s))}return fa.from(r)}eq(e){if(!(e instanceof fa)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?rv(r?n:n.sort(Bl)):Ec}static from(e){switch(e.length){case 0:return gr;case 1:return e[0];default:return new fa(e.every(n=>n instanceof Wt)?e:e.reduce((n,r)=>n.concat(r instanceof Wt?r:r.members),[]))}}}function yj(t,e,n,r,i,s,o){let a=t.slice();for(let u=0,c=s;u<n.maps.length;u++){let f=0;n.maps[u].forEach((d,h,p,m)=>{let g=m-p-(h-d);for(let y=0;y<a.length;y+=3){let v=a[y+1];if(v<0||d>v+c-f)continue;let w=a[y]+c-f;h>=w?a[y+1]=d<=w?-2:-1:d>=c&&g&&(a[y]+=g,a[y+1]+=g)}f+=g}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=n.map(t[u]+s),f=c-i;if(f<0||f>=r.content.size){l=!0;continue}let d=n.map(t[u+1]+s,-1),h=d-i,{index:p,offset:m}=r.content.findIndex(f),g=r.maybeChild(p);if(g&&m==f&&m+g.nodeSize==h){let y=a[u+2].mapInner(n,g,c+1,t[u]+s+1,o);y!=gr?(a[u]=f,a[u+1]=h,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=bj(a,t,e,n,i,s,o),c=Em(u,r,0,o);e=c.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,d=0;f<c.children.length;f+=3){let h=c.children[f];for(;d<a.length&&a[d]<h;)d+=3;a.splice(d,0,c.children[f],c.children[f+1],c.children[f+2])}}return new Wt(e.sort(Bl),a)}function UD(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Un(i.from+e,i.to+e,i.type))}return n}function bj(t,e,n,r,i,s,o){function a(l,u){for(let c=0;c<l.local.length;c++){let f=l.local[c].map(r,i,u);f?n.push(f):o.onRemove&&o.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function jD(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function HD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Em(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let u=jD(t,a,l+n);if(u){s=!0;let c=Em(u,a,n+l+1,r);c!=gr&&i.push(l,l+a.nodeSize,c)}});let o=UD(s?HD(t):t,-n).sort(Bl);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Wt(o,i):gr}function Bl(t,e){return t.from-e.from||t.to-e.to}function rv(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),VD(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),VD(e,i,r.copy(s.from,r.to)));break}}}return e}function VD(t,e,n){for(;e<t.length&&Bl(n,t[e])>0;)e++;t.splice(e,0,n)}function iv(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=gr&&e.push(r)}),t.cursorWrapper&&e.push(Wt.create(t.state.doc,[t.cursorWrapper.deco])),fa.from(e)}const wj={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},vj=Hr&&sa<=11;class Aj{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class xj{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Aj,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Hr&&sa<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),vj&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,wj)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(mD(this.view)){if(this.suppressingSelectionUpdates)return uo(this.view);if(Hr&&sa<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ml(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=ah(s))n.add(s);for(let s=e.anchorNode;s;s=ah(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&mD(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let f=this.registerMutation(n[c],l);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(Ki&&l.length){let c=l.filter(f=>f.nodeName=="BR");if(c.length==2){let[f,d]=c;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of c){let h=d.parentNode;h&&h.nodeName=="LI"&&(!f||Sj(e,f)!=h)&&d.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ym(r)&&(u=Ww(e))&&u.eq(Qe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,uo(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Ej(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||uo(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let f=e.addedNodes[c];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Hr&&sa<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:f,nextSibling:d}=e.addedNodes[c];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d)}let o=i&&i.parentNode==e.target?er(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?er(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let zD=new WeakMap,$D=!1;function Ej(t){if(!zD.has(t)&&(zD.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ki,$D)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),$D=!0}}function GD(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Ml(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function kj(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return GD(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?GD(t,n):null}function Sj(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Cj(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),u,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],ym(l)||u.push({node:l.focusNode,offset:l.focusOffset})),mr&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let y=r.childNodes[g-1],v=y.pmViewDesc;if(y.nodeName=="BR"&&!v){s=g;break}if(!v||v.size)break}let f=t.state.doc,d=t.someProp("domParser")||th.fromSchema(t.state.schema),h=f.resolve(o),p=null,m=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Dj,context:h});if(u&&u[0].pos!=null){let g=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:a}}function Dj(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Sr&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Sr&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Tj=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Oj(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=Ww(t,D);if(I&&!t.state.selection.eq(I)){if(mr&&qi&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Q=>Q(t,Nl(13,"Enter"))))return;let F=t.state.tr.setSelection(I);D=="pointer"?F.setMeta("pointer",!0):D=="key"&&F.scrollIntoView(),s&&F.setMeta("composition",s),t.dispatch(F)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=Cj(t,e,n),c=t.state.doc,f=c.slice(u.from,u.to),d,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(d=t.state.selection.to,h="end"):(d=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=Nj(f.content,u.doc.content,u.from,d,h);if((wc&&t.input.lastIOSEnter>Date.now()-225||qi)&&i.some(D=>D.nodeType==1&&!Tj.test(D.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",D=>D(t,Nl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof We&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let D=WD(t,t.state.doc,u.sel);if(D&&!D.eq(t.state.selection)){let I=t.state.tr.setSelection(D);s&&I.setMeta("composition",s),t.dispatch(I)}}return}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof We&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Hr&&sa<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=u.doc.resolveNoCache(p.start-u.from),g=u.doc.resolveNoCache(p.endB-u.from),y=c.resolve(p.start),v=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,w;if((wc&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!v&&m.pos<u.doc.content.size&&!m.sameParent(g)&&(w=Qe.findFrom(u.doc.resolve(m.pos+1),1,!0))&&w.head==g.pos)&&t.someProp("handleKeyDown",D=>D(t,Nl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&Mj(c,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",D=>D(t,Nl(8,"Backspace")))){qi&&mr&&t.domObserver.suppressSelectionUpdates();return}mr&&qi&&p.endB==p.start&&(t.input.lastAndroidDelete=Date.now()),qi&&!v&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,g=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,Nl(13,"Enter"))})},20));let b=p.start,E=p.endA,x,O,S;if(v){if(m.pos==g.pos)Hr&&sa<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>uo(t),20)),x=t.state.tr.delete(b,E),O=c.resolve(p.start).marksAcross(c.resolve(p.endA));else if(p.endA==p.endB&&(S=_j(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))x=t.state.tr,S.type=="add"?x.addMark(b,E,S.mark):x.removeMark(b,E,S.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let D=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",I=>I(t,b,E,D)))return;x=t.state.tr.insertText(D,b,E)}}if(x||(x=t.state.tr.replace(b,E,u.doc.slice(p.start-u.from,p.endB-u.from))),u.sel){let D=WD(t,x.doc,u.sel);D&&!(mr&&qi&&t.composing&&D.empty&&(p.start!=p.endB||t.input.lastAndroidDelete<Date.now()-100)&&(D.head==b||D.head==x.mapping.map(E)-1)||Hr&&D.empty&&D.head==b)&&x.setSelection(D)}O&&x.ensureMarks(O),s&&x.setMeta("composition",s),t.dispatch(x.scrollIntoView())}function WD(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:qw(t,e.resolve(n.anchor),e.resolve(n.head))}function _j(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)s=n[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(Ae.from(u).eq(t))return{mark:a,type:o}}function Mj(t,e,n,r,i){if(n-e<=i.pos-r.pos||sv(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(sv(s,!0,!0));return!o.parent.isTextblock||o.pos>n||sv(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function sv(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Nj(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&KD(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&KD(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function KD(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Pj{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new XU,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(XD),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=JD(this),QD(this),this.nodeViews=YD(this),this.docView=rD(this.state.doc,qD(this),iv(this),this.dom,this),this.domObserver=new xj(this,(r,i,s,o)=>Oj(this,r,i,s,o)),this.domObserver.start(),ZU(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Xw(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(XD),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(RD(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=YD(this);Rj(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Xw(this),this.editable=JD(this),QD(this);let l=iv(this),u=qD(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,u,l);(f||!e.selection.eq(i.selection))&&(o=!0);let d=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&pU(this);if(o){this.domObserver.stop();let h=f&&(Hr||mr)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Ij(i.selection,e.selection);if(f){let p=mr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=dj(this)),(s||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=rD(e.doc,u,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&FU(this))?uo(this,h):(hD(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&mU(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ze){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&$3(this,n.getBoundingClientRect(),e)}else $3(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new BD(e.slice,e.move,i<0?void 0:ze.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(Hr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&gU(this.dom),uo(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return AU(this,e)}coordsAtPos(e,n=1){return J3(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return CU(this,n||this.state,e)}pasteHTML(e,n){return mh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return mh(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(ej(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],iv(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,rU())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return nj(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return Sr&&this.root.nodeType===11&&lU(this.dom.ownerDocument)==this.dom&&kj(this,e)||e}domSelection(){return this.root.getSelection()}}function qD(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Un.node(0,t.state.doc.content.size,e)]}function QD(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Un.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function JD(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Ij(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function YD(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Rj(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function XD(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var da={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},km={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Lj=typeof navigator<"u"&&/Mac/.test(navigator.platform),Bj=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tr=0;tr<10;tr++)da[48+tr]=da[96+tr]=String(tr);for(var tr=1;tr<=24;tr++)da[tr+111]="F"+tr;for(var tr=65;tr<=90;tr++)da[tr]=String.fromCharCode(tr+32),km[tr]=String.fromCharCode(tr);for(var ov in da)km.hasOwnProperty(ov)||(km[ov]=da[ov]);function Fj(t){var e=Lj&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Bj&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?km:da)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Uj=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function jj(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Uj?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Hj(t){let e=Object.create(null);for(let n in t)e[jj(n)]=t[n];return e}function av(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Vj(t){return new Ut({props:{handleKeyDown:lv(t)}})}function lv(t){let e=Hj(t);return function(n,r){let i=Fj(r),s,o=e[av(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[av(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(s=da[r.keyCode])&&s!=i){let a=e[av(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const zj=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function ZD(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const $j=(t,e,n)=>{let r=ZD(t,n);if(!r)return!1;let i=uv(r);if(!i){let o=r.blockRange(),a=o&&hc(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&rT(t,i,e))return!0;if(r.parent.content.size==0&&(kc(s,"end")||ze.isSelectable(s))){let o=pm(t.doc,r.before(),r.after(),Ce.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(kc(s,"end")?Qe.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):ze.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Gj=(t,e,n)=>{let r=ZD(t,n);if(!r)return!1;let i=uv(r);return i?eT(t,i,e):!1},Wj=(t,e,n)=>{let r=tT(t,n);if(!r)return!1;let i=cv(r);return i?eT(t,i,e):!1};function eT(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=pm(t.doc,s,l,Ce.empty);if(!u||u.from!=s||u instanceof Hn&&u.slice.size>=l-s)return!1;if(n){let c=t.tr.step(u);c.setSelection(We.create(c.doc,s)),n(c.scrollIntoView())}return!0}function kc(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Kj=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=uv(r)}let o=s&&s.nodeBefore;return!o||!ze.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ze.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function uv(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function tT(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const qj=(t,e,n)=>{let r=tT(t,n);if(!r)return!1;let i=cv(r);if(!i)return!1;let s=i.nodeAfter;if(rT(t,i,e))return!0;if(r.parent.content.size==0&&(kc(s,"start")||ze.isSelectable(s))){let o=pm(t.doc,r.before(),r.after(),Ce.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(kc(s,"start")?Qe.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ze.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Qj=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=cv(r)}let o=s&&s.nodeAfter;return!o||!ze.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ze.create(t.doc,s.pos)).scrollIntoView()),!0)};function cv(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Jj=(t,e)=>{let n=t.selection,r=n instanceof ze,i;if(r){if(n.node.isTextblock||!ra(t.doc,n.from))return!1;i=n.from}else if(i=hm(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(ze.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Yj=(t,e)=>{let n=t.selection,r;if(n instanceof ze){if(n.node.isTextblock||!ra(t.doc,n.to))return!1;r=n.to}else if(r=hm(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Xj=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&hc(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Zj=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
39
- `).scrollIntoView()),!0)};function nT(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const eH=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=nT(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Qe.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},tH=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Wi||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=nT(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(We.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},nH=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(pc(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&hc(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},rH=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(ze.create(t.doc,i))),!0)};function iH(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||ra(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function rT(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(iH(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,d=Ae.empty;for(let m=s.length-1;m>=0;m--)d=Ae.from(s[m].create(null,d));d=Ae.from(r.copy(d));let h=t.tr.step(new Vn(e.pos-1,f,e.pos,f,new Ce(d,1,0),s.length,!0)),p=f+2*s.length;ra(h.doc,p)&&h.join(p),n(h.scrollIntoView())}return!0}let l=Qe.findFrom(e,1),u=l&&l.$from.blockRange(l.$to),c=u&&hc(u);if(c!=null&&c>=e.depth)return n&&n(t.tr.lift(u,c).scrollIntoView()),!0;if(a&&kc(i,"start",!0)&&kc(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let h=i,p=1;for(;!h.isTextblock;h=h.firstChild)p++;if(f.canReplace(f.childCount,f.childCount,h.content)){if(n){let m=Ae.empty;for(let y=d.length-1;y>=0;y--)m=Ae.from(d[y].copy(m));let g=t.tr.step(new Vn(e.pos-d.length,e.pos+i.nodeSize,e.pos+p,e.pos+i.nodeSize-p,new Ce(m,d.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function iT(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(We.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const sH=iT(-1),oH=iT(1);function aH(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&Tw(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function sT(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(u),f=c.index();i=c.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function lH(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=!1,l=o;if(!o)return!1;if(o.depth>=2&&i.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let c=n.doc.resolve(o.start-2);l=new sm(c,c,o.depth),o.endIndex<o.parent.childCount&&(o=new sm(i,n.doc.resolve(s.end(o.depth)),o.depth)),a=!0}let u=Tw(l,t,e,o);return u?(r&&r(uH(n.tr,o,u,a,t).scrollIntoView()),!0):!1}}function uH(t,e,n,r,i){let s=Ae.empty;for(let c=n.length-1;c>=0;c--)s=Ae.from(n[c].type.create(n[c].attrs,s));t.step(new Vn(e.start-(r?2:0),e.end,e.start,e.end,new Ce(s,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==i&&(o=c+1);let a=n.length-o,l=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,f=e.endIndex,d=!0;c<f;c++,d=!1)!d&&pc(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function cH(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?fH(e,n,t,s):dH(e,n,s):!0:!1}}function fH(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Vn(s-1,o,s,o,new Ce(Ae.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new sm(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=hc(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(s,-1)-1;return ra(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function dH(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(a?0:1),c+1,o.content.append(l?Ae.empty:Ae.from(i))))return!1;let f=s.pos,d=f+o.nodeSize;return r.step(new Vn(f-(a?1:0),d+(l?1:0),f+1,d-1,new Ce((a?Ae.empty:Ae.from(i.copy(Ae.empty))).append(l?Ae.empty:Ae.from(i.copy(Ae.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function hH(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=Ae.from(u?t.create():null),f=new Ce(Ae.from(t.create(null,Ae.from(a.type.create(null,c)))),u?3:1,0),d=s.start,h=s.end;n(e.tr.step(new Vn(d-(u?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}function Sm(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class Cm{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>{const f=l(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,u=e||s.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(u,n),y=h(...m)(g);return a.push(y),f}])),run:c};return f}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,u])=>[l,(...c)=>u(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Sm({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}}class pH{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function je(t,e,n){return t.config[e]===void 0&&t.parent?je(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?je(t.parent,e,n):null}):t.config[e]}function Dm(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function oT(t){const e=[],{nodeExtensions:n,markExtensions:r}=Dm(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=je(o,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(f=>{Object.entries(c.attributes).forEach(([d,h])=>{e.push({type:f,name:d,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=je(o,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,f])=>{const d={...s,...f};typeof(d==null?void 0:d.default)=="function"&&(d.default=d.default()),d!=null&&d.isRequired&&(d==null?void 0:d.default)===void 0&&delete d.default,e.push({type:o.name,name:c,attribute:d})})}),e}function zn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function gt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],u=a.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function fv(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>gt(n,r),{})}function aT(t){return typeof t=="function"}function dt(t,e=void 0,...n){return aT(t)?e?t.bind(e)(...n):t(...n):t}function mH(t={}){return Object.keys(t).length===0&&t.constructor===Object}function gH(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function lT(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):gH(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function uT(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&mH(n)?!1:n!=null))}function yH(t,e){var n;const r=oT(t),{nodeExtensions:i,markExtensions:s}=Dm(t),o=(n=i.find(u=>je(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((y,v)=>{const w=je(v,"extendNodeSchema",f);return{...y,...w?w(u):{}}},{}),h=uT({...d,content:dt(je(u,"content",f)),marks:dt(je(u,"marks",f)),group:dt(je(u,"group",f)),inline:dt(je(u,"inline",f)),atom:dt(je(u,"atom",f)),selectable:dt(je(u,"selectable",f)),draggable:dt(je(u,"draggable",f)),code:dt(je(u,"code",f)),whitespace:dt(je(u,"whitespace",f)),defining:dt(je(u,"defining",f)),isolating:dt(je(u,"isolating",f)),attrs:Object.fromEntries(c.map(y=>{var v;return[y.name,{default:(v=y==null?void 0:y.attribute)===null||v===void 0?void 0:v.default}]}))}),p=dt(je(u,"parseHTML",f));p&&(h.parseDOM=p.map(y=>lT(y,c)));const m=je(u,"renderHTML",f);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:fv(y,c)}));const g=je(u,"renderText",f);return g&&(h.toText=g),[u.name,h]})),l=Object.fromEntries(s.map(u=>{const c=r.filter(g=>g.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((g,y)=>{const v=je(y,"extendMarkSchema",f);return{...g,...v?v(u):{}}},{}),h=uT({...d,inclusive:dt(je(u,"inclusive",f)),excludes:dt(je(u,"excludes",f)),group:dt(je(u,"group",f)),spanning:dt(je(u,"spanning",f)),code:dt(je(u,"code",f)),attrs:Object.fromEntries(c.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))}),p=dt(je(u,"parseHTML",f));p&&(h.parseDOM=p.map(g=>lT(g,c)));const m=je(u,"renderHTML",f);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:fv(g,c)})),[u.name,h]}));return new xw({topNode:o,nodes:a,marks:l})}function dv(t,e){return e.nodes[t]||e.marks[t]||null}function cT(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const bH=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom?c:c.slice(0,Math.max(0,r-s))}),n};function hv(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class yh{constructor(e){this.find=e.find,this.handler=e.handler}}const wH=(t,e)=>{if(hv(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Tm(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let c=!1;const f=bH(u)+s;return o.forEach(d=>{if(c)return;const h=wH(f,d.find);if(!h)return;const p=l.state.tr,m=Sm({state:l.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:y,chain:v,can:w}=new Cm({editor:n,state:m});d.handler({state:m,range:g,match:h,commands:y,chain:v,can:w})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),c=!0)}),c}function vH(t){const{editor:e,rules:n}=t,r=new Ut({state:{init(){return null},apply(i,s){const o=i.getMeta(r);if(o)return o;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:u,text:c}=a,f=u+c.length;Tm({editor:e,from:u,to:f,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Tm({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Tm({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Tm({editor:e,from:o.pos,to:o.pos,text:`
40
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function AH(t){return typeof t=="number"}class xH{constructor(e){this.find=e.find,this.handler=e.handler}}const EH=(t,e,n)=>{if(hv(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function kH(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Cm({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"");EH(y,s.find,o).forEach(w=>{if(w.index===void 0)return;const b=m+w.index+1,E=b+w[0].length,x={from:n.tr.mapping.map(b),to:n.tr.mapping.map(E)},O=s.handler({state:n,range:x,match:w,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:a});f.push(O)})}),f.every(h=>h!==null)}const SH=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function CH(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const l=({state:c,from:f,to:d,rule:h,pasteEvt:p})=>{const m=c.tr,g=Sm({state:c,transaction:m});if(!(!kH({editor:e,state:g,from:Math.max(f-1,0),to:d.b-1,rule:h,pasteEvent:p,dropEvent:a})||!m.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m};return n.map(c=>new Ut({view(f){const d=h=>{var p;r=!((p=f.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?f.dom.parentElement:null};return window.addEventListener("dragstart",d),{destroy(){window.removeEventListener("dragstart",d)}}},props:{handleDOMEvents:{drop:(f,d)=>(s=r===f.dom.parentElement,a=d,!1),paste:(f,d)=>{var h;const p=(h=d.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(f,d,h)=>{const p=f[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),v=!!y;if(!m&&!g&&!v)return;if(v){const{from:E,text:x}=y,O=E+x.length,S=SH(x);return l({rule:c,state:h,from:E,to:{b:O},pasteEvt:S})}const w=d.doc.content.findDiffStart(h.doc.content),b=d.doc.content.findDiffEnd(h.doc.content);if(!(!AH(w)||!b||w===b.b))return l({rule:c,state:h,from:w,to:b,pasteEvt:o})}}))}function DH(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}class Sc{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Sc.resolve(e),this.schema=yH(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Sc.sort(Sc.flatten(e)),r=DH(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=je(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=je(r,"priority")||100,o=je(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:dv(n.name,this.schema)},i=je(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Sc.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:dv(o.name,this.schema)},l=[],u=je(o,"addKeyboardShortcuts",a);let c={};if(o.type==="mark"&&je(o,"exitable",a)&&(c.ArrowRight=()=>In.handleExit({editor:e,mark:o})),u){const m=Object.fromEntries(Object.entries(u()).map(([g,y])=>[g,()=>y({editor:e})]));c={...c,...m}}const f=Vj(c);l.push(f);const d=je(o,"addInputRules",a);cT(o,e.options.enableInputRules)&&d&&r.push(...d());const h=je(o,"addPasteRules",a);cT(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=je(o,"addProseMirrorPlugins",a);if(p){const m=p();l.push(...m)}return l}).flat();return[vH({editor:e,rules:r}),...CH({editor:e,rules:i}),...s]}get attributes(){return oT(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Dm(this.extensions);return Object.fromEntries(n.filter(r=>!!je(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:zn(r.name,this.schema)},o=je(r,"addNodeView",s);if(!o)return[];const a=(l,u,c,f)=>{const d=fv(l,i);return o()({editor:e,node:l,getPos:c,decorations:f,HTMLAttributes:d,extension:r})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:dv(e.name,this.schema)};e.type==="mark"&&(!((n=dt(je(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=je(e,"onBeforeCreate",r),s=je(e,"onCreate",r),o=je(e,"onUpdate",r),a=je(e,"onSelectionUpdate",r),l=je(e,"onTransaction",r),u=je(e,"onFocus",r),c=je(e,"onBlur",r),f=je(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),f&&this.editor.on("destroy",f)})}}function TH(t){return Object.prototype.toString.call(t).slice(8,-1)}function Om(t){return TH(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function _m(t,e){const n={...t};return Om(t)&&Om(e)&&Object.keys(e).forEach(r=>{Om(e[r])&&Om(t[r])?n[r]=_m(t[r],e[r]):n[r]=e[r]}),n}class It{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=dt(je(this,"addOptions",{name:this.name}))),this.storage=dt(je(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new It(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_m(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new It({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=dt(je(n,"addOptions",{name:n.name})),n.storage=dt(je(n,"addStorage",{name:n.name,options:n.options})),n}}function fT(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
41
-
42
- `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,u,c,f)=>{var d;l.isBlock&&u>r&&(a+=s);const h=o==null?void 0:o[l.type.name];if(h)return c&&(a+=h({node:l,pos:u,parent:c,index:f,range:e})),!1;l.isText&&(a+=(d=l==null?void 0:l.text)===null||d===void 0?void 0:d.slice(Math.max(r,u)-u,i-u))}),a}function dT(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const hT=It.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ut({key:new en("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),l=dT(n);return fT(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),OH=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),_H=(t=!1)=>({commands:e})=>e.setContent("",t),MH=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,f=u.resolve(c.map(l)),d=u.resolve(c.map(l+a.nodeSize)),h=f.blockRange(d);if(!h)return;const p=hc(h);if(a.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},NH=t=>e=>t(e),PH=()=>({state:t,dispatch:e})=>tH(t,e),IH=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new We(r.doc.resolve(o-1))),!0},RH=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1},LH=t=>({tr:e,state:n,dispatch:r})=>{const i=zn(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),u=s.after(o);e.delete(l,u).scrollIntoView()}return!0}return!1},BH=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},FH=()=>({state:t,dispatch:e})=>zj(t,e),UH=()=>({commands:t})=>t.keyboardShortcut("Enter"),jH=()=>({state:t,dispatch:e})=>eH(t,e);function Mm(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:hv(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function pv(t,e,n={}){return t.find(r=>r.type===e&&Mm(r.attrs,n))}function HH(t,e,n={}){return!!pv(t,e,n)}function mv(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const i=pv([...r.node.marks],e,n);if(!i)return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(pv([...r.node.marks],e,n);s>0&&i.isInSet(t.parent.child(s-1).marks);)s-=1,o-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&HH([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function ha(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const VH=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=ha(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const f=mv(l,s,e);if(f&&f.from<=u&&f.to>=c){const d=We.create(o,f.from,f.to);n.setSelection(d)}}return!0},zH=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Nm(t){return t instanceof We}function co(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function pT(t,e=null){if(!e)return null;const n=Qe.atStart(t),r=Qe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?We.create(t,co(0,i,s),co(t.content.size,i,s)):We.create(t,co(e,i,s),co(e,i,s))}function Pm(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const $H=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{Pm()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!Nm(n.state.selection))return o(),!0;const a=pT(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},GH=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),WH=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),mT=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&mT(r)}return t};function gT(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return mT(n)}function Im(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{return Array.isArray(t)&&t.length>0?Ae.fromArray(t.map(o=>e.nodeFromJSON(o))):e.nodeFromJSON(t)}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Im("",e,n)}if(i){let s=e,o=!1,a="";n.errorOnInvalidContent&&(s=new xw({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})}));const l=th.fromSchema(s),u=n.slice?l.parseSlice(gT(t),n.parseOptions).content:l.parse(gT(t),n.parseOptions);if(n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)});return u}return Im("",e,n)}function KH(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Hn||i instanceof Vn))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,u,c)=>{o===0&&(o=c)}),t.setSelection(Qe.near(t.doc.resolve(o),n))}const qH=t=>!("type"in t),QH=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=Im(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch{return!1}let{from:l,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,f=!0;if((qH(a)?a:[a]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,f=f?p.isBlock:!1}),l===u&&f){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,u+=1)}let h;c?(Array.isArray(e)?h=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?h=e.text:h=e,r.insertText(h,l,u)):(h=a,r.replaceWith(l,u,h)),n.updateSelection&&KH(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:h})}return!0},JH=()=>({state:t,dispatch:e})=>Jj(t,e),YH=()=>({state:t,dispatch:e})=>Yj(t,e),XH=()=>({state:t,dispatch:e})=>$j(t,e),ZH=()=>({state:t,dispatch:e})=>qj(t,e),eV=()=>({state:t,dispatch:e,tr:n})=>{try{const r=hm(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},tV=()=>({state:t,dispatch:e,tr:n})=>{try{const r=hm(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},nV=()=>({state:t,dispatch:e})=>Gj(t,e),rV=()=>({state:t,dispatch:e})=>Wj(t,e);function yT(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function iV(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Pm()||yT()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const sV=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=iV(t).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l==null||l.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function bh(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?zn(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;const h=Math.max(r,d),p=Math.min(i,d+f.nodeSize);a.push({node:f,from:h,to:p})});const l=i-r,u=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Mm(f.node.attrs,n,{strict:!1}));return s?!!u.length:u.reduce((f,d)=>f+d.to-d.from,0)>=l}const oV=(t,e={})=>({state:n,dispatch:r})=>{const i=zn(t,n.schema);return bh(n,i,e)?Xj(n,r):!1},aV=()=>({state:t,dispatch:e})=>nH(t,e),lV=t=>({state:e,dispatch:n})=>{const r=zn(t,e.schema);return cH(r)(e,n)},uV=()=>({state:t,dispatch:e})=>Zj(t,e);function Rm(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function bT(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const cV=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=Rm(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=zn(t,r.schema)),a==="mark"&&(o=ha(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{s&&s===u.type&&n.setNodeMarkup(c,void 0,bT(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&n.addMark(c,c+u.nodeSize,o.create(bT(f.attrs,e)))})})}),!0):!1},fV=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),dV=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),hV=()=>({state:t,dispatch:e})=>Kj(t,e),pV=()=>({state:t,dispatch:e})=>Qj(t,e),mV=()=>({state:t,dispatch:e})=>rH(t,e),gV=()=>({state:t,dispatch:e})=>oH(t,e),yV=()=>({state:t,dispatch:e})=>sH(t,e);function gv(t,e,n={},r={}){return Im(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const bV=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var l,u;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const f=gv(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,f).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function wh(t,e){const n=ha(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function wV(t,e){const n=new Mw(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function vV(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function AV(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function yv(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function bv(t){return e=>yv(e.$from,t)}function wv(t,e){const n=_l.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function xV(t,e){const n={from:0,to:t.content.size};return fT(t,n,e)}function EV(t,e){const n=zn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function wT(t,e){const n=Rm(typeof e=="string"?e:e.name,t.schema);return n==="node"?EV(t,e):n==="mark"?wh(t,e):{}}function kV(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function SV(t){const e=kV(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function CV(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(s).map(a,-1),c=e.slice(s).map(l),f=e.invert().map(u,-1),d=e.invert().map(c);r.push({oldRange:{from:f,to:d},newRange:{from:u,to:c}})})}),SV(r)}function vv(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t-1),o=mv(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function Lm(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Av(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?ha(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>Mm(f.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:f,$to:d})=>{const h=f.pos,p=d.pos;t.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),v=Math.min(p,g+m.nodeSize),w=v-y;o+=w,a.push(...m.marks.map(b=>({mark:b,from:y,to:v})))})}),o===0)return!1;const l=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>Mm(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),u=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,d)=>f+d.to-d.from,0);return(l>0?l+u:l)>=o}function DV(t,e,n={}){if(!e)return bh(t,null,n)||Av(t,null,n);const r=Rm(e,t.schema);return r==="node"?bh(t,e,n):r==="mark"?Av(t,e,n):!1}function vT(t,e){const{nodeExtensions:n}=Dm(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=dt(je(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function AT(t){const e=t.type.createAndFill(t.attrs);return e?t.eq(e):!1}function xv(t){return t instanceof ze}function TV(t,e,n){const i=t.state.doc.content.size,s=co(e,0,i),o=co(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),f=Math.min(a.left,l.left),d=Math.max(a.right,l.right),h=d-f,p=c-u,y={top:u,bottom:c,left:f,right:d,width:h,height:p,x:f,y:u};return{...y,toJSON:()=>y}}function OV(t,e,n){var r;const{selection:i}=e;let s=null;if(Nm(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,f,d)=>{if(u)return!1;if(c.isInline){const h=!d||d.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=h&&p}return!u}),u})}const _V=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=ha(t,r.schema);if(i)if(o){const u=wh(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(c,f,(d,h)=>{const p=Math.max(h,c),m=Math.min(h+d.nodeSize,f);d.marks.find(y=>y.type===l)?d.marks.forEach(y=>{l===y.type&&n.addMark(p,m,l.create({...y.attrs,...e}))}):n.addMark(p,m,l.create(e))})});return OV(r,n,l)},MV=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),NV=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=zn(t,n.schema);return s.isTextblock?i().command(({commands:o})=>sT(s,e)(n)?!0:o.clearNodes()).command(({state:o})=>sT(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},PV=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=co(t,0,r.content.size),s=ze.create(r,i);e.setSelection(s)}return!0},IV=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=We.atStart(r).from,a=We.atEnd(r).to,l=co(i,o,a),u=co(s,o,a),c=We.create(r,l,u);e.setSelection(c)}return!0},RV=t=>({state:e,dispatch:n})=>{const r=zn(t,e.schema);return hH(r)(e,n)};function xT(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const LV=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,u=i.extensionManager.attributes,c=Lm(u,a.node().type.name,a.node().attrs);if(s instanceof ze&&s.node.isBlock)return!a.parentOffset||!pc(o,a.pos)?!1:(r&&(t&&xT(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,d=a.depth===0?void 0:vV(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=f&&d?[{type:d,attrs:c}]:void 0,p=pc(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&pc(e.doc,e.mapping.map(a.pos),1,d?[{type:d}]:void 0)&&(p=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(p&&(s instanceof We&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),d&&!f&&!a.parentOffset&&a.parent.type!==d)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&e.setNodeMarkup(e.mapping.map(a.before()),d)}t&&xT(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},BV=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var s;const o=zn(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const c=a.node(-1);if(c.type!==o)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let g=Ae.empty;const y=a.index(-1)?1:a.index(-2)?2:3;for(let O=a.depth-y;O>=a.depth-3;O-=1)g=Ae.from(a.node(O).copy(g));const v=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w=Lm(f,a.node().type.name,a.node().attrs),b=((s=o.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(w))||void 0;g=g.append(Ae.from(o.createAndFill(null,b)||void 0));const E=a.before(a.depth-(y-1));e.replace(E,a.after(-v),new Ce(g,4-y,0));let x=-1;e.doc.nodesBetween(E,e.doc.content.size,(O,S)=>{if(x>-1)return!1;O.isTextblock&&O.content.size===0&&(x=S+1)}),x>-1&&e.setSelection(We.near(e.doc.resolve(x))),e.scrollIntoView()}return!0}const d=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,h=Lm(f,c.type.name,c.attrs),p=Lm(f,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);const m=d?[{type:o,attrs:h},{type:d,attrs:p}]:[{type:o,attrs:h}];if(!pc(e.doc,a.pos,2))return!1;if(r){const{selection:g,storedMarks:y}=n,{splittableMarks:v}=i.extensionManager,w=y||g.$to.parentOffset&&g.$from.marks();if(e.split(a.pos,2,m).scrollIntoView(),!w||!r)return!0;const b=w.filter(E=>v.includes(E.type.name));e.ensureMarks(b)}return!0},Ev=(t,e)=>{const n=bv(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&ra(t.doc,n.pos)&&t.join(n.pos),!0},kv=(t,e)=>{const n=bv(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&ra(t.doc,r)&&t.join(r),!0};var FV=Object.freeze({__proto__:null,blur:OH,clearContent:_H,clearNodes:MH,command:NH,createParagraphNear:PH,cut:IH,deleteCurrentNode:RH,deleteNode:LH,deleteRange:BH,deleteSelection:FH,enter:UH,exitCode:jH,extendMarkRange:VH,first:zH,focus:$H,forEach:GH,insertContent:WH,insertContentAt:QH,joinBackward:XH,joinDown:YH,joinForward:ZH,joinItemBackward:eV,joinItemForward:tV,joinTextblockBackward:nV,joinTextblockForward:rV,joinUp:JH,keyboardShortcut:sV,lift:oV,liftEmptyBlock:aV,liftListItem:lV,newlineInCode:uV,resetAttributes:cV,scrollIntoView:fV,selectAll:dV,selectNodeBackward:hV,selectNodeForward:pV,selectParentNode:mV,selectTextblockEnd:gV,selectTextblockStart:yV,setContent:bV,setMark:_V,setMeta:MV,setNode:NV,setNodeSelection:PV,setTextSelection:IV,sinkListItem:RV,splitBlock:LV,splitListItem:BV,toggleList:(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,h=zn(t,o.schema),p=zn(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:v}=m,w=y.blockRange(v),b=g||m.$to.parentOffset&&m.$from.marks();if(!w)return!1;const E=bv(x=>vT(x.type.name,f))(m);if(w.depth>=1&&E&&w.depth-E.depth<=1){if(E.node.type===h)return u.liftListItem(p);if(vT(E.node.type.name,f)&&h.validContent(E.node.content)&&a)return l().command(()=>(s.setNodeMarkup(E.pos,h),!0)).command(()=>Ev(s,h)).command(()=>kv(s,h)).run()}return!n||!b||!a?l().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>Ev(s,h)).command(()=>kv(s,h)).run():l().command(()=>{const x=c().wrapInList(h,r),O=b.filter(S=>d.includes(S.type.name));return s.ensureMarks(O),x?!0:u.clearNodes()}).wrapInList(h,r).command(()=>Ev(s,h)).command(()=>kv(s,h)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=ha(t,r.schema);return Av(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const s=zn(t,r.schema),o=zn(e,r.schema);return bh(r,s,n)?i.setNode(o):i.setNode(s,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=zn(t,n.schema);return bh(n,i,e)?r.lift(i):r.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=ha(t,r.schema),{$from:u,empty:c,ranges:f}=a;if(!i)return!0;if(c&&o){let{from:d,to:h}=a;const p=(s=u.marks().find(g=>g.type===l))===null||s===void 0?void 0:s.attrs,m=mv(u,l,p);m&&(d=m.from,h=m.to),n.removeMark(d,h,l)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,l)});return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=Rm(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=zn(t,r.schema)),a==="mark"&&(o=ha(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const u=l.$from.pos,c=l.$to.pos;r.doc.nodesBetween(u,c,(f,d)=>{s&&s===f.type&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(h=>{if(o===h.type){const p=Math.max(d,u),m=Math.min(d+f.nodeSize,c);n.addMark(p,m,o.create({...h.attrs,...e}))}})})}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=zn(t,n.schema);return aH(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=zn(t,n.schema);return lH(i,e)(n,r)}});const ET=It.create({name:"commands",addCommands(){return{...FV}}}),kT=It.create({name:"editable",addProseMirrorPlugins(){return[new Ut({key:new en("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ST=It.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ut({key:new en("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),CT=It.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:f}=l,{pos:d,parent:h}=f,p=f.parent.isTextblock&&d>0?a.doc.resolve(d-1):f,m=p.parent.type.spec.isolating,g=f.pos-f.parentOffset,y=m&&p.parent.childCount===1?g===f.pos:Qe.atStart(u).from===d;return!c||!h.type.isTextblock||h.textContent.length||!y||y&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Pm()||yT()?s:i},addProseMirrorPlugins(){return[new Ut({key:new en("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(p=>p.docChanged)&&!e.doc.eq(n.doc)))return;const{empty:i,from:s,to:o}=e.selection,a=Qe.atStart(e.doc).from,l=Qe.atEnd(e.doc).to;if(i||!(s===a&&o===l)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,d=Sm({state:n,transaction:f}),{commands:h}=new Cm({editor:this.editor,state:d});if(h.clearNodes(),!!f.steps.length)return f}})]}}),DT=It.create({name:"tabindex",addProseMirrorPlugins(){return[new Ut({key:new en("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var UV=Object.freeze({__proto__:null,ClipboardTextSerializer:hT,Commands:ET,Editable:kT,FocusEvents:ST,Keymap:CT,Tabindex:DT});class Fl{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Fl(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Fl(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Fl(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=this.pos+r+1,o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const a=new Fl(o,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new Fl(o,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const n=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(n.from).run()}}const jV=`.ProseMirror {
43
- position: relative;
44
- }
45
-
46
- .ProseMirror {
47
- word-wrap: break-word;
48
- white-space: pre-wrap;
49
- white-space: break-spaces;
50
- -webkit-font-variant-ligatures: none;
51
- font-variant-ligatures: none;
52
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
53
- }
54
-
55
- .ProseMirror [contenteditable="false"] {
56
- white-space: normal;
57
- }
58
-
59
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
60
- white-space: pre-wrap;
61
- }
62
-
63
- .ProseMirror pre {
64
- white-space: pre-wrap;
65
- }
66
-
67
- img.ProseMirror-separator {
68
- display: inline !important;
69
- border: none !important;
70
- margin: 0 !important;
71
- width: 1px !important;
72
- height: 1px !important;
73
- }
74
-
75
- .ProseMirror-gapcursor {
76
- display: none;
77
- pointer-events: none;
78
- position: absolute;
79
- margin: 0;
80
- }
81
-
82
- .ProseMirror-gapcursor:after {
83
- content: "";
84
- display: block;
85
- position: absolute;
86
- top: -2px;
87
- width: 20px;
88
- border-top: 1px solid black;
89
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
90
- }
91
-
92
- @keyframes ProseMirror-cursor-blink {
93
- to {
94
- visibility: hidden;
95
- }
96
- }
97
-
98
- .ProseMirror-hideselection *::selection {
99
- background: transparent;
100
- }
101
-
102
- .ProseMirror-hideselection *::-moz-selection {
103
- background: transparent;
104
- }
105
-
106
- .ProseMirror-hideselection * {
107
- caret-color: transparent;
108
- }
109
-
110
- .ProseMirror-focused .ProseMirror-gapcursor {
111
- display: block;
112
- }
113
-
114
- .tippy-box[data-animation=fade][data-state=hidden] {
115
- opacity: 0
116
- }`;function HV(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let VV=class extends pH{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n}},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=HV(jV,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=aT(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[kT,hT.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),ET,ST,CT,DT]:[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Sc(i,this)}createCommandManager(){this.commandManager=new Cm({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=gv(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=gv(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=pT(e,this.options.autofocus);this.view=new Pj(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:bc.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return wT(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return DV(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return wv(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
117
-
118
- `,textSerializers:r={}}=e||{};return xV(this.state.doc,{blockSeparator:n,textSerializers:{...dT(this.schema),...r}})}get isEmpty(){return AT(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Fl(n,this)}get $doc(){return this.$pos(0)}};function Ul(t){return new yh({find:t.find,handler:({state:e,range:n,match:r})=>{const i=dt(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),u=n.from+a.indexOf(o),c=u+o.length;if(vv(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>u).length)return null;c<n.to&&s.delete(c,n.to),u>n.from&&s.delete(n.from+l,u);const d=n.from+l+o.length;s.addMark(n.from+l,d,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Sv(t){return new yh({find:t.find,handler:({state:e,range:n,match:r})=>{const i=dt(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>a?c=a:a=c+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(c,a,l)}else if(r[0]){const u=t.type.isInline?o:o-1;s.insert(u,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()}})}function Cv(t){return new yh({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=dt(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function mn(t){return new yh({find:t.find,handler:({state:e,range:n,match:r})=>{let i=t.replace,s=n.from;const o=n.to;if(r[1]){const a=r[0].lastIndexOf(r[1]);i+=r[0].slice(a+r[1].length),s+=a;const l=s-o;l>0&&(i=r[0].slice(a-l,a)+i,s=o)}e.tr.insertText(i,s,o)}})}function Cc(t){return new yh({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=dt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),u=l&&Tw(l,t.type,s);if(!u)return null;if(o.wrap(l,u),t.keepMarks&&t.editor){const{selection:f,storedMarks:d}=e,{splittableMarks:h}=t.editor.extensionManager,p=d||f.$to.parentOffset&&f.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&ra(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)}})}class In{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=dt(je(this,"addOptions",{name:this.name}))),this.storage=dt(je(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new In(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_m(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new In(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=dt(je(n,"addOptions",{name:n.name})),n.storage=dt(je(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const l=o.find(u=>(u==null?void 0:u.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let ot=class MC{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=dt(je(this,"addOptions",{name:this.name}))),this.storage=dt(je(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new MC(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>_m(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new MC(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=dt(je(n,"addOptions",{name:n.name})),n.storage=dt(je(n,"addStorage",{name:n.name,options:n.options})),n}};function zV(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}class $V{constructor(e,n,r){this.isDragging=!1,this.component=e,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var n,r,i,s,o,a,l;const{view:u}=this.editor,c=e.target,f=c.nodeType===3?(n=c.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(c)||!f)return;let d=0,h=0;if(this.dom!==f){const g=this.dom.getBoundingClientRect(),y=f.getBoundingClientRect(),v=(i=e.offsetX)!==null&&i!==void 0?i:(s=e.nativeEvent)===null||s===void 0?void 0:s.offsetX,w=(o=e.offsetY)!==null&&o!==void 0?o:(a=e.nativeEvent)===null||a===void 0?void 0:a.offsetY;d=y.x-g.x+v,h=y.y-g.y+w}(l=e.dataTransfer)===null||l===void 0||l.setDragImage(this.dom,d,h);const p=ze.create(u.state.doc,this.getPos()),m=u.state.tr.setSelection(p);u.dispatch(m)}stopEvent(e){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const r=e.target;if(!(this.dom.contains(r)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(r))))return!1;const s=e.type.startsWith("drag"),o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!o&&!s)return!0;const{isEditable:l}=this.editor,{isDragging:u}=this,c=!!this.node.type.spec.draggable,f=ze.isSelectable(this.node),d=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!c&&f&&s&&e.preventDefault(),c&&s&&!u)return e.preventDefault(),!1;if(c&&l&&!u&&m){const g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(u||o||d||h||p||m&&f)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(Pm()||zV())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:n})=>{const r=this.getPos();return n.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0})}deleteNode(){const e=this.getPos(),n=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:n})}}function pa(t){return new xH({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=dt(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let u=n.to;if(a){const c=l.search(/\S/),f=n.from+l.indexOf(a),d=f+a.length;if(vv(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>f).length)return null;d<n.to&&o.delete(d,n.to),f>n.from&&o.delete(n.from+c,f),u=n.from+c+a.length,o.addMark(n.from+c,u,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function GV(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Vr="top",ki="bottom",Si="right",zr="left",Dv="auto",vh=[Vr,ki,Si,zr],Dc="start",Ah="end",WV="clippingParents",TT="viewport",xh="popper",KV="reference",OT=vh.reduce(function(t,e){return t.concat([e+"-"+Dc,e+"-"+Ah])},[]),_T=[].concat(vh,[Dv]).reduce(function(t,e){return t.concat([e,e+"-"+Dc,e+"-"+Ah])},[]),qV="beforeRead",QV="read",JV="afterRead",YV="beforeMain",XV="main",ZV="afterMain",ez="beforeWrite",tz="write",nz="afterWrite",rz=[qV,QV,JV,YV,XV,ZV,ez,tz,nz];function Ss(t){return t?(t.nodeName||"").toLowerCase():null}function si(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function jl(t){var e=si(t).Element;return t instanceof e||t instanceof Element}function Ci(t){var e=si(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Tv(t){if(typeof ShadowRoot>"u")return!1;var e=si(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function iz(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Ci(s)||!Ss(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function sz(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,u){return l[u]="",l},{});!Ci(i)||!Ss(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const MT={name:"applyStyles",enabled:!0,phase:"write",fn:iz,effect:sz,requires:["computeStyles"]};function Cs(t){return t.split("-")[0]}var Hl=Math.max,Bm=Math.min,Tc=Math.round;function Ov(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function NT(){return!/^((?!chrome|android).)*safari/i.test(Ov())}function Oc(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Ci(t)&&(i=t.offsetWidth>0&&Tc(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Tc(r.height)/t.offsetHeight||1);var o=jl(t)?si(t):window,a=o.visualViewport,l=!NT()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/i,c=(r.top+(l&&a?a.offsetTop:0))/s,f=r.width/i,d=r.height/s;return{width:f,height:d,top:c,right:u+f,bottom:c+d,left:u,x:u,y:c}}function _v(t){var e=Oc(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function PT(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Tv(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fo(t){return si(t).getComputedStyle(t)}function oz(t){return["table","td","th"].indexOf(Ss(t))>=0}function ma(t){return((jl(t)?t.ownerDocument:t.document)||window.document).documentElement}function Fm(t){return Ss(t)==="html"?t:t.assignedSlot||t.parentNode||(Tv(t)?t.host:null)||ma(t)}function IT(t){return!Ci(t)||fo(t).position==="fixed"?null:t.offsetParent}function az(t){var e=/firefox/i.test(Ov()),n=/Trident/i.test(Ov());if(n&&Ci(t)){var r=fo(t);if(r.position==="fixed")return null}var i=Fm(t);for(Tv(i)&&(i=i.host);Ci(i)&&["html","body"].indexOf(Ss(i))<0;){var s=fo(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Eh(t){for(var e=si(t),n=IT(t);n&&oz(n)&&fo(n).position==="static";)n=IT(n);return n&&(Ss(n)==="html"||Ss(n)==="body"&&fo(n).position==="static")?e:n||az(t)||e}function Mv(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function kh(t,e,n){return Hl(t,Bm(e,n))}function lz(t,e,n){var r=kh(t,e,n);return r>n?n:r}function RT(){return{top:0,right:0,bottom:0,left:0}}function LT(t){return Object.assign({},RT(),t)}function BT(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var uz=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,LT(typeof e!="number"?e:BT(e,vh))};function cz(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=Cs(n.placement),l=Mv(a),u=[zr,Si].indexOf(a)>=0,c=u?"height":"width";if(!(!s||!o)){var f=uz(i.padding,n),d=_v(s),h=l==="y"?Vr:zr,p=l==="y"?ki:Si,m=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],g=o[l]-n.rects.reference[l],y=Eh(s),v=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,w=m/2-g/2,b=f[h],E=v-d[c]-f[p],x=v/2-d[c]/2+w,O=kh(b,x,E),S=l;n.modifiersData[r]=(e={},e[S]=O,e.centerOffset=O-x,e)}}function fz(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||PT(e.elements.popper,i)&&(e.elements.arrow=i))}const dz={name:"arrow",enabled:!0,phase:"main",fn:cz,effect:fz,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function _c(t){return t.split("-")[1]}var hz={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pz(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Tc(n*i)/i||0,y:Tc(r*i)/i||0}}function FT(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,f=t.isFixed,d=o.x,h=d===void 0?0:d,p=o.y,m=p===void 0?0:p,g=typeof c=="function"?c({x:h,y:m}):{x:h,y:m};h=g.x,m=g.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),w=zr,b=Vr,E=window;if(u){var x=Eh(n),O="clientHeight",S="clientWidth";if(x===si(n)&&(x=ma(n),fo(x).position!=="static"&&a==="absolute"&&(O="scrollHeight",S="scrollWidth")),x=x,i===Vr||(i===zr||i===Si)&&s===Ah){b=ki;var D=f&&x===E&&E.visualViewport?E.visualViewport.height:x[O];m-=D-r.height,m*=l?1:-1}if(i===zr||(i===Vr||i===ki)&&s===Ah){w=Si;var I=f&&x===E&&E.visualViewport?E.visualViewport.width:x[S];h-=I-r.width,h*=l?1:-1}}var F=Object.assign({position:a},u&&hz),Q=c===!0?pz({x:h,y:m},si(n)):{x:h,y:m};if(h=Q.x,m=Q.y,l){var V;return Object.assign({},F,(V={},V[b]=v?"0":"",V[w]=y?"0":"",V.transform=(E.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",V))}return Object.assign({},F,(e={},e[b]=v?m+"px":"",e[w]=y?h+"px":"",e.transform="",e))}function mz(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Cs(e.placement),variation:_c(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,FT(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,FT(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const gz={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:mz,data:{}};var Um={passive:!0};function yz(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=si(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&u.forEach(function(c){c.addEventListener("scroll",n.update,Um)}),a&&l.addEventListener("resize",n.update,Um),function(){s&&u.forEach(function(c){c.removeEventListener("scroll",n.update,Um)}),a&&l.removeEventListener("resize",n.update,Um)}}const bz={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:yz,data:{}};var wz={left:"right",right:"left",bottom:"top",top:"bottom"};function jm(t){return t.replace(/left|right|bottom|top/g,function(e){return wz[e]})}var vz={start:"end",end:"start"};function UT(t){return t.replace(/start|end/g,function(e){return vz[e]})}function Nv(t){var e=si(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Pv(t){return Oc(ma(t)).left+Nv(t).scrollLeft}function Az(t,e){var n=si(t),r=ma(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var u=NT();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Pv(t),y:l}}function xz(t){var e,n=ma(t),r=Nv(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=Hl(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=Hl(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Pv(t),l=-r.scrollTop;return fo(i||n).direction==="rtl"&&(a+=Hl(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function Iv(t){var e=fo(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function jT(t){return["html","body","#document"].indexOf(Ss(t))>=0?t.ownerDocument.body:Ci(t)&&Iv(t)?t:jT(Fm(t))}function Sh(t,e){var n;e===void 0&&(e=[]);var r=jT(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=si(r),o=i?[s].concat(s.visualViewport||[],Iv(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(Sh(Fm(o)))}function Rv(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Ez(t,e){var n=Oc(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function HT(t,e,n){return e===TT?Rv(Az(t,n)):jl(e)?Ez(e,n):Rv(xz(ma(t)))}function kz(t){var e=Sh(Fm(t)),n=["absolute","fixed"].indexOf(fo(t).position)>=0,r=n&&Ci(t)?Eh(t):t;return jl(r)?e.filter(function(i){return jl(i)&&PT(i,r)&&Ss(i)!=="body"}):[]}function Sz(t,e,n,r){var i=e==="clippingParents"?kz(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,u){var c=HT(t,u,r);return l.top=Hl(c.top,l.top),l.right=Bm(c.right,l.right),l.bottom=Bm(c.bottom,l.bottom),l.left=Hl(c.left,l.left),l},HT(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function VT(t){var e=t.reference,n=t.element,r=t.placement,i=r?Cs(r):null,s=r?_c(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case Vr:l={x:o,y:e.y-n.height};break;case ki:l={x:o,y:e.y+e.height};break;case Si:l={x:e.x+e.width,y:a};break;case zr:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=i?Mv(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(s){case Dc:l[u]=l[u]-(e[c]/2-n[c]/2);break;case Ah:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function Ch(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?WV:a,u=n.rootBoundary,c=u===void 0?TT:u,f=n.elementContext,d=f===void 0?xh:f,h=n.altBoundary,p=h===void 0?!1:h,m=n.padding,g=m===void 0?0:m,y=LT(typeof g!="number"?g:BT(g,vh)),v=d===xh?KV:xh,w=t.rects.popper,b=t.elements[p?v:d],E=Sz(jl(b)?b:b.contextElement||ma(t.elements.popper),l,c,o),x=Oc(t.elements.reference),O=VT({reference:x,element:w,strategy:"absolute",placement:i}),S=Rv(Object.assign({},w,O)),D=d===xh?S:x,I={top:E.top-D.top+y.top,bottom:D.bottom-E.bottom+y.bottom,left:E.left-D.left+y.left,right:D.right-E.right+y.right},F=t.modifiersData.offset;if(d===xh&&F){var Q=F[i];Object.keys(I).forEach(function(V){var B=[Si,ki].indexOf(V)>=0?1:-1,N=[Vr,ki].indexOf(V)>=0?"y":"x";I[V]+=Q[N]*B})}return I}function Cz(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?_T:l,c=_c(r),f=c?a?OT:OT.filter(function(p){return _c(p)===c}):vh,d=f.filter(function(p){return u.indexOf(p)>=0});d.length===0&&(d=f);var h=d.reduce(function(p,m){return p[m]=Ch(t,{placement:m,boundary:i,rootBoundary:s,padding:o})[Cs(m)],p},{});return Object.keys(h).sort(function(p,m){return h[p]-h[m]})}function Dz(t){if(Cs(t)===Dv)return[];var e=jm(t);return[UT(t),e,UT(e)]}function Tz(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,u=n.padding,c=n.boundary,f=n.rootBoundary,d=n.altBoundary,h=n.flipVariations,p=h===void 0?!0:h,m=n.allowedAutoPlacements,g=e.options.placement,y=Cs(g),v=y===g,w=l||(v||!p?[jm(g)]:Dz(g)),b=[g].concat(w).reduce(function(Ie,ke){return Ie.concat(Cs(ke)===Dv?Cz(e,{placement:ke,boundary:c,rootBoundary:f,padding:u,flipVariations:p,allowedAutoPlacements:m}):ke)},[]),E=e.rects.reference,x=e.rects.popper,O=new Map,S=!0,D=b[0],I=0;I<b.length;I++){var F=b[I],Q=Cs(F),V=_c(F)===Dc,B=[Vr,ki].indexOf(Q)>=0,N=B?"width":"height",H=Ch(e,{placement:F,boundary:c,rootBoundary:f,altBoundary:d,padding:u}),K=B?V?Si:zr:V?ki:Vr;E[N]>x[N]&&(K=jm(K));var J=jm(K),X=[];if(s&&X.push(H[Q]<=0),a&&X.push(H[K]<=0,H[J]<=0),X.every(function(Ie){return Ie})){D=F,S=!1;break}O.set(F,X)}if(S)for(var ie=p?3:1,le=function(ke){var $=b.find(function(ne){var G=O.get(ne);if(G)return G.slice(0,ke).every(function(Z){return Z})});if($)return D=$,"break"},Pe=ie;Pe>0;Pe--){var xe=le(Pe);if(xe==="break")break}e.placement!==D&&(e.modifiersData[r]._skip=!0,e.placement=D,e.reset=!0)}}const Oz={name:"flip",enabled:!0,phase:"main",fn:Tz,requiresIfExists:["offset"],data:{_skip:!1}};function zT(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function $T(t){return[Vr,Si,ki,zr].some(function(e){return t[e]>=0})}function _z(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ch(e,{elementContext:"reference"}),a=Ch(e,{altBoundary:!0}),l=zT(o,r),u=zT(a,i,s),c=$T(l),f=$T(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":f})}const Mz={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_z};function Nz(t,e,n){var r=Cs(t),i=[zr,Vr].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[zr,Si].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Pz(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=_T.reduce(function(c,f){return c[f]=Nz(f,e.rects,s),c},{}),a=o[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=o}const Iz={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Pz};function Rz(t){var e=t.state,n=t.name;e.modifiersData[n]=VT({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Lz={name:"popperOffsets",enabled:!0,phase:"read",fn:Rz,data:{}};function Bz(t){return t==="x"?"y":"x"}function Fz(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,f=n.padding,d=n.tether,h=d===void 0?!0:d,p=n.tetherOffset,m=p===void 0?0:p,g=Ch(e,{boundary:l,rootBoundary:u,padding:f,altBoundary:c}),y=Cs(e.placement),v=_c(e.placement),w=!v,b=Mv(y),E=Bz(b),x=e.modifiersData.popperOffsets,O=e.rects.reference,S=e.rects.popper,D=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,I=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),F=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Q={x:0,y:0};if(x){if(s){var V,B=b==="y"?Vr:zr,N=b==="y"?ki:Si,H=b==="y"?"height":"width",K=x[b],J=K+g[B],X=K-g[N],ie=h?-S[H]/2:0,le=v===Dc?O[H]:S[H],Pe=v===Dc?-S[H]:-O[H],xe=e.elements.arrow,Ie=h&&xe?_v(xe):{width:0,height:0},ke=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:RT(),$=ke[B],ne=ke[N],G=kh(0,O[H],Ie[H]),Z=w?O[H]/2-ie-G-$-I.mainAxis:le-G-$-I.mainAxis,A=w?-O[H]/2+ie+G+ne+I.mainAxis:Pe+G+ne+I.mainAxis,P=e.elements.arrow&&Eh(e.elements.arrow),ue=P?b==="y"?P.clientTop||0:P.clientLeft||0:0,de=(V=F==null?void 0:F[b])!=null?V:0,oe=K+Z-de-ue,we=K+A-de,De=kh(h?Bm(J,oe):J,K,h?Hl(X,we):X);x[b]=De,Q[b]=De-K}if(a){var pe,Ke=b==="x"?Vr:zr,qe=b==="x"?ki:Si,tt=x[E],lt=E==="y"?"height":"width",ft=tt+g[Ke],Ze=tt-g[qe],Se=[Vr,zr].indexOf(y)!==-1,Ue=(pe=F==null?void 0:F[E])!=null?pe:0,C=Se?ft:tt-O[lt]-S[lt]-Ue+I.altAxis,M=Se?tt+O[lt]+S[lt]-Ue-I.altAxis:Ze,R=h&&Se?lz(C,tt,M):kh(h?C:ft,tt,h?M:Ze);x[E]=R,Q[E]=R-tt}e.modifiersData[r]=Q}}const Uz={name:"preventOverflow",enabled:!0,phase:"main",fn:Fz,requiresIfExists:["offset"]};function jz(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Hz(t){return t===si(t)||!Ci(t)?Nv(t):jz(t)}function Vz(t){var e=t.getBoundingClientRect(),n=Tc(e.width)/t.offsetWidth||1,r=Tc(e.height)/t.offsetHeight||1;return n!==1||r!==1}function zz(t,e,n){n===void 0&&(n=!1);var r=Ci(e),i=Ci(e)&&Vz(e),s=ma(e),o=Oc(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Ss(e)!=="body"||Iv(s))&&(a=Hz(e)),Ci(e)?(l=Oc(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Pv(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function $z(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function Gz(t){var e=$z(t);return rz.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function Wz(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Kz(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var GT={placement:"bottom",modifiers:[],strategy:"absolute"};function WT(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function qz(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,s=i===void 0?GT:i;return function(a,l,u){u===void 0&&(u=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},GT,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],d=!1,h={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;m(),c.options=Object.assign({},s,c.options,v),c.scrollParents={reference:jl(a)?Sh(a):a.contextElement?Sh(a.contextElement):[],popper:Sh(l)};var w=Gz(Kz([].concat(r,c.options.modifiers)));return c.orderedModifiers=w.filter(function(b){return b.enabled}),p(),h.update()},forceUpdate:function(){if(!d){var y=c.elements,v=y.reference,w=y.popper;if(WT(v,w)){c.rects={reference:zz(v,Eh(w),c.options.strategy==="fixed"),popper:_v(w)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(I){return c.modifiersData[I.name]=Object.assign({},I.data)});for(var b=0;b<c.orderedModifiers.length;b++){if(c.reset===!0){c.reset=!1,b=-1;continue}var E=c.orderedModifiers[b],x=E.fn,O=E.options,S=O===void 0?{}:O,D=E.name;typeof x=="function"&&(c=x({state:c,options:S,name:D,instance:h})||c)}}}},update:Wz(function(){return new Promise(function(g){h.forceUpdate(),g(c)})}),destroy:function(){m(),d=!0}};if(!WT(a,l))return h;h.setOptions(u).then(function(g){!d&&u.onFirstUpdate&&u.onFirstUpdate(g)});function p(){c.orderedModifiers.forEach(function(g){var y=g.name,v=g.options,w=v===void 0?{}:v,b=g.effect;if(typeof b=="function"){var E=b({state:c,name:y,instance:h,options:w}),x=function(){};f.push(E||x)}})}function m(){f.forEach(function(g){return g()}),f=[]}return h}}var Qz=[bz,Lz,gz,MT,Iz,Oz,Uz,dz,Mz],Jz=qz({defaultModifiers:Qz}),Yz="tippy-box",KT="tippy-content",Xz="tippy-backdrop",qT="tippy-arrow",QT="tippy-svg-arrow",Vl={passive:!0,capture:!0},JT=function(){return document.body};function Zz(t,e){return{}.hasOwnProperty.call(t,e)}function Lv(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Bv(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function YT(t,e){return typeof t=="function"?t.apply(void 0,e):t}function XT(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function e$(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function t$(t){return t.split(/\s+/).filter(Boolean)}function Mc(t){return[].concat(t)}function ZT(t,e){t.indexOf(e)===-1&&t.push(e)}function n$(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function r$(t){return t.split("-")[0]}function Hm(t){return[].slice.call(t)}function eO(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Dh(){return document.createElement("div")}function Th(t){return["Element","Fragment"].some(function(e){return Bv(t,e)})}function i$(t){return Bv(t,"NodeList")}function s$(t){return Bv(t,"MouseEvent")}function o$(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function a$(t){return Th(t)?[t]:i$(t)?Hm(t):Array.isArray(t)?t:Hm(document.querySelectorAll(t))}function Fv(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function tO(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function l$(t){var e,n=Mc(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function u$(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,u=r$(o.placement),c=o.modifiersData.offset;if(!c)return!0;var f=u==="bottom"?c.top.y:0,d=u==="top"?c.bottom.y:0,h=u==="right"?c.left.x:0,p=u==="left"?c.right.x:0,m=s.top-r+f>l,g=r-s.bottom-d>l,y=s.left-n+h>l,v=n-s.right-p>l;return m||g||y||v})}function Uv(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function nO(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Ds={isTouch:!1},rO=0;function c$(){Ds.isTouch||(Ds.isTouch=!0,window.performance&&document.addEventListener("mousemove",iO))}function iO(){var t=performance.now();t-rO<20&&(Ds.isTouch=!1,document.removeEventListener("mousemove",iO)),rO=t}function f$(){var t=document.activeElement;if(o$(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function d$(){document.addEventListener("touchstart",c$,Vl),window.addEventListener("blur",f$)}var h$=typeof window<"u"&&typeof document<"u",p$=h$?!!window.msCrypto:!1;function Nc(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function sO(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function m$(t){return sO(`
119
- %ctippy.js
120
-
121
- %c`+sO(t)+`
122
-
123
- %c👷‍ This is a development-only message. It will be removed in production.
124
- `)}function oO(t){return[m$(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Oh;process.env.NODE_ENV!=="production"&&g$();function g$(){Oh=new Set}function ho(t,e){if(t&&!Oh.has(e)){var n;Oh.add(e),(n=console).warn.apply(n,oO(e))}}function jv(t,e){if(t&&!Oh.has(e)){var n;Oh.add(e),(n=console).error.apply(n,oO(e))}}function y$(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;jv(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),jv(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var aO={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},b$={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},oi=Object.assign({appendTo:JT,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},aO,b$),w$=Object.keys(oi),v$=function(e){process.env.NODE_ENV!=="production"&&cO(e,[]);var n=Object.keys(e);n.forEach(function(r){oi[r]=e[r]})};function lO(t){var e=t.plugins||[],n=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=oi[s])!=null?a:o}return r},{});return Object.assign({},t,n)}function A$(t,e){var n=e?Object.keys(lO(Object.assign({},oi,{plugins:e}))):w$,r=n.reduce(function(i,s){var o=(t.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function uO(t,e){var n=Object.assign({},e,{content:YT(e.content,[t])},e.ignoreAttributes?{}:A$(t,e.plugins));return n.aria=Object.assign({},oi.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function cO(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=e$(oi,Object.keys(aO)),s=!Zz(i,r);s&&(s=e.filter(function(o){return o.name===r}).length===0),ho(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
125
-
126
- `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
127
- `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var x$=function(){return"innerHTML"};function Hv(t,e){t[x$()]=e}function fO(t){var e=Dh();return t===!0?e.className=qT:(e.className=QT,Th(t)?e.appendChild(t):Hv(e,t)),e}function dO(t,e){Th(e.content)?(Hv(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Hv(t,e.content):t.textContent=e.content)}function Vv(t){var e=t.firstElementChild,n=Hm(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(KT)}),arrow:n.find(function(r){return r.classList.contains(qT)||r.classList.contains(QT)}),backdrop:n.find(function(r){return r.classList.contains(Xz)})}}function hO(t){var e=Dh(),n=Dh();n.className=Yz,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Dh();r.className=KT,r.setAttribute("data-state","hidden"),dO(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Vv(e),l=a.box,u=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&dO(u,t.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(fO(o.arrow))):l.appendChild(fO(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}hO.$$tippy=!0;var E$=1,Vm=[],zv=[];function k$(t,e){var n=uO(t,Object.assign({},oi,lO(eO(e)))),r,i,s,o=!1,a=!1,l=!1,u=!1,c,f,d,h=[],p=XT(oe,n.interactiveDebounce),m,g=E$++,y=null,v=n$(n.plugins),w={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:t,popper:Dh(),popperInstance:y,props:n,state:w,plugins:v,clearDelayTimeouts:C,setProps:M,setContent:R,show:z,hide:se,hideWithInteractivity:te,enable:Se,disable:Ue,unmount:fe,destroy:he};if(!n.render)return process.env.NODE_ENV!=="production"&&jv(!0,"render() function has not been supplied."),b;var E=n.render(b),x=E.popper,O=E.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,t._tippy=b,x._tippy=b;var S=v.map(function(U){return U.fn(b)}),D=t.hasAttribute("aria-expanded");return P(),ie(),K(),J("onCreate",[b]),n.showOnCreate&&ft(),x.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&B().addEventListener("mousemove",p)}),b;function I(){var U=b.props.touch;return Array.isArray(U)?U:[U,0]}function F(){return I()[0]==="hold"}function Q(){var U;return!!((U=b.props.render)!=null&&U.$$tippy)}function V(){return m||t}function B(){var U=V().parentNode;return U?l$(U):document}function N(){return Vv(x)}function H(U){return b.state.isMounted&&!b.state.isVisible||Ds.isTouch||c&&c.type==="focus"?0:Lv(b.props.delay,U?0:1,oi.delay)}function K(U){U===void 0&&(U=!1),x.style.pointerEvents=b.props.interactive&&!U?"":"none",x.style.zIndex=""+b.props.zIndex}function J(U,re,ce){if(ce===void 0&&(ce=!0),S.forEach(function(ge){ge[U]&&ge[U].apply(ge,re)}),ce){var ye;(ye=b.props)[U].apply(ye,re)}}function X(){var U=b.props.aria;if(U.content){var re="aria-"+U.content,ce=x.id,ye=Mc(b.props.triggerTarget||t);ye.forEach(function(ge){var Le=ge.getAttribute(re);if(b.state.isVisible)ge.setAttribute(re,Le?Le+" "+ce:ce);else{var Ve=Le&&Le.replace(ce,"").trim();Ve?ge.setAttribute(re,Ve):ge.removeAttribute(re)}})}}function ie(){if(!(D||!b.props.aria.expanded)){var U=Mc(b.props.triggerTarget||t);U.forEach(function(re){b.props.interactive?re.setAttribute("aria-expanded",b.state.isVisible&&re===V()?"true":"false"):re.removeAttribute("aria-expanded")})}}function le(){B().removeEventListener("mousemove",p),Vm=Vm.filter(function(U){return U!==p})}function Pe(U){if(!(Ds.isTouch&&(l||U.type==="mousedown"))){var re=U.composedPath&&U.composedPath()[0]||U.target;if(!(b.props.interactive&&nO(x,re))){if(Mc(b.props.triggerTarget||t).some(function(ce){return nO(ce,re)})){if(Ds.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else J("onClickOutside",[b,U]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||$())}}}function xe(){l=!0}function Ie(){l=!1}function ke(){var U=B();U.addEventListener("mousedown",Pe,!0),U.addEventListener("touchend",Pe,Vl),U.addEventListener("touchstart",Ie,Vl),U.addEventListener("touchmove",xe,Vl)}function $(){var U=B();U.removeEventListener("mousedown",Pe,!0),U.removeEventListener("touchend",Pe,Vl),U.removeEventListener("touchstart",Ie,Vl),U.removeEventListener("touchmove",xe,Vl)}function ne(U,re){Z(U,function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&re()})}function G(U,re){Z(U,re)}function Z(U,re){var ce=N().box;function ye(ge){ge.target===ce&&(Uv(ce,"remove",ye),re())}if(U===0)return re();Uv(ce,"remove",f),Uv(ce,"add",ye),f=ye}function A(U,re,ce){ce===void 0&&(ce=!1);var ye=Mc(b.props.triggerTarget||t);ye.forEach(function(ge){ge.addEventListener(U,re,ce),h.push({node:ge,eventType:U,handler:re,options:ce})})}function P(){F()&&(A("touchstart",de,{passive:!0}),A("touchend",we,{passive:!0})),t$(b.props.trigger).forEach(function(U){if(U!=="manual")switch(A(U,de),U){case"mouseenter":A("mouseleave",we);break;case"focus":A(p$?"focusout":"blur",De);break;case"focusin":A("focusout",De);break}})}function ue(){h.forEach(function(U){var re=U.node,ce=U.eventType,ye=U.handler,ge=U.options;re.removeEventListener(ce,ye,ge)}),h=[]}function de(U){var re,ce=!1;if(!(!b.state.isEnabled||pe(U)||a)){var ye=((re=c)==null?void 0:re.type)==="focus";c=U,m=U.currentTarget,ie(),!b.state.isVisible&&s$(U)&&Vm.forEach(function(ge){return ge(U)}),U.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?ce=!0:ft(U),U.type==="click"&&(o=!ce),ce&&!ye&&Ze(U)}}function oe(U){var re=U.target,ce=V().contains(re)||x.contains(re);if(!(U.type==="mousemove"&&ce)){var ye=lt().concat(x).map(function(ge){var Le,Ve=ge._tippy,pt=(Le=Ve.popperInstance)==null?void 0:Le.state;return pt?{popperRect:ge.getBoundingClientRect(),popperState:pt,props:n}:null}).filter(Boolean);u$(ye,U)&&(le(),Ze(U))}}function we(U){var re=pe(U)||b.props.trigger.indexOf("click")>=0&&o;if(!re){if(b.props.interactive){b.hideWithInteractivity(U);return}Ze(U)}}function De(U){b.props.trigger.indexOf("focusin")<0&&U.target!==V()||b.props.interactive&&U.relatedTarget&&x.contains(U.relatedTarget)||Ze(U)}function pe(U){return Ds.isTouch?F()!==U.type.indexOf("touch")>=0:!1}function Ke(){qe();var U=b.props,re=U.popperOptions,ce=U.placement,ye=U.offset,ge=U.getReferenceClientRect,Le=U.moveTransition,Ve=Q()?Vv(x).arrow:null,pt=ge?{getBoundingClientRect:ge,contextElement:ge.contextElement||V()}:t,nt={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ct){var kt=Ct.state;if(Q()){var Jt=N(),Yt=Jt.box;["placement","reference-hidden","escaped"].forEach(function(Xt){Xt==="placement"?Yt.setAttribute("data-placement",kt.placement):kt.attributes.popper["data-popper-"+Xt]?Yt.setAttribute("data-"+Xt,""):Yt.removeAttribute("data-"+Xt)}),kt.attributes.popper={}}}},et=[{name:"offset",options:{offset:ye}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Le}},nt];Q()&&Ve&&et.push({name:"arrow",options:{element:Ve,padding:3}}),et.push.apply(et,(re==null?void 0:re.modifiers)||[]),b.popperInstance=Jz(pt,x,Object.assign({},re,{placement:ce,onFirstUpdate:d,modifiers:et}))}function qe(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function tt(){var U=b.props.appendTo,re,ce=V();b.props.interactive&&U===JT||U==="parent"?re=ce.parentNode:re=YT(U,[ce]),re.contains(x)||re.appendChild(x),b.state.isMounted=!0,Ke(),process.env.NODE_ENV!=="production"&&ho(b.props.interactive&&U===oi.appendTo&&ce.nextElementSibling!==x,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
128
-
129
- `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
130
-
131
- `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
132
-
133
- `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function lt(){return Hm(x.querySelectorAll("[data-tippy-root]"))}function ft(U){b.clearDelayTimeouts(),U&&J("onTrigger",[b,U]),ke();var re=H(!0),ce=I(),ye=ce[0],ge=ce[1];Ds.isTouch&&ye==="hold"&&ge&&(re=ge),re?r=setTimeout(function(){b.show()},re):b.show()}function Ze(U){if(b.clearDelayTimeouts(),J("onUntrigger",[b,U]),!b.state.isVisible){$();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(U.type)>=0&&o)){var re=H(!1);re?i=setTimeout(function(){b.state.isVisible&&b.hide()},re):s=requestAnimationFrame(function(){b.hide()})}}function Se(){b.state.isEnabled=!0}function Ue(){b.hide(),b.state.isEnabled=!1}function C(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function M(U){if(process.env.NODE_ENV!=="production"&&ho(b.state.isDestroyed,Nc("setProps")),!b.state.isDestroyed){J("onBeforeUpdate",[b,U]),ue();var re=b.props,ce=uO(t,Object.assign({},re,eO(U),{ignoreAttributes:!0}));b.props=ce,P(),re.interactiveDebounce!==ce.interactiveDebounce&&(le(),p=XT(oe,ce.interactiveDebounce)),re.triggerTarget&&!ce.triggerTarget?Mc(re.triggerTarget).forEach(function(ye){ye.removeAttribute("aria-expanded")}):ce.triggerTarget&&t.removeAttribute("aria-expanded"),ie(),K(),O&&O(re,ce),b.popperInstance&&(Ke(),lt().forEach(function(ye){requestAnimationFrame(ye._tippy.popperInstance.forceUpdate)})),J("onAfterUpdate",[b,U])}}function R(U){b.setProps({content:U})}function z(){process.env.NODE_ENV!=="production"&&ho(b.state.isDestroyed,Nc("show"));var U=b.state.isVisible,re=b.state.isDestroyed,ce=!b.state.isEnabled,ye=Ds.isTouch&&!b.props.touch,ge=Lv(b.props.duration,0,oi.duration);if(!(U||re||ce||ye)&&!V().hasAttribute("disabled")&&(J("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,Q()&&(x.style.visibility="visible"),K(),ke(),b.state.isMounted||(x.style.transition="none"),Q()){var Le=N(),Ve=Le.box,pt=Le.content;Fv([Ve,pt],0)}d=function(){var et;if(!(!b.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,Q()&&b.props.animation){var Lt=N(),Ct=Lt.box,kt=Lt.content;Fv([Ct,kt],ge),tO([Ct,kt],"visible")}X(),ie(),ZT(zv,b),(et=b.popperInstance)==null||et.forceUpdate(),J("onMount",[b]),b.props.animation&&Q()&&G(ge,function(){b.state.isShown=!0,J("onShown",[b])})}},tt()}}function se(){process.env.NODE_ENV!=="production"&&ho(b.state.isDestroyed,Nc("hide"));var U=!b.state.isVisible,re=b.state.isDestroyed,ce=!b.state.isEnabled,ye=Lv(b.props.duration,1,oi.duration);if(!(U||re||ce)&&(J("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,Q()&&(x.style.visibility="hidden"),le(),$(),K(!0),Q()){var ge=N(),Le=ge.box,Ve=ge.content;b.props.animation&&(Fv([Le,Ve],ye),tO([Le,Ve],"hidden"))}X(),ie(),b.props.animation?Q()&&ne(ye,b.unmount):b.unmount()}}function te(U){process.env.NODE_ENV!=="production"&&ho(b.state.isDestroyed,Nc("hideWithInteractivity")),B().addEventListener("mousemove",p),ZT(Vm,p),p(U)}function fe(){process.env.NODE_ENV!=="production"&&ho(b.state.isDestroyed,Nc("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(qe(),lt().forEach(function(U){U._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),zv=zv.filter(function(U){return U!==b}),b.state.isMounted=!1,J("onHidden",[b]))}function he(){process.env.NODE_ENV!=="production"&&ho(b.state.isDestroyed,Nc("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),ue(),delete t._tippy,b.state.isDestroyed=!0,J("onDestroy",[b]))}}function zl(t,e){e===void 0&&(e={});var n=oi.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(y$(t),cO(e,n)),d$();var r=Object.assign({},e,{plugins:n}),i=a$(t);if(process.env.NODE_ENV!=="production"){var s=Th(r.content),o=i.length>1;ho(s&&o,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
134
-
135
- `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
136
-
137
- `,`1) content: element.innerHTML
138
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,u){var c=u&&k$(u,r);return c&&l.push(c),l},[]);return Th(t)?a[0]:a}zl.defaultProps=oi,zl.setDefaultProps=v$,zl.currentInput=Ds,Object.assign({},MT,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});var S$={name:"sticky",defaultValue:!1,fn:function(e){var n=e.reference,r=e.popper;function i(){return e.popperInstance?e.popperInstance.state.elements.reference:n}function s(u){return e.props.sticky===!0||e.props.sticky===u}var o=null,a=null;function l(){var u=s("reference")?i().getBoundingClientRect():null,c=s("popper")?r.getBoundingClientRect():null;(u&&pO(o,u)||c&&pO(a,c))&&e.popperInstance&&e.popperInstance.update(),o=u,a=c,e.state.isMounted&&requestAnimationFrame(l)}return{onMount:function(){e.props.sticky&&l()}}}};function pO(t,e){return t&&e?t.top!==e.top||t.right!==e.right||t.bottom!==e.bottom||t.left!==e.left:!0}zl.setDefaultProps({render:hO});class C${constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:s=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:u,to:c})=>{const{doc:f,selection:d}=l,{empty:h}=d,p=!f.textBetween(u,c).length&&Nm(l.selection),m=this.element.contains(document.activeElement);return!(!(a.hasFocus()||m)||h||p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const u=!(l!=null&&l.selection.eq(a.state.selection)),c=!(l!=null&&l.doc.eq(a.state.doc));!u&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,u,c,l)},this.updateDelay))},this.updateHandler=(a,l,u,c)=>{var f,d,h;const{state:p,composing:m}=a,{selection:g}=p;if(m||!l&&!u)return;this.createTooltip();const{ranges:v}=g,w=Math.min(...v.map(x=>x.$from.pos)),b=Math.max(...v.map(x=>x.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:a,state:p,oldState:c,from:w,to:b}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(xv(p.selection)){let x=a.nodeDOM(w);const O=x.dataset.nodeViewWrapper?x:x.querySelector("[data-node-view-wrapper]");if(O&&(x=O.firstChild),x)return x.getBoundingClientRect()}return TV(a,w,b)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=zl(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const s=!(n!=null&&n.selection.eq(e.state.selection)),o=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,s,o,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const mO=t=>new Ut({key:typeof t.pluginKey=="string"?new en(t.pluginKey):t.pluginKey,view:e=>new C$({view:e,...t})});It.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[mO({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});const D$=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},T$=({renderers:t})=>_.createElement(_.Fragment,null,Object.entries(t).map(([e,n])=>Zt.createPortal(n.reactElement,n.element,e)));class O$ extends _.Component{constructor(e){super(e),this.editorContentRef=_.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?Zt.flushSync(e):e()}setRenderer(e,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:n}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{const r={...n};return delete r[e],{renderers:r}})})}componentWillUnmount(){const{editor:e}=this.props;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...r}=this.props;return _.createElement(_.Fragment,null,_.createElement("div",{ref:D$(n,this.editorContentRef),...r}),_.createElement(T$,{renderers:this.state.renderers}))}}const _$=_.forwardRef((t,e)=>{const n=_.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return _.createElement(O$,{key:n,innerRef:e,...t})}),M$=_.memo(_$);class zm extends VV{constructor(){super(...arguments),this.contentComponent=null}}var $v={exports:{}},Gv={},$m={exports:{}},Wv={};/**
139
- * @license React
140
- * use-sync-external-store-shim.production.min.js
141
- *
142
- * Copyright (c) Facebook, Inc. and its affiliates.
143
- *
144
- * This source code is licensed under the MIT license found in the
145
- * LICENSE file in the root directory of this source tree.
146
- */var gO;function N$(){if(gO)return Wv;gO=1;var t=_;function e(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,d){var h=d(),p=r({inst:{value:h,getSnapshot:d}}),m=p[0].inst,g=p[1];return s(function(){m.value=h,m.getSnapshot=d,l(m)&&g({inst:m})},[f,h,d]),i(function(){return l(m)&&g({inst:m}),f(function(){l(m)&&g({inst:m})})},[f]),o(h),h}function l(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function u(f,d){return d()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Wv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:c,Wv}var Kv={};/**
147
- * @license React
148
- * use-sync-external-store-shim.development.js
149
- *
150
- * Copyright (c) Facebook, Inc. and its affiliates.
151
- *
152
- * This source code is licensed under the MIT license found in the
153
- * LICENSE file in the root directory of this source tree.
154
- */var yO;function P$(){return yO||(yO=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=_,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(w){{for(var b=arguments.length,E=new Array(b>1?b-1:0),x=1;x<b;x++)E[x-1]=arguments[x];r("error",w,E)}}function r(w,b,E){{var x=e.ReactDebugCurrentFrame,O=x.getStackAddendum();O!==""&&(b+="%s",E=E.concat([O]));var S=E.map(function(D){return String(D)});S.unshift("Warning: "+b),Function.prototype.apply.call(console[w],console,S)}}function i(w,b){return w===b&&(w!==0||1/w===1/b)||w!==w&&b!==b}var s=typeof Object.is=="function"?Object.is:i,o=t.useState,a=t.useEffect,l=t.useLayoutEffect,u=t.useDebugValue,c=!1,f=!1;function d(w,b,E){c||t.startTransition!==void 0&&(c=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var x=b();if(!f){var O=b();s(x,O)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var S=o({inst:{value:x,getSnapshot:b}}),D=S[0].inst,I=S[1];return l(function(){D.value=x,D.getSnapshot=b,h(D)&&I({inst:D})},[w,x,b]),a(function(){h(D)&&I({inst:D});var F=function(){h(D)&&I({inst:D})};return w(F)},[w]),u(x),x}function h(w){var b=w.getSnapshot,E=w.value;try{var x=b();return!s(E,x)}catch{return!0}}function p(w,b,E){return b()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,y=g?p:d,v=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y;Kv.useSyncExternalStore=v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Kv}var bO;function wO(){return bO||(bO=1,process.env.NODE_ENV==="production"?$m.exports=N$():$m.exports=P$()),$m.exports}/**
155
- * @license React
156
- * use-sync-external-store-shim/with-selector.production.min.js
157
- *
158
- * Copyright (c) Facebook, Inc. and its affiliates.
159
- *
160
- * This source code is licensed under the MIT license found in the
161
- * LICENSE file in the root directory of this source tree.
162
- */var vO;function I$(){if(vO)return Gv;vO=1;var t=_,e=wO();function n(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Gv.useSyncExternalStoreWithSelector=function(u,c,f,d,h){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(x){if(!v){if(v=!0,w=x,x=d(x),h!==void 0&&m.hasValue){var O=m.value;if(h(O,x))return b=O}return b=x}if(O=b,r(w,x))return O;var S=d(x);return h!==void 0&&h(O,S)?O:(w=x,b=S)}var v=!1,w,b,E=f===void 0?null:f;return[function(){return y(c())},E===null?void 0:function(){return y(E())}]},[c,f,d,h]);var g=i(u,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},Gv}var qv={};/**
163
- * @license React
164
- * use-sync-external-store-shim/with-selector.development.js
165
- *
166
- * Copyright (c) Facebook, Inc. and its affiliates.
167
- *
168
- * This source code is licensed under the MIT license found in the
169
- * LICENSE file in the root directory of this source tree.
170
- */var AO;function R$(){return AO||(AO=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=_,e=wO();function n(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;function u(c,f,d,h,p){var m=s(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var y=a(function(){var E=!1,x,O,S=function(Q){if(!E){E=!0,x=Q;var V=h(Q);if(p!==void 0&&g.hasValue){var B=g.value;if(p(B,V))return O=B,B}return O=V,V}var N=x,H=O;if(r(N,Q))return H;var K=h(Q);return p!==void 0&&p(H,K)?H:(x=Q,O=K,K)},D=d===void 0?null:d,I=function(){return S(f())},F=D===null?void 0:function(){return S(D())};return[I,F]},[f,d,h,p]),v=y[0],w=y[1],b=i(c,v,w);return o(function(){g.hasValue=!0,g.value=b},[b]),l(b),b}qv.useSyncExternalStoreWithSelector=u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),qv}process.env.NODE_ENV==="production"?$v.exports=I$():$v.exports=R$();var L$=$v.exports;function B$(t){let e=0,n=0,r={editor:t,transactionNumber:0},i=t;const s=new Set;return{getSnapshot(){return e===n||(n=e,r={editor:i,transactionNumber:e}),r},getServerSnapshot(){return{editor:null,transactionNumber:0}},subscribe(a){return s.add(a),()=>{s.delete(a)}},watch(a){if(i=a,i){const l=()=>{e+=1,s.forEach(c=>c())},u=i;return u.on("transaction",l),()=>{u.off("transaction",l)}}}}}function F$(t){const[e]=_.useState(()=>B$(t.editor)),n=L$.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getServerSnapshot,t.selector,t.equalityFn);return _.useEffect(()=>e.watch(t.editor),[t.editor]),_.useDebugValue(n),n}const xO=process.env.NODE_ENV!=="production",Qv=typeof window>"u",U$=Qv||!!(typeof window<"u"&&window.next);function j$(t={},e=[]){const n=_.useRef(!1),[r,i]=_.useState(()=>{if(t.immediatelyRender===void 0)return Qv||U$?(xO&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):new zm(t);if(t.immediatelyRender&&Qv&&xO)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return t.immediatelyRender?new zm(t):null});_.useDebugValue(r),_.useEffect(()=>{let O=r;O?Array.isArray(e)&&e.length?(O=new zm(t),i(O)):O.setOptions(t):(O=new zm(t),i(O))},e);const{onBeforeCreate:s,onBlur:o,onCreate:a,onDestroy:l,onFocus:u,onSelectionUpdate:c,onTransaction:f,onUpdate:d,onContentError:h}=t,p=_.useRef(s),m=_.useRef(o),g=_.useRef(a),y=_.useRef(l),v=_.useRef(u),w=_.useRef(c),b=_.useRef(f),E=_.useRef(d),x=_.useRef(h);return _.useEffect(()=>{r&&(s&&(r.off("beforeCreate",p.current),r.on("beforeCreate",s),p.current=s),o&&(r.off("blur",m.current),r.on("blur",o),m.current=o),a&&(r.off("create",g.current),r.on("create",a),g.current=a),l&&(r.off("destroy",y.current),r.on("destroy",l),y.current=l),u&&(r.off("focus",v.current),r.on("focus",u),v.current=u),c&&(r.off("selectionUpdate",w.current),r.on("selectionUpdate",c),w.current=c),f&&(r.off("transaction",b.current),r.on("transaction",f),b.current=f),d&&(r.off("update",E.current),r.on("update",d),E.current=d),h&&(r.off("contentError",x.current),r.on("contentError",h),x.current=h))},[s,o,a,l,u,c,f,d,h,r]),_.useEffect(()=>(n.current=!0,()=>{n.current=!1,r&&setTimeout(()=>{!n.current&&!r.isDestroyed&&r.destroy()})}),[]),F$({editor:r,selector:({transactionNumber:O})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&O===0?0:O+1}),r}const EO=_.createContext({editor:null});EO.Consumer;const H$=()=>_.useContext(EO),kO=t=>{const[e,n]=_.useState(null),{editor:r}=H$();return _.useEffect(()=>{var i;if(!e||!((i=t.editor)===null||i===void 0)&&i.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:s="bubbleMenu",editor:o,tippyOptions:a={},updateDelay:l,shouldShow:u=null}=t,c=o||r;if(!c){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const f=mO({updateDelay:l,editor:c,element:e,pluginKey:s,shouldShow:u,tippyOptions:a});return c.registerPlugin(f),()=>c.unregisterPlugin(s)},[t.editor,r,e]),_.createElement("div",{ref:n,className:t.className,style:{visibility:"hidden"}},t.children)},SO=_.createContext({onDragStart:void 0}),CO=()=>_.useContext(SO),DO=t=>{const e=t.as||"div",{nodeViewContentRef:n}=CO();return _.createElement(e,{...t,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...t.style}})},_h=_.forwardRef((t,e)=>{const{onDragStart:n}=CO(),r=t.as||"div";return _.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function V$(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function z$(t){var e;return typeof t=="object"&&((e=t.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class TO{constructor(e,{editor:n,props:r={},as:i="div",className:s="",attrs:o}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),o&&Object.keys(o).forEach(a=>{this.element.setAttribute(a,o[a])}),this.render()}render(){var e,n;const r=this.component,i=this.props;(V$(r)||z$(r))&&(i.ref=s=>{this.ref=s}),this.reactElement=_.createElement(r,{...i}),(n=(e=this.editor)===null||e===void 0?void 0:e.contentComponent)===null||n===void 0||n.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e,n;(n=(e=this.editor)===null||e===void 0?void 0:e.contentComponent)===null||n===void 0||n.removeRenderer(this.id)}}class $$ extends $V{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(s={})=>this.updateAttributes(s),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const s=o=>o.charAt(0).toUpperCase()+o.substring(1);this.component.displayName=s(this.extension.name)}const n=s=>{const o=this.component,a=this.onDragStart.bind(this),l=u=>{u&&this.contentDOMElement&&u.firstChild!==this.contentDOMElement&&u.appendChild(this.contentDOMElement)};return _.createElement(_.Fragment,null,_.createElement(SO.Provider,{value:{onDragStart:a,nodeViewContentRef:l}},_.createElement(o,{...s})))};n.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit");let r=this.node.isInline?"span":"div";this.options.as&&(r=this.options.as);const{className:i=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new TO(n,{editor:this.editor,props:e,as:r,className:`node-${this.node.type.name} ${i}`.trim(),attrs:this.options.attrs})}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection;if(e<=this.getPos()&&n>=this.getPos()+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n){const r=i=>{this.renderer.updateProps(i)};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations;return this.node=e,this.decorations=n,this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:n,updateProps:()=>r({node:e,decorations:n})})}return e===this.node&&this.decorations===n||(this.node=e,this.decorations=n,r({node:e,decorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}}function $l(t,e){return n=>n.editor.contentComponent?new $$(t,n,e):{}}var OO={exports:{}};/*!
171
- Copyright (c) 2018 Jed Watson.
172
- Licensed under the MIT License (MIT), see
173
- http://jedwatson.github.io/classnames
174
- */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)e.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(OO);var G$=OO.exports;const Ne=Jd(G$);/**
175
- * @license lucide-react v0.379.0 - ISC
176
- *
177
- * This source code is licensed under the ISC license.
178
- * See the LICENSE file in the root directory of this source tree.
179
- */const W$=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_O=(...t)=>t.filter((e,n,r)=>!!e&&r.indexOf(e)===n).join(" ");/**
180
- * @license lucide-react v0.379.0 - ISC
181
- *
182
- * This source code is licensed under the ISC license.
183
- * See the LICENSE file in the root directory of this source tree.
184
- */var K$={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
185
- * @license lucide-react v0.379.0 - ISC
186
- *
187
- * This source code is licensed under the ISC license.
188
- * See the LICENSE file in the root directory of this source tree.
189
- */const q$=_.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>_.createElement("svg",{ref:l,...K$,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:_O("lucide",i),...a},[...o.map(([u,c])=>_.createElement(u,c)),...Array.isArray(s)?s:[s]]));/**
190
- * @license lucide-react v0.379.0 - ISC
191
- *
192
- * This source code is licensed under the ISC license.
193
- * See the LICENSE file in the root directory of this source tree.
194
- */const Xe=(t,e)=>{const n=_.forwardRef(({className:r,...i},s)=>_.createElement(q$,{ref:s,iconNode:e,className:_O(`lucide-${W$(t)}`,r),...i}));return n.displayName=`${t}`,n};/**
195
- * @license lucide-react v0.379.0 - ISC
196
- *
197
- * This source code is licensed under the ISC license.
198
- * See the LICENSE file in the root directory of this source tree.
199
- */const Jv=Xe("AlignCenter",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"17",x2:"7",y1:"12",y2:"12",key:"rsh8ii"}],["line",{x1:"19",x2:"5",y1:"18",y2:"18",key:"1t0tuv"}]]);/**
200
- * @license lucide-react v0.379.0 - ISC
201
- *
202
- * This source code is licensed under the ISC license.
203
- * See the LICENSE file in the root directory of this source tree.
204
- */const Mh=Xe("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/**
205
- * @license lucide-react v0.379.0 - ISC
206
- *
207
- * This source code is licensed under the ISC license.
208
- * See the LICENSE file in the root directory of this source tree.
209
- */const Yv=Xe("AlignRight",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}],["line",{x1:"21",x2:"7",y1:"18",y2:"18",key:"1g9eri"}]]);/**
210
- * @license lucide-react v0.379.0 - ISC
211
- *
212
- * This source code is licensed under the ISC license.
213
- * See the LICENSE file in the root directory of this source tree.
214
- */const Xv=Xe("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
215
- * @license lucide-react v0.379.0 - ISC
216
- *
217
- * This source code is licensed under the ISC license.
218
- * See the LICENSE file in the root directory of this source tree.
219
- */const Q$=Xe("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/**
220
- * @license lucide-react v0.379.0 - ISC
221
- *
222
- * This source code is licensed under the ISC license.
223
- * See the LICENSE file in the root directory of this source tree.
224
- */const Zv=Xe("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
225
- * @license lucide-react v0.379.0 - ISC
226
- *
227
- * This source code is licensed under the ISC license.
228
- * See the LICENSE file in the root directory of this source tree.
229
- */const Nh=Xe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
230
- * @license lucide-react v0.379.0 - ISC
231
- *
232
- * This source code is licensed under the ISC license.
233
- * See the LICENSE file in the root directory of this source tree.
234
- */const Gm=Xe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
235
- * @license lucide-react v0.379.0 - ISC
236
- *
237
- * This source code is licensed under the ISC license.
238
- * See the LICENSE file in the root directory of this source tree.
239
- */const J$=Xe("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
240
- * @license lucide-react v0.379.0 - ISC
241
- *
242
- * This source code is licensed under the ISC license.
243
- * See the LICENSE file in the root directory of this source tree.
244
- */const Ph=Xe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
245
- * @license lucide-react v0.379.0 - ISC
246
- *
247
- * This source code is licensed under the ISC license.
248
- * See the LICENSE file in the root directory of this source tree.
249
- */const MO=Xe("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
250
- * @license lucide-react v0.379.0 - ISC
251
- *
252
- * This source code is licensed under the ISC license.
253
- * See the LICENSE file in the root directory of this source tree.
254
- */const Y$=Xe("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
255
- * @license lucide-react v0.379.0 - ISC
256
- *
257
- * This source code is licensed under the ISC license.
258
- * See the LICENSE file in the root directory of this source tree.
259
- */const X$=Xe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
260
- * @license lucide-react v0.379.0 - ISC
261
- *
262
- * This source code is licensed under the ISC license.
263
- * See the LICENSE file in the root directory of this source tree.
264
- */const Z$=Xe("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/**
265
- * @license lucide-react v0.379.0 - ISC
266
- *
267
- * This source code is licensed under the ISC license.
268
- * See the LICENSE file in the root directory of this source tree.
269
- */const eG=Xe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
270
- * @license lucide-react v0.379.0 - ISC
271
- *
272
- * This source code is licensed under the ISC license.
273
- * See the LICENSE file in the root directory of this source tree.
274
- */const Wm=Xe("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
275
- * @license lucide-react v0.379.0 - ISC
276
- *
277
- * This source code is licensed under the ISC license.
278
- * See the LICENSE file in the root directory of this source tree.
279
- */const Km=Xe("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
280
- * @license lucide-react v0.379.0 - ISC
281
- *
282
- * This source code is licensed under the ISC license.
283
- * See the LICENSE file in the root directory of this source tree.
284
- */const qm=Xe("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
285
- * @license lucide-react v0.379.0 - ISC
286
- *
287
- * This source code is licensed under the ISC license.
288
- * See the LICENSE file in the root directory of this source tree.
289
- */const NO=Xe("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/**
290
- * @license lucide-react v0.379.0 - ISC
291
- *
292
- * This source code is licensed under the ISC license.
293
- * See the LICENSE file in the root directory of this source tree.
294
- */const PO=Xe("ImagePlus",[["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"31hg93"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["line",{x1:"19",x2:"19",y1:"2",y2:"8",key:"1gkr8c"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
295
- * @license lucide-react v0.379.0 - ISC
296
- *
297
- * This source code is licensed under the ISC license.
298
- * See the LICENSE file in the root directory of this source tree.
299
- */const tG=Xe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
300
- * @license lucide-react v0.379.0 - ISC
301
- *
302
- * This source code is licensed under the ISC license.
303
- * See the LICENSE file in the root directory of this source tree.
304
- */const eA=Xe("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
305
- * @license lucide-react v0.379.0 - ISC
306
- *
307
- * This source code is licensed under the ISC license.
308
- * See the LICENSE file in the root directory of this source tree.
309
- */const tA=Xe("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
310
- * @license lucide-react v0.379.0 - ISC
311
- *
312
- * This source code is licensed under the ISC license.
313
- * See the LICENSE file in the root directory of this source tree.
314
- */const nA=Xe("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
315
- * @license lucide-react v0.379.0 - ISC
316
- *
317
- * This source code is licensed under the ISC license.
318
- * See the LICENSE file in the root directory of this source tree.
319
- */const Pc=Xe("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
320
- * @license lucide-react v0.379.0 - ISC
321
- *
322
- * This source code is licensed under the ISC license.
323
- * See the LICENSE file in the root directory of this source tree.
324
- */const Qm=Xe("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
325
- * @license lucide-react v0.379.0 - ISC
326
- *
327
- * This source code is licensed under the ISC license.
328
- * See the LICENSE file in the root directory of this source tree.
329
- */const nG=Xe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
330
- * @license lucide-react v0.379.0 - ISC
331
- *
332
- * This source code is licensed under the ISC license.
333
- * See the LICENSE file in the root directory of this source tree.
334
- */const rG=Xe("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
335
- * @license lucide-react v0.379.0 - ISC
336
- *
337
- * This source code is licensed under the ISC license.
338
- * See the LICENSE file in the root directory of this source tree.
339
- */const iG=Xe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
340
- * @license lucide-react v0.379.0 - ISC
341
- *
342
- * This source code is licensed under the ISC license.
343
- * See the LICENSE file in the root directory of this source tree.
344
- */const sG=Xe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
345
- * @license lucide-react v0.379.0 - ISC
346
- *
347
- * This source code is licensed under the ISC license.
348
- * See the LICENSE file in the root directory of this source tree.
349
- */const oG=Xe("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
350
- * @license lucide-react v0.379.0 - ISC
351
- *
352
- * This source code is licensed under the ISC license.
353
- * See the LICENSE file in the root directory of this source tree.
354
- */const aG=Xe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
355
- * @license lucide-react v0.379.0 - ISC
356
- *
357
- * This source code is licensed under the ISC license.
358
- * See the LICENSE file in the root directory of this source tree.
359
- */const lG=Xe("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
360
- * @license lucide-react v0.379.0 - ISC
361
- *
362
- * This source code is licensed under the ISC license.
363
- * See the LICENSE file in the root directory of this source tree.
364
- */const uG=Xe("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/**
365
- * @license lucide-react v0.379.0 - ISC
366
- *
367
- * This source code is licensed under the ISC license.
368
- * See the LICENSE file in the root directory of this source tree.
369
- */const IO=Xe("SquareCheckBig",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]]);/**
370
- * @license lucide-react v0.379.0 - ISC
371
- *
372
- * This source code is licensed under the ISC license.
373
- * See the LICENSE file in the root directory of this source tree.
374
- */const rA=Xe("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
375
- * @license lucide-react v0.379.0 - ISC
376
- *
377
- * This source code is licensed under the ISC license.
378
- * See the LICENSE file in the root directory of this source tree.
379
- */const iA=Xe("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
380
- * @license lucide-react v0.379.0 - ISC
381
- *
382
- * This source code is licensed under the ISC license.
383
- * See the LICENSE file in the root directory of this source tree.
384
- */const cG=Xe("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/**
385
- * @license lucide-react v0.379.0 - ISC
386
- *
387
- * This source code is licensed under the ISC license.
388
- * See the LICENSE file in the root directory of this source tree.
389
- */const Jm=Xe("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/**
390
- * @license lucide-react v0.379.0 - ISC
391
- *
392
- * This source code is licensed under the ISC license.
393
- * See the LICENSE file in the root directory of this source tree.
394
- */const RO=Xe("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/**
395
- * @license lucide-react v0.379.0 - ISC
396
- *
397
- * This source code is licensed under the ISC license.
398
- * See the LICENSE file in the root directory of this source tree.
399
- */const sA=Xe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
400
- * @license lucide-react v0.379.0 - ISC
401
- *
402
- * This source code is licensed under the ISC license.
403
- * See the LICENSE file in the root directory of this source tree.
404
- */const LO=Xe("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/**
405
- * @license lucide-react v0.379.0 - ISC
406
- *
407
- * This source code is licensed under the ISC license.
408
- * See the LICENSE file in the root directory of this source tree.
409
- */const oA=Xe("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
410
- * @license lucide-react v0.379.0 - ISC
411
- *
412
- * This source code is licensed under the ISC license.
413
- * See the LICENSE file in the root directory of this source tree.
414
- */const aA=Xe("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
415
- * @license lucide-react v0.379.0 - ISC
416
- *
417
- * This source code is licensed under the ISC license.
418
- * See the LICENSE file in the root directory of this source tree.
419
- */const fG=Xe("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
420
- * @license lucide-react v0.379.0 - ISC
421
- *
422
- * This source code is licensed under the ISC license.
423
- * See the LICENSE file in the root directory of this source tree.
424
- */const dG=Xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
425
- * @license lucide-react v0.379.0 - ISC
426
- *
427
- * This source code is licensed under the ISC license.
428
- * See the LICENSE file in the root directory of this source tree.
429
- */const BO=Xe("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]),hG=({editor:t,isOpen:e,setIsOpen:n})=>{const r=[{name:"Text",icon:RO,command:()=>t.chain().focus().toggleNode("paragraph","paragraph").run(),isActive:()=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{name:"Heading 1",icon:Wm,command:()=>t.chain().focus().toggleHeading({level:1}).run(),isActive:()=>t.isActive("heading",{level:1})},{name:"Heading 2",icon:Km,command:()=>t.chain().focus().toggleHeading({level:2}).run(),isActive:()=>t.isActive("heading",{level:2})},{name:"Heading 3",icon:qm,command:()=>t.chain().focus().toggleHeading({level:3}).run(),isActive:()=>t.isActive("heading",{level:3})},{name:"To-do List",icon:IO,command:()=>t.chain().focus().toggleTaskList().run(),isActive:()=>t.isActive("taskItem")},{name:"Bullet List",icon:Pc,command:()=>t.chain().focus().toggleBulletList().run(),isActive:()=>t.isActive("bulletList")},{name:"Numbered List",icon:Pc,command:()=>t.chain().focus().toggleOrderedList().run(),isActive:()=>t.isActive("orderedList")},{name:"Quote",icon:Jm,command:()=>t.chain().focus().toggleNode("paragraph","paragraph").toggleBlockquote().run(),isActive:()=>t.isActive("blockquote")},{name:"Code",icon:Ph,command:()=>t.chain().focus().toggleCode().run(),isActive:()=>t.isActive("code")}],i=r.filter(s=>s.isActive()).pop()??{name:"Multiple"};return k.jsxs("div",{className:"relative h-full flex items-center",children:[k.jsxs("button",{className:"flex items-center justify-between p-2 text-sm font-medium text-black hover:bg-[#f2f2f2] min-w-[6rem] w-[6rem] h-8 px-2 gap-1 transition rounded",onClick:()=>n(!e),children:[k.jsx("span",{className:"truncate",children:i==null?void 0:i.name}),k.jsx(Gm,{size:16})]}),e&&k.jsx("section",{className:"fixed top-full z-[99999] mt-1 flex w-48 flex-col overflow-hidden rounded border border-stone-200 bg-white p-1 shadow-xl animate-in fade-in slide-in-from-top-1",children:r.map((s,o)=>k.jsxs("button",{onClick:()=>{s.command(),n(!1)},className:Ne("flex items-center justify-between rounded-sm px-2 py-1 text-sm text-stone-600 hover:bg-stone-100",{"text-blue-600":s.isActive()}),children:[k.jsxs("div",{className:"flex items-center space-x-2",children:[k.jsx("div",{className:"rounded-sm border border-stone-200 p-1",children:k.jsx(s.icon,{className:"h-3 w-3"})}),k.jsx("span",{children:s.name})]}),i.name===s.name&&k.jsx(Nh,{className:"h-4 w-4"})]},o))})]})},pG=({editor:t,isOpen:e,setIsOpen:n})=>{const r=[{name:"Default",color:"#000000"},{name:"Purple",color:"#9333EA"},{name:"Red",color:"#E00000"},{name:"Blue",color:"#2563EB"},{name:"Green",color:"#008A00"},{name:"Orange",color:"#FFA500"},{name:"Pink",color:"#BA4081"},{name:"Gray",color:"#A8A29E"}],i=r.find(({color:s})=>t.isActive("textStyle",{color:s}));return k.jsxs("div",{className:"",children:[k.jsxs("button",{className:"flex h-[100%] items-center gap-1 p-2 text-sm font-medium text-stone-600 hover:bg-stone-100 active:bg-stone-200",onClick:()=>n(!e),children:[k.jsx("span",{style:{color:(i==null?void 0:i.color)||"#000000"},children:"A"}),k.jsx(Gm,{className:"h-4 w-4 "})]}),e&&k.jsx("section",{className:"fixed top-full z-[99999] mt-1 flex w-48 flex-col overflow-hidden rounded border border-stone-200 bg-white p-1 shadow-xl animate-in fade-in slide-in-from-top-1",children:r.map(({name:s,color:o},a)=>k.jsxs("button",{onClick:()=>{t.chain().focus().setColor(o).run(),n(!1)},className:Ne("flex items-center justify-between rounded-sm px-2 py-1 text-sm text-stone-600 hover:bg-stone-100",{"text-blue-600":t.isActive("textStyle",{color:o})}),children:[k.jsxs("div",{className:"flex items-center space-x-2",children:[k.jsx("div",{className:"rounded-sm border border-stone-200 px-1 py-px font-medium",style:{color:o},children:"A"}),k.jsx("span",{children:s})]}),t.isActive("textStyle",{color:o})&&k.jsx(Nh,{className:"h-4 w-4"})]},a))})]})};var Ge=(t=>(t[t.NONE=0]="NONE",t[t.HEADING=1]="HEADING",t[t.TEXT_COLOR=2]="TEXT_COLOR",t[t.HIGHLIGHT=3]="HIGHLIGHT",t[t.LINK=4]="LINK",t[t.FONT_FAMILY=5]="FONT_FAMILY",t[t.ALIGNMENT=6]="ALIGNMENT",t[t.LIST=7]="LIST",t[t.TEXT_FORMATING=8]="TEXT_FORMATING",t[t.TEXT_COLOR_PICKER=9]="TEXT_COLOR_PICKER",t[t.LINK_POPUP=10]="LINK_POPUP",t))(Ge||{});function mG(t){const[e,n]=_.useState(t),r=_.useRef(null),i=s=>{r&&r.current&&!r.current.contains(s.target)&&n(0)};return _.useEffect(()=>(document.addEventListener("click",i,!0),()=>{document.removeEventListener("click",i,!0)}),[]),{ref:r,toolVisibilty:e,setToolVisibility:n}}const gG="data:image/gif;base64,R0lGODlhUQBRAPf/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/ACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAwABACxQAFAAAQABAIAAAAAA/wAIBAADBAQAIfkECQQA/wAsKAACAAgACAAACBkA/wkEAEDgQIIIDyJcyLChw4X/GhqE+C8gACH5BAkDAP8ALCwAAwAIAAgAAAgYAP8BGDjwn0CCCBMqXMhQ4UGEBh8CMBgQACH5BAkDAP8ALDAABAAJAAgAAAgcAP/9A0AQgMCBBRMiTEhwIcOHEB86LHiQocCAAAAh+QQJBAD/ACwzAAYACwAJAAAIJQD//QNAkKDAgwUTAkCosODAhg4fQlw4caHAiQcvJsyY0aLAgAAAIfkECQMA/wAsNwAIAAsACgAACCYA//0DQJCgwIMFEyJMyHAgw4cQCzqMKDAigIUPD06UqLGiwX8BAQAh+QQJAwD/ACw7AAoADAANAAAILgD//QNAUKBBgwQTAjg4UGHCgw4VIoz4sCHFghYvZqQ4kWNHhxA9fsTIsKHBgAAAIfkECQQA/wAsPgANAA0AEAAACDcA/wkEAECgwYMEExY8+E+hQoYOHxqMmBAhRYIWL068uHAgx4wUQToUKXFjRIYNT0IcidLjwoAAACH5BAkDAP8ALEEAEQANABQAAAg9AP8JBEBQoEGDBBMCODhQYUKGDh8ejCixIUWIFBcizKjRYsSJGTFe3DiSpEORH0GmNKkQZUuXBWEyBGkwIAAh+QQJAwD/ACxEABYACwAYAAAIQgD/ARg48J9BgwQTHhSYkODBhg4RQgTwcCJFhhMrQtS4UWJHjA05KvTY0eJFkCNRRlRZkGRKiyJXwnS5UuVCkgYDAgAh+QQJBAD/ACxFABsACgAeAAAIRQD//QNAkKBAgQUTHkxYECHDhgMfAnD4kCJDixclGoxYkeNFjwpBQtSIcaTEkhtJapy4UmTKky5ZqoRJMibKgyJxctQZEAAh+QQJAwD/ACw/ACAAEAAjAAAIYgD/CRxIEIBBAAQT/jvIUOFAhgcdCoQY0SFFgxIvIrR4MWNHjhQ9hgQJUWRJkg0VatyYcCXKiio/xhzZUuNLmA9tzqRZUGZPnxN11gS60OVPokaP8gxKtOjSnE+h4iQpUWBAACH5BAkDAP8ALDQAJgAbACUAAAh5AP8JHEiwoEEACAEYXMjwX8KEDSM6fAhR4kKKFS0WxIhQ40GOHjeCDDmQo0KSE0eSNIlSIMuWL1fGDDnTo8mTMlXarKnxJsqbOHfq7MlTItCcQy0epemTaVGGQDsSXWo0atCGVq9ezDqVakSuXZNWFTv2YcuSZs8GBAAh+QQJBAD/ACwnACwAJwAjAAAIhgD/CRxIsKDBgwUBKASAsKHDgwsXPpzYMGJEihgJWpSYMeNGhR09fgxJ8SNIkg9NokypcmXFli4hjowpcyZNjTBvDjTJUOdOnj4F8uzpc2hQoUCDGi26VOfQkzefEo0pdarLqlGxXq0KtSNXiyK/gg0rliPGshdDou1KVuvKr06bMk179F9AACH5BAkDAP8ALBkAMgAzAB0AAAiIAP8JHEiwoMGDCBP+A8BQocOHEBlKBACxosWBEyVe3Kgwo0aOIAl6/Bgy5MiGJUGeRJly48qWHFdShGlRJs2aL29WtKnzIc+eCWXOBIpQ6FCiBY0iNWj06NKFSp8KbOqUKcmLVFkWPekw68SuXsN+9SlW7M6yWbGibRpzbU6VbsfSXCuVbc+AAAAh+QQJAwD/ACwNADgAPAAXAAAIiAD/CRxIsKDBgwgTKgSgsKHDhw0BSJQIsaLFhBMzXtx4MaNHjiAjetQokGHIkyVHTvz3ESVHlSthurQIkyJLmTMd1rS5MyfGnSZv1vRpEGhQoT2JGj2a0ujMpUwHQrXZcarIqVELYl2pc6vXoRW/iiVZdSxWlGahPk2LkyjStG4Pjo37cGnOgAAAIfkECQQA/wAsBQAyAD8AHQAACJsA/wEYOPCfwYMIEypcyLChQ4MEIz6cSLGiwogSLWrceBFjQY4gN3okGLIkxZEfTapciDLlypcQUcKcKbAlTZgtAdx8mXOnyp4+TQIN2jBjwpw6iR712HGoUplNbT6VuhRpUKsskSadqdWhVpclv25lKBZsxbJji6I1G/WryLVwqWqMS9coyLpxV+ItS3Ov05t+7U7Nq/Sh2JABAQAh+QQJAwD/ACwCACUAOwAqAAAIuAD/ARhI8J/BgwgTKlzIsCFDggUdSpxIMSFEiBUzalR4MeLGjxU7DgRJcqJIACVTPhSpsiXCky5jwozZ8iRKmipn4iypcyfInj432gxKEijRkEaPShyqVGPSpg2ZQqUodarDqlZXPs160OZNrlpZgl3o9evYl1jPGvSq1mLZtl3fwhUoF27ZkTgxUr1rlmdHpHz7At7qNrDHsHX3Gl7M1injx3+FQp7sd7LhmpYTu8x8sanlsXwrBgQAIfkECQMA/wAsAgAYADMANwAACMUA/wn8B6AggIEIEypcyLAhQoMQHUqcKBGiQYoYMxK0WFCjR4ccO34cmTDkQZIoTZ5EOdIky5QhX5J0KfMjzZoZVeLUeHMnxZ4+K8YM+nMoUaEcj04EqlQh06YPjUJ1KnVq1KpWN2LN+tRq16lfoerMWnKr17BKx5IdiDZt26Nq18Ylq3Kl3Llc8YLVu/dt0LprBdYVSXdw4MGEzxoujNhu08YX+0JOvNCizcmYKRfNPLkl58YzPy+GKTqpzNIRfZYWi1hhQAAh+QQJBAD/ACwCAA4AKgBBAAAIzQD/CRxIEIBBgwQTKlzIUOHBhw0jSiz4EOLEiwsrWsTI8Z/GjR0nfjwYkuNIhCVFnkx5cSVLiS5fNjwJQGbEmDYzjszJECdPih9/6tQo1OHOokArIk14dKnApkt9FpUqFGrUoE6fYs1qFWnXqVudfq0a9irRrB7Leh37ky1Ptznh2qRK9ixXuS/ptsXLUu9bvin9xgVckiZaw2IFy0ScWHFgmjXNOi4MOTJYyJIx162McjBnkHk/T2YqmnDS0p0fo05NefXfz2s131X6LyAAIfkECQMA/wAsAgAGACAARwAACMkA/wkcSLCgQQAADCpcqBChw4QMIxJ8+FCiRYoULS7EiFHjQY4ZPQ4EGVLkP5IVTZ5EiVDlSpQuX5KMKZMjTZg3Z9KsWdIlzpw2d+oUCnInT4dGj7YkGpRpR6NFoUZ1mlLqU6s9Yw4FmlVrU6pIk04FuxRrVbIQzYZVWxZtUqVp3Yr9yvVs3bVo495tu5evz7F9327tq/cvXcOHVf4kXNjkYq+AFT+WPFkky8YeL2O+eJmx3cya/UoMjVcjacQsIVc2vdpy5LoCAwIAIfkECQMA/wAsAgADACQARQAACMoA/wkcSLCgwYMAEio8yLDhQIUQFzqcKDCixYQUG17cmNHgxo8dH34EGXIkyY4mL4b8lxLiSpEtX8I0KXPmyZopaxakqdOmxZ4+XQKtOHIoUY5GixpliTRp06FKnapcynSq1J9Un14VuvQmVKtdwW6VGFYsUK9nzabFmlVtT61f2ZaNSPUo3bpw195tK3cs2blcAf/1C6Bu1b5x9woerFcx4cJ8ETdmPJmyzqiPIWfWnFjyZcyVA7/l2dnty5ybI3vGmbeyYbucJwYEACH5BAkEAP8ALAIAAgAuAD4AAAjLAP8JHEiwoMGDBgEoXMgQocOHAxlKnKgQosWIFDNKvPhQo8eGHBN+HAkgJEGSKE3+Q8nSJMuUHF8uVOnwJU2IMG92HKnTIsmeOD8C9elxaFCNRnciTYqwKNOaS5+KzCj1oNOqBaNixUh168muXrlODCt2I1mBYM+mDauVLcWzZWfCXfl27lqvbfHWhXtX71i7e9UGJtt3a2Gsh6smlprX8OKnj5lGTjrZaGPHf/kOdrvZb2bClYFeBd0Z82fOp1GD1Gx2Ll25rjGeDQgAIfkECQMA/wAsAgACADgAMgAACMMA/wkcSLCgwYMFAShcyBChw4cQBzKcSJFixIsHK2rcuBDjRY4gOXpEGLLkxpEETarUiHKlS4seX8rsiPHlw5A1VaL8VzFnyZ0GFfoUCbSowJ9Gi+JMqhQkU6NOnwIlKnUn1aotWWK1enLryKteP2oNOxQmWbE9z5alqTZi17YQ38J1OHYuybp2g6bNe9csX71+/0rEK5jn3sKDAyMmXJixYMd/IfOVnJeyXctzMcOVu1hzW89qQZ89jDgx29IphaImGBAAIfkECQMA/wAsAwACAD8AJAAACK0A/wkcSLCgwYMEAShcyBChw4cQHzKcSJFixIsYK2rcuBCjx4IcQ3L8mFGkyY0kHZ5cOTLlQJYwW5KMSVPjTJgSaV5k6XJlRJ8uX5rMGTKoSpkGhxo9WpEpyqU/LR4UCbVkR4RFq2r9l3UrVKRejXYNK/Yp2bI2zy41q7Yn27Y3m8IN+nauVal24+LN6zEt375+/+6UK/huw8KGryKOunexU8WOiR6ODHEi5YgBAQAh+QQJBAD/ACwIAAIAQAAXAAAIiQD/CRxIsKDBggASKlyY8KDDhxAjDmRIsaJCiRgz/rPIsaPGjwQ7ivQIEuPIkyRLHkTJMqXKjS1jcnwps6ZFkDUh5szYUmXPiCxfTkSp86RQg0RXjjz60ChCkUwlLh3qMmpTqAKxWpVKsupWrju/8gwrduzPsh8rwqSI1ifDrG/b0gTwtKFcqwEBACH5BAkDAP8ALBIAAgA6AB0AAAiPAP8JHEiw4EAACBMqNMiwocOHAhVKnDgRokWIFDNqTHixY8SNIDV6fBiy5MaRBU2qPDlypUuWF1/KpBjTJUmbGEui/LfypsidBFX6XAi0ocmhAIrmBKm0aVCmTp2GjCoVJlWlVq8Czaq15c+uW7+CRSl2rFeaZsmWTWtxLVukRN92zCj3bNy6bSXiVZv0X0AAIfkECQMA/wAsHwACADAAJQAACJUA/wn8B6CgwYMFBypcyLChQ4III0Z8SJGixIsSK2oUiLHjxI0PPYo8CLLhyJMJSypEiVLlQJYnXYKECUCmSpY2b47MWTImz5kif/b0KBRox6IbiSJNinEp04tOKx6NarEp1ZBWr5qEqnVrxq5eP4JdyHXsyrJmIX5Ny3Et26xv3aZFO1euWbh1EbI9q3fvS5J+ySoMCAAh+QQJBAD/ACwtAAMAIgArAAAIjgD//QNAEIDAgwgTKlwosKBDgwwjLnxIUaLFhhQrXmSYseNGhR1DfkQY0uNIjCU1nhyY0uHKgy0LvoQZcybNlDZviszJsiTPniZ/+vwJVGXOoUJ3Jg3KU2lTpk8zEkX5cGpRl0SdRq06VetRqV3BZhW71OhXsluxjjV7lutat2XVxpUZlq1NqGkhWgUqMCAAIfkECQMA/wAsOQAJABYALQAACHwA/wEYOPCfwYMIEwokSFChQ4MMIz5MGFHiRIgVGV5cmLHhxY4aP4IsKBLkRo4dT6KsqHLkSZcvTcbM2DJlTZo3Lc5kuVPnRps9QwYlORSAypUeix6VqTSn0J84m0qFynNqSZ9Xn05kmjUpVaxbo37VGrbqWKJOj1I0ejAgACH5BAkDAP8ALEEAEQAOACsAAAhvAP8JBABAoMGD/wgqLIhw4EKCDR8qjCgR4sGKEy9iRIjRosGOHDeGrDhSIkWTJR+eVJkyo0aUL2F+JNnS40yZDnEmpBlz4UqfNRn2dHmTZVGjOXGKHGozKdCjT50S3clT6tSlVptihSp0aMOiDQMCACH5BAkEAP8ALD8AHAAQACYAAAhqAP8JHDgQgEEABBMKPHhQYUGGDR1CjKhwokGH/ywilGgRo8aNFTtynOhRZEiSIyGWRHlSZUqGK10m/PgSZkubNynONEmQZs6LP4Hu5LlQY02dRY0OZflQaVOiGZ0+ZToVaVWQPzE21fovIAAh+QQJAwD/ACw7ACYAFAAhAAAIZgD/CRxIsCAAAAUTGjzIUGFChhAdLoR4UOJAig0t/sNYUSNHhB45hhRp8aPGjSRLpnT4EaREkypXKmwZE+NImy9h5pQ5kedFmjtxsgT6sKXLnj4FGj1KcGlQoTN1DoX6lGnIkwMDAgAh+QQJAwD/ACw2ADAAFwAbAAAIXQD/CRxIsOBAAAAMKjSIsGHChQodOoTIUCJCigQtNsR4UONDjB4/gvTI8V/IkiZJcjy5kuVIjSVDilwos6VKiDIv4sy5kyfNnDMzAqU4lGjNlxZR3ow5EWXBoCUDAgAh+QQJBAD/ACwwADkAGQAUAAAITwD/CRxIsOBAAAgRGlxoMKFDhhAdPoTYUOJEigctKsSYUSMAjv88JgQpciPGkiYZoky5cOVHlS5fVowJk2ZLmzVRntTJkSdJiyBnygwqMCAAIfkECQMA/wAsKgA/ABkAEAAACEYA/wkcSLAgQQAIARhcaDChQ4YQHT6E2FDiRIr/LFrEqHEjw44dC4IceXBkyJImPQ5MqRIlS4ULX8KMSBKjwJM2Rc7MSTAgACH5BAkDAP8ALCQARAAYAAsAAAg3AP8JHEiw4D8ACBMaXCgwoUOFDBs+nIhQIsWLDw9i3KiQI0eNHi9aDJlxIEmIBUlGHFly5b+AAAAh+QQJBAD/ACweAEYAFgAJAAAIKwD/CRxIsOA/AAgBEEzIsKFDhQcfSmwYcaLFixcrYnSocSNDgR4/FtxYMCAAIfkECQMA/wAsGQBFABQACgAACC4A/wkEQFCgwYMI/xFcyDDhQYYQIy4cKLHiRIsYM2JUqDEixY4TH3Z0aNCiwIAAACH5BAkDAP8ALBQAQwASAAsAAAgxAP/9A0AQgMCDCBEWXGgw4UGGEB0OhEix4cSKFC9iZChwY0aNHi12DClxo0SFHP8FBAAh+QQJBAD/ACwQAEAAEAANAAAINAD//QNAUKDBgwYJKgSA8ODChw0HPlzYcOJEhxYvCsyoUSLHggk/ggyZMSLHiCRHotx4MCAAIfkECQMA/wAsDAA9AA4ADQAACDEA/wEYOPCfwYMGCSpEeFChQ4YOHzaMuDAhxYoCLxKcqBEAx4sIOzLMKHFkyZEJEQYEACH5BAkDAP8ALAkAOQAMAA0AAAguAP8BGDjwn8GDBBMeNJhQIcKGBR9CBCBxYkWIDCcSzKjxokOODRcKDCky48GAAAAh+QQJBAD/ACwGADUACwAMAAAIKgD//QNAEIDAgwMLEkSoUOHBhg4TQjQocaLAiQUvYtRokWNDhh8RVhQYEAAh+QQJAwD/ACwEADAACgANAAAIKQD/CQQAQKDBfwQTFhyoMCHDhgshEnwIkaJCixclTkQoEeNCjAcZGgwIACH5BAkDAP8ALAMALAAJAAwAAAgmAP8BGDjwn0GCCA8iJChwYUGHDyE2lAgRwMSFFxkq1GjwYMd/AQEAIfkECQQA/wAsAgAnAAkACwAACCIA//0DQBCAQIEFCyJMqJBhQ4cGIUaEOFBiRYYLMWYkKDAgACH5BAkDAP8ALAIAIwAIAAoAAAgaAP8BGEjwn0CCAw8iXMiwocOHDRUWNIjQYEAAIfkECQMA/wAsAgAeAAkACgAACB8A/wkEQFCgQYIIAQxMWPAfw4cQITqUGHEhw4MJBQYEACH5BAkEAP8ALAMAGgAJAAoAAAggAP8JBEAQgMB/BRMOTEhwIcOHEBkihOhQ4USLBxseDAgAIfkECQMA/wAsBQAWAAgACQAACBoA//0DQBCAwIEFCSJMyLChw4cOFyYUyFBgQAAh+QQJAwD/ACwHABIACAAJAAAIGQD/CQRAUOA/gggBDEzIsKHDhxAbLkQoMCAAIfkECQQA/wAsCQAPAAkACQAACB4A/wkEQBCAwH8FEw5MSBAhw4cQIS5keJDiwYEXAwIAIfkECQMA/wAsDAAMAAgACAAACBgA//0DQBCAwIEFEypcyLChQoQJD0b8FxAAIfkECQMA/wAsDwAJAAgACAAACBkA/wkEQFDgP4IIAQxMyLChw4cHGy5E+C8gACH5BAkEAP8ALBIABwAJAAgAAAgcAP8JBEBQ4ECCCAEcTKiQocOH/yBGdGiQocCAAAAh+QQJAwD/ACwWAAUACAAIAAAIGQD/CQQAQOBAggj/IVzIsKFDhwoZGlwoMCAAIfkECQMA/wAsGQAEAAkACAAACB0A//0DQJCgwIEFCwpMqJBhQoQOIT5cOPGgQoEBAQAh+QQJBAD/ACxQAFAAAQABAAAIBAD/BQQAIfkECQQA/wAsUABQAAEAAQAACAQA/wUEADs=",Ym=new en("upload-image"),yG=()=>new Ut({key:Ym,state:{init(){return Wt.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(this);if(n&&n.add){const{id:r,pos:i,src:s}=n.add,o=document.createElement("div");o.setAttribute("class","img-placeholder");const a=document.createElement("img");a.setAttribute("class","rounded-lg border border-stone-200"),a.src=s,o.appendChild(a);const l=Un.widget(i+1,o,{id:r});e=e.add(t.doc,[l])}else n&&n.remove&&(e=e.remove(e.find(void 0,void 0,r=>r.id==n.remove.id)));return e}},props:{decorations(t){return this.getState(t)}}});function bG(t,e){const r=Ym.getState(t).find(null,null,i=>i.id==e);return r.length?r[0].from:null}function lA(t,e,n){if(!t.type.includes("image/")){console.log("file is not an image");return}const r={},i=e.state.tr;i.selection.empty||i.deleteSelection(),i.setMeta(Ym,{add:{id:r,pos:n,src:gG}}),e.dispatch(i);const s=new FileReader;s.readAsDataURL(t),s.onloadend=()=>{const{schema:o}=e.state,a=bG(e.state,r);if(!a)return;const l=s.result,u=o.nodes.resizableMedia.create({src:l,"media-type":"img"}),c=e.state.tr.replaceWith(a-2,a+u.nodeSize,u).setMeta(Ym,{remove:{id:r}});e.dispatch(c)}}const wG=async t=>{const e=new FileReader;if(e.readAsDataURL(t),t.size>zh)throw e.abort(),console.log("should be less than 1 mb"),new Error("Image too large");return await new Promise(r=>{e.onload=()=>{r(e.result)}})};function ai(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function vG(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function FO(...t){return e=>t.forEach(n=>vG(n,e))}function Di(...t){return Y.useCallback(FO(...t),t)}function AG(t,e){const n=Y.createContext(e);function r(s){const{children:o,...a}=s,l=Y.useMemo(()=>a,Object.values(a));return k.jsx(n.Provider,{value:l,children:o})}function i(s){const o=Y.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return r.displayName=t+"Provider",[r,i]}function uA(t,e=[]){let n=[];function r(s,o){const a=Y.createContext(o),l=n.length;n=[...n,o];function u(f){const{scope:d,children:h,...p}=f,m=(d==null?void 0:d[t][l])||a,g=Y.useMemo(()=>p,Object.values(p));return k.jsx(m.Provider,{value:g,children:h})}function c(f,d){const h=(d==null?void 0:d[t][l])||a,p=Y.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,c]}const i=()=>{const s=n.map(o=>Y.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return Y.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,xG(i,...e)]}function xG(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...a,...f}},{});return Y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Gl=globalThis!=null&&globalThis.document?Y.useLayoutEffect:()=>{},EG=Y.useId||(()=>{}),kG=0;function Xm(t){const[e,n]=Y.useState(EG());return Gl(()=>{t||n(r=>r??String(kG++))},[t]),t||(e?`radix-${e}`:"")}function ga(t){const e=Y.useRef(t);return Y.useEffect(()=>{e.current=t}),Y.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function UO({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=SG({defaultProp:e,onChange:n}),s=t!==void 0,o=s?t:r,a=ga(n),l=Y.useCallback(u=>{if(s){const f=typeof u=="function"?u(t):u;f!==t&&a(f)}else i(u)},[s,t,i,a]);return[o,l]}function SG({defaultProp:t,onChange:e}){const n=Y.useState(t),[r]=n,i=Y.useRef(r),s=ga(e);return Y.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}var Zm=Y.forwardRef((t,e)=>{const{children:n,...r}=t,i=Y.Children.toArray(n),s=i.find(DG);if(s){const o=s.props.children,a=i.map(l=>l===s?Y.Children.count(o)>1?Y.Children.only(null):Y.isValidElement(o)?o.props.children:null:l);return k.jsx(cA,{...r,ref:e,children:Y.isValidElement(o)?Y.cloneElement(o,void 0,a):null})}return k.jsx(cA,{...r,ref:e,children:n})});Zm.displayName="Slot";var cA=Y.forwardRef((t,e)=>{const{children:n,...r}=t;if(Y.isValidElement(n)){const i=OG(n);return Y.cloneElement(n,{...TG(r,n.props),ref:e?FO(e,i):i})}return Y.Children.count(n)>1?Y.Children.only(null):null});cA.displayName="SlotClone";var CG=({children:t})=>k.jsx(k.Fragment,{children:t});function DG(t){return Y.isValidElement(t)&&t.type===CG}function TG(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{s(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function OG(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var _G=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$r=_G.reduce((t,e)=>{const n=Y.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?Zm:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),k.jsx(a,{...o,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function MG(t,e){t&&bw.flushSync(()=>t.dispatchEvent(e))}function NG(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t);Y.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var PG="DismissableLayer",fA="dismissableLayer.update",IG="dismissableLayer.pointerDownOutside",RG="dismissableLayer.focusOutside",jO,HO=Y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dA=Y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,u=Y.useContext(HO),[c,f]=Y.useState(null),d=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=Y.useState({}),p=Di(e,O=>f(O)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),v=c?m.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,b=v>=y,E=FG(O=>{const S=O.target,D=[...u.branches].some(I=>I.contains(S));!b||D||(i==null||i(O),o==null||o(O),O.defaultPrevented||a==null||a())},d),x=UG(O=>{const S=O.target;[...u.branches].some(I=>I.contains(S))||(s==null||s(O),o==null||o(O),O.defaultPrevented||a==null||a())},d);return NG(O=>{v===u.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},d),Y.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(jO=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),VO(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=jO)}},[c,d,n,u]),Y.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),VO())},[c,u]),Y.useEffect(()=>{const O=()=>h({});return document.addEventListener(fA,O),()=>document.removeEventListener(fA,O)},[]),k.jsx($r.div,{...l,ref:p,style:{pointerEvents:w?b?"auto":"none":void 0,...t.style},onFocusCapture:ai(t.onFocusCapture,x.onFocusCapture),onBlurCapture:ai(t.onBlurCapture,x.onBlurCapture),onPointerDownCapture:ai(t.onPointerDownCapture,E.onPointerDownCapture)})});dA.displayName=PG;var LG="DismissableLayerBranch",BG=Y.forwardRef((t,e)=>{const n=Y.useContext(HO),r=Y.useRef(null),i=Di(e,r);return Y.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),k.jsx($r.div,{...t,ref:i})});BG.displayName=LG;function FG(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t),r=Y.useRef(!1),i=Y.useRef(()=>{});return Y.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){zO(IG,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function UG(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t),r=Y.useRef(!1);return Y.useEffect(()=>{const i=s=>{s.target&&!r.current&&zO(RG,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function VO(){const t=new CustomEvent(fA);document.dispatchEvent(t)}function zO(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?MG(i,s):i.dispatchEvent(s)}var hA="focusScope.autoFocusOnMount",pA="focusScope.autoFocusOnUnmount",$O={bubbles:!1,cancelable:!0},jG="FocusScope",Ic=Y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=Y.useState(null),u=ga(i),c=ga(s),f=Y.useRef(null),d=Di(e,m=>l(m)),h=Y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Y.useEffect(()=>{if(r){let m=function(w){if(h.paused||!a)return;const b=w.target;a.contains(b)?f.current=b:ya(f.current,{select:!0})},g=function(w){if(h.paused||!a)return;const b=w.relatedTarget;b!==null&&(a.contains(b)||ya(f.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&ya(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),v.disconnect()}}},[r,a,h.paused]),Y.useEffect(()=>{if(a){KO.add(h);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(hA,$O);a.addEventListener(hA,u),a.dispatchEvent(y),y.defaultPrevented||(HG(WG(GO(a)),{select:!0}),document.activeElement===m&&ya(a))}return()=>{a.removeEventListener(hA,u),setTimeout(()=>{const y=new CustomEvent(pA,$O);a.addEventListener(pA,c),a.dispatchEvent(y),y.defaultPrevented||ya(m??document.body,{select:!0}),a.removeEventListener(pA,c),KO.remove(h)},0)}}},[a,u,c,h]);const p=Y.useCallback(m=>{if(!n&&!r||h.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){const v=m.currentTarget,[w,b]=VG(v);w&&b?!m.shiftKey&&y===b?(m.preventDefault(),n&&ya(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),n&&ya(b,{select:!0})):y===v&&m.preventDefault()}},[n,r,h.paused]);return k.jsx($r.div,{tabIndex:-1,...o,ref:d,onKeyDown:p})});Ic.displayName=jG;function HG(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ya(r,{select:e}),document.activeElement!==n)return}function VG(t){const e=GO(t),n=WO(e,t),r=WO(e.reverse(),t);return[n,r]}function GO(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function WO(t,e){for(const n of t)if(!zG(n,{upTo:e}))return n}function zG(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function $G(t){return t instanceof HTMLInputElement&&"select"in t}function ya(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&$G(t)&&e&&t.select()}}var KO=GG();function GG(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=qO(t,e),t.unshift(e)},remove(e){var n;t=qO(t,e),(n=t[0])==null||n.resume()}}}function qO(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function WG(t){return t.filter(e=>e.tagName!=="A")}var KG="Portal",QO=Y.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=Y.useState(!1);Gl(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Zt.createPortal(k.jsx($r.div,{...r,ref:e}),o):null});QO.displayName=KG;function qG(t,e){return Y.useReducer((n,r)=>e[n][r]??n,t)}var Ih=t=>{const{present:e,children:n}=t,r=QG(e),i=typeof n=="function"?n({present:r.isPresent}):Y.Children.only(n),s=Di(r.ref,JG(i));return typeof n=="function"||r.isPresent?Y.cloneElement(i,{ref:s}):null};Ih.displayName="Presence";function QG(t){const[e,n]=Y.useState(),r=Y.useRef({}),i=Y.useRef(t),s=Y.useRef("none"),o=t?"mounted":"unmounted",[a,l]=qG(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Y.useEffect(()=>{const u=eg(r.current);s.current=a==="mounted"?u:"none"},[a]),Gl(()=>{const u=r.current,c=i.current;if(c!==t){const d=s.current,h=eg(u);t?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Gl(()=>{if(e){const u=f=>{const h=eg(r.current).includes(f.animationName);f.target===e&&h&&bw.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===e&&(s.current=eg(r.current))};return e.addEventListener("animationstart",c),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{e.removeEventListener("animationstart",c),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:Y.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function eg(t){return(t==null?void 0:t.animationName)||"none"}function JG(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var mA=0;function JO(){Y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??YO()),document.body.insertAdjacentElement("beforeend",t[1]??YO()),mA++,()=>{mA===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),mA--}},[])}function YO(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}var Ts=function(){return Ts=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ts.apply(this,arguments)};function XO(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function YG(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var tg="right-scroll-bar-position",ng="width-before-scroll-bar",XG="with-scroll-bars-hidden",ZG="--removed-body-scroll-bar-size";function gA(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function eW(t,e){var n=_.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var tW=typeof window<"u"?Y.useLayoutEffect:Y.useEffect,ZO=new WeakMap;function nW(t,e){var n=eW(null,function(r){return t.forEach(function(i){return gA(i,r)})});return tW(function(){var r=ZO.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||gA(a,null)}),s.forEach(function(a){i.has(a)||gA(a,o)})}ZO.set(n,t)},[t]),n}function rW(t){return t}function iW(t,e){e===void 0&&(e=rW);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var c=o;o=[],c.forEach(s)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(c){o.push(c),u()},filter:function(c){return o=o.filter(c),n}}}};return i}function sW(t){t===void 0&&(t={});var e=iW(null);return e.options=Ts({async:!0,ssr:!1},t),e}var e6=function(t){var e=t.sideCar,n=XO(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return Y.createElement(r,Ts({},n))};e6.isSideCarExport=!0;function oW(t,e){return t.useMedium(e),e6}var t6=sW(),yA=function(){},rg=Y.forwardRef(function(t,e){var n=Y.useRef(null),r=Y.useState({onScrollCapture:yA,onWheelCapture:yA,onTouchMoveCapture:yA}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,u=t.removeScrollBar,c=t.enabled,f=t.shards,d=t.sideCar,h=t.noIsolation,p=t.inert,m=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,v=t.gapMode,w=XO(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),b=d,E=nW([n,e]),x=Ts(Ts({},w),i);return Y.createElement(Y.Fragment,null,c&&Y.createElement(b,{sideCar:t6,removeScrollBar:u,shards:f,noIsolation:h,inert:p,setCallbacks:s,allowPinchZoom:!!m,lockRef:n,gapMode:v}),o?Y.cloneElement(Y.Children.only(a),Ts(Ts({},x),{ref:E})):Y.createElement(y,Ts({},x,{className:l,ref:E}),a))});rg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},rg.classNames={fullWidth:ng,zeroRight:tg};var aW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function lW(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=aW();return e&&t.setAttribute("nonce",e),t}function uW(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function cW(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var fW=function(){var t=0,e=null;return{add:function(n){t==0&&(e=lW())&&(uW(e,n),cW(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},dW=function(){var t=fW();return function(e,n){Y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},n6=function(){var t=dW(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},hW={left:0,top:0,right:0,gap:0},bA=function(t){return parseInt(t||"",10)||0},pW=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[bA(n),bA(r),bA(i)]},mW=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return hW;var e=pW(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},gW=n6(),Rc="data-scroll-locked",yW=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
430
- .`.concat(XG,` {
431
- overflow: hidden `).concat(r,`;
432
- padding-right: `).concat(a,"px ").concat(r,`;
433
- }
434
- body[`).concat(Rc,`] {
435
- overflow: hidden `).concat(r,`;
436
- overscroll-behavior: contain;
437
- `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
438
- padding-left: `.concat(i,`px;
439
- padding-top: `).concat(s,`px;
440
- padding-right: `).concat(o,`px;
441
- margin-left:0;
442
- margin-top:0;
443
- margin-right: `).concat(a,"px ").concat(r,`;
444
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
445
- }
446
-
447
- .`).concat(tg,` {
448
- right: `).concat(a,"px ").concat(r,`;
449
- }
450
-
451
- .`).concat(ng,` {
452
- margin-right: `).concat(a,"px ").concat(r,`;
453
- }
454
-
455
- .`).concat(tg," .").concat(tg,` {
456
- right: 0 `).concat(r,`;
457
- }
458
-
459
- .`).concat(ng," .").concat(ng,` {
460
- margin-right: 0 `).concat(r,`;
461
- }
462
-
463
- body[`).concat(Rc,`] {
464
- `).concat(ZG,": ").concat(a,`px;
465
- }
466
- `)},r6=function(){var t=parseInt(document.body.getAttribute(Rc)||"0",10);return isFinite(t)?t:0},bW=function(){Y.useEffect(function(){return document.body.setAttribute(Rc,(r6()+1).toString()),function(){var t=r6()-1;t<=0?document.body.removeAttribute(Rc):document.body.setAttribute(Rc,t.toString())}},[])},wW=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;bW();var s=Y.useMemo(function(){return mW(i)},[i]);return Y.createElement(gW,{styles:yW(s,!e,i,n?"":"!important")})},wA=!1;if(typeof window<"u")try{var ig=Object.defineProperty({},"passive",{get:function(){return wA=!0,!0}});window.addEventListener("test",ig,ig),window.removeEventListener("test",ig,ig)}catch{wA=!1}var Lc=wA?{passive:!1}:!1,vW=function(t){return t.tagName==="TEXTAREA"},i6=function(t,e){var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!vW(t)&&n[e]==="visible")},AW=function(t){return i6(t,"overflowY")},xW=function(t){return i6(t,"overflowX")},s6=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=o6(t,r);if(i){var s=a6(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},EW=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},kW=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},o6=function(t,e){return t==="v"?AW(e):xW(e)},a6=function(t,e){return t==="v"?EW(e):kW(e)},SW=function(t,e){return t==="h"&&e==="rtl"?-1:1},CW=function(t,e,n,r,i){var s=SW(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),u=!1,c=o>0,f=0,d=0;do{var h=a6(t,a),p=h[0],m=h[1],g=h[2],y=m-g-s*p;(p||y)&&o6(t,a)&&(f+=y,d+=p),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(c&&(Math.abs(f)<1||!i)||!c&&(Math.abs(d)<1||!i))&&(u=!0),u},sg=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},l6=function(t){return[t.deltaX,t.deltaY]},u6=function(t){return t&&"current"in t?t.current:t},DW=function(t,e){return t[0]===e[0]&&t[1]===e[1]},TW=function(t){return`
467
- .block-interactivity-`.concat(t,` {pointer-events: none;}
468
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
469
- `)},OW=0,Bc=[];function _W(t){var e=Y.useRef([]),n=Y.useRef([0,0]),r=Y.useRef(),i=Y.useState(OW++)[0],s=Y.useState(n6)[0],o=Y.useRef(t);Y.useEffect(function(){o.current=t},[t]),Y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=YG([t.lockRef.current],(t.shards||[]).map(u6),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=Y.useCallback(function(m,g){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var y=sg(m),v=n.current,w="deltaX"in m?m.deltaX:v[0]-y[0],b="deltaY"in m?m.deltaY:v[1]-y[1],E,x=m.target,O=Math.abs(w)>Math.abs(b)?"h":"v";if("touches"in m&&O==="h"&&x.type==="range")return!1;var S=s6(O,x);if(!S)return!0;if(S?E=O:(E=O==="v"?"h":"v",S=s6(O,x)),!S)return!1;if(!r.current&&"changedTouches"in m&&(w||b)&&(r.current=E),!E)return!0;var D=r.current||E;return CW(D,g,m,D==="h"?w:b,!0)},[]),l=Y.useCallback(function(m){var g=m;if(!(!Bc.length||Bc[Bc.length-1]!==s)){var y="deltaY"in g?l6(g):sg(g),v=e.current.filter(function(E){return E.name===g.type&&(E.target===g.target||g.target===E.shadowParent)&&DW(E.delta,y)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var w=(o.current.shards||[]).map(u6).filter(Boolean).filter(function(E){return E.contains(g.target)}),b=w.length>0?a(g,w[0]):!o.current.noIsolation;b&&g.cancelable&&g.preventDefault()}}},[]),u=Y.useCallback(function(m,g,y,v){var w={name:m,delta:g,target:y,should:v,shadowParent:MW(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(b){return b!==w})},1)},[]),c=Y.useCallback(function(m){n.current=sg(m),r.current=void 0},[]),f=Y.useCallback(function(m){u(m.type,l6(m),m.target,a(m,t.lockRef.current))},[]),d=Y.useCallback(function(m){u(m.type,sg(m),m.target,a(m,t.lockRef.current))},[]);Y.useEffect(function(){return Bc.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,Lc),document.addEventListener("touchmove",l,Lc),document.addEventListener("touchstart",c,Lc),function(){Bc=Bc.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,Lc),document.removeEventListener("touchmove",l,Lc),document.removeEventListener("touchstart",c,Lc)}},[]);var h=t.removeScrollBar,p=t.inert;return Y.createElement(Y.Fragment,null,p?Y.createElement(s,{styles:TW(i)}):null,h?Y.createElement(wW,{gapMode:t.gapMode}):null)}function MW(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const NW=oW(t6,_W);var vA=Y.forwardRef(function(t,e){return Y.createElement(rg,Ts({},t,{ref:e,sideCar:NW}))});vA.classNames=rg.classNames;var PW=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Fc=new WeakMap,og=new WeakMap,ag={},AA=0,c6=function(t){return t&&(t.host||c6(t.parentNode))},IW=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=c6(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},RW=function(t,e,n,r){var i=IW(e,Array.isArray(t)?t:[t]);ag[n]||(ag[n]=new WeakMap);var s=ag[n],o=[],a=new Set,l=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(d){if(a.has(d))c(d);else try{var h=d.getAttribute(r),p=h!==null&&h!=="false",m=(Fc.get(d)||0)+1,g=(s.get(d)||0)+1;Fc.set(d,m),s.set(d,g),o.push(d),m===1&&p&&og.set(d,!0),g===1&&d.setAttribute(n,"true"),p||d.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",d,y)}})};return c(e),a.clear(),AA++,function(){o.forEach(function(f){var d=Fc.get(f)-1,h=s.get(f)-1;Fc.set(f,d),s.set(f,h),d||(og.has(f)||f.removeAttribute(r),og.delete(f)),h||f.removeAttribute(n)}),AA--,AA||(Fc=new WeakMap,Fc=new WeakMap,og=new WeakMap,ag={})}},f6=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=PW(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),RW(r,i,n,"aria-hidden")):function(){return null}},xA="Dialog",[d6,q1e]=uA(xA),[LW,Qi]=d6(xA),h6=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=Y.useRef(null),l=Y.useRef(null),[u=!1,c]=UO({prop:r,defaultProp:i,onChange:s});return k.jsx(LW,{scope:e,triggerRef:a,contentRef:l,contentId:Xm(),titleId:Xm(),descriptionId:Xm(),open:u,onOpenChange:c,onOpenToggle:Y.useCallback(()=>c(f=>!f),[c]),modal:o,children:n})};h6.displayName=xA;var p6="DialogTrigger",m6=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Qi(p6,n),s=Di(e,i.triggerRef);return k.jsx($r.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":SA(i.open),...r,ref:s,onClick:ai(t.onClick,i.onOpenToggle)})});m6.displayName=p6;var EA="DialogPortal",[BW,g6]=d6(EA,{forceMount:void 0}),y6=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Qi(EA,e);return k.jsx(BW,{scope:e,forceMount:n,children:Y.Children.map(r,o=>k.jsx(Ih,{present:n||s.open,children:k.jsx(QO,{asChild:!0,container:i,children:o})}))})};y6.displayName=EA;var lg="DialogOverlay",b6=Y.forwardRef((t,e)=>{const n=g6(lg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Qi(lg,t.__scopeDialog);return s.modal?k.jsx(Ih,{present:r||s.open,children:k.jsx(FW,{...i,ref:e})}):null});b6.displayName=lg;var FW=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Qi(lg,n);return k.jsx(vA,{as:Zm,allowPinchZoom:!0,shards:[i.contentRef],children:k.jsx($r.div,{"data-state":SA(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Wl="DialogContent",w6=Y.forwardRef((t,e)=>{const n=g6(Wl,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Qi(Wl,t.__scopeDialog);return k.jsx(Ih,{present:r||s.open,children:s.modal?k.jsx(UW,{...i,ref:e}):k.jsx(jW,{...i,ref:e})})});w6.displayName=Wl;var UW=Y.forwardRef((t,e)=>{const n=Qi(Wl,t.__scopeDialog),r=Y.useRef(null),i=Di(e,n.contentRef,r);return Y.useEffect(()=>{const s=r.current;if(s)return f6(s)},[]),k.jsx(v6,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ai(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ai(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:ai(t.onFocusOutside,s=>s.preventDefault())})}),jW=Y.forwardRef((t,e)=>{const n=Qi(Wl,t.__scopeDialog),r=Y.useRef(!1),i=Y.useRef(!1);return k.jsx(v6,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),v6=Y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Qi(Wl,n),l=Y.useRef(null),u=Di(e,l);return JO(),k.jsxs(k.Fragment,{children:[k.jsx(Ic,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:k.jsx(dA,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":SA(a.open),...o,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),k.jsxs(k.Fragment,{children:[k.jsx(HW,{titleId:a.titleId}),k.jsx(zW,{contentRef:l,descriptionId:a.descriptionId})]})]})}),kA="DialogTitle",A6=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Qi(kA,n);return k.jsx($r.h2,{id:i.titleId,...r,ref:e})});A6.displayName=kA;var x6="DialogDescription",E6=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Qi(x6,n);return k.jsx($r.p,{id:i.descriptionId,...r,ref:e})});E6.displayName=x6;var k6="DialogClose",S6=Y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Qi(k6,n);return k.jsx($r.button,{type:"button",...r,ref:e,onClick:ai(t.onClick,()=>i.onOpenChange(!1))})});S6.displayName=k6;function SA(t){return t?"open":"closed"}var C6="DialogTitleWarning",[Q1e,D6]=AG(C6,{contentName:Wl,titleName:kA,docsSlug:"dialog"}),HW=({titleId:t})=>{const e=D6(C6),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
470
-
471
- If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
472
-
473
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return Y.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},VW="DialogDescriptionWarning",zW=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${D6(VW).contentName}}.`;return Y.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},T6=h6,O6=m6,_6=y6,CA=b6,DA=w6,TA=A6,OA=E6,M6=S6;function $W(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const N6=_.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),ug=()=>{const t=_.useContext(N6);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};$W("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");const GW=typeof window<"u"?_.useLayoutEffect:_.useEffect;function _A(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}function WW(){return MA(/^Mac/)}function KW(){return MA(/^iPhone/)}function qW(){return MA(/^iPad/)||WW()&&navigator.maxTouchPoints>1}function P6(){return KW()||qW()}function MA(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):void 0}const NA=typeof document<"u"&&window.visualViewport;function I6(t){let e=window.getComputedStyle(t);return/(auto|scroll)/.test(e.overflow+e.overflowX+e.overflowY)}function R6(t){for(I6(t)&&(t=t.parentElement);t&&!I6(t);)t=t.parentElement;return t||document.scrollingElement||document.documentElement}const QW=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let cg=0,PA;function JW(t={}){let{isDisabled:e}=t;GW(()=>{if(!e)return cg++,cg===1&&(P6()?PA=XW():PA=YW()),()=>{cg--,cg===0&&PA()}},[e])}function YW(){return _A(L6(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function XW(){let t,e=0,n=f=>{t=R6(f.target),!(t===document.documentElement&&t===document.body)&&(e=f.changedTouches[0].pageY)},r=f=>{if(!t||t===document.documentElement||t===document.body){f.preventDefault();return}let d=f.changedTouches[0].pageY,h=t.scrollTop,p=t.scrollHeight-t.clientHeight;p!==0&&((h<=0&&d>e||h>=p&&d<e)&&f.preventDefault(),e=d)},i=f=>{let d=f.target;IA(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},s=f=>{let d=f.target;IA(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",NA&&(NA.height<window.innerHeight?requestAnimationFrame(()=>{B6(d)}):NA.addEventListener("resize",()=>B6(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},a=window.pageXOffset,l=window.pageYOffset,u=_A(L6(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=_A(Rh(document,"touchstart",n,{passive:!1,capture:!0}),Rh(document,"touchmove",r,{passive:!1,capture:!0}),Rh(document,"touchend",i,{passive:!1,capture:!0}),Rh(document,"focus",s,!0),Rh(window,"scroll",o));return()=>{u(),c(),window.scrollTo(a,l)}}function L6(t,e,n){let r=t.style[e];return t.style[e]=n,()=>{t.style[e]=r}}function Rh(t,e,n,r){return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}}function B6(t){let e=document.scrollingElement||document.documentElement;for(;t&&t!==e;){let n=R6(t);if(n!==document.documentElement&&n!==document.body&&n!==t){let r=n.getBoundingClientRect().top,i=t.getBoundingClientRect().top,s=t.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom;s>o&&(n.scrollTop+=i-r)}t=n.parentElement}}function IA(t){return t instanceof HTMLInputElement&&!QW.has(t.type)||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable}function ZW(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function eK(...t){return e=>t.forEach(n=>ZW(n,e))}function F6(...t){return Y.useCallback(eK(...t),t)}let Lh=null;function tK({isOpen:t,modal:e,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:s}){const[o,a]=_.useState(()=>typeof window<"u"?window.location.href:""),l=_.useRef(0),u=_.useCallback(()=>{if(Lh===null&&t&&!s){Lh={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:d}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const h=d-window.innerHeight;h&&l.current>=d&&(document.body.style.top=`${-(l.current+h)}px`)}),300)}},[t]),c=_.useCallback(()=>{if(Lh!==null&&!s){const f=-parseInt(document.body.style.top,10),d=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Lh),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){a(window.location.href);return}window.scrollTo(d,f)}),Lh=null}},[o]);return _.useEffect(()=>{function f(){l.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),_.useEffect(()=>{n||!r||(t?(!window.matchMedia("(display-mode: standalone)").matches&&u(),e||window.setTimeout(()=>{c()},500)):c())},[t,r,o,e,n,u,c]),{restorePositionSetting:c}}const U6=new WeakMap;function tn(t,e,n=!1){if(!t||!(t instanceof HTMLElement))return;let r={};Object.entries(e).forEach(([i,s])=>{if(i.startsWith("--")){t.style.setProperty(i,s);return}r[i]=t.style[i],t.style[i]=s}),!n&&U6.set(t,r)}function fg(t,e){if(!t||!(t instanceof HTMLElement))return;let n=U6.get(t);n&&(e?t.style[e]=n[e]:Object.entries(n).forEach(([r,i])=>{t.style[r]=i}))}const Rn=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function dg(t,e){if(!t)return null;const n=window.getComputedStyle(t),r=n.transform||n.webkitTransform||n.mozTransform;let i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(", ")[Rn(e)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(", ")[Rn(e)?5:4]):null)}function nK(t){return 8*(Math.log(t+1)-2)}const $t={DURATION:.5,EASE:[.32,.72,0,1]},j6=.4;function H6(t){const e=_.useRef(t);return _.useEffect(()=>{e.current=t}),_.useMemo(()=>(...n)=>e.current==null?void 0:e.current.call(e,...n),[])}function rK({defaultProp:t,onChange:e}){const n=_.useState(t),[r]=n,i=_.useRef(r),s=H6(e);return _.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}function iK({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=rK({defaultProp:e,onChange:n}),s=t!==void 0,o=s?t:r,a=H6(n),l=_.useCallback(u=>{if(s){const f=typeof u=="function"?u(t):u;f!==t&&a(f)}else i(u)},[s,t,i,a]);return[o,l]}function sK({activeSnapPointProp:t,setActiveSnapPointProp:e,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:s,onSnapPointChange:o,direction:a="bottom"}){const[l,u]=iK({prop:t,defaultProp:n==null?void 0:n[0],onChange:e}),c=_.useMemo(()=>l===(n==null?void 0:n[n.length-1])||null,[n,l]),f=n&&n.length>0&&(s||s===0)&&!Number.isNaN(s)&&n[s]===l||!n,d=_.useMemo(()=>n==null?void 0:n.findIndex(w=>w===l),[n,l]),h=_.useMemo(()=>{var w;return(w=n==null?void 0:n.map(b=>{const E=typeof window<"u",x=typeof b=="string";let O=0;if(x&&(O=parseInt(b,10)),Rn(a)){const D=x?O:E?b*window.innerHeight:0;return E?a==="bottom"?window.innerHeight-D:-window.innerHeight+D:D}const S=x?O:E?b*window.innerWidth:0;return E?a==="right"?window.innerWidth-S:-window.innerWidth+S:S}))!=null?w:[]},[n]),p=_.useMemo(()=>d!==null?h==null?void 0:h[d]:null,[h,d]),m=_.useCallback(w=>{var b;const E=(b=h==null?void 0:h.findIndex(x=>x===w))!=null?b:null;o(E),tn(r.current,{transition:`transform ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`,transform:Rn(a)?`translate3d(0, ${w}px, 0)`:`translate3d(${w}px, 0, 0)`}),h&&E!==h.length-1&&E!==s?tn(i.current,{transition:`opacity ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`,opacity:"0"}):tn(i.current,{transition:`opacity ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`,opacity:"1"}),u(E!==null?n==null?void 0:n[E]:null)},[r.current,n,h,s,i,u]);_.useEffect(()=>{if(l||t){var w;const b=(w=n==null?void 0:n.findIndex(E=>E===t||E===l))!=null?w:-1;h&&b!==-1&&typeof h[b]=="number"&&m(h[b])}},[l,t,n,h,m]);function g({draggedDistance:w,closeDrawer:b,velocity:E,dismissible:x}){if(s===void 0)return;const O=a==="bottom"||a==="right"?(p??0)-w:(p??0)+w,S=d===s-1,D=d===0,I=w>0;if(S&&tn(i.current,{transition:`opacity ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`}),E>2&&!I){x?b():m(h[0]);return}if(E>2&&I&&h&&n){m(h[n.length-1]);return}const F=h==null?void 0:h.reduce((V,B)=>typeof V!="number"||typeof B!="number"?V:Math.abs(B-O)<Math.abs(V-O)?B:V),Q=Rn(a)?window.innerHeight:window.innerWidth;if(E>j6&&Math.abs(w)<Q*.4){const V=I?1:-1;if(V>0&&c){m(h[n.length-1]);return}if(D&&V<0&&x&&b(),d===null)return;m(h[d+V]);return}m(F)}function y({draggedDistance:w}){if(p===null)return;const b=a==="bottom"||a==="right"?p-w:p+w;(a==="bottom"||a==="right")&&b<h[h.length-1]||(a==="top"||a==="left")&&b>h[h.length-1]||tn(r.current,{transform:Rn(a)?`translate3d(0, ${b}px, 0)`:`translate3d(${b}px, 0, 0)`})}function v(w,b){if(!n||typeof d!="number"||!h||s===void 0)return null;const E=d===s-1;if(d>=s&&b)return 0;if(E&&!b)return 1;if(!f&&!E)return null;const O=E?d+1:d-1,S=E?h[O]-h[O-1]:h[O+1]-h[O],D=w/Math.abs(S);return E?1-D:D}return{isLastSnapPoint:c,activeSnapPoint:l,shouldFade:f,getPercentageDragged:v,setActiveSnapPoint:u,activeSnapPointIndex:d,onRelease:g,onDrag:y,snapPointsOffset:h}}const oK=.25,aK=100,V6=8,Kl=16,z6=26,RA="vaul-dragging";function $6({open:t,onOpenChange:e,children:n,shouldScaleBackground:r,onDrag:i,onRelease:s,snapPoints:o,nested:a=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=oK,scrollLockTimeout:c=aK,dismissible:f=!0,handleOnly:d=!1,fadeFromIndex:h=o&&o.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:g,modal:y=!0,onClose:v,noBodyStyles:w,direction:b="bottom",preventScrollRestoration:E=!0,disablePreventScroll:x=!1}){var O;const[S=!1,D]=_.useState(!1),[I,F]=_.useState(!1),[Q,V]=_.useState(!1),[B,N]=_.useState(!1),[H,K]=_.useState(!1),[J,X]=_.useState(!1),ie=_.useRef(null),le=_.useRef(null),Pe=_.useRef(null),xe=_.useRef(null),Ie=_.useRef(null),ke=_.useRef(!1),$=_.useRef(null),ne=_.useRef(0),G=_.useRef(!1),Z=_.useRef(0),A=_.useRef(null),P=_.useRef(((O=A.current)==null?void 0:O.getBoundingClientRect().height)||0),ue=_.useRef(0),de=_.useCallback(re=>{o&&re===Ke.length-1&&(le.current=new Date)},[]),{activeSnapPoint:oe,activeSnapPointIndex:we,setActiveSnapPoint:De,onRelease:pe,snapPointsOffset:Ke,onDrag:qe,shouldFade:tt,getPercentageDragged:lt}=sK({snapPoints:o,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:A,fadeFromIndex:h,overlayRef:ie,onSnapPointChange:de,direction:b});JW({isDisabled:!S||H||!y||J||!I||x});const{restorePositionSetting:ft}=tK({isOpen:S,modal:y,nested:a,hasBeenOpened:I,preventScrollRestoration:E,noBodyStyles:w});function Ze(){return(window.innerWidth-z6)/window.innerWidth}function Se(re){var ce;!f&&!o||A.current&&!A.current.contains(re.target)||(P.current=((ce=A.current)==null?void 0:ce.getBoundingClientRect().height)||0,K(!0),Pe.current=new Date,P6()&&window.addEventListener("touchend",()=>ke.current=!1,{once:!0}),re.target.setPointerCapture(re.pointerId),ne.current=Rn(b)?re.clientY:re.clientX)}function Ue(re,ce){var ye;let ge=re;const Le=(ye=window.getSelection())==null?void 0:ye.toString(),Ve=A.current?dg(A.current,b):null,pt=new Date;if(ge.hasAttribute("data-vaul-no-drag")||ge.closest("[data-vaul-no-drag]"))return!1;if(b==="right"||b==="left")return!0;if(le.current&&pt.getTime()-le.current.getTime()<500)return!1;if(Ve!==null&&(b==="bottom"?Ve>0:Ve<0))return!0;if(Le&&Le.length>0)return!1;if(Ie.current&&pt.getTime()-Ie.current.getTime()<c&&Ve===0||ce)return Ie.current=pt,!1;for(;ge;){if(ge.scrollHeight>ge.clientHeight){if(ge.scrollTop!==0)return Ie.current=new Date,!1;if(ge.getAttribute("role")==="dialog")return!0}ge=ge.parentNode}return!0}function C(re){if(A.current&&H){const ce=b==="bottom"||b==="right"?1:-1,ye=(ne.current-(Rn(b)?re.clientY:re.clientX))*ce,ge=ye>0,Le=o&&!f&&!ge;if(Le&&we===0)return;const Ve=Math.abs(ye),pt=document.querySelector("[vaul-drawer-wrapper]");let nt=Ve/P.current;const et=lt(Ve,ge);if(et!==null&&(nt=et),Le&&nt>=1||!ke.current&&!Ue(re.target,ge))return;if(A.current.classList.add(RA),ke.current=!0,tn(A.current,{transition:"none"}),tn(ie.current,{transition:"none"}),o&&qe({draggedDistance:ye}),ge&&!o){const Ct=nK(ye),kt=Math.min(Ct*-1,0)*ce;tn(A.current,{transform:Rn(b)?`translate3d(0, ${kt}px, 0)`:`translate3d(${kt}px, 0, 0)`});return}const Lt=1-nt;if((tt||h&&we===h-1)&&(i==null||i(re,nt),tn(ie.current,{opacity:`${Lt}`,transition:"none"},!0)),pt&&ie.current&&r){const Ct=Math.min(Ze()+nt*(1-Ze()),1),kt=8-nt*8,Jt=Math.max(0,14-nt*14);tn(pt,{borderRadius:`${kt}px`,transform:Rn(b)?`scale(${Ct}) translate3d(0, ${Jt}px, 0)`:`scale(${Ct}) translate3d(${Jt}px, 0, 0)`,transition:"none"},!0)}if(!o){const Ct=Ve*ce;tn(A.current,{transform:Rn(b)?`translate3d(0, ${Ct}px, 0)`:`translate3d(${Ct}px, 0, 0)`})}}}_.useEffect(()=>()=>{te(!1),ft()},[]),_.useEffect(()=>{var re;function ce(){if(!A.current)return;const ye=document.activeElement;if(IA(ye)||G.current){var ge;const Le=((ge=window.visualViewport)==null?void 0:ge.height)||0;let Ve=window.innerHeight-Le;const pt=A.current.getBoundingClientRect().height||0;ue.current||(ue.current=pt);const nt=A.current.getBoundingClientRect().top;if(Math.abs(Z.current-Ve)>60&&(G.current=!G.current),o&&o.length>0&&Ke&&we){const et=Ke[we]||0;Ve+=et}if(Z.current=Ve,pt>Le||G.current){const et=A.current.getBoundingClientRect().height;let Lt=et;et>Le&&(Lt=Le-z6),g?A.current.style.height=`${et-Math.max(Ve,0)}px`:A.current.style.height=`${Math.max(Lt,Le-nt)}px`}else A.current.style.height=`${ue.current}px`;o&&o.length>0&&!G.current?A.current.style.bottom="0px":A.current.style.bottom=`${Math.max(Ve,0)}px`}}return(re=window.visualViewport)==null||re.addEventListener("resize",ce),()=>{var ye;return(ye=window.visualViewport)==null?void 0:ye.removeEventListener("resize",ce)}},[we,o,Ke]);function M(){A.current&&(z(),v==null||v(),tn(A.current,{transform:Rn(b)?`translate3d(0, ${b==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${b==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`}),tn(ie.current,{opacity:"0",transition:`opacity ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`}),te(!1),setTimeout(()=>{V(!1),D(!1)},300),setTimeout(()=>{o&&De(o[0])},$t.DURATION*1e3))}_.useEffect(()=>{if(!S&&r){const re=setTimeout(()=>{fg(document.body)},200);return()=>clearTimeout(re)}},[S,r]),_.useLayoutEffect(()=>{t?(D(!0),F(!0)):M()},[t]),_.useEffect(()=>{B&&(e==null||e(S))},[S]),_.useEffect(()=>{N(!0)},[]);function R(){if(!A.current)return;const re=document.querySelector("[vaul-drawer-wrapper]"),ce=dg(A.current,b);tn(A.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`}),tn(ie.current,{transition:`opacity ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`,opacity:"1"}),r&&ce&&ce>0&&S&&tn(re,{borderRadius:`${V6}px`,overflow:"hidden",...Rn(b)?{transform:`scale(${Ze()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Ze()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${$t.DURATION}s`,transitionTimingFunction:`cubic-bezier(${$t.EASE.join(",")})`},!0)}function z(){!H||!A.current||(A.current.classList.remove(RA),ke.current=!1,K(!1),xe.current=new Date)}function se(re){if(!H||!A.current)return;A.current.classList.remove(RA),ke.current=!1,K(!1),xe.current=new Date;const ce=dg(A.current,b);if(!Ue(re.target,!1)||!ce||Number.isNaN(ce)||Pe.current===null)return;const ye=xe.current.getTime()-Pe.current.getTime(),ge=ne.current-(Rn(b)?re.clientY:re.clientX),Le=Math.abs(ge)/ye;if(Le>.05&&(X(!0),setTimeout(()=>{X(!1)},200)),o){pe({draggedDistance:ge*(b==="bottom"||b==="right"?1:-1),closeDrawer:M,velocity:Le,dismissible:f}),s==null||s(re,!0);return}if(b==="bottom"||b==="right"?ge>0:ge<0){R(),s==null||s(re,!0);return}if(Le>j6){M(),s==null||s(re,!1);return}var Ve;const pt=Math.min((Ve=A.current.getBoundingClientRect().height)!=null?Ve:0,window.innerHeight);if(ce>=pt*u){M(),s==null||s(re,!1);return}s==null||s(re,!0),R()}_.useEffect(()=>{S&&(tn(document.documentElement,{scrollBehavior:"auto"}),le.current=new Date,te(!0))},[S]),_.useEffect(()=>{if(A.current&&Q){var re;const ce=A==null||(re=A.current)==null?void 0:re.querySelectorAll("*");ce==null||ce.forEach(ye=>{const ge=ye;(ge.scrollHeight>ge.clientHeight||ge.scrollWidth>ge.clientWidth)&&ge.classList.add("vaul-scrollable")})}},[Q]);function te(re){const ce=document.querySelector("[vaul-drawer-wrapper]");!ce||!r||(re?(l&&(w||(tn(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),tn(document.body,{background:"black"},!0))),tn(ce,{borderRadius:`${V6}px`,overflow:"hidden",...Rn(b)?{transform:`scale(${Ze()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Ze()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${$t.DURATION}s`,transitionTimingFunction:`cubic-bezier(${$t.EASE.join(",")})`})):(fg(ce,"overflow"),fg(ce,"transform"),fg(ce,"borderRadius"),tn(ce,{transitionProperty:"transform, border-radius",transitionDuration:`${$t.DURATION}s`,transitionTimingFunction:`cubic-bezier(${$t.EASE.join(",")})`})))}function fe(re){const ce=re?(window.innerWidth-Kl)/window.innerWidth:1,ye=re?-Kl:0;$.current&&window.clearTimeout($.current),tn(A.current,{transition:`transform ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`,transform:`scale(${ce}) translate3d(0, ${ye}px, 0)`}),!re&&A.current&&($.current=setTimeout(()=>{const ge=dg(A.current,b);tn(A.current,{transition:"none",transform:Rn(b)?`translate3d(0, ${ge}px, 0)`:`translate3d(${ge}px, 0, 0)`})},500))}function he(re,ce){if(ce<0)return;const ye=Rn(b)?window.innerHeight:window.innerWidth,ge=(ye-Kl)/ye,Le=ge+ce*(1-ge),Ve=-Kl+ce*Kl;tn(A.current,{transform:Rn(b)?`scale(${Le}) translate3d(0, ${Ve}px, 0)`:`scale(${Le}) translate3d(${Ve}px, 0, 0)`,transition:"none"})}function U(re,ce){const ye=Rn(b)?window.innerHeight:window.innerWidth,ge=ce?(ye-Kl)/ye:1,Le=ce?-Kl:0;ce&&tn(A.current,{transition:`transform ${$t.DURATION}s cubic-bezier(${$t.EASE.join(",")})`,transform:Rn(b)?`scale(${ge}) translate3d(0, ${Le}px, 0)`:`scale(${ge}) translate3d(${Le}px, 0, 0)`})}return _.createElement(T6,{modal:y,onOpenChange:re=>{if(t!==void 0){e==null||e(re);return}re?(F(!0),D(re)):M()},open:S},_.createElement(N6.Provider,{value:{visible:Q,activeSnapPoint:oe,snapPoints:o,setActiveSnapPoint:De,drawerRef:A,overlayRef:ie,scaleBackground:te,onOpenChange:e,onPress:Se,setVisible:V,onRelease:se,onDrag:C,dismissible:f,handleOnly:d,isOpen:S,isDragging:H,shouldFade:tt,closeDrawer:M,onNestedDrag:he,onNestedOpenChange:fe,onNestedRelease:U,keyboardIsOpen:G,openProp:t,modal:y,snapPointsOffset:Ke,direction:b}},n))}const lK=250,uK=120,G6=_.forwardRef(function({preventCycle:t=!1,children:e,...n},r){const{visible:i,closeDrawer:s,isDragging:o,snapPoints:a,activeSnapPoint:l,setActiveSnapPoint:u,dismissible:c,handleOnly:f,onPress:d,onDrag:h}=ug(),p=_.useRef(null),m=_.useRef(!1);function g(){if(m.current){w();return}window.setTimeout(()=>{y()},uK)}function y(){if(o||t||m.current){w();return}if(w(),(!a||a.length===0)&&c){s();return}if(l===a[a.length-1]&&c){s();return}const E=a.findIndex(O=>O===l);if(E===-1)return;const x=a[E+1];u(x)}function v(){p.current=window.setTimeout(()=>{m.current=!0},lK)}function w(){window.clearTimeout(p.current),m.current=!1}return _.createElement("div",{onClick:g,onDoubleClick:()=>{m.current=!0,s()},onPointerCancel:w,onPointerDown:b=>{f&&d(b),v()},onPointerMove:b=>{f&&h(b)},ref:r,"vaul-drawer-visible":i?"true":"false","vaul-handle":"","aria-hidden":"true",...n},_.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},e))});G6.displayName="Drawer.Handle";const W6=_.forwardRef(function({children:t,...e},n){const{overlayRef:r,snapPoints:i,onRelease:s,shouldFade:o,isOpen:a,visible:l}=ug(),u=F6(n,r),c=i&&i.length>0;return _.createElement(CA,{onMouseUp:s,ref:u,"vaul-drawer-visible":l?"true":"false","vaul-overlay":"","vaul-snap-points":a&&c?"true":"false","vaul-snap-points-overlay":a&&o?"true":"false",...e})});W6.displayName="Drawer.Overlay";const K6=_.forwardRef(function({onOpenAutoFocus:t,onPointerDownOutside:e,onAnimationEnd:n,style:r,...i},s){const{drawerRef:o,onPress:a,onRelease:l,onDrag:u,dismissible:c,keyboardIsOpen:f,snapPointsOffset:d,visible:h,closeDrawer:p,modal:m,openProp:g,onOpenChange:y,setVisible:v,handleOnly:w,direction:b}=ug(),E=F6(s,o),x=_.useRef(null),O=_.useRef(!1),S=(D,I,F=0)=>{if(O.current)return!0;const Q=Math.abs(D.y),V=Math.abs(D.x),B=V>Q,N=["bottom","right"].includes(I)?1:-1;if(I==="left"||I==="right"){if(!(D.x*N<0)&&V>=0&&V<=F)return B}else if(!(D.y*N<0)&&Q>=0&&Q<=F)return!B;return O.current=!0,!0};return _.useEffect(()=>{v(!0)},[]),_.createElement(DA,{"vaul-drawer":"","vaul-drawer-direction":b,"vaul-drawer-visible":h?"true":"false",...i,ref:E,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...r}:r,onOpenAutoFocus:D=>{if(t)t(D);else{var I;D.preventDefault(),(I=o.current)==null||I.focus()}},onPointerDown:D=>{w||(i.onPointerDown==null||i.onPointerDown.call(i,D),x.current={x:D.clientX,y:D.clientY},a(D))},onPointerDownOutside:D=>{if(e==null||e(D),!m||D.defaultPrevented){D.preventDefault();return}f.current&&(f.current=!1),D.preventDefault(),y==null||y(!1),!(!c||g!==void 0)&&p()},onFocusOutside:D=>{if(!m){D.preventDefault();return}},onEscapeKeyDown:D=>{if(!m){D.preventDefault();return}},onPointerMove:D=>{if(w||(i.onPointerMove==null||i.onPointerMove.call(i,D),!x.current))return;const I=D.clientY-x.current.y,F=D.clientX-x.current.x,Q=D.pointerType==="touch"?10:2;S({x:F,y:I},b,Q)?u(D):(Math.abs(F)>Q||Math.abs(I)>Q)&&(x.current=null)},onPointerUp:D=>{i.onPointerUp==null||i.onPointerUp.call(i,D),x.current=null,O.current=!1,l(D)}})});K6.displayName="Drawer.Content";function cK({onDrag:t,onOpenChange:e,...n}){const{onNestedDrag:r,onNestedOpenChange:i,onNestedRelease:s}=ug();if(!r)throw new Error("Drawer.NestedRoot must be placed in another drawer");return _.createElement($6,{nested:!0,onClose:()=>{i(!1)},onDrag:(o,a)=>{r(o,a),t==null||t(o,a)},onOpenChange:o=>{o&&i(o),e==null||e(o)},onRelease:s,...n})}const Ji={Root:$6,NestedRoot:cK,Content:K6,Handle:G6,Overlay:W6,Trigger:O6,Portal:_6,Close:M6,Title:TA,Description:OA},q6=({shouldScaleBackground:t=!0,...e})=>k.jsx(Ji.Root,{shouldScaleBackground:t,...e});q6.displayName="Drawer";const Q6=Ji.Trigger,fK=Ji.Portal,J6=_.forwardRef(({className:t,...e},n)=>k.jsx(Ji.Overlay,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));J6.displayName=Ji.Overlay.displayName;const Y6=_.forwardRef(({className:t,children:e,...n},r)=>k.jsxs(fK,{children:[k.jsx(J6,{}),k.jsx(Ic,{trapped:!1,children:k.jsxs(Ji.Content,{ref:r,className:Ne("fixed inset-x-0 bottom-0 z-50 flex h-auto flex-col rounded-t-[16px] drop-shadow-2xl bg-white",t),...n,children:[k.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-white"}),e,k.jsx(Ji.Close,{className:"absolute right-2 top-4 hover:bg-gray-200 rounded-full p-2 ring-offset-white transition focus:outline-none focus:ring-2 focus:ring-blue-700 focus:ring-offset-2 disabled:pointer-events-none text-black data-[state=open]:bg-gray-100 data-[state=open]:text-black",children:k.jsx(dG,{size:20,fill:"black"})})]})})]}));Y6.displayName="DrawerContent";const X6=({className:t,...e})=>k.jsx("div",{className:Ne("grid gap-1.5 p-4 text-center sm:text-left",t),...e});X6.displayName="DrawerHeader";const Z6=_.forwardRef(({className:t,...e},n)=>k.jsx(Ji.Title,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",t),...e}));Z6.displayName=Ji.Title.displayName;const dK=_.forwardRef(({className:t,...e},n)=>k.jsx(Ji.Description,{ref:n,className:Ne("text-sm text-black",t),...e}));dK.displayName=Ji.Description.displayName;const hK=({title:t,content:e,contentClassName:n})=>k.jsxs(Y6,{className:"w-full z-20",children:[k.jsx(X6,{className:"px-4 pt-0",children:k.jsx(Z6,{className:"text-left sm:text-center text-base",children:t})}),k.jsx("div",{className:Ne("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",n),children:e&&e})]}),pK=T6,mK=O6,gK=_6,yK=M6,e_=Y.forwardRef(({className:t,...e},n)=>k.jsx(CA,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));e_.displayName=CA.displayName;const t_=Y.forwardRef(({className:t,children:e,...n},r)=>k.jsxs(gK,{children:[k.jsx(e_,{}),k.jsx(Ic,{trapped:!1,children:k.jsxs(DA,{ref:r,className:Ne("fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%] gap-4 bg-white duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-xl",t),...n,children:[k.jsx("div",{}),e]})})]}));t_.displayName=DA.displayName;const n_=({className:t,...e})=>k.jsx("div",{className:Ne("grid gap-1.5 p-4 text-center sm:text-left",t),...e});n_.displayName="DialogHeader";const r_=({className:t,...e})=>k.jsx("div",{className:Ne("flex space-x-2",t),...e});r_.displayName="DialogFooter";const i_=Y.forwardRef(({className:t,...e},n)=>k.jsx(TA,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",t),...e}));i_.displayName=TA.displayName;const bK=Y.forwardRef(({className:t,...e},n)=>k.jsx(OA,{ref:n,className:Ne("text-sm text-black",t),...e}));bK.displayName=OA.displayName;function wK(t){return Object.prototype.toString.call(t)==="[object Object]"}function s_(t){return wK(t)||Array.isArray(t)}function vK(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function LA(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;const i=JSON.stringify(Object.keys(t.breakpoints||{})),s=JSON.stringify(Object.keys(e.breakpoints||{}));return i!==s?!1:n.every(o=>{const a=t[o],l=e[o];return typeof a=="function"?`${a}`==`${l}`:!s_(a)||!s_(l)?a===l:LA(a,l)})}function o_(t){return t.concat().sort((e,n)=>e.name>n.name?1:-1).map(e=>e.options)}function AK(t,e){if(t.length!==e.length)return!1;const n=o_(t),r=o_(e);return n.every((i,s)=>{const o=r[s];return LA(i,o)})}function BA(t){return typeof t=="number"}function FA(t){return typeof t=="string"}function UA(t){return typeof t=="boolean"}function a_(t){return Object.prototype.toString.call(t)==="[object Object]"}function on(t){return Math.abs(t)}function jA(t){return Math.sign(t)}function Bh(t,e){return on(t-e)}function xK(t,e){if(t===0||e===0||on(t)<=on(e))return 0;const n=Bh(on(t),on(e));return on(n/t)}function Fh(t){return jh(t).map(Number)}function Yi(t){return t[Uh(t)]}function Uh(t){return Math.max(0,t.length-1)}function HA(t,e){return e===Uh(t)}function l_(t,e=0){return Array.from(Array(t),(n,r)=>e+r)}function jh(t){return Object.keys(t)}function u_(t,e){return[t,e].reduce((n,r)=>(jh(r).forEach(i=>{const s=n[i],o=r[i],a=a_(s)&&a_(o);n[i]=a?u_(s,o):o}),n),{})}function VA(t,e){return typeof e.MouseEvent<"u"&&t instanceof e.MouseEvent}function EK(t,e){const n={start:r,center:i,end:s};function r(){return 0}function i(l){return s(l)/2}function s(l){return e-l}function o(l,u){return FA(t)?n[t](l):t(e,l,u)}return{measure:o}}function Hh(){let t=[];function e(i,s,o,a={passive:!0}){let l;if("addEventListener"in i)i.addEventListener(s,o,a),l=()=>i.removeEventListener(s,o,a);else{const u=i;u.addListener(o),l=()=>u.removeListener(o)}return t.push(l),r}function n(){t=t.filter(i=>i())}const r={add:e,clear:n};return r}function kK(t,e,n,r){const i=Hh(),s=1e3/60;let o=null,a=0,l=0;function u(){i.add(t,"visibilitychange",()=>{t.hidden&&p()})}function c(){h(),i.clear()}function f(g){if(!l)return;o||(o=g);const y=g-o;for(o=g,a+=y;a>=s;)n(),a-=s;const v=on(a/s);r(v),l&&e.requestAnimationFrame(f)}function d(){l||(l=e.requestAnimationFrame(f))}function h(){e.cancelAnimationFrame(l),o=null,a=0,l=0}function p(){o=null,a=0}return{init:u,destroy:c,start:d,stop:h,update:n,render:r}}function SK(t,e){const n=e==="rtl",r=t==="y",i=r?"y":"x",s=r?"x":"y",o=!r&&n?-1:1,a=c(),l=f();function u(p){const{height:m,width:g}=p;return r?m:g}function c(){return r?"top":n?"right":"left"}function f(){return r?"bottom":n?"left":"right"}function d(p){return p*o}return{scroll:i,cross:s,startEdge:a,endEdge:l,measureSize:u,direction:d}}function ql(t=0,e=0){const n=on(t-e);function r(u){return u<t}function i(u){return u>e}function s(u){return r(u)||i(u)}function o(u){return s(u)?r(u)?t:e:u}function a(u){return n?u-n*Math.ceil((u-e)/n):u}return{length:n,max:e,min:t,constrain:o,reachedAny:s,reachedMax:i,reachedMin:r,removeOffset:a}}function c_(t,e,n){const{constrain:r}=ql(0,t),i=t+1;let s=o(e);function o(d){return n?on((i+d)%i):r(d)}function a(){return s}function l(d){return s=o(d),f}function u(d){return c().set(a()+d)}function c(){return c_(t,a(),n)}const f={get:a,set:l,add:u,clone:c};return f}function CK(t,e,n,r,i,s,o,a,l,u,c,f,d,h,p,m,g,y,v){const{cross:w,direction:b}=t,E=["INPUT","SELECT","TEXTAREA"],x={passive:!1},O=Hh(),S=Hh(),D=ql(50,225).constrain(h.measure(20)),I={mouse:300,touch:400},F={mouse:500,touch:600},Q=p?43:25;let V=!1,B=0,N=0,H=!1,K=!1,J=!1,X=!1;function ie(ue){if(!v)return;function de(we){(UA(v)||v(ue,we))&&$(we)}const oe=e;O.add(oe,"dragstart",we=>we.preventDefault(),x).add(oe,"touchmove",()=>{},x).add(oe,"touchend",()=>{}).add(oe,"touchstart",de).add(oe,"mousedown",de).add(oe,"touchcancel",G).add(oe,"contextmenu",G).add(oe,"click",Z,!0)}function le(){O.clear(),S.clear()}function Pe(){const ue=X?n:e;S.add(ue,"touchmove",ne,x).add(ue,"touchend",G).add(ue,"mousemove",ne,x).add(ue,"mouseup",G)}function xe(ue){const de=ue.nodeName||"";return E.includes(de)}function Ie(){return(p?F:I)[X?"mouse":"touch"]}function ke(ue,de){const oe=f.add(jA(ue)*-1),we=c.byDistance(ue,!p).distance;return p||on(ue)<D?we:g&&de?we*.5:c.byIndex(oe.get(),0).distance}function $(ue){const de=VA(ue,r);X=de,J=p&&de&&!ue.buttons&&V,V=Bh(i.get(),o.get())>=2,!(de&&ue.button!==0)&&(xe(ue.target)||(H=!0,s.pointerDown(ue),u.useFriction(0).useDuration(0),i.set(o),Pe(),B=s.readPoint(ue),N=s.readPoint(ue,w),d.emit("pointerDown")))}function ne(ue){if(!VA(ue,r)&&ue.touches.length>=2)return G(ue);const oe=s.readPoint(ue),we=s.readPoint(ue,w),De=Bh(oe,B),pe=Bh(we,N);if(!K&&!X&&(!ue.cancelable||(K=De>pe,!K)))return G(ue);const Ke=s.pointerMove(ue);De>m&&(J=!0),u.useFriction(.3).useDuration(.75),a.start(),i.add(b(Ke)),ue.preventDefault()}function G(ue){const oe=c.byDistance(0,!1).index!==f.get(),we=s.pointerUp(ue)*Ie(),De=ke(b(we),oe),pe=xK(we,De),Ke=Q-10*pe,qe=y+pe/50;K=!1,H=!1,S.clear(),u.useDuration(Ke).useFriction(qe),l.distance(De,!p),X=!1,d.emit("pointerUp")}function Z(ue){J&&(ue.stopPropagation(),ue.preventDefault(),J=!1)}function A(){return H}return{init:ie,destroy:le,pointerDown:A}}function DK(t,e){let r,i;function s(f){return f.timeStamp}function o(f,d){const p=`client${(d||t.scroll)==="x"?"X":"Y"}`;return(VA(f,e)?f:f.touches[0])[p]}function a(f){return r=f,i=f,o(f)}function l(f){const d=o(f)-o(i),h=s(f)-s(r)>170;return i=f,h&&(r=f),d}function u(f){if(!r||!i)return 0;const d=o(i)-o(r),h=s(f)-s(r),p=s(f)-s(i)>170,m=d/h;return h&&!p&&on(m)>.1?m:0}return{pointerDown:a,pointerMove:l,pointerUp:u,readPoint:o}}function TK(){function t(n){const{offsetTop:r,offsetLeft:i,offsetWidth:s,offsetHeight:o}=n;return{top:r,right:i+s,bottom:r+o,left:i,width:s,height:o}}return{measure:t}}function OK(t){function e(r){return t*(r/100)}return{measure:e}}function _K(t,e,n,r,i,s,o){let a,l,u=[],c=!1;function f(m){return i.measureSize(o.measure(m))}function d(m){if(!s)return;l=f(t),u=r.map(f);function g(v){for(const w of v){const b=w.target===t,E=r.indexOf(w.target),x=b?l:u[E],O=f(b?t:r[E]);if(on(O-x)>=.5){n.requestAnimationFrame(()=>{m.reInit(),e.emit("resize")});break}}}a=new ResizeObserver(v=>{c||(UA(s)||s(m,v))&&g(v)}),[t].concat(r).forEach(v=>a.observe(v))}function h(){a&&a.disconnect(),c=!0}return{init:d,destroy:h}}function MK(t,e,n,r,i){let s=0,o=0,a=r,l=i,u=t.get(),c=0;function f(){const E=n.get()-t.get(),x=!a;let O=0;return x?(s=0,t.set(n),O=E):(s+=E/a,s*=l,u+=s,t.add(s),O=u-c),o=jA(O),c=u,b}function d(){const E=n.get()-e.get();return on(E)<.001}function h(){return a}function p(){return o}function m(){return s}function g(){return v(r)}function y(){return w(i)}function v(E){return a=E,b}function w(E){return l=E,b}const b={direction:p,duration:h,velocity:m,seek:f,settled:d,useBaseFriction:y,useBaseDuration:g,useFriction:w,useDuration:v};return b}function NK(t,e,n,r,i){const s=i.measure(10),o=i.measure(50),a=ql(.1,.99);let l=!1;function u(){return!(l||!t.reachedAny(n.get())||!t.reachedAny(e.get()))}function c(h){if(!u())return;const p=t.reachedMin(e.get())?"min":"max",m=on(t[p]-e.get()),g=n.get()-e.get(),y=a.constrain(m/o);n.subtract(g*y),!h&&on(g)<s&&(n.set(t.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(h){l=!h}return{shouldConstrain:u,constrain:c,toggleActive:f}}function PK(t,e,n,r,i){const s=ql(-e+t,0),o=f(),a=c(),l=d();function u(p,m){return Bh(p,m)<1}function c(){const p=o[0],m=Yi(o),g=o.lastIndexOf(p),y=o.indexOf(m)+1;return ql(g,y)}function f(){return n.map((p,m)=>{const{min:g,max:y}=s,v=s.constrain(p),w=!m,b=HA(n,m);return w?y:b||u(g,v)?g:u(y,v)?y:v}).map(p=>parseFloat(p.toFixed(3)))}function d(){if(e<=t+i)return[s.max];if(r==="keepSnaps")return o;const{min:p,max:m}=a;return o.slice(p,m)}return{snapsContained:l,scrollContainLimit:a}}function IK(t,e,n){const r=e[0],i=n?r-t:Yi(e);return{limit:ql(i,r)}}function RK(t,e,n,r){const s=e.min+.1,o=e.max+.1,{reachedMin:a,reachedMax:l}=ql(s,o);function u(d){return d===1?l(n.get()):d===-1?a(n.get()):!1}function c(d){if(!u(d))return;const h=t*(d*-1);r.forEach(p=>p.add(h))}return{loop:c}}function LK(t){const{max:e,length:n}=t;function r(s){const o=s-e;return n?o/-n:0}return{get:r}}function BK(t,e,n,r,i){const{startEdge:s,endEdge:o}=t,{groupSlides:a}=i,l=f().map(e.measure),u=d(),c=h();function f(){return a(r).map(m=>Yi(m)[o]-m[0][s]).map(on)}function d(){return r.map(m=>n[s]-m[s]).map(m=>-on(m))}function h(){return a(u).map(m=>m[0]).map((m,g)=>m+l[g])}return{snaps:u,snapsAligned:c}}function FK(t,e,n,r,i,s){const{groupSlides:o}=i,{min:a,max:l}=r,u=c();function c(){const d=o(s),h=!t||e==="keepSnaps";return n.length===1?[s]:h?d:d.slice(a,l).map((p,m,g)=>{const y=!m,v=HA(g,m);if(y){const w=Yi(g[0])+1;return l_(w)}if(v){const w=Uh(s)-Yi(g)[0]+1;return l_(w,Yi(g)[0])}return p})}return{slideRegistry:u}}function UK(t,e,n,r,i){const{reachedAny:s,removeOffset:o,constrain:a}=r;function l(p){return p.concat().sort((m,g)=>on(m)-on(g))[0]}function u(p){const m=t?o(p):a(p),g=e.map((v,w)=>({diff:c(v-m,0),index:w})).sort((v,w)=>on(v.diff)-on(w.diff)),{index:y}=g[0];return{index:y,distance:m}}function c(p,m){const g=[p,p+n,p-n];if(!t)return p;if(!m)return l(g);const y=g.filter(v=>jA(v)===m);return y.length?l(y):Yi(g)-n}function f(p,m){const g=e[p]-i.get(),y=c(g,m);return{index:p,distance:y}}function d(p,m){const g=i.get()+p,{index:y,distance:v}=u(g),w=!t&&s(g);if(!m||w)return{index:y,distance:p};const b=e[y]-v,E=p+c(b,0);return{index:y,distance:E}}return{byDistance:d,byIndex:f,shortcut:c}}function jK(t,e,n,r,i,s,o){function a(f){const d=f.distance,h=f.index!==e.get();s.add(d),d&&(r.duration()?t.start():(t.update(),t.render(1),t.update())),h&&(n.set(e.get()),e.set(f.index),o.emit("select"))}function l(f,d){const h=i.byDistance(f,d);a(h)}function u(f,d){const h=e.clone().set(f),p=i.byIndex(h.get(),d);a(p)}return{distance:l,index:u}}function HK(t,e,n,r,i,s,o){let a=0;function l(){s.add(document,"keydown",u,!1),e.forEach(c)}function u(d){d.code==="Tab"&&(a=new Date().getTime())}function c(d){const h=()=>{if(new Date().getTime()-a>10)return;t.scrollLeft=0;const g=e.indexOf(d),y=n.findIndex(v=>v.includes(g));BA(y)&&(i.useDuration(0),r.index(y,0),o.emit("slideFocus"))};s.add(d,"focus",h,{passive:!0,capture:!0})}return{init:l}}function hg(t){let e=t;function n(){return e}function r(l){e=o(l)}function i(l){e+=o(l)}function s(l){e-=o(l)}function o(l){return BA(l)?l:l.get()}return{get:n,set:r,add:i,subtract:s}}function f_(t,e){const n=t.scroll==="x"?s:o,r=e.style;let i=!1;function s(f){return`translate3d(${f}px,0px,0px)`}function o(f){return`translate3d(0px,${f}px,0px)`}function a(f){i||(r.transform=n(t.direction(f)))}function l(f){i=!f}function u(){i||(r.transform="",e.getAttribute("style")||e.removeAttribute("style"))}return{clear:u,to:a,toggleActive:l}}function VK(t,e,n,r,i,s,o,a,l){const c=Fh(i),f=Fh(i).reverse(),d=y().concat(v());function h(O,S){return O.reduce((D,I)=>D-i[I],S)}function p(O,S){return O.reduce((D,I)=>h(D,S)>0?D.concat([I]):D,[])}function m(O){return s.map((S,D)=>({start:S-r[D]+.5+O,end:S+e-.5+O}))}function g(O,S,D){const I=m(S);return O.map(F=>{const Q=D?0:-n,V=D?n:0,B=D?"end":"start",N=I[F][B];return{index:F,loopPoint:N,slideLocation:hg(-1),translate:f_(t,l[F]),target:()=>a.get()>N?Q:V}})}function y(){const O=o[0],S=p(f,O);return g(S,n,!1)}function v(){const O=e-o[0]-1,S=p(c,O);return g(S,-n,!0)}function w(){return d.every(({index:O})=>{const S=c.filter(D=>D!==O);return h(S,e)<=.1})}function b(){d.forEach(O=>{const{target:S,translate:D,slideLocation:I}=O,F=S();F!==I.get()&&(D.to(F),I.set(F))})}function E(){d.forEach(O=>O.translate.clear())}return{canLoop:w,clear:E,loop:b,loopPoints:d}}function zK(t,e,n){let r,i=!1;function s(l){if(!n)return;function u(c){for(const f of c)if(f.type==="childList"){l.reInit(),e.emit("slidesChanged");break}}r=new MutationObserver(c=>{i||(UA(n)||n(l,c))&&u(c)}),r.observe(t,{childList:!0})}function o(){r&&r.disconnect(),i=!0}return{init:s,destroy:o}}function $K(t,e,n,r){const i={};let s=null,o=null,a,l=!1;function u(){a=new IntersectionObserver(p=>{l||(p.forEach(m=>{const g=e.indexOf(m.target);i[g]=m}),s=null,o=null,n.emit("slidesInView"))},{root:t.parentElement,threshold:r}),e.forEach(p=>a.observe(p))}function c(){a&&a.disconnect(),l=!0}function f(p){return jh(i).reduce((m,g)=>{const y=parseInt(g),{isIntersecting:v}=i[y];return(p&&v||!p&&!v)&&m.push(y),m},[])}function d(p=!0){if(p&&s)return s;if(!p&&o)return o;const m=f(p);return p&&(s=m),p||(o=m),m}return{init:u,destroy:c,get:d}}function GK(t,e,n,r,i,s){const{measureSize:o,startEdge:a,endEdge:l}=t,u=n[0]&&i,c=p(),f=m(),d=n.map(o),h=g();function p(){if(!u)return 0;const v=n[0];return on(e[a]-v[a])}function m(){if(!u)return 0;const v=s.getComputedStyle(Yi(r));return parseFloat(v.getPropertyValue(`margin-${l}`))}function g(){return n.map((v,w,b)=>{const E=!w,x=HA(b,w);return E?d[w]+c:x?d[w]+f:b[w+1][a]-v[a]}).map(on)}return{slideSizes:d,slideSizesWithGaps:h,startGap:c,endGap:f}}function WK(t,e,n,r,i,s,o,a,l){const{startEdge:u,endEdge:c,direction:f}=t,d=BA(n);function h(y,v){return Fh(y).filter(w=>w%v===0).map(w=>y.slice(w,w+v))}function p(y){return y.length?Fh(y).reduce((v,w,b)=>{const E=Yi(v)||0,x=E===0,O=w===Uh(y),S=i[u]-s[E][u],D=i[u]-s[w][c],I=!r&&x?f(o):0,F=!r&&O?f(a):0,Q=on(D-F-(S+I));return b&&Q>e+l&&v.push(w),O&&v.push(y.length),v},[]).map((v,w,b)=>{const E=Math.max(b[w-1]||0);return y.slice(E,v)}):[]}function m(y){return d?h(y,n):p(y)}return{groupSlides:m}}function KK(t,e,n,r,i,s,o){const{align:a,axis:l,direction:u,startIndex:c,loop:f,duration:d,dragFree:h,dragThreshold:p,inViewThreshold:m,slidesToScroll:g,skipSnaps:y,containScroll:v,watchResize:w,watchSlides:b,watchDrag:E}=s,x=2,O=TK(),S=O.measure(e),D=n.map(O.measure),I=SK(l,u),F=I.measureSize(S),Q=OK(F),V=EK(a,F),B=!f&&!!v,N=f||!!v,{slideSizes:H,slideSizesWithGaps:K,startGap:J,endGap:X}=GK(I,S,D,n,N,i),ie=WK(I,F,g,f,S,D,J,X,x),{snaps:le,snapsAligned:Pe}=BK(I,V,S,D,ie),xe=-Yi(le)+Yi(K),{snapsContained:Ie,scrollContainLimit:ke}=PK(F,xe,Pe,v,x),$=B?Ie:Pe,{limit:ne}=IK(xe,$,f),G=c_(Uh($),c,f),Z=G.clone(),A=Fh(n),P=({dragHandler:R,scrollBody:z,scrollBounds:se,options:{loop:te}})=>{te||se.constrain(R.pointerDown()),z.seek()},ue=({scrollBody:R,translate:z,location:se,offsetLocation:te,scrollLooper:fe,slideLooper:he,dragHandler:U,animation:re,eventHandler:ce,scrollBounds:ye,options:{loop:ge}},Le)=>{const Ve=R.velocity(),pt=R.settled(),nt=!ye.shouldConstrain(),et=ge?pt:pt&&nt;et&&!U.pointerDown()&&(re.stop(),ce.emit("settle")),et||ce.emit("scroll"),te.set(se.get()-Ve+Ve*Le),ge&&(fe.loop(R.direction()),he.loop()),z.to(te.get())},de=kK(r,i,()=>P(M),R=>ue(M,R)),oe=.68,we=$[G.get()],De=hg(we),pe=hg(we),Ke=hg(we),qe=MK(De,pe,Ke,d,oe),tt=UK(f,$,xe,ne,Ke),lt=jK(de,G,Z,qe,tt,Ke,o),ft=LK(ne),Ze=Hh(),Se=$K(e,n,o,m),{slideRegistry:Ue}=FK(B,v,$,ke,ie,A),C=HK(t,n,Ue,lt,qe,Ze,o),M={ownerDocument:r,ownerWindow:i,eventHandler:o,containerRect:S,slideRects:D,animation:de,axis:I,dragHandler:CK(I,t,r,i,Ke,DK(I,i),De,de,lt,qe,tt,G,o,Q,h,p,y,oe,E),eventStore:Ze,percentOfView:Q,index:G,indexPrevious:Z,limit:ne,location:De,offsetLocation:pe,options:s,resizeHandler:_K(e,o,i,n,I,w,O),scrollBody:qe,scrollBounds:NK(ne,pe,Ke,qe,Q),scrollLooper:RK(xe,ne,pe,[De,pe,Ke]),scrollProgress:ft,scrollSnapList:$.map(ft.get),scrollSnaps:$,scrollTarget:tt,scrollTo:lt,slideLooper:VK(I,F,xe,H,K,le,$,pe,n),slideFocus:C,slidesHandler:zK(e,o,b),slidesInView:Se,slideIndexes:A,slideRegistry:Ue,slidesToScroll:ie,target:Ke,translate:f_(I,e)};return M}function qK(){let t={},e;function n(u){e=u}function r(u){return t[u]||[]}function i(u){return r(u).forEach(c=>c(e,u)),l}function s(u,c){return t[u]=r(u).concat([c]),l}function o(u,c){return t[u]=r(u).filter(f=>f!==c),l}function a(){t={}}const l={init:n,emit:i,off:o,on:s,clear:a};return l}const QK={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0};function JK(t){function e(s,o){return u_(s,o||{})}function n(s){const o=s.breakpoints||{},a=jh(o).filter(l=>t.matchMedia(l).matches).map(l=>o[l]).reduce((l,u)=>e(l,u),{});return e(s,a)}function r(s){return s.map(o=>jh(o.breakpoints||{})).reduce((o,a)=>o.concat(a),[]).map(t.matchMedia)}return{mergeOptions:e,optionsAtMedia:n,optionsMediaQueries:r}}function YK(t){let e=[];function n(s,o){return e=o.filter(({options:a})=>t.optionsAtMedia(a).active!==!1),e.forEach(a=>a.init(s,t)),o.reduce((a,l)=>Object.assign(a,{[l.name]:l}),{})}function r(){e=e.filter(s=>s.destroy())}return{init:n,destroy:r}}function pg(t,e,n){const r=t.ownerDocument,i=r.defaultView,s=JK(i),o=YK(s),a=Hh(),l=qK(),{mergeOptions:u,optionsAtMedia:c,optionsMediaQueries:f}=s,{on:d,off:h,emit:p}=l,m=F;let g=!1,y,v=u(QK,pg.globalOptions),w=u(v),b=[],E,x,O;function S(){const{container:P,slides:ue}=w;x=(FA(P)?t.querySelector(P):P)||t.children[0];const oe=FA(ue)?x.querySelectorAll(ue):ue;O=[].slice.call(oe||x.children)}function D(P){const ue=KK(t,x,O,r,i,P,l);if(P.loop&&!ue.slideLooper.canLoop()){const de=Object.assign({},P,{loop:!1});return D(de)}return ue}function I(P,ue){g||(v=u(v,P),w=c(v),b=ue||b,S(),y=D(w),f([v,...b.map(({options:de})=>de)]).forEach(de=>a.add(de,"change",F)),w.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(),y.eventHandler.init(A),y.resizeHandler.init(A),y.slidesHandler.init(A),y.options.loop&&y.slideLooper.loop(),x.offsetParent&&O.length&&y.dragHandler.init(A),E=o.init(A,b)))}function F(P,ue){const de=le();Q(),I(u({startIndex:de},P),ue),l.emit("reInit")}function Q(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),o.destroy(),a.clear()}function V(){g||(g=!0,a.clear(),Q(),l.emit("destroy"),l.clear())}function B(P,ue,de){!w.active||g||(y.scrollBody.useBaseFriction().useDuration(ue===!0?0:w.duration),y.scrollTo.index(P,de||0))}function N(P){const ue=y.index.add(1).get();B(ue,P,-1)}function H(P){const ue=y.index.add(-1).get();B(ue,P,1)}function K(){return y.index.add(1).get()!==le()}function J(){return y.index.add(-1).get()!==le()}function X(){return y.scrollSnapList}function ie(){return y.scrollProgress.get(y.location.get())}function le(){return y.index.get()}function Pe(){return y.indexPrevious.get()}function xe(){return y.slidesInView.get()}function Ie(){return y.slidesInView.get(!1)}function ke(){return E}function $(){return y}function ne(){return t}function G(){return x}function Z(){return O}const A={canScrollNext:K,canScrollPrev:J,containerNode:G,internalEngine:$,destroy:V,off:h,on:d,emit:p,plugins:ke,previousScrollSnap:Pe,reInit:m,rootNode:ne,scrollNext:N,scrollPrev:H,scrollProgress:ie,scrollSnapList:X,scrollTo:B,selectedScrollSnap:le,slideNodes:Z,slidesInView:xe,slidesNotInView:Ie};return I(e,n),setTimeout(()=>l.emit("init"),0),A}pg.globalOptions=void 0;function zA(t={},e=[]){const n=_.useRef(t),r=_.useRef(e),[i,s]=_.useState(),[o,a]=_.useState(),l=_.useCallback(()=>{i&&i.reInit(n.current,r.current)},[i]);return _.useEffect(()=>{if(vK()&&o){pg.globalOptions=zA.globalOptions;const u=pg(o,n.current,r.current);return s(u),()=>u.destroy()}else s(void 0)},[o,s]),_.useEffect(()=>{LA(n.current,t)||(n.current=t,l())},[t,l]),_.useEffect(()=>{AK(r.current,e)||(r.current=e,l())},[e,l]),[a,i]}zA.globalOptions=void 0;const d_=_.createContext(null);function Vh(){const t=_.useContext(d_);if(!t)throw new Error("useCarousel must be used within a <Carousel />");return t}const h_=_.forwardRef(({orientation:t="horizontal",opts:e,setApi:n,plugins:r,className:i,children:s,...o},a)=>{const[l,u]=zA({...e,axis:t==="horizontal"?"x":"y"},r),[c,f]=_.useState(!1),[d,h]=_.useState(!1),p=_.useCallback(v=>{v&&(f(v.canScrollPrev()),h(v.canScrollNext()))},[]),m=_.useCallback(()=>{u==null||u.scrollPrev()},[u]),g=_.useCallback(()=>{u==null||u.scrollNext()},[u]),y=_.useCallback(v=>{v.key==="ArrowLeft"?(v.preventDefault(),m()):v.key==="ArrowRight"&&(v.preventDefault(),g())},[m,g]);return _.useEffect(()=>{!u||!n||n(u)},[u,n]),_.useEffect(()=>{if(u)return p(u),u.on("reInit",p),u.on("select",p),()=>{u==null||u.off("select",p)}},[u,p]),k.jsx(d_.Provider,{value:{carouselRef:l,api:u,opts:e,orientation:t||((e==null?void 0:e.axis)==="y"?"vertical":"horizontal"),scrollPrev:m,scrollNext:g,canScrollPrev:c,canScrollNext:d},children:k.jsx("div",{ref:a,onKeyDownCapture:y,className:Ne("relative",i),role:"region","aria-roledescription":"carousel",...o,children:s})})});h_.displayName="Carousel";const p_=_.forwardRef(({className:t,...e},n)=>{const{carouselRef:r,orientation:i}=Vh();return k.jsx("div",{ref:r,className:"overflow-hidden",children:k.jsx("div",{ref:n,className:Ne("flex",i==="horizontal"?"-ml-4":"-mt-4 flex-col",t),...e})})});p_.displayName="CarouselContent";const $A=_.forwardRef(({className:t,...e},n)=>{const{orientation:r}=Vh();return k.jsx("div",{ref:n,role:"group","aria-roledescription":"slide",className:Ne("min-w-0 shrink-0 grow-0 basis-full",r==="horizontal"?"pl-4":"pt-4",t),...e})});$A.displayName="CarouselItem";const m_=_.forwardRef(({index:t,className:e,...n},r)=>{const{api:i}=Vh(),[s,o]=_.useState(0),[,a]=_.useState([]),l=_.useCallback(d=>{i&&i.scrollTo(d)},[i]),u=_.useCallback(d=>{d&&a(d.scrollSnapList())},[]),c=_.useCallback(d=>{d&&o(d.selectedScrollSnap())},[]);_.useEffect(()=>{i&&(u(i),c(i),i.on("reInit",u),i.on("reInit",c),i.on("select",c))},[i,u,c]);const f=s===t;return k.jsx("button",{ref:r,className:Ne("w-2 h-2 transition-colors duration-200 rounded-full",f?"bg-black":"bg-[#E8EBEC] hover:bg-black/50",e),onClick:()=>l(t),...n})});m_.displayName="CarouselIndicator";const XK=_.forwardRef(({className:t,...e},n)=>{const{scrollPrev:r,canScrollPrev:i}=Vh();return k.jsx("button",{ref:n,className:Ne("btn bg-white hover:bg-[#F2F4F5] transition text-black flex items-center border-2 rounded h-9 px-4 py-2 text-sm font-medium disabled:bg-[#E8EBEC] disabled:text-[#A1AAB1]",t),disabled:!i,onClick:r,...e,children:k.jsx("span",{children:"Back"})})});XK.displayName="CarouselPrevious";const ZK=_.forwardRef(({className:t,...e},n)=>{const{scrollNext:r,canScrollNext:i}=Vh();return k.jsx("button",{ref:n,className:Ne("btn bg-black hover:bg-black text-white flex items-center border-2 rounded h-9 px-4 py-2 text-sm font-medium disabled:bg-[#E8EBEC] disabled:text-[#A1AAB1]",t),disabled:!i,onClick:r,...e,children:k.jsx("span",{children:"Next"})})});ZK.displayName="CarouselNext";const mg=Y.forwardRef(({className:t,label:e,type:n="text",isValid:r=!0,message:i,onChange:s,leftIcon:o,rightIcon:a,...l},u)=>{const c=Y.useRef(null),f=Di(u,c),d=Y.useCallback(()=>{var m;(m=c.current)==null||m.focus()},[]),h=Y.useMemo(()=>{if(o==null)return;const m=Y.Children.only(o);if(Y.isValidElement(m))return Y.cloneElement(m,{...m.props,onClick:g=>{var y,v;(v=(y=m.props).onClick)==null||v.call(y,g),d()},className:Ne("absolute left-3 text-[#A1AAB1]",{"cursor-not-allowed":l.disabled})})},[d,o,l.disabled]),p=Y.useMemo(()=>{if(a==null)return;const m=Y.Children.only(a);if(Y.isValidElement(m))return Y.cloneElement(m,{...m.props,onClick:g=>{var y,v;(v=(y=m.props).onClick)==null||v.call(y,g),d()},className:Ne("absolute right-3 cursor-pointer text-[#A1AAB1]",{"cursor-not-allowed":l.disabled},{"text-red-500":!r})})},[d,a,l.disabled,r]);return k.jsxs("div",{className:"flex flex-col",children:[e?k.jsx("label",{className:"mb-2 text-sm font-medium",children:e}):null,k.jsxs("div",{className:"relative flex items-center group",children:[h,k.jsx("input",{type:n,className:Ne("flex h-9 w-full rounded border-[1px] border-[#E8EBEC] hover:border-black bg-transparent px-3 py-2 text-sm text-black transition-colors file:border-0 file:bg-transparent file:text-sm placeholder:text-[#A1AAB1] focus-visible:outline-none focus-visible:border-black",{"pr-3 pl-10":h},{"pr-10":p},{"border-red-500":!r},{"disabled:cursor-not-allowed disabled:bg-[#E8EBEC] disabled:border-[#A1AAB1] disabled:text-[#A1AAB1]":l.disabled},t),onChange:s,ref:f,...l}),p]}),i?k.jsx("p",{className:Ne("text-sm mt-2 font-normal text-wrap text-justify",{"text-red-500":!r,"text-black":r}),children:i}):null]})});mg.displayName="TextField";const ba=_.forwardRef(({active:t,buttonSize:e="medium",children:n,disabled:r,variant:i="primary",className:s,activeClassname:o,isLoading:a=!1,...l},u)=>{const c=Ne("flex items-center justify-center border-2 gap-2 transition text-sm font-semibold rounded disabled:opacity-50 whitespace-nowrap",i==="primary"&&Ne("text-white bg-black border-black",!r&&!t&&"hover:bg-neutral-800 active:bg-neutral-900",t&&Ne("bg-neutral-900 dark:bg-neutral-300",o)),i==="secondary"&&Ne("text-neutral-900 border-black",!r&&!t&&"hover:bg-neutral-100 active:bg-neutral-200",t&&"bg-neutral-200"),i==="tertiary"&&Ne("bg-neutral-50 text-neutral-900 border-transparent",!r&&!t&&"hover:bg-neutral-100 active:bg-neutral-200",t&&Ne("bg-neutral-200",o)),i==="ghost"&&Ne("bg-transparent border-transparent text-neutral-900",!r&&!t&&"hover:bg-black/5 hover:text-neutral-700 active:bg-black/10",t&&Ne("bg-black/10",o)),e==="medium"&&"py-2 px-3",e==="small"&&"py-1 px-2",e==="icon"&&"w-8 h-8",e==="iconSmall"&&"w-6 h-6",s);return k.jsx("button",{ref:u,disabled:r,className:c,...l,children:a?k.jsx(nG,{size:20,className:"animate-spin",fill:"transparent",stroke:"currentColor"}):n})});ba.displayName="Button";const g_=[{title:"Trebuchet MS",value:"Trebuchet MS, sans-serif",command:t=>{t.chain().focus().setFontFamily("Trebuchet MS, sans-serif").run()}},{title:"Verdana",value:"Verdana, Geneva, sans-serif",command:t=>{t.chain().focus().setFontFamily("Verdana, Geneva, sans-serif").run()}},{title:"Georgia",value:"Georgia, serif",command:t=>{t.chain().focus().setFontFamily("Georgia, serif").run()}},{title:"Arial",value:"Arial, Helvetica, sans-serif",command:t=>{t.chain().focus().setFontFamily("Arial, Helvetica, sans-serif").run()}},{title:"Comic Sans MS",value:"Comic Sans MS, Comic Sans",command:t=>{t.chain().focus().setFontFamily("Comic Sans MS, Comic Sans").run()}},{title:"Impact",value:"Impact, Charcoal, sans-serif",command:t=>{t.chain().focus().setFontFamily("Impact, Charcoal, sans-serif").run()}},{title:"Palatino",value:"Palatino Linotype, Book Antiqua, Palatino, serif",command:t=>{t.chain().focus().setFontFamily("Palatino Linotype, Book Antiqua, Palatino, serif").run()}},{title:"Lucida Grande",value:"Lucida Sans Unicode, Lucida Grande, sans-serif",command:t=>{t.chain().focus().setFontFamily("Lucida Sans Unicode, Lucida Grande, sans-serif").run()}},{title:"Serif",value:"serif",command:t=>{t.chain().focus().setFontFamily("serif").run()}},{title:"Monospace",value:"monospace",command:t=>{t.chain().focus().setFontFamily("monospace").run()}},{title:"Cursive",value:"cursive",command:t=>{t.chain().focus().setFontFamily("cursive").run()}}],GA=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}],zh=1024*100,WA={IMAGE_SIZE:"Image size should be less than 100KB"},KA=({editor:t,onError:e})=>{const{ref:n,toolVisibilty:r,setToolVisibility:i}=mG(Ge.NONE),s=[{icon:k.jsx(Q$,{size:20}),title:"Text Color",onClick:()=>i(Ge.TEXT_COLOR),isActive:r===Ge.TEXT_COLOR},{icon:k.jsx(NO,{size:20}),title:"Highlight",onClick:()=>i(Ge.HIGHLIGHT),isActive:r===Ge.HIGHLIGHT},null,{icon:k.jsx(Zv,{size:20}),title:"Bold",onClick:()=>t==null?void 0:t.chain().focus().toggleBold().run(),isActive:t==null?void 0:t.isActive("bold")},{icon:k.jsx(eA,{size:20}),title:"Italic",onClick:()=>t==null?void 0:t.chain().focus().toggleItalic().run(),isActive:t==null?void 0:t.isActive("italic")},{icon:k.jsx(aA,{size:20}),title:"Underlined",onClick:()=>t==null?void 0:t.chain().focus().toggleUnderline().run(),isActive:t==null?void 0:t.isActive("underline")},{icon:k.jsx(rA,{size:20}),title:"Strikethrough",onClick:()=>t==null?void 0:t.chain().focus().toggleStrike().run(),isActive:t==null?void 0:t.isActive("strike")},null,{icon:k.jsx(Qm,{size:20}),title:"List",onClick:()=>{t==null||t.chain().focus().toggleBulletList().run(),i(Ge.NONE)},isActive:t==null?void 0:t.isActive("bulletList")},{icon:k.jsx(Pc,{size:20}),title:"Ordered List",onClick:()=>{t==null||t.chain().focus().toggleOrderedList().run(),i(Ge.NONE)},isActive:t==null?void 0:t.isActive("orderedList")},{icon:k.jsx(nA,{size:20}),title:"To-do List",onClick:()=>{t==null||t.chain().focus().toggleTaskList().run(),i(Ge.NONE)},isActive:t==null?void 0:t.isActive("taskList")},{icon:k.jsx(Mh,{size:20}),title:"Alignment",onClick:()=>i(Ge.ALIGNMENT),isActive:r===Ge.ALIGNMENT},{icon:k.jsx(Jm,{size:20}),title:"Quote",onClick:()=>t==null?void 0:t.chain().focus().toggleBlockquote().run(),isActive:t==null?void 0:t.isActive("blockquote")},null,{icon:k.jsx(PO,{size:20}),title:"Upload Image",onClick:()=>{t==null||t.chain().focus().deleteRange(t.state.selection).run();const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=async()=>{var l;if((l=a.files)!=null&&l.length){const u=a.files[0];if(u.size>zh){e&&typeof e=="function"&&e(WA.IMAGE_SIZE);return}const f=t.view.state.selection.from;lA(u,t.view,f)}},a.click()},isActive:!1},{icon:k.jsx(tA,{size:20}),title:"Link",onClick:()=>i(Ge.LINK),isActive:t==null?void 0:t.isActive("link")},{icon:k.jsx(Ph,{size:20}),title:"Code",onClick:()=>t==null?void 0:t.chain().focus().toggleCodeBlock().run(),isActive:t==null?void 0:t.isActive("codeBlock")},{icon:k.jsx(iA,{size:20}),title:"Add table",onClick:()=>t==null?void 0:t.chain().focus().insertTable({rows:3,cols:2,withHeaderRow:!0}).run(),isActive:!1}],o=[{icon:k.jsx(oA,{size:24}),title:"Text formating",onClick:()=>i(Ge.TEXT_FORMATING),isActive:r===Ge.TEXT_FORMATING},{icon:k.jsx(iA,{size:24}),title:"Add table",onClick:()=>t==null?void 0:t.chain().focus().insertTable({rows:3,cols:2,withHeaderRow:!0}).run(),isActive:!0},{icon:k.jsx(nA,{size:24}),title:"To-do list",onClick:()=>{t==null||t.chain().focus().toggleTaskList().run(),i(Ge.NONE)},isActive:!0},{icon:k.jsx(PO,{size:24}),title:"Add image",onClick:()=>{t==null||t.chain().focus().deleteRange(t.state.selection).run();const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=async()=>{var l;if((l=a.files)!=null&&l.length){const u=a.files[0];if(u.size>zh){e&&typeof e=="function"&&e(WA.IMAGE_SIZE);return}const f=t.view.state.selection.from;lA(u,t.view,f)}},a.click()},isActive:!0},{icon:k.jsx(fG,{size:24}),title:"Undo",onClick:()=>{t==null||t.chain().undo().run()},isActive:t==null?void 0:t.can().undo()},{icon:k.jsx(lG,{size:24}),title:"Redo",onClick:()=>{t==null||t.chain().redo().run()},isActive:t==null?void 0:t.can().redo()}];return{toolbar:s,bottomToolbar:o,toolRef:n,toolVisibilty:r,setToolVisibility:i}},y_=({editor:t,setVisibility:e,elementRef:n})=>{const r=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}];return k.jsxs("div",{ref:n,className:"z-50 h-auto absolute gap-2 top-14 flex flex-wrap left-[20%] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[k.jsx(Xv,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetHighlight().run(),e(Ge.NONE)}}),r.map(i=>k.jsx("div",{onClick:()=>{t.chain().focus().toggleHighlight({color:i.color}).run(),e(Ge.NONE)},className:Ne("w-6 drop-shadow rounded-full flex items-center justify-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6",i.code),children:k.jsx(Nh,{size:14,className:Ne(t.isActive("highlight",{color:i.color})?"visible":"invisible")})},i.color))]})},eq=({elementRef:t,editor:e,setToolVisibility:n})=>k.jsx("div",{ref:t,className:Ne("z-50 h-auto absolute top-14 left-0 max-h-[330px] w-48 overflow-y-auto scroll-smooth bg-white px-1 py-2 shadow-lg transition-all rounded animate-in fade-in slide-in-from-top-1"),children:g_.map(r=>k.jsx("button",{onClick:()=>{r.command(e),n(Ge.NONE)},style:{fontFamily:r.title},className:Ne("flex w-full items-center space-x-2 rounded px-2 py-1 text-left text-sm text-black transition",e.isActive("textStyle",{fontFamily:r.value})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:k.jsx("p",{className:"font-medium",children:r.title})},r.title))}),b_=({elementRef:t,editor:e,setToolVisibility:n})=>k.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-14 left-[60%] translate-x-1/2 flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[k.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("left").run(),n(Ge.NONE)},className:Ne("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"left"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:k.jsx(Mh,{})}),k.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("center").run(),n(Ge.NONE)},className:Ne("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"center"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:k.jsx(Jv,{})}),k.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("right").run(),n(Ge.NONE)},className:Ne("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"right"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:k.jsx(Yv,{})})]}),tq=({elementRef:t,editor:e,setToolVisibility:n})=>k.jsxs("div",{ref:t,className:Ne("z-50 h-auto absolute gap-2 top-[50px] right-[30%] flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all"),children:[k.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"unordered list",children:k.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleBulletList().run(),n(Ge.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("bulletList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:k.jsx(Qm,{size:20})})}),k.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"ordered list",children:k.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleOrderedList().run(),n(Ge.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("orderedList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:k.jsx(Pc,{size:20})})}),k.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"to-do list",children:k.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleTaskList().run(),n(Ge.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("taskList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:k.jsx(nA,{size:20})})})]}),w_=({elementRef:t,editor:e,setToolVisibility:n,bubbleMenu:r,setIsLinkPopupOpen:i})=>{const[s,o]=_.useState(e.getAttributes("link").href),a=()=>{if(s===null)return;if(s===""){e.chain().focus().extendMarkRange("link").unsetLink().run();return}let l=s;!s.startsWith("http://")&&!s.startsWith("https://")&&(l="https://"+s);try{l.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&e.chain().focus().extendMarkRange("link").setLink({href:l}).run()}catch{console.error("Invalid URL");return}e.chain().focus().extendMarkRange("link").setLink({href:l}).run(),n(Ge.NONE),r&&i&&i(!1)};return k.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-14 translate-x-1/2 items-center flex max-h-[330px] overflow-y-auto scroll-smooth rounded-lg bg-white p-2 shadow-lg transition-all",children:[k.jsx(mg,{onChange:l=>o(l.target.value),className:"w-full",placeholder:"Add link here",value:s}),k.jsxs("div",{className:"h-full flex items-center gap-2",children:[k.jsx(ba,{onClick:()=>a(),className:"min-w-fit h-[36px]",children:"Apply"}),k.jsx(ba,{variant:"secondary",onClick:()=>e.chain().focus().unsetLink().run(),className:"min-w-fit h-[36px]",children:"Unset"})]})]})},nq=({editor:t,setVisibility:e,elementRef:n})=>k.jsxs("div",{ref:n,className:"z-50 h-auto absolute gap-2 top-14 flex flex-wrap left-[100px] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[k.jsx(Xv,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetColor().run(),e(Ge.NONE)}}),GA.map(r=>k.jsx("div",{onClick:()=>{t.chain().focus().setColor(r.color).run(),e(Ge.NONE)},className:Ne("w-6 drop-shadow rounded-full flex justify-center items-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6",r.code),children:k.jsx(Nh,{size:14,className:Ne(t.isActive("textStyle",{color:r.color})?"visible":"invisible")})},r.color))]}),rq=({editor:t,setVisibility:e,elementRef:n})=>{const r=[{title:"Text",description:"Normal",icon:k.jsx(oA,{size:20}),command:i=>i.chain().focus().toggleNode("paragraph","paragraph").run(),isActive:()=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{title:"Heading 1",description:"Big",icon:k.jsx(Wm,{size:20}),command:i=>{i.chain().focus().toggleHeading({level:1}).run()},isActive:()=>t.isActive("heading",{level:1})},{title:"Heading 2",description:"Medium",icon:k.jsx(Km,{size:20}),command:i=>{i.chain().focus().toggleHeading({level:2}).run()},isActive:()=>t.isActive("heading",{level:2})},{title:"Heading 3",description:"Small",icon:k.jsx(qm,{size:20}),command:i=>{i.chain().focus().toggleHeading({level:3}).run()},isActive:()=>t.isActive("heading",{level:3})}];return k.jsx("div",{ref:n,className:Ne("absolute top-[50px] z-50 mt-1 flex w-48 flex-col overflow-hidden rounded bg-white p-1 shadow-lg animate-in fade-in slide-in-from-top-1","left-0"),children:r.map(i=>k.jsxs("button",{onClick:()=>{i.command(t),e(Ge.NONE)},className:Ne("flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-black transition",{"bg-yellow-300 hover:brightness-90":i.isActive(),"hover:bg-[#f2f2f2]":!i.isActive()}),children:[k.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded bg-white",children:i.icon}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium",children:i.title}),k.jsxs("p",{className:"text-xs text-stone-500",children:[" ",i.description," "]})]})]},i.title))})},iq=({editor:t,setToolVisibility:e})=>{const n=[{title:"Text",description:"Normal",icon:k.jsx(oA,{size:20}),command:r=>r.chain().toggleNode("paragraph","paragraph").run(),isActive:()=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{title:"Heading 1",description:"Big",icon:k.jsx(Wm,{size:20}),command:r=>{r.chain().toggleHeading({level:1}).run()},isActive:()=>t.isActive("heading",{level:1})},{title:"Heading 2",description:"Medium",icon:k.jsx(Km,{size:20}),command:r=>{r.chain().toggleHeading({level:2}).run()},isActive:()=>t.isActive("heading",{level:2})},{title:"Heading 3",description:"Small",icon:k.jsx(qm,{size:20}),command:r=>{r.chain().toggleHeading({level:3}).run()},isActive:()=>t.isActive("heading",{level:3})}];return k.jsx(hK,{title:"Text formating",content:k.jsxs("div",{className:"px-4 flex flex-col gap-2 w-full",children:[k.jsx("div",{className:"flex justify-start sm:justify-center items-center gap-1",children:n.map(r=>k.jsx("button",{onClick:()=>r.command(t),className:Ne("flex w-fit items-center font-medium space-x-2 rounded p-2 text-center text-sm text-black transition",{"bg-yellow-300 hover:brightness-90":r.isActive(),"hover:bg-[#f2f2f2]":!r.isActive()}),children:r.title},r.title))}),k.jsxs("div",{className:"flex justify-between sm:justify-center items-center gap-1",children:[k.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[k.jsx("button",{onClick:()=>{t==null||t.chain().setTextAlign("left").run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"left"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"left"})}),children:k.jsx(Mh,{size:20})}),k.jsx("button",{onClick:()=>{t==null||t.chain().setTextAlign("center").run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"center"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"center"})}),children:k.jsx(Jv,{size:20})}),k.jsx("button",{onClick:()=>{t==null||t.chain().setTextAlign("right").run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"right"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"right"})}),children:k.jsx(Yv,{size:20})})]}),k.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[k.jsx(mK,{asChild:!0,children:k.jsx("button",{onClick:()=>e(Ge.LINK_POPUP),className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("link"),"hover:bg-[#f2f2f2]":!t.isActive("link")}),children:k.jsx(tA,{size:20})})}),k.jsx("button",{onClick:()=>{t==null||t.chain().toggleCodeBlock().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("codeBlock"),"hover:bg-[#f2f2f2]":!t.isActive("codeBlock")}),children:k.jsx(Ph,{size:20})}),k.jsx("button",{onClick:()=>{t==null||t.chain().toggleBlockquote().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("blockquote"),"hover:bg-[#f2f2f2]":!t.isActive("blockquote")}),children:k.jsx(Jm,{size:20})})]})]}),k.jsxs("div",{className:"flex justify-between sm:justify-center items-center gap-1",children:[k.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[k.jsx("button",{onClick:()=>{t.chain().toggleBold().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("bold"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:k.jsx(Zv,{size:20})}),k.jsx("button",{onClick:()=>{t.chain().toggleItalic().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("italic"),"hover:bg-[#f2f2f2]":!t.isActive("italic")}),children:k.jsx(eA,{size:20})}),k.jsx("button",{onClick:()=>{t.chain().toggleUnderline().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("underline"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:k.jsx(aA,{size:20})}),k.jsx("button",{onClick:()=>{t.chain().toggleStrike().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("strike"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:k.jsx(rA,{size:20})})]}),k.jsxs("div",{className:"bg-[#f8f9fa] rounded flex flex-[0.5] sm:flex-none gap-2 justify-evenly w-full sm:w-fit p-1",children:[k.jsx("button",{onClick:()=>{t==null||t.chain().toggleBulletList().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("bulletList"),"hover:bg-[#f2f2f2]":!t.isActive("bulletList")}),children:k.jsx(Qm,{size:20})}),k.jsx("button",{onClick:()=>{t==null||t.chain().toggleOrderedList().run()},className:Ne("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("orderedList"),"hover:bg-[#f2f2f2]":!t.isActive("orderedList")}),children:k.jsx(Pc,{size:20})})]})]}),k.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[k.jsx("p",{className:"text-left sm:text-center text-lg font-semibold leading-none tracking-tight",children:"Text color"}),k.jsxs(h_,{opts:{align:"start",dragFree:!0,slidesToScroll:"auto"},className:"w-full max-w-md mx-auto",children:[k.jsxs(p_,{children:[k.jsx($A,{style:{flexBasis:"calc(100% / 12)"},children:k.jsx(Xv,{className:"cursor-pointer",onClick:()=>{t.chain().unsetColor().run()}})}),GA.map((r,i)=>k.jsx($A,{style:{flexBasis:"calc(100% / 12)"},children:k.jsx("button",{onClick:()=>{t.chain().setColor(r.color).run()},className:Ne("w-6 h-6 mb-1 drop-shadow rounded-full flex justify-center items-center cursor-pointer transition",r.code),children:k.jsx(Nh,{size:14,className:Ne(t.isActive("textStyle",{color:r.color})?"visible":"invisible")})},r.color)},i))]}),k.jsx("div",{className:"flex justify-center gap-2 mt-4 w-full max-w-sm",children:Array.from({length:GA.length/8}).map((r,i)=>k.jsx(m_,{index:i},i))})]})]})]})})},sq=t=>{const e=[{name:"Bold",isActive:()=>t.editor.isActive("bold"),command:()=>t.editor.chain().focus().toggleBold().run(),icon:k.jsx(Zv,{size:20})},{name:"Italic",isActive:()=>t.editor.isActive("italic"),command:()=>t.editor.chain().focus().toggleItalic().run(),icon:k.jsx(eA,{size:20})},{name:"Underline",isActive:()=>t.editor.isActive("underline"),command:()=>t.editor.chain().focus().toggleUnderline().run(),icon:k.jsx(aA,{size:20})},{name:"Strikethrough",isActive:()=>t.editor.isActive("strike"),command:()=>t.editor.chain().focus().toggleStrike().run(),icon:k.jsx(rA,{size:20})},{name:"Alignment",isActive:()=>f===Ge.ALIGNMENT,command:()=>c(Ge.ALIGNMENT),icon:k.jsx(Mh,{size:20})},{name:"Code",isActive:()=>t.editor.isActive("codeBlock"),command:()=>t.editor.chain().focus().toggleCodeBlock().run(),icon:k.jsx(Ph,{size:20})},{name:"Link",isActive:()=>t.editor.isActive("link"),command:()=>l(!a),icon:k.jsx(tA,{size:20})}],n={...t,shouldShow:({state:h,editor:p})=>{const{selection:m}=h,{empty:g}=m;return!(p.isActive("image")||g||xv(m))},tippyOptions:{moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",onHidden:()=>{i(!1),o(!1),l(!1)}}},[r,i]=_.useState(!1),[s,o]=_.useState(!1),[a,l]=_.useState(!1),{toolRef:u,setToolVisibility:c,toolVisibilty:f}=KA({editor:t.editor}),d=({editor:h})=>{var b,E;const{from:p,to:m}=h.state.selection,g=((b=h.state.doc.nodeAt(p))==null?void 0:b.type.name)==="resizableMedia",y=((E=h.state.doc.nodeAt(p))==null?void 0:E.type.name)==="iframe",v=h.isActive("codeBlock");if(p===m||g||v||y)return!1;let w=!1;return h.state.doc.nodesBetween(p,m,x=>{x.marks&&x.marks.forEach(O=>{O.type.name==="highlight"&&O.attrs.color==="yellow"&&(w=!0)})}),!w};return k.jsxs(kO,{...n,shouldShow:d,className:"hidden lg:flex gap-2 overflow-hidden rounded-[12px] h-[52px] min-w-[550px] w-full py-2 px-4 bg-white items-center shadow-lg",children:[k.jsx(hG,{editor:t.editor,isOpen:r,setIsOpen:()=>{i(!r),o(!1)}}),e.map((h,p)=>k.jsxs("div",{className:"flex items-center",children:[k.jsx("button",{onClick:h.command,className:Ne("min-w-fit w-8 h-8 px-2 rounded",{"bg-yellow-300":h.isActive()}),children:h.icon}),(p===4||p===6)&&k.jsx("div",{className:"w-1.5 h-4 bg-gray-300 mx-2"})]},p)),k.jsx(pG,{editor:t.editor,isOpen:s,setIsOpen:()=>{o(!s),i(!1)}}),k.jsx("button",{onClick:()=>c(Ge.HIGHLIGHT),className:Ne("min-w-fit w-8 h-8 px-2",{"bg-yellow-300":f===Ge.HIGHLIGHT}),children:k.jsx(NO,{size:20})}),f===Ge.ALIGNMENT&&k.jsx(b_,{setToolVisibility:c,editor:t.editor,elementRef:u}),a&&k.jsx(w_,{setToolVisibility:c,editor:t.editor,elementRef:u,bubbleMenu:!0,setIsLinkPopupOpen:l}),f===Ge.HIGHLIGHT&&k.jsx(y_,{setVisibility:c,editor:t.editor,elementRef:u})]})};function oq(){const t=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let e=[];for(let n=0;n<36;n++)n===8||n===13||n===18||n===23?e[n]="-":e[n]=t[Math.ceil(Math.random()*t.length-1)];return e.join("")}var aq=oq;const lq=Jd(aq),v_=ot.create({name:"column",content:"dBlock+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",gt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}}),uq=(t,e)=>Array.from({length:t},(n,r)=>e(r)),gg=({type:t,content:e})=>e?{type:t,content:e}:{type:t},cq=({content:t})=>gg({type:"paragraph",content:t}),A_=({content:t})=>gg({type:"dBlock",content:t}),x_=({content:t})=>gg({type:"column",content:t}),E_=({content:t})=>gg({type:"columns",content:t}),k_=t=>{const e=[A_({content:[cq({})]})];return uq(t,()=>x_({content:e}))},S_=(t,e)=>{for(let n=t.depth;n>0;n--){const r=t.node(n),i=n>0?t.before(n):0,s=t.start(n);if(e({node:r,pos:i,start:s}))return{start:s,depth:n,node:r,pos:i}}throw Error("no ancestor found")};class yg extends Qe{constructor(n){const{$from:r,$to:i}=n;super(r,i);W(this,"_$from");W(this,"_$to");this._$from=r,this._$to=i}get $from(){return this._$from}get $to(){return this._$to}map(){return this}content(){return this.$from.doc.slice(this.from,this.to,!0)}eq(n){return n instanceof yg&&n.anchor==this.anchor}toJSON(){return{type:"column",from:this.from,to:this.to}}expandSelection(n){var l;const r=({pos:u,node:c})=>c.type.name===v_.name?!0:n.resolve(u).depth<=0,{pos:i}=S_(this.$from,r);this._$from=n.resolve(i);const{pos:s,node:o}=S_(this.$to,r);this._$to=n.resolve(s+o.nodeSize),((l=this.getFirstNode())==null?void 0:l.type.name)===bg.name&&(this._$from=n.resolve(this.$from.pos+2),this._$to=n.resolve(this.$to.pos+2));const a=this;a.$anchor=this._$from,a.$head=this._$to,a.ranges=[new Pw(this._$from,this._$to)]}static create(n,r,i){const s=n.resolve(r),o=n.resolve(i),a=new We(s,o);return new yg(a)}getFirstNode(){return this.content().content.firstChild}}var Ql=(t=>(t.AlignLeft="align-left",t.AlignRight="align-right",t.AlignCenter="align-center",t))(Ql||{});const bg=ot.create({name:"columns",group:"columns",content:"column{2,}",defining:!0,draggable:!0,isolating:!0,addAttributes(){return{layout:{default:"align-center"}}},addCommands(){return{unsetColumns:()=>({tr:t,dispatch:e})=>{try{if(!e)return;const n=t.selection.$from,i=yv(n,({node:l})=>!this.options.nestedColumns&&l.type==this.type?!0:l.type==this.type);if(i===void 0)return;let s=[];i.node.descendants((l,u,c)=>{(c==null?void 0:c.type.name)===bg.name&&s.push(l)}),s=s.reverse().filter(l=>l.content.size>0);const o=t.doc.resolve(i.pos),a=new ze(o);return t=t.setSelection(a),s.forEach(l=>t=t.insert(i.pos,l)),t=t.deleteSelection(),e(t)}catch(n){console.error(n)}},setColumns:(t,e=!1)=>({tr:n,dispatch:r})=>{try{const{doc:i,selection:s}=n;if(!r){console.log("no dispatch");return}const o=new yg(s);o.expandSelection(i);const{openStart:a,openEnd:l}=o.content();if(a!==l){console.warn("failed depth check");return}let u;if(e){const h=o.content().toJSON(),p=x_(h),m=k_(t-1);u=E_({content:[p,...m]})}else{const h=k_(t);u=E_({content:h})}const c=i.type.schema.nodeFromJSON(A_({content:[u]}));if(c===null)return;const f=o.$anchor.parent.type;if(!(h=>!(!h.contentMatch.matchType(this.type)||!this.options.nestedColumns&&h.name===bg.name))(f)){console.warn("content not allowed");return}return n=n.setSelection(o),n=n.replaceSelectionWith(c,!1),r(n)}catch(i){console.error(i)}},setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]}}),fq=(t,e)=>{const{view:n,state:{selection:{from:r}}}=t,i=document.querySelectorAll(".has-focus"),s=i.length,a=i[s-1];if(a&&a.getAttribute("data-type")&&a.getAttribute("data-type")===e||a&&a.classList&&a.classList.contains(e))return a;const l=n.domAtPos(r).node;let u=l;for(u.tagName||(u=l.parentElement);u&&!(u.getAttribute("data-type")&&u.getAttribute("data-type")===e)&&!u.classList.contains(e);)u=u.parentElement;return u},qA=_.forwardRef(({children:t,className:e,withShadow:n=!0,withBorder:r=!1,...i},s)=>{const o=Ne(e,"bg-white rounded",n?"shadow-lg":"",r?"border border-neutral-200":"");return k.jsx("div",{className:o,...i,ref:s,children:t})});qA.displayName="Surface";const C_=({content:t,children:e})=>{const[n,r]=_.useState(!1);return k.jsxs("div",{className:"relative inline-block",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[e,n&&k.jsx("div",{className:"absolute z-10 p-2 mt-2 text-sm text-white bg-gray-800 rounded shadow-lg",children:t})]})},D_=_.forwardRef(({shouldShowContent:t=!0,children:e,isVertical:n=!1,className:r,...i},s)=>{const o=Ne("text-black inline-flex h-full leading-none gap-0.5",n?"flex-col p-2":"flex-row p-1 items-center",r);return t?t&&k.jsx(qA,{className:o,...i,ref:s,children:e}):null});D_.displayName="Toolbar";const T_=_.forwardRef(({horizontal:t,className:e,...n},r)=>{const i=Ne("bg-neutral-200",t?"w-full min-w-[1.5rem] h-[1px] my-1 first:mt-0 last:mt-0":"h-full min-h-[1.5rem] w-[1px] mx-1 first:ml-0 last:mr-0",e);return k.jsx("div",{className:i,ref:r,...n})});T_.displayName="Toolbar.Divider";const O_=_.forwardRef(({children:t,buttonSize:e="icon",variant:n="ghost",className:r,tooltip:i,activeClassname:s,...o},a)=>{const l=Ne("gap-1 min-w-[2rem] px-2 w-auto",r),u=k.jsx(ba,{activeClassname:s,className:l,variant:n,buttonSize:e,ref:a,...o,children:t});return i?k.jsx(C_,{content:i,children:u}):u});O_.displayName="ToolbarButton";const Uc={Wrapper:D_,Divider:T_,Button:O_},dq=({editor:t,appendTo:e})=>{const n=_.useCallback(()=>{const l=fq(t,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[t]),r=_.useCallback(()=>t.isActive("columns"),[t]),i=_.useCallback(()=>{t.chain().focus().setLayout(Ql.AlignLeft).run()},[t]),s=_.useCallback(()=>{t.chain().focus().setLayout(Ql.AlignRight).run()},[t]),o=_.useCallback(()=>{t.chain().focus().setLayout(Ql.AlignCenter).run()},[t]),a=_.useCallback(()=>{t.chain().focus().deleteNode("columns").run()},[t]);return k.jsx(kO,{editor:t,pluginKey:`columnsMenu-${lq()}`,shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:n,moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",appendTo:()=>e==null?void 0:e.current,plugins:[S$],sticky:"popper"},children:k.jsxs(Uc.Wrapper,{children:[k.jsx(Uc.Button,{tooltip:"Align left",active:t.isActive("columns",{layout:Ql.AlignLeft}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:i,children:k.jsx(sG,{size:20})}),k.jsx(Uc.Button,{tooltip:"Align center",active:t.isActive("columns",{layout:Ql.AlignCenter}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:o,children:k.jsx(MO,{size:20})}),k.jsx(Uc.Button,{tooltip:"Align right",active:t.isActive("columns",{layout:Ql.AlignRight}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:s,children:k.jsx(oG,{size:20})}),k.jsx(Uc.Button,{tooltip:"Remove column",onClick:a,children:k.jsx(sA,{size:20})})]})})},__=_.createContext(null),wg=()=>_.useContext(__),hq=({children:t,isPreviewMode:e})=>k.jsx(__.Provider,{value:e,children:t}),M_=({height:t,width:e})=>k.jsx("span",{className:"flex items-center justify-center ",children:k.jsx("span",{className:`${e?`w-${e}`:"w-8"} ${t?`h-${t}`:"h-8"} border-4 border-t-4 border-t-[#ccc] border-gray-500 rounded-full animate-spin`})}),pq=({editor:t,onError:e})=>{var o;const{toolRef:n,toolVisibilty:r,setToolVisibility:i,toolbar:s}=KA({editor:t,onError:e});return k.jsxs("div",{className:"w-fit bg-transparent px-4 items-center h-16 flex gap-1 justify-center relative",children:[k.jsxs("button",{className:"bg-transparent flex items-center gap-2 min-w-[55px]",onClick:()=>i(Ge.FONT_FAMILY),children:[k.jsx("span",{className:"text-sm",children:((o=g_.find(a=>t==null?void 0:t.isActive("textStyle",{fontFamily:a.value})))==null?void 0:o.title)||"Font"}),k.jsx(Gm,{size:16})]}),k.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"}),k.jsxs("button",{className:"bg-transparent gap-2 flex items-center min-w-[55px]",onClick:()=>i(Ge.HEADING),children:[k.jsx("span",{className:"text-sm",children:t!=null&&t.isActive("heading",{level:1})?"Heading 1":t!=null&&t.isActive("heading",{level:2})?"Heading 2":t!=null&&t.isActive("heading",{level:3})?"Heading 3":"Text"}),k.jsx(Gm,{size:16})]}),k.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"}),s.map((a,l)=>a?k.jsx("div",{className:"tooltip tooltip-neutral tooltip-bottom text-xs","data-tip":a.title,children:k.jsx("span",{onClick:()=>a.onClick(),className:Ne("rounded w-8 h-8 p-1 flex cursor-pointer justify-center items-center transition",a.isActive?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:typeof a.icon=="string"?k.jsx("img",{src:a.icon,className:"w-4"}):a.icon})},a.title):k.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"},l)),r===Ge.FONT_FAMILY&&k.jsx(eq,{setToolVisibility:i,editor:t,elementRef:n}),r===Ge.HEADING&&k.jsx(rq,{setVisibility:i,editor:t,elementRef:n}),r===Ge.TEXT_COLOR&&k.jsx(nq,{setVisibility:i,editor:t,elementRef:n}),r===Ge.HIGHLIGHT&&k.jsx(y_,{setVisibility:i,editor:t,elementRef:n}),r===Ge.ALIGNMENT&&k.jsx(b_,{setToolVisibility:i,editor:t,elementRef:n}),r===Ge.LIST&&k.jsx(tq,{setToolVisibility:i,editor:t,elementRef:n}),r===Ge.LINK&&k.jsx(w_,{setToolVisibility:i,editor:t,elementRef:n})]})},mq={attributes:{class:"prose-lg prose-headings:font-display prose prose-p:my-2 prose-h1:my-2 prose-h2:my-2 prose-h3:my-2 prose-ul:my-2 prose-ol:my-2 max-w-none focus:outline-none w-full",spellcheck:"false",suppressContentEditableWarning:"true"}},Tr=()=>new Map,QA=t=>{const e=Tr();return t.forEach((n,r)=>{e.set(r,n)}),e},Os=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},gq=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},yq=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},wa=()=>new Set,JA=t=>t[t.length-1],bq=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},va=Array.from,wq=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},YA=Array.isArray;class N_{constructor(){this._observers=Tr()}on(e,n){return Os(this._observers,e,wa).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return va((this._observers.get(e)||Tr()).values()).forEach(r=>r(...n))}destroy(){this._observers=Tr()}}class vq{constructor(){this._observers=Tr()}on(e,n){Os(this._observers,e,wa).add(n)}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return va((this._observers.get(e)||Tr()).values()).forEach(r=>r(...n))}destroy(){this._observers=Tr()}}const _s=Math.floor,vg=Math.abs,Jl=(t,e)=>t<e?t:e,po=(t,e)=>t>e?t:e,P_=t=>t!==0?t<0:1/t<0,I_=1,R_=2,XA=4,ZA=8,$h=32,mo=64,li=128,Ag=31,ex=63,Yl=127,Aq=2147483647,L_=Number.MAX_SAFE_INTEGER,xq=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&_s(t)===t),Eq=t=>t.toLowerCase(),kq=/^\s*/g,Sq=t=>t.replace(kq,""),Cq=/([A-Z])/g,B_=(t,e)=>Sq(t.replace(Cq,n=>`${e}${Eq(n)}`)),Dq=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},Gh=typeof TextEncoder<"u"?new TextEncoder:null,Tq=Gh?t=>Gh.encode(t):Dq;let Wh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Wh&&Wh.decode(new Uint8Array).length===1&&(Wh=null);let Kh=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const jc=()=>new Kh,Oq=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Ti=t=>{const e=new Uint8Array(Oq(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},_q=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(po(n,e)*2),t.cpos=0)},$n=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},tx=$n,wt=(t,e)=>{for(;e>Yl;)$n(t,li|Yl&e),e=_s(e/128);$n(t,Yl&e)},nx=(t,e)=>{const n=P_(e);for(n&&(e=-e),$n(t,(e>ex?li:0)|(n?mo:0)|ex&e),e=_s(e/64);e>0;)$n(t,(e>Yl?li:0)|Yl&e),e=_s(e/128)},rx=new Uint8Array(3e4),Mq=rx.length/3,Nq=(t,e)=>{if(e.length<Mq){const n=Gh.encodeInto(e,rx).written||0;wt(t,n);for(let r=0;r<n;r++)$n(t,rx[r])}else Gr(t,Tq(e))},Pq=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;wt(t,r);for(let i=0;i<r;i++)$n(t,n.codePointAt(i))},Xl=Gh&&Gh.encodeInto?Nq:Pq,xg=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=Jl(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(po(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},Gr=(t,e)=>{wt(t,e.byteLength),xg(t,e)},ix=(t,e)=>{_q(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},Iq=(t,e)=>ix(t,4).setFloat32(0,e,!1),Rq=(t,e)=>ix(t,8).setFloat64(0,e,!1),Lq=(t,e)=>ix(t,8).setBigInt64(0,e,!1),F_=new DataView(new ArrayBuffer(4)),Bq=t=>(F_.setFloat32(0,t),F_.getFloat32(0)===t),qh=(t,e)=>{switch(typeof e){case"string":$n(t,119),Xl(t,e);break;case"number":xq(e)&&vg(e)<=Aq?($n(t,125),nx(t,e)):Bq(e)?($n(t,124),Iq(t,e)):($n(t,123),Rq(t,e));break;case"bigint":$n(t,122),Lq(t,e);break;case"object":if(e===null)$n(t,126);else if(YA(e)){$n(t,117),wt(t,e.length);for(let n=0;n<e.length;n++)qh(t,e[n])}else if(e instanceof Uint8Array)$n(t,116),Gr(t,e);else{$n(t,118);const n=Object.keys(e);wt(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];Xl(t,i),qh(t,e[i])}}break;case"boolean":$n(t,e?120:121);break;default:$n(t,127)}};class U_ extends Kh{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&wt(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const j_=t=>{t.count>0&&(nx(t.encoder,t.count===1?t.s:-t.s),t.count>1&&wt(t.encoder,t.count-2))};class Eg{constructor(){this.encoder=new Kh,this.s=0,this.count=0}write(e){this.s===e?this.count++:(j_(this),this.count=1,this.s=e)}toUint8Array(){return j_(this),Ti(this.encoder)}}const H_=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);nx(t.encoder,e),t.count>1&&wt(t.encoder,t.count-2)}};class sx{constructor(){this.encoder=new Kh,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(H_(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return H_(this),Ti(this.encoder)}}class Fq{constructor(){this.sarr=[],this.s="",this.lensE=new Eg}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Kh;return this.sarr.push(this.s),this.s="",Xl(e,this.sarr.join("")),xg(e,this.lensE.toUint8Array()),Ti(e)}}const Aa=t=>new Error(t),Xi=()=>{throw Aa("Method unimplemented")},ui=()=>{throw Aa("Unexpected case")},V_=Aa("Unexpected end of array"),z_=Aa("Integer out of Range");let kg=class{constructor(e){this.arr=e,this.pos=0}};const xa=t=>new kg(t),Uq=t=>t.pos!==t.arr.length,jq=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Wr=t=>jq(t,at(t)),Hc=t=>t.arr[t.pos++],at=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&Yl)*n,n*=128,i<li)return e;if(e>L_)throw z_}throw V_},ox=t=>{let e=t.arr[t.pos++],n=e&ex,r=64;const i=(e&mo)>0?-1:1;if(!(e&li))return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Yl)*r,r*=128,e<li)return i*n;if(n>L_)throw z_}throw V_},Zl=Wh?t=>Wh.decode(Wr(t)):t=>{let e=at(t);if(e===0)return"";{let n=String.fromCodePoint(Hc(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Hc(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},ax=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},Hq=[t=>{},t=>null,ox,t=>ax(t,4).getFloat32(0,!1),t=>ax(t,8).getFloat64(0,!1),t=>ax(t,8).getBigInt64(0,!1),t=>!1,t=>!0,Zl,t=>{const e=at(t),n={};for(let r=0;r<e;r++){const i=Zl(t);n[i]=Qh(t)}return n},t=>{const e=at(t),n=[];for(let r=0;r<e;r++)n.push(Qh(t));return n},Wr],Qh=t=>Hq[127-Hc(t)](t);class $_ extends kg{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Uq(this)?this.count=at(this)+1:this.count=-1),this.count--,this.s}}class Sg extends kg{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=ox(this);const e=P_(this.s);this.count=1,e&&(this.s=-this.s,this.count=at(this)+2)}return this.count--,this.s}}class lx extends kg{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=ox(this),n=e&1;this.diff=_s(e/2),this.count=1,n&&(this.count=at(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Vq{constructor(e){this.decoder=new Sg(e),this.str=Zl(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const zq=crypto.getRandomValues.bind(crypto),$q=Math.random,G_=()=>zq(new Uint32Array(1))[0],Gq=t=>t[_s($q()*t.length)],Wq="10000000-1000-4000-8000"+-1e11,Kq=()=>Wq.replace(/[018]/g,t=>(t^G_()&15>>t/4).toString(16)),Jh=Date.now,W_=t=>new Promise(t);Promise.all.bind(Promise);const K_=t=>t===void 0?null:t;class qq{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let q_=new qq,Qq=!0;try{typeof localStorage<"u"&&localStorage&&(q_=localStorage,Qq=!1)}catch{}const Jq=q_,Yq=Object.assign,ux=Object.keys,Xq=(t,e)=>{for(const n in t)e(t[n],n)},Q_=t=>ux(t).length,J_=t=>ux(t).length,Zq=t=>{for(const e in t)return!1;return!0},eQ=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},Y_=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),tQ=(t,e)=>t===e||J_(t)===J_(e)&&eQ(t,(n,r)=>(n!==void 0||Y_(e,r))&&e[r]===n),cx=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&cx(t,e,n+1)}},nQ=t=>t,rQ=(t,e)=>t===e,Yh=(t,e)=>{if(t==null||e==null)return rQ(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Yh(t.get(n),e.get(n)))return!1;break}case Object:if(Q_(t)!==Q_(e))return!1;for(const n in t)if(!Y_(t,n)||!Yh(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Yh(t[n],e[n]))return!1;break;default:return!1}return!0},iQ=(t,e)=>e.includes(t),Vc=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",sQ=typeof window<"u"&&typeof document<"u"&&!Vc;let Ms;const oQ=()=>{if(Ms===void 0)if(Vc){Ms=Tr();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&Ms.set(e,""),e=r):e!==null&&(Ms.set(e,r),e=null)}e!==null&&Ms.set(e,"")}else typeof location=="object"?(Ms=Tr(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");Ms.set(`--${B_(e,"-")}`,n),Ms.set(`-${B_(e,"-")}`,n)}})):Ms=Tr();return Ms},fx=t=>oQ().has(t),dx=t=>K_(Vc?process.env[t.toUpperCase().replaceAll("-","_")]:Jq.getItem(t)),X_=t=>fx("--"+t)||dx(t)!==null;X_("production");const aQ=Vc&&iQ(process.env.FORCE_COLOR,["true","1","2"])||!fx("--no-colors")&&!X_("no-color")&&(!Vc||process.stdout.isTTY)&&(!Vc||fx("--color")||dx("COLORTERM")!==null||(dx("TERM")||"").includes("color")),lQ=t=>new Uint8Array(t),uQ=t=>{const e=lQ(t.byteLength);return e.set(t),e};class cQ{constructor(e,n){this.left=e,this.right=n}}const go=(t,e)=>new cQ(t,e),fQ=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const dQ=t=>gq(t,(e,n)=>`${n}:${e};`).join(""),hQ=(t=>class{constructor(n){this._=n}destroy(){t(this._)}})(clearTimeout),hx=(t,e)=>new hQ(setTimeout(e,t)),yo=Symbol,Z_=yo(),eM=yo(),pQ=yo(),mQ=yo(),gQ=yo(),tM=yo(),yQ=yo(),px=yo(),bQ=yo(),wQ=t=>{var i;t.length===1&&((i=t[0])==null?void 0:i.constructor)===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const s=t[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const s=t[r];s instanceof Symbol||n.push(s)}return n},vQ={[Z_]:go("font-weight","bold"),[eM]:go("font-weight","normal"),[pQ]:go("color","blue"),[gQ]:go("color","green"),[mQ]:go("color","grey"),[tM]:go("color","red"),[yQ]:go("color","purple"),[px]:go("color","orange"),[bQ]:go("color","black")},nM=aQ?t=>{var o;t.length===1&&((o=t[0])==null?void 0:o.constructor)===Function&&(t=t[0]());const e=[],n=[],r=Tr();let i=[],s=0;for(;s<t.length;s++){const a=t[s],l=vQ[a];if(l!==void 0)r.set(l.left,l.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const u=dQ(r);s>0||u.length>0?(e.push("%c"+a),n.push(u)):e.push(a)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const a=t[s];a instanceof Symbol||i.push(a)}return i}:wQ,AQ=(...t)=>{console.log(...nM(t)),rM.forEach(e=>e.print(t))},xQ=(...t)=>{console.warn(...nM(t)),t.unshift(px),rM.forEach(e=>e.print(t))},rM=wa(),iM=t=>({[Symbol.iterator](){return this},next:t}),EQ=(t,e)=>iM(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),mx=(t,e)=>iM(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class gx{constructor(e,n){this.clock=e,this.len=n}}class zc{constructor(){this.clients=new Map}}const Ea=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);for(let o=0;o<r.length;o++){const a=r[o];AM(t,s,a.clock,a.len,n)}}),kQ=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=_s((n+r)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;n=i+1}else r=i-1}return null},$c=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&kQ(n,e.clock)!==null},yx=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?i.len=po(i.len,s.clock+s.len-i.clock):(r<n&&(e[r]=s),r++)}e.length=r})},bx=t=>{const e=new zc;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let o=n+1;o<t.length;o++)bq(s,t[o].clients.get(i)||[]);e.clients.set(i,s)}});return yx(e),e},Xh=(t,e,n,r)=>{Os(t.clients,e,()=>[]).push(new gx(n,r))},sM=()=>new zc,oM=t=>{const e=sM();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const o=n[s];if(o.deleted){const a=o.id.clock;let l=o.length;if(s+1<n.length)for(let u=n[s+1];s+1<n.length&&u.deleted;u=n[++s+1])l+=u.length;i.push(new gx(a,l))}}i.length>0&&e.clients.set(r,i)}),e},Gc=(t,e)=>{wt(t.restEncoder,e.clients.size),va(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),wt(t.restEncoder,n);const i=r.length;wt(t.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},wx=t=>{const e=new zc,n=at(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=at(t.restDecoder),s=at(t.restDecoder);if(s>0){const o=Os(e.clients,i,()=>[]);for(let a=0;a<s;a++)o.push(new gx(t.readDsClock(),t.readDsLen()))}}return e},aM=(t,e,n)=>{const r=new zc,i=at(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const o=at(t.restDecoder),a=at(t.restDecoder),l=n.clients.get(o)||[],u=vn(n,o);for(let c=0;c<a;c++){const f=t.readDsClock(),d=f+t.readDsLen();if(f<u){u<d&&Xh(r,o,u,d-u);let h=Ns(l,f),p=l[h];for(!p.deleted&&p.id.clock<f&&(l.splice(h+1,0,Hg(e,p,f-p.id.clock)),h++);h<l.length&&(p=l[h++],p.id.clock<d);)p.deleted||(d<p.id.clock+p.length&&l.splice(h,0,Hg(e,p,d-p.id.clock)),p.delete(e))}else Xh(r,o,f,d-f)}}if(r.clients.size>0){const s=new eu;return wt(s.restEncoder,0),Gc(s,r),s.toUint8Array()}return null},lM=G_;class ka extends N_{constructor({guid:e=Kq(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=lM(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new bM,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=W_(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>W_(u=>{const c=f=>{(f===void 0||f===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Gt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(va(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Gt(this,e,n)}get(e,n=nr){const r=Os(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==nr&&i!==n)if(i===nr){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Jc)}getText(e=""){return this.get(e,nu)}getMap(e=""){return this.get(e,Yc)}getXmlElement(e=""){return this.get(e,Or)}getXmlFragment(e=""){return this.get(e,ru)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){va(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ka({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Gt(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class uM{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return at(this.restDecoder)}readDsLen(){return at(this.restDecoder)}}class SQ extends uM{readLeftID(){return it(at(this.restDecoder),at(this.restDecoder))}readRightID(){return it(at(this.restDecoder),at(this.restDecoder))}readClient(){return at(this.restDecoder)}readInfo(){return Hc(this.restDecoder)}readString(){return Zl(this.restDecoder)}readParentInfo(){return at(this.restDecoder)===1}readTypeRef(){return at(this.restDecoder)}readLen(){return at(this.restDecoder)}readAny(){return Qh(this.restDecoder)}readBuf(){return uQ(Wr(this.restDecoder))}readJSON(){return JSON.parse(Zl(this.restDecoder))}readKey(){return Zl(this.restDecoder)}}class CQ{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=at(this.restDecoder),this.dsCurrVal}readDsLen(){const e=at(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Wc extends CQ{constructor(e){super(e),this.keys=[],at(e),this.keyClockDecoder=new lx(Wr(e)),this.clientDecoder=new Sg(Wr(e)),this.leftClockDecoder=new lx(Wr(e)),this.rightClockDecoder=new lx(Wr(e)),this.infoDecoder=new $_(Wr(e),Hc),this.stringDecoder=new Vq(Wr(e)),this.parentInfoDecoder=new $_(Wr(e),Hc),this.typeRefDecoder=new Sg(Wr(e)),this.lenDecoder=new Sg(Wr(e))}readLeftID(){return new Kc(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Kc(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Qh(this.restDecoder)}readBuf(){return Wr(this.restDecoder)}readJSON(){return Qh(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class DQ{constructor(){this.restEncoder=jc()}toUint8Array(){return Ti(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){wt(this.restEncoder,e)}writeDsLen(e){wt(this.restEncoder,e)}}class Cg extends DQ{writeLeftID(e){wt(this.restEncoder,e.client),wt(this.restEncoder,e.clock)}writeRightID(e){wt(this.restEncoder,e.client),wt(this.restEncoder,e.clock)}writeClient(e){wt(this.restEncoder,e)}writeInfo(e){tx(this.restEncoder,e)}writeString(e){Xl(this.restEncoder,e)}writeParentInfo(e){wt(this.restEncoder,e?1:0)}writeTypeRef(e){wt(this.restEncoder,e)}writeLen(e){wt(this.restEncoder,e)}writeAny(e){qh(this.restEncoder,e)}writeBuf(e){Gr(this.restEncoder,e)}writeJSON(e){Xl(this.restEncoder,JSON.stringify(e))}writeKey(e){Xl(this.restEncoder,e)}}class TQ{constructor(){this.restEncoder=jc(),this.dsCurrVal=0}toUint8Array(){return Ti(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,wt(this.restEncoder,n)}writeDsLen(e){e===0&&ui(),wt(this.restEncoder,e-1),this.dsCurrVal+=e}}class eu extends TQ{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new sx,this.clientEncoder=new Eg,this.leftClockEncoder=new sx,this.rightClockEncoder=new sx,this.infoEncoder=new U_(tx),this.stringEncoder=new Fq,this.parentInfoEncoder=new U_(tx),this.typeRefEncoder=new Eg,this.lenEncoder=new Eg}toUint8Array(){const e=jc();return wt(e,0),Gr(e,this.keyClockEncoder.toUint8Array()),Gr(e,this.clientEncoder.toUint8Array()),Gr(e,this.leftClockEncoder.toUint8Array()),Gr(e,this.rightClockEncoder.toUint8Array()),Gr(e,Ti(this.infoEncoder)),Gr(e,this.stringEncoder.toUint8Array()),Gr(e,Ti(this.parentInfoEncoder)),Gr(e,this.typeRefEncoder.toUint8Array()),Gr(e,this.lenEncoder.toUint8Array()),xg(e,Ti(this.restEncoder)),Ti(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){qh(this.restEncoder,e)}writeBuf(e){Gr(this.restEncoder,e)}writeJSON(e){qh(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const OQ=(t,e,n,r)=>{r=po(r,e[0].id.clock);const i=Ns(e,r);wt(t.restEncoder,e.length-i),t.writeClient(n),wt(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(t,0)},vx=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{vn(e,s)>i&&r.set(s,i)}),Og(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),wt(t.restEncoder,r.size),va(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{OQ(t,e.clients.get(i),i,s)})},_Q=(t,e)=>{const n=Tr(),r=at(t.restDecoder);for(let i=0;i<r;i++){const s=at(t.restDecoder),o=new Array(s),a=t.readClient();let l=at(t.restDecoder);n.set(a,{i:0,refs:o});for(let u=0;u<s;u++){const c=t.readInfo();switch(Ag&c){case 0:{const f=t.readLen();o[u]=new Oi(it(a,l),f),l+=f;break}case 10:{const f=at(t.restDecoder);o[u]=new _i(it(a,l),f),l+=f;break}default:{const f=(c&(mo|li))===0,d=new Kt(it(a,l),null,(c&li)===li?t.readLeftID():null,null,(c&mo)===mo?t.readRightID():null,f?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,f&&(c&$h)===$h?t.readString():null,XM(t,c));o[u]=d,l+=d.length}}}}return n},MQ=(t,e,n)=>{const r=[];let i=va(n.keys()).sort((h,p)=>h-p);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let h=n.get(i[i.length-1]);for(;h.refs.length===h.i;)if(i.pop(),i.length>0)h=n.get(i[i.length-1]);else return null;return h};let o=s();if(o===null)return null;const a=new bM,l=new Map,u=(h,p)=>{const m=l.get(h);(m==null||m>p)&&l.set(h,p)};let c=o.refs[o.i++];const f=new Map,d=()=>{for(const h of r){const p=h.id.client,m=n.get(p);m?(m.i--,a.clients.set(p,m.refs.slice(m.i)),n.delete(p),m.i=0,m.refs=[]):a.clients.set(p,[h]),i=i.filter(g=>g!==p)}r.length=0};for(;;){if(c.constructor!==_i){const p=Os(f,c.id.client,()=>vn(e,c.id.client))-c.id.clock;if(p<0)r.push(c),u(c.id.client,c.id.clock-1),d();else{const m=c.getMissing(t,e);if(m!==null){r.push(c);const g=n.get(m)||{refs:[],i:0};if(g.refs.length===g.i)u(m,vn(e,m)),d();else{c=g.refs[g.i++];continue}}else(p===0||p<c.length)&&(c.integrate(t,p),f.set(c.id.client,c.id.clock+c.length))}}if(r.length>0)c=r.pop();else if(o!==null&&o.i<o.refs.length)c=o.refs[o.i++];else{if(o=s(),o===null)break;c=o.refs[o.i++]}}if(a.clients.size>0){const h=new eu;return vx(h,a,new Map),wt(h.restEncoder,0),{missing:l,update:h.toUint8Array()}}return null},NQ=(t,e)=>vx(t,e.doc.store,e.beforeState),PQ=(t,e,n,r=new Wc(t))=>Gt(e,i=>{i.local=!1;let s=!1;const o=i.doc,a=o.store,l=_Q(r,o),u=MQ(i,a,l),c=a.pendingStructs;if(c){for(const[d,h]of c.missing)if(h<vn(a,d)){s=!0;break}if(u){for(const[d,h]of u.missing){const p=c.missing.get(d);(p==null||p>h)&&c.missing.set(d,h)}c.update=Mg([c.update,u.update])}}else a.pendingStructs=u;const f=aM(r,i,a);if(a.pendingDs){const d=new Wc(xa(a.pendingDs));at(d.restDecoder);const h=aM(d,i,a);f&&h?a.pendingDs=Mg([f,h]):a.pendingDs=f||h}else a.pendingDs=f;if(s){const d=a.pendingStructs.update;a.pendingStructs=null,Dg(i.doc,d)}},n,!1),Dg=(t,e,n,r=Wc)=>{const i=xa(e);PQ(i,t,n,new r(i))},IQ=(t,e,n=new Map)=>{vx(t,e.store,n),Gc(t,oM(e.store))},cM=(t,e=new Uint8Array([0]),n=new eu)=>{const r=fM(e);IQ(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(qQ(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===Cg)return WQ(i.map((s,o)=>o===0?s:JQ(s)));if(n.constructor===eu)return Mg(i)}return i[0]},RQ=t=>{const e=new Map,n=at(t.restDecoder);for(let r=0;r<n;r++){const i=at(t.restDecoder),s=at(t.restDecoder);e.set(i,s)}return e},fM=t=>RQ(new uM(xa(t)));class LQ{constructor(){this.l=[]}}const dM=()=>new LQ,hM=(t,e)=>t.l.push(e),pM=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},mM=(t,e,n)=>cx(t.l,[e,n]);class Kc{constructor(e,n){this.client=e,this.clock=n}}const qc=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,it=(t,e)=>new Kc(t,e),Zh=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw ui()},ep=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class tp{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const np=t=>new tp(t.type==null?null:it(t.type.client,t.type.clock),t.tname??null,t.item==null?null:it(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class BQ{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const FQ=(t,e,n=0)=>new BQ(t,e,n),Tg=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Zh(t):r=it(t._item.id.client,t._item.id.clock),new tp(r,i,e,n)},Ax=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Tg(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Tg(t,it(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Tg(t,r.lastId,n);r=r.right}return Tg(t,null,n)},UQ=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,o=t.tname,a=t.assoc;let l=null,u=0;if(i!==null){if(vn(r,i.client)<=i.clock)return null;const c=n?Lx(r,i):{item:Qc(r,i),diff:0},f=c.item;if(!(f instanceof Kt))return null;if(l=f.parent,l._item===null||!l._item.deleted){u=f.deleted||!f.countable?0:c.diff+(a>=0?0:1);let d=f.left;for(;d!==null;)!d.deleted&&d.countable&&(u+=d.length),d=d.left}}else{if(o!==null)l=e.get(o);else if(s!==null){if(vn(r,s.client)<=s.clock)return null;const{item:c}=n?Lx(r,s):{item:Qc(r,s)};if(c instanceof Kt&&c.content instanceof es)l=c.content.type;else return null}else throw ui();a>=0?u=l._length:u=0}return FQ(l,u,t.assoc)},gM=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&qc(t.item,e.item)&&qc(t.type,e.type)&&t.assoc===e.assoc;class xx{constructor(e,n){this.ds=e,this.sv=n}}const yM=(t,e)=>new xx(t,e),Ex=t=>yM(oM(t.store),Og(t.store)),tu=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!$c(e.ds,t.id),kx=(t,e)=>{const n=Os(t.meta,kx,wa),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<vn(r,s)&&Kr(t,it(s,i))}),Ea(t,e.ds,i=>{}),n.add(e))};class bM{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Og=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},vn=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},wM=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw ui()}n.push(e)},Ns=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let o=_s(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;n=o+1}else r=o-1;o=_s((n+r)/2)}throw ui()},Qc=(t,e)=>{const n=t.clients.get(e.client);return n[Ns(n,e.clock)]},Sx=(t,e,n)=>{const r=Ns(e,n),i=e[r];return i.id.clock<n&&i instanceof Kt?(e.splice(r+1,0,Hg(t,i,n-i.id.clock)),r+1):r},Kr=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Sx(t,n,e.clock)]},vM=(t,e,n)=>{const r=e.clients.get(n.client),i=Ns(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Oi&&r.splice(i+1,0,Hg(t,s,n.clock-s.id.clock+1)),s},jQ=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Ns(r,e.id.clock)]=n},AM=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let o=Sx(t,e,n),a;do a=e[o++],s<a.id.clock+a.length&&Sx(t,e,s),i(a);while(o<e.length&&e[o].id.clock<s)};let HQ=class{constructor(e,n,r){this.doc=e,this.deleteSet=new zc,this.beforeState=Og(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}};const xM=(t,e)=>e.deleteSet.clients.size===0&&!yq(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(yx(e.deleteSet),NQ(t,e),Gc(t,e.deleteSet),!0),EM=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Os(t.changed,e,wa).add(n)},_g=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Kt&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},VQ=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],l=a.clock+a.len;for(let u=Ns(s,a.clock),c=s[u];u<s.length&&c.id.clock<l;c=s[++u]){const f=s[u];if(a.clock+a.len<=f.id.clock)break;f instanceof Kt&&f.deleted&&!f.keep&&n(f)&&f.gc(e,!1)}}}},zQ=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],a=Jl(i.length-1,1+Ns(i,o.clock+o.len-1));for(let l=a,u=i[l];l>0&&u.id.clock>=o.clock;u=i[l])l-=1+_g(i,l)}})},kM=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{yx(s),n.afterState=Og(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(c=>c.target._item===null||!c.target._item.deleted),l.forEach(c=>{c.currentTarget=u,c._path=null}),l.sort((c,f)=>c.path.length-f.path.length),mM(u._dEH,l,n))})}),a.push(()=>r.emit("afterTransaction",[n,r])),cx(a,[]),n._needFormattingCleanup&&cJ(n)}finally{r.gc&&VQ(s,i,r.gcFilter),zQ(s,i),n.afterState.forEach((c,f)=>{const d=n.beforeState.get(f)||0;if(d!==c){const h=i.clients.get(f),p=po(Ns(h,d),1);for(let m=h.length-1;m>=p;)m-=1+_g(h,m)}});for(let c=o.length-1;c>=0;c--){const{client:f,clock:d}=o[c].id,h=i.clients.get(f),p=Ns(h,d);p+1<h.length&&_g(h,p+1)>1||p>0&&_g(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(AQ(px,Z_,"[yjs] ",eM,tM,"Changed the client-id because another client seems to be using it."),r.clientID=lM()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new Cg;xM(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new eu;xM(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(c=>c.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):kM(t,e+1)}}},Gt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,o=null;t._transaction===null&&(s=!0,t._transaction=new HQ(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(s){const a=t._transaction===i[0];t._transaction=null,a&&kM(i,0)}}return o};class $Q{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const SM=(t,e,n)=>{Ea(t,n.deletions,r=>{r instanceof Kt&&e.scope.some(i=>ep(i,r))&&Bx(r,!1)})},CM=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;Gt(i,a=>{for(;e.length>0&&t.currStackItem===null;){const l=i.store,u=e.pop(),c=new Set,f=[];let d=!1;Ea(a,u.insertions,h=>{if(h instanceof Kt){if(h.redone!==null){let{item:p,diff:m}=Lx(l,h.id);m>0&&(p=Kr(a,it(p.id.client,p.id.clock+m))),h=p}!h.deleted&&s.some(p=>ep(p,h))&&f.push(h)}}),Ea(a,u.deletions,h=>{h instanceof Kt&&s.some(p=>ep(p,h))&&!$c(u.insertions,h.id)&&c.add(h)}),c.forEach(h=>{d=YM(a,h,c,u.insertions,t.ignoreRemoteMapChanges,t)!==null||d});for(let h=f.length-1;h>=0;h--){const p=f[h];t.deleteFilter(p)&&(p.delete(a),d=!0)}t.currStackItem=d?u:null}a.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=a},t);const o=t.currStackItem;if(o!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return o};class DM extends N_{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=YA(e)?e[0].doc:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(g=>l.changedParentTypes.has(g))||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,c=this.redoing,f=u?this.redoStack:this.undoStack;u?this.stopCapturing():c||this.clear(!1,!0);const d=new zc;l.afterState.forEach((g,y)=>{const v=l.beforeState.get(y)||0,w=g-v;w>0&&Xh(d,y,v,w)});const h=Jh();let p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&f.length>0&&!u&&!c){const g=f[f.length-1];g.deletions=bx([g.deletions,l.deleteSet]),g.insertions=bx([g.insertions,d])}else f.push(new $Q(l.deleteSet,d)),p=!0;!u&&!c&&(this.lastChange=h),Ea(l,l.deleteSet,g=>{g instanceof Kt&&this.scope.some(y=>ep(y,g))&&Bx(g,!0)});const m=[{stackItem:f[f.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){e=YA(e)?e:[e],e.forEach(n=>{this.scope.every(r=>r!==n)&&(n.doc!==this.doc&&xQ("[yjs#509] Not same Y.Doc"),this.scope.push(n))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>SM(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>SM(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=CM(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=CM(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*GQ(t){const e=at(t.restDecoder);for(let n=0;n<e;n++){const r=at(t.restDecoder),i=t.readClient();let s=at(t.restDecoder);for(let o=0;o<r;o++){const a=t.readInfo();if(a===10){const l=at(t.restDecoder);yield new _i(it(i,s),l),s+=l}else if(Ag&a){const l=(a&(mo|li))===0,u=new Kt(it(i,s),null,(a&li)===li?t.readLeftID():null,null,(a&mo)===mo?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&$h)===$h?t.readString():null,XM(t,a));yield u,s+=u.length}else{const l=t.readLen();yield new Oi(it(i,s),l),s+=l}}}}class Cx{constructor(e,n){this.gen=GQ(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===_i);return this.curr}}class Dx{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const WQ=t=>Mg(t,SQ,Cg),KQ=(t,e)=>{if(t.constructor===Oi){const{client:n,clock:r}=t.id;return new Oi(it(n,r+e),t.length-e)}else if(t.constructor===_i){const{client:n,clock:r}=t.id;return new _i(it(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new Kt(it(r,i+e),null,it(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Mg=(t,e=Wc,n=eu)=>{if(t.length===1)return t[0];const r=t.map(c=>new e(xa(c)));let i=r.map(c=>new Cx(c,!0)),s=null;const o=new n,a=new Dx(o);for(;i=i.filter(d=>d.curr!==null),i.sort((d,h)=>{if(d.curr.id.client===h.curr.id.client){const p=d.curr.id.clock-h.curr.id.clock;return p===0?d.curr.constructor===h.curr.constructor?0:d.curr.constructor===_i?1:-1:p}else return h.curr.id.client-d.curr.id.client}),i.length!==0;){const c=i[0],f=c.curr.id.client;if(s!==null){let d=c.curr,h=!1;for(;d!==null&&d.id.clock+d.length<=s.struct.id.clock+s.struct.length&&d.id.client>=s.struct.id.client;)d=c.next(),h=!0;if(d===null||d.id.client!==f||h&&d.id.clock>s.struct.id.clock+s.struct.length)continue;if(f!==s.struct.id.client)Sa(a,s.struct,s.offset),s={struct:d,offset:0},c.next();else if(s.struct.id.clock+s.struct.length<d.id.clock)if(s.struct.constructor===_i)s.struct.length=d.id.clock+d.length-s.struct.id.clock;else{Sa(a,s.struct,s.offset);const p=d.id.clock-s.struct.id.clock-s.struct.length;s={struct:new _i(it(f,s.struct.id.clock+s.struct.length),p),offset:0}}else{const p=s.struct.id.clock+s.struct.length-d.id.clock;p>0&&(s.struct.constructor===_i?s.struct.length-=p:d=KQ(d,p)),s.struct.mergeWith(d)||(Sa(a,s.struct,s.offset),s={struct:d,offset:0},c.next())}}else s={struct:c.curr,offset:0},c.next();for(let d=c.curr;d!==null&&d.id.client===f&&d.id.clock===s.struct.id.clock+s.struct.length&&d.constructor!==_i;d=c.next())Sa(a,s.struct,s.offset),s={struct:d,offset:0}}s!==null&&(Sa(a,s.struct,s.offset),s=null),Tx(a);const l=r.map(c=>wx(c)),u=bx(l);return Gc(o,u),o.toUint8Array()},qQ=(t,e,n=Wc,r=eu)=>{const i=fM(e),s=new r,o=new Dx(s),a=new n(xa(t)),l=new Cx(a,!1);for(;l.curr;){const c=l.curr,f=c.id.client,d=i.get(f)||0;if(l.curr.constructor===_i){l.next();continue}if(c.id.clock+c.length>d)for(Sa(o,c,po(d-c.id.clock,0)),l.next();l.curr&&l.curr.id.client===f;)Sa(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===f&&l.curr.id.clock+l.curr.length<=d;)l.next()}Tx(o);const u=wx(a);return Gc(s,u),s.toUint8Array()},TM=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Ti(t.encoder.restEncoder)}),t.encoder.restEncoder=jc(),t.written=0)},Sa=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&TM(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),wt(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},Tx=t=>{TM(t);const e=t.encoder.restEncoder;wt(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];wt(e,r.written),xg(e,r.restEncoder)}},QQ=(t,e,n,r)=>{const i=new n(xa(t)),s=new Cx(i,!1),o=new r,a=new Dx(o);for(let u=s.curr;u!==null;u=s.next())Sa(a,e(u),0);Tx(a);const l=wx(i);return Gc(o,l),o.toUint8Array()},JQ=t=>QQ(t,nQ,Wc,Cg),OM="You must not compute changes after the event-handler fired.";class Ng{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=YQ(this.currentTarget,this.target))}deletes(e){return $c(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Aa(OM);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))o="delete",a=JA(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=JA(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=JA(s.content.getContent());else return;e.set(i,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Aa(OM);const n=this.target,r=wa(),i=wa(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=u.length,i.add(u)):this.adds(u)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(u.content.getContent()),r.add(u)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=u.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const YQ=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},_M=80;let Ox=0;class XQ{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Ox++}}const ZQ=t=>{t.timestamp=Ox++},MM=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Ox++},eJ=(t,e,n)=>{if(t.length>=_M){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return MM(r,e,n),r}else{const r=new XQ(e,n);return t.push(r),r}},Pg=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,o)=>vg(e-s.index)<vg(e-o.index)?s:o);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,ZQ(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&vg(n.index-i)<r.parent.length/_M?(MM(n,r,i),n):eJ(t._searchMarker,r,i)},rp=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=po(e,i.index+n))}},Ig=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Os(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;mM(r._eH,n,e)};class nr{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=dM(),this._dEH=dM(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Xi()}clone(){throw Xi()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){hM(this._eH,e)}observeDeep(e){hM(this._dEH,e)}unobserve(e){pM(this._eH,e)}unobserveDeep(e){pM(this._dEH,e)}toJSON(){}}const NM=(t,e,n)=>{e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)i.push(o[a]),r--;e=0}}s=s.right}return i},PM=t=>{const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},IM=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&tu(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},ip=(t,e)=>{let n=0,r=t._start;for(;r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},RM=(t,e)=>{const n=[];return ip(t,(r,i)=>{n.push(e(r,i,t))}),n},tJ=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},LM=(t,e)=>{const n=Pg(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Rg=(t,e,n,r)=>{let i=n;const s=t.doc,o=s.clientID,a=s.store,l=n===null?e._start:n.right;let u=[];const c=()=>{u.length>0&&(i=new Kt(it(o,vn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new su(u)),i.integrate(t,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(c(),f.constructor){case Uint8Array:case ArrayBuffer:i=new Kt(it(o,vn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new sp(new Uint8Array(f))),i.integrate(t,0);break;case ka:i=new Kt(it(o,vn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new ap(f)),i.integrate(t,0);break;default:if(f instanceof nr)i=new Kt(it(o,vn(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new es(f)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},BM=()=>Aa("Length exceeded!"),FM=(t,e,n,r)=>{if(n>e._length)throw BM();if(n===0)return e._searchMarker&&rp(e._searchMarker,n,r.length),Rg(t,e,null,r);const i=n,s=Pg(e,n);let o=e._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&Kr(t,it(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&rp(e._searchMarker,i,r.length),Rg(t,e,o,r)},nJ=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Rg(t,e,i,n)},UM=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,o=Pg(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Kr(t,it(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Kr(t,it(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw BM();e._searchMarker&&rp(e._searchMarker,i,-s+r)},Lg=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},_x=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,o=s.clientID;let a;if(r==null)a=new su([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:a=new su([r]);break;case Uint8Array:a=new sp(r);break;case ka:a=new ap(r);break;default:if(r instanceof nr)a=new es(r);else throw new Error("Unexpected content type")}new Kt(it(o,vn(s.store,o)),i,i&&i.lastId,null,null,e,n,a).integrate(t,0)},Mx=(t,e)=>{const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},jM=t=>{const e={};return t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},HM=(t,e)=>{const n=t._map.get(e);return n!==void 0&&!n.deleted},rJ=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&tu(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Bg=t=>EQ(t.entries(),e=>!e[1].deleted);class iJ extends Ng{}class Jc extends nr{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Jc;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Jc}clone(){const e=new Jc;return e.insert(0,this.toArray().map(n=>n instanceof nr?n.clone():n)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,n){super._callObserver(e,n),Ig(this,e,new iJ(this,e))}insert(e,n){this.doc!==null?Gt(this.doc,r=>{FM(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Gt(this.doc,n=>{nJ(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Gt(this.doc,r=>{UM(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return LM(this,e)}toArray(){return PM(this)}slice(e=0,n=this.length){return NM(this,e,n)}toJSON(){return this.map(e=>e instanceof nr?e.toJSON():e)}map(e){return RM(this,e)}forEach(e){ip(this,e)}[Symbol.iterator](){return tJ(this)}_write(e){e.writeTypeRef(TJ)}}const sJ=t=>new Jc;class oJ extends Ng{constructor(e,n,r){super(e,n),this.keysChanged=r}}class Yc extends nr{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new Yc}clone(){const e=new Yc;return this.forEach((n,r)=>{e.set(r,n instanceof nr?n.clone():n)}),e}_callObserver(e,n){Ig(this,e,new oJ(this,e,n))}toJSON(){const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof nr?i.toJSON():i}}),e}get size(){return[...Bg(this._map)].length}keys(){return mx(Bg(this._map),e=>e[0])}values(){return mx(Bg(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return mx(Bg(this._map),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Gt(this.doc,n=>{Lg(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Gt(this.doc,r=>{_x(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Mx(this,e)}has(e){return HM(this,e)}clear(){this.doc!==null?Gt(this.doc,e=>{this.forEach(function(n,r,i){Lg(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(OJ)}}const aJ=t=>new Yc,Ca=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&tQ(t,e);class Nx{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&ui(),this.right.content.constructor){case Ln:this.right.deleted||Xc(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const VM=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case Ln:e.right.deleted||Xc(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&Kr(t,it(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Fg=(t,e,n,r)=>{const i=new Map,s=r?Pg(e,n):null;if(s){const o=new Nx(s.p.left,s.p,s.index,i);return VM(t,o,n-s.index)}else{const o=new Nx(null,e._start,0,i);return VM(t,o,n)}},zM=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Ln&&Ca(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((o,a)=>{const l=n.left,u=n.right,c=new Kt(it(s,vn(i.store,s)),l,l&&l.lastId,u,u&&u.id,e,null,new Ln(a,o));c.integrate(t,0),n.right=c,n.forward()})},Xc=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},$M=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Ln&&Ca(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},GM=(t,e,n,r)=>{const i=t.doc,s=i.clientID,o=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!Ca(u,l)){o.set(a,u);const{left:c,right:f}=n;n.right=new Kt(it(s,vn(i.store,s)),c,c&&c.lastId,f,f&&f.id,e,null,new Ln(a,l)),n.right.integrate(t,0),n.forward()}}return o},Px=(t,e,n,r,i)=>{n.currentAttributes.forEach((d,h)=>{i[h]===void 0&&(i[h]=null)});const s=t.doc,o=s.clientID;$M(n,i);const a=GM(t,e,n,i),l=r.constructor===String?new Zi(r):r instanceof nr?new es(r):new iu(r);let{left:u,right:c,index:f}=n;e._searchMarker&&rp(e._searchMarker,n.index,l.getLength()),c=new Kt(it(o,vn(s.store,o)),u,u&&u.lastId,c,c&&c.id,e,null,l),c.integrate(t,0),n.right=c,n.index=f,n.forward(),zM(t,e,n,a)},WM=(t,e,n,r,i)=>{const s=t.doc,o=s.clientID;$M(n,i);const a=GM(t,e,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Ln));){if(!n.right.deleted)switch(n.right.content.constructor){case Ln:{const{key:l,value:u}=n.right.content,c=i[l];if(c!==void 0){if(Ca(c,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(t)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&Kr(t,it(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
474
- `;n.right=new Kt(it(o,vn(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new Zi(l)),n.right.integrate(t,0),n.forward()}zM(t,e,n,a)},KM=(t,e,n,r,i)=>{let s=e;const o=Tr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Ln){const u=s.content;o.set(u.key,u)}s=s.right}let a=0,l=!1;for(;e!==s;){if(n===e&&(l=!0),!e.deleted){const u=e.content;switch(u.constructor){case Ln:{const{key:c,value:f}=u,d=r.get(c)??null;(o.get(c)!==u||d===f)&&(e.delete(t),a++,!l&&(i.get(c)??null)===f&&d!==f&&(d===null?i.delete(c):i.set(c,d))),!l&&!e.deleted&&Xc(i,u);break}}}e=e.right}return a},lJ=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Ln){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},uJ=t=>{let e=0;return Gt(t.doc,n=>{let r=t._start,i=t._start,s=Tr();const o=QA(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case Ln:Xc(o,i.content);break;default:e+=KM(n,r,i,s,o),s=QA(o),r=i;break}i=i.right}}),e},cJ=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&AM(t,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===Ln&&o.constructor!==Oi&&e.add(o.parent)})}Gt(n,r=>{Ea(t,t.deleteSet,i=>{if(i instanceof Oi||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Ln?e.add(s):lJ(r,i)});for(const i of e)uJ(i)})},qM=(t,e,n)=>{const r=n,i=QA(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case es:case iu:case Zi:n<e.right.length&&Kr(t,it(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&KM(t,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&rp(o._searchMarker,e.index,-r+n),e};class fJ extends Ng{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Gt(e,r=>{const i=new Map,s=new Map;let o=this.target._start,a=null;const l={};let u="",c=0,f=0;const d=()=>{if(a!==null){let h=null;switch(a){case"delete":f>0&&(h={delete:f}),f=0;break;case"insert":(typeof u=="object"||u.length>0)&&(h={insert:u},i.size>0&&(h.attributes={},i.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),u="";break;case"retain":c>0&&(h={retain:c},Zq(l)||(h.attributes=Yq({},l))),c=0;break}h&&n.push(h),a=null}};for(;o!==null;){switch(o.content.constructor){case es:case iu:this.adds(o)?this.deletes(o)||(d(),a="insert",u=o.content.getContent()[0],d()):this.deletes(o)?(a!=="delete"&&(d(),a="delete"),f+=1):o.deleted||(a!=="retain"&&(d(),a="retain"),c+=1);break;case Zi:this.adds(o)?this.deletes(o)||(a!=="insert"&&(d(),a="insert"),u+=o.content.str):this.deletes(o)?(a!=="delete"&&(d(),a="delete"),f+=o.length):o.deleted||(a!=="retain"&&(d(),a="retain"),c+=o.length);break;case Ln:{const{key:h,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const m=i.get(h)??null;Ca(m,p)?p!==null&&o.delete(r):(a==="retain"&&d(),Ca(p,s.get(h)??null)?delete l[h]:l[h]=p)}}else if(this.deletes(o)){s.set(h,p);const m=i.get(h)??null;Ca(m,p)||(a==="retain"&&d(),l[h]=m)}else if(!o.deleted){s.set(h,p);const m=l[h];m!==void 0&&(Ca(m,p)?m!==null&&o.delete(r):(a==="retain"&&d(),p===null?delete l[h]:l[h]=p))}o.deleted||(a==="insert"&&d(),Xc(i,o.content));break}}o=o.right}for(d();n.length>0;){const h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class nu extends nr{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new nu}clone(){const e=new nu;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new fJ(this,e,n);Ig(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Zi&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Gt(this.doc,r=>{const i=new Nx(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const a=!n&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
475
- `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&Px(r,this,i,a,o.attributes||{})}else o.retain!==void 0?WM(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&qM(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){const i=[],s=new Map,o=this.doc;let a="",l=this._start;function u(){if(a.length>0){const f={};let d=!1;s.forEach((p,m)=>{d=!0,f[m]=p});const h={insert:a};d&&(h.attributes=f),i.push(h),a=""}}const c=()=>{for(;l!==null;){if(tu(l,e)||n!==void 0&&tu(l,n))switch(l.content.constructor){case Zi:{const f=s.get("ychange");e!==void 0&&!tu(l,e)?(f===void 0||f.user!==l.id.client||f.type!=="removed")&&(u(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!tu(l,n)?(f===void 0||f.user!==l.id.client||f.type!=="added")&&(u(),s.set("ychange",r?r("added",l.id):{type:"added"})):f!==void 0&&(u(),s.delete("ychange")),a+=l.content.str;break}case es:case iu:{u();const f={insert:l.content.getContent()[0]};if(s.size>0){const d={};f.attributes=d,s.forEach((h,p)=>{d[p]=h})}i.push(f);break}case Ln:tu(l,e)&&(u(),Xc(s,l.content));break}l=l.right}u()};return e||n?Gt(o,f=>{e&&kx(f,e),n&&kx(f,n),c()},"cleanup"):c(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Gt(i,s=>{const o=Fg(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),Px(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Gt(i,s=>{const o=Fg(s,this,e,!r);Px(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Gt(r,i=>{qM(i,Fg(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?Gt(i,s=>{const o=Fg(s,this,e,!1);o.right!==null&&WM(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Gt(this.doc,n=>{Lg(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Gt(this.doc,r=>{_x(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Mx(this,e)}getAttributes(){return jM(this)}_write(e){e.writeTypeRef(_J)}}const dJ=t=>new nu;class Ix{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===Or||n.constructor===ru)&&n._start!==null)e=n._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class ru extends nr{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ru}clone(){const e=new ru;return e.insert(0,this.toArray().map(n=>n instanceof nr?n.clone():n)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Ix(this,e)}querySelector(e){e=e.toUpperCase();const r=new Ix(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),va(new Ix(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Ig(this,e,new mJ(this,n,e))}toString(){return RM(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),ip(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Gt(this.doc,r=>{FM(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Gt(this.doc,r=>{const i=e&&e instanceof nr?e._item:e;Rg(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Aa("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Gt(this.doc,r=>{UM(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return PM(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return LM(this,e)}slice(e=0,n=this.length){return NM(this,e,n)}forEach(e){ip(this,e)}_write(e){e.writeTypeRef(NJ)}}const hJ=t=>new ru;class Or extends ru{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new Or(this.nodeName)}clone(){const e=new Or(this.nodeName),n=this.getAttributes();return Xq(n,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof nr?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Gt(this.doc,n=>{Lg(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Gt(this.doc,r=>{_x(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Mx(this,e)}hasAttribute(e){return HM(this,e)}getAttributes(e){return e?rJ(this,e):jM(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return ip(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(MJ),e.writeKey(this.nodeName)}}const pJ=t=>new Or(t.readKey());class mJ extends Ng{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Ug extends Yc{constructor(e){super(),this.hookName=e}_copy(){return new Ug(this.hookName)}clone(){const e=new Ug(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(PJ),e.writeKey(this.hookName)}}const gJ=t=>new Ug(t.readKey());class ci extends nu{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new ci}clone(){const e=new ci;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(IJ)}}const yJ=t=>new ci;class Rx{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Xi()}mergeWith(e){return!1}write(e,n,r){throw Xi()}integrate(e,n){throw Xi()}}const bJ=0;class Oi extends Rx{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),wM(e.doc.store,this)}write(e,n){e.writeInfo(bJ),e.writeLen(this.length-n)}getMissing(e,n){return null}}class sp{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new sp(this.content)}splice(e){throw Xi()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const wJ=t=>new sp(t.readBuf());class op{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new op(this.len)}splice(e){const n=new op(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Xh(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const vJ=t=>new op(t.readLen()),QM=(t,e)=>new ka({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class ap{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ap(QM(this.doc.guid,this.opts))}splice(e){throw Xi()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const AJ=t=>new ap(QM(t.readString(),t.readAny()));class iu{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new iu(this.embed)}splice(e){throw Xi()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const xJ=t=>new iu(t.readJSON());class Ln{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ln(this.key,this.value)}splice(e){throw Xi()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const EJ=t=>new Ln(t.readKey(),t.readJSON());class jg{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new jg(this.arr)}splice(e){const n=new jg(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const kJ=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new jg(n)};class su{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new su(this.arr)}splice(e){const n=new su(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const SJ=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new su(n)};class Zi{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Zi(this.str)}splice(e){const n=new Zi(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const CJ=t=>new Zi(t.readString()),DJ=[sJ,aJ,dJ,pJ,hJ,gJ,yJ],TJ=0,OJ=1,_J=2,MJ=3,NJ=4,PJ=5,IJ=6;class es{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new es(this.type._copy())}splice(e){throw Xi()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const RJ=t=>new es(DJ[t.readTypeRef()](t)),Lx=(t,e)=>{let n=e,r=0,i;do r>0&&(n=it(n.client,n.clock+r)),i=Qc(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Kt);return{item:i,diff:r}},Bx=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Hg=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new Kt(it(r,i+n),e,it(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=it(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},JM=(t,e)=>wq(t,n=>$c(n.deletions,e)),YM=(t,e,n,r,i,s)=>{const o=t.doc,a=o.store,l=o.clientID,u=e.redone;if(u!==null)return Kr(t,u);let c=e.parent._item,f=null,d;if(c!==null&&c.deleted===!0){if(c.redone===null&&(!n.has(c)||YM(t,c,n,r,i,s)===null))return null;for(;c.redone!==null;)c=Kr(t,c.redone)}const h=c===null?e.parent:c.content.type;if(e.parentSub===null){for(f=e.left,d=e;f!==null;){let y=f;for(;y!==null&&y.parent._item!==c;)y=y.redone===null?null:Kr(t,y.redone);if(y!==null&&y.parent._item===c){f=y;break}f=f.left}for(;d!==null;){let y=d;for(;y!==null&&y.parent._item!==c;)y=y.redone===null?null:Kr(t,y.redone);if(y!==null&&y.parent._item===c){d=y;break}d=d.right}}else if(d=null,e.right&&!i){for(f=e;f!==null&&f.right!==null&&(f.right.redone||$c(r,f.right.id)||JM(s.undoStack,f.right.id)||JM(s.redoStack,f.right.id));)for(f=f.right;f.redone;)f=Kr(t,f.redone);if(f&&f.right!==null)return null}else f=h._map.get(e.parentSub)||null;const p=vn(a,l),m=it(l,p),g=new Kt(m,f,f&&f.lastId,d,d&&d.id,h,e.parentSub,e.content.copy());return e.redone=m,Bx(g,!0),g.integrate(t,0),g};let Kt=class NC extends Rx{constructor(e,n,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?R_:0}set marker(e){(this.info&ZA)>0!==e&&(this.info^=ZA)}get marker(){return(this.info&ZA)>0}get keep(){return(this.info&I_)>0}set keep(e){this.keep!==e&&(this.info^=I_)}get countable(){return(this.info&R_)>0}get deleted(){return(this.info&XA)>0}set deleted(e){this.deleted!==e&&(this.info^=XA)}markDeleted(){this.info|=XA}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=vn(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=vn(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Kc&&this.id.client!==this.parent.client&&this.parent.clock>=vn(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=vM(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Kr(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Oi||this.right&&this.right.constructor===Oi)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===NC&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===NC&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Kc){const r=Qc(n,this.parent);r.constructor===Oi?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=vM(e,e.doc.store,it(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),qc(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(qc(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Qc(e.doc.store,i.origin)))s.has(Qc(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),wM(e.doc.store,this),this.content.integrate(e,this),EM(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Oi(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:it(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&qc(e.origin,this.lastId)&&this.right===e&&qc(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Xh(e.deleteSet,this.id.client,this.id.clock,this.length),EM(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw ui();this.content.gc(e),n?jQ(e,this,new Oi(this.id,this.length)):this.content=new op(this.length)}write(e,n){const r=n>0?it(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Ag|(r===null?0:li)|(i===null?0:mo)|(s===null?0:$h);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=Zh(a);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===Kc?(e.writeParentInfo(!1),e.writeLeftID(a)):ui();s!==null&&e.writeString(s)}this.content.write(e,n)}};const XM=(t,e)=>LJ[e&Ag](t),LJ=[()=>{ui()},vJ,kJ,wJ,CJ,xJ,EJ,RJ,SJ,AJ,()=>{ui()}],BJ=10;class _i extends Rx{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){ui()}write(e,n){e.writeInfo(BJ),wt(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const ZM=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},eN="__ $YJS$ __";ZM[eN]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),ZM[eN]=!0;const Fx=3e4;class FJ extends vq{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Jh();this.getLocalState()!==null&&Fx/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&Fx<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&UJ(this,r,"timeout")},_s(Fx/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),i=r===void 0?0:r.clock+1,s=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:Jh()});const o=[],a=[],l=[],u=[];e===null?u.push(n):s==null?e!=null&&o.push(n):(a.push(n),Yh(s,e)||l.push(n)),(o.length>0||l.length>0||u.length>0)&&this.emit("change",[{added:o,updated:l,removed:u},"local"]),this.emit("update",[{added:o,updated:a,removed:u},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const UJ=(t,e,n)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(t.states.has(s)){if(t.states.delete(s),s===t.clientID){const o=t.meta.get(s);t.meta.set(s,{clock:o.clock+1,lastUpdated:Jh()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},jJ=(t,e,n=t.states)=>{const r=e.length,i=jc();wt(i,r);for(let s=0;s<r;s++){const o=e[s],a=n.get(o)||null,l=t.meta.get(o).clock;wt(i,o),wt(i,l),Xl(i,JSON.stringify(a))}return Ti(i)},HJ=(t,e,n)=>{const r=xa(e),i=Jh(),s=[],o=[],a=[],l=[],u=at(r);for(let c=0;c<u;c++){const f=at(r);let d=at(r);const h=JSON.parse(Zl(r)),p=t.meta.get(f),m=t.states.get(f),g=p===void 0?0:p.clock;(g<d||g===d&&h===null&&t.states.has(f))&&(h===null?f===t.clientID&&t.getLocalState()!=null?d++:t.states.delete(f):t.states.set(f,h),t.meta.set(f,{clock:d,lastUpdated:i}),p===void 0&&h!==null?s.push(f):p!==void 0&&h===null?l.push(f):h!==null&&(Yh(h,m)||a.push(f),o.push(f)))}(s.length>0||a.length>0||l.length>0)&&t.emit("change",[{added:s,updated:a,removed:l},n]),(s.length>0||o.length>0||l.length>0)&&t.emit("update",[{added:s,updated:o,removed:l},n])},VJ=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},zJ=/[\uD800-\uDBFF]/,$J=/[\uDC00-\uDFFF]/,GJ=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&zJ.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&$J.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},ln=new en("y-sync"),bo=new en("y-undo"),Vg=new en("yjs-cursor"),zg=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!$c(e.ds,t.id),WJ=[{light:"#ecd44433",dark:"#ecd444"}],KJ=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=wa();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,Gq(e))}return t.get(n)},qJ=(t,{colors:e=WJ,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const a=new JJ(t,s),l=new Ut({props:{editable:u=>{const c=ln.getState(u);return c.snapshot==null&&c.prevSnapshot==null}},key:ln,state:{init:(u,c)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(u,c)=>{const f=u.getMeta(ln);if(f!==void 0){c=Object.assign({},c);for(const d in f)c[d]=f[d]}return c.addToHistory=u.getMeta("addToHistory")!==!1,c.isChangeOrigin=f!==void 0&&!!f.isChangeOrigin,c.isUndoRedoOperation=f!==void 0&&!!f.isChangeOrigin&&!!f.isUndoRedoOperation,a.prosemirrorView!==null&&f!==void 0&&(f.snapshot!=null||f.prevSnapshot!=null)&&hx(0,()=>{a.prosemirrorView!=null&&(f.restore==null?a._renderSnapshot(f.snapshot,f.prevSnapshot,c):(a._renderSnapshot(f.snapshot,f.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),c}},view:u=>(a.initView(u),s==null&&a._forceRerender(),i(),{update:()=>{const c=l.getState(u.state);if(c.snapshot==null&&c.prevSnapshot==null&&(o||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(o=!0,c.addToHistory===!1&&!c.isChangeOrigin){const f=bo.getState(u.state),d=f&&f.undoManager;d&&d.stopCapturing()}a.mux(()=>{c.doc.transact(f=>{f.meta.set("addToHistory",c.addToHistory),a._prosemirrorChanged(u.state.doc)},ln)})}},destroy:()=>{a.destroy()}})});return l},QJ=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null){const r=cp(n.doc,n.type,e.anchor,n.mapping),i=cp(n.doc,n.type,e.head,n.mapping);r!==null&&i!==null&&(t=t.setSelection(We.create(t.doc,r,i)))}},Ux=(t,e)=>({anchor:Kg(e.selection.anchor,t.type,t.mapping),head:Kg(e.selection.head,t.type,t.mapping)});class JJ{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=VJ(),this.mapping=n,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Ux(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(sQ&&this._domSelectionInView===null&&(hx(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection(),n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=fQ.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=yM(sM(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(ln,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>$g(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Ce(Ae.from(e),0,0));n.setMeta(ln,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>$g(i,this.prosemirrorView.state.schema,this.mapping)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Ce(Ae.from(n),0,0));e&&r.setSelection(We.create(r.doc,e.anchor,e.head)),this.prosemirrorView.dispatch(r.setMeta(ln,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc;e||(e=Ex(this.doc)),(e instanceof Uint8Array||n instanceof Uint8Array)&&((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&ui(),i=new ka({gc:!1}),Dg(i,n),n=Ex(i),Dg(i,e),e=Ex(i)),this.mapping.clear(),this.mux(()=>{i.transact(s=>{const o=r.permanentUserData;o&&o.dss.forEach(c=>{Ea(s,c,f=>{})});const a=(c,f)=>{const d=c==="added"?o.getUserByClientId(f.client):o.getUserByDeletedId(f);return{user:d,type:c,color:KJ(r.colorMapping,r.colors,d)}},l=IM(this.type,new xx(n.ds,e.sv)).map(c=>!c._item.deleted||zg(c._item,e)||zg(c._item,n)?$g(c,this.prosemirrorView.state.schema,new Map,e,n,a):null).filter(c=>c!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Ce(Ae.from(l),0,0));this.prosemirrorView.dispatch(u.setMeta(ln,{isChangeOrigin:!0}))},ln)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=ln.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,l)=>this.mapping.delete(l);Ea(n,n.deleteSet,a=>{if(a.constructor===Kt){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(a=>tN(a,this.prosemirrorView.state.schema,this.mapping)).filter(a=>a!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Ce(Ae.from(s),0,0));QJ(o,this.beforeTransactionSelection,this),o=o.setMeta(ln,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof DM}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Vx(this.doc,this.type,e,this.mapping),this.beforeTransactionSelection=Ux(this,this.prosemirrorView.state)},ln)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const tN=(t,e,n,r,i,s)=>{const o=n.get(t);if(o===void 0){if(t instanceof Or)return $g(t,e,n,r,i,s);throw Xi()}return o},$g=(t,e,n,r,i,s)=>{const o=[],a=l=>{if(l.constructor===Or){const u=tN(l,e,n,r,i,s);u!==null&&o.push(u)}else{const u=YJ(l,e,n,r,i,s);u!==null&&u.forEach(c=>{c!==null&&o.push(c)})}};r===void 0||i===void 0?t.toArray().forEach(a):IM(t,new xx(i.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(zg(t._item,r)?zg(t._item,i)||(l.ychange=s?s("added",t._item.id):{type:"added"}):l.ychange=s?s("removed",t._item.id):{type:"removed"});const u=e.node(t.nodeName,l,o);return n.set(t,u),u}catch{return t.doc.transact(u=>{t._item.delete(u)},ln),n.delete(t),null}},YJ=(t,e,n,r,i,s)=>{const o=[],a=t.toDelta(r,i,s);try{for(let l=0;l<a.length;l++){const u=a[l],c=[];for(const f in u.attributes)c.push(e.mark(f,u.attributes[f]));o.push(e.text(u.insert,c))}}catch{return t.doc.transact(u=>{t._item.delete(u)},ln),null}return o},XJ=(t,e)=>{const n=new ci,r=t.map(i=>({insert:i.text,attributes:sN(i.marks)}));return n.applyDelta(r),e.set(n,t),n},ZJ=(t,e)=>{const n=new Or(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,Gg(t).map(r=>jx(r,e))),e.set(n,t),n},jx=(t,e)=>t instanceof Array?XJ(t,e):ZJ(t,e),nN=t=>typeof t=="object"&&t!==null,Hx=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===Object.keys(e).filter(i=>e[i]!==null).length;for(let i=0;i<n.length&&r;i++){const s=n[i],o=t[s],a=e[s];r=s==="ychange"||o===a||nN(o)&&nN(a)&&Hx(o,a)}return r},Gg=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},rN=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&ux(r.attributes||{}).length===e[i].marks.length&&e[i].marks.every(s=>Hx(r.attributes[s.type.name]||{},s.attrs)))},lp=(t,e)=>{if(t instanceof Or&&!(e instanceof Array)&&zx(t,e)){const n=Gg(e);return t._length===n.length&&Hx(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>lp(r,n[i]))}return t instanceof ci&&e instanceof Array&&rN(t,e)},Wg=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),iN=(t,e,n)=>{const r=t.toArray(),i=Gg(e),s=i.length,o=r.length,a=Jl(o,s);let l=0,u=0,c=!1;for(;l<a;l++){const f=r[l],d=i[l];if(Wg(n.get(f),d))c=!0;else if(!lp(f,d))break}for(;l+u<a;u++){const f=r[o-u-1],d=i[s-u-1];if(Wg(n.get(f),d))c=!0;else if(!lp(f,d))break}return{equalityFactor:l+u,foundMappedChild:c}},eY=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Zi?e+=n.content.str:n.content instanceof Ln&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},tY=(t,e,n)=>{n.set(t,e);const{nAttrs:r,str:i}=eY(t),s=e.map(u=>({insert:u.text,attributes:Object.assign({},r,sN(u.marks))})),{insert:o,remove:a,index:l}=GJ(i,s.map(u=>u.insert).join(""));t.delete(l,a),t.insert(l,o),t.applyDelta(s.map(u=>({retain:u.insert.length,attributes:u.attributes})))},sN=t=>{const e={};return t.forEach(n=>{n.type.name!=="ychange"&&(e[n.type.name]=n.attrs)}),e},Vx=(t,e,n,r)=>{if(e instanceof Or&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.set(e,n),e instanceof Or){const f=e.getAttributes(),d=n.attrs;for(const h in d)d[h]!==null?f[h]!==d[h]&&h!=="ychange"&&e.setAttribute(h,d[h]):e.removeAttribute(h);for(const h in f)d[h]===void 0&&e.removeAttribute(h)}const i=Gg(n),s=i.length,o=e.toArray(),a=o.length,l=Jl(s,a);let u=0,c=0;for(;u<l;u++){const f=o[u],d=i[u];if(!Wg(r.get(f),d))if(lp(f,d))r.set(f,d);else break}for(;c+u+1<l;c++){const f=o[a-c-1],d=i[s-c-1];if(!Wg(r.get(f),d))if(lp(f,d))r.set(f,d);else break}t.transact(()=>{for(;a-u-c>0&&s-u-c>0;){const d=o[u],h=i[u],p=o[a-c-1],m=i[s-c-1];if(d instanceof ci&&h instanceof Array)rN(d,h)||tY(d,h,r),u+=1;else{let g=d instanceof Or&&zx(d,h),y=p instanceof Or&&zx(p,m);if(g&&y){const v=iN(d,h,r),w=iN(p,m,r);v.foundMappedChild&&!w.foundMappedChild?y=!1:!v.foundMappedChild&&w.foundMappedChild||v.equalityFactor<w.equalityFactor?g=!1:y=!1}g?(Vx(t,d,h,r),u+=1):y?(Vx(t,p,m,r),c+=1):(r.delete(e.get(u)),e.delete(u,1),e.insert(u,[jx(h,r)]),u+=1)}}const f=a-u-c;if(a===1&&s===0&&o[0]instanceof ci?(r.delete(o[0]),o[0].delete(0,o[0].length)):f>0&&(e.slice(u,u+f).forEach(d=>r.delete(d)),e.delete(u,f)),u+c<s){const d=[];for(let h=u;h<s-c;h++)d.push(jx(i[h],r));e.insert(u,d)}},ln)},zx=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let up=null;const nY=()=>{const t=up;up=null,t.forEach((e,n)=>{const r=n.state.tr,i=ln.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,o)=>{r.setMeta(o,s)}),n.dispatch(r))})},rY=(t,e,n)=>{up||(up=new Map,hx(0,nY)),Os(up,t,Tr).set(e,n)},Kg=(t,e,n)=>{if(t===0)return Ax(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof ci){if(r._length>=t)return Ax(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new tp(r._item===null?null:r._item.id,r._item===null?Zh(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new tp(r._item===null?null:r._item.id,r._item===null?Zh(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw ui();if(t===0&&r.constructor!==ci&&r!==e)return iY(r._item.parent,r._item)}return Ax(e,e._length,-1)},iY=(t,e)=>{let n=null,r=null;return t._item===null?r=Zh(t):n=it(t._item.id.client,t._item.id.clock),new tp(n,r,e.id)},cp=(t,e,n,r)=>{const i=UQ(n,t);if(i===null||i.type!==e&&!ep(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===ci)o=i.index;else if(s._item===null||!s._item.deleted){let a=s._first,l=0;for(;l<s._length&&l<i.index&&a!==null;){if(!a.deleted){const u=a.content.type;l++,u instanceof ci?o+=u._length:o+=r.get(u).nodeSize}a=a.right}o+=1}for(;s!==e&&s._item!==null;){const a=s._item.parent;if(a._item===null||!a._item.deleted){o+=1;let l=a._first;for(;l!==null;){const u=l.content.type;if(u===s)break;l.deleted||(u instanceof ci?o+=u._length:o+=r.get(u).nodeSize),l=l.right}}s=a}return o-1},sY=(t,e,n)=>t!==e,oY=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),i=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},oN=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),aY=/^#[0-9a-fA-F]{6}$/,aN=(t,e,n,r,i)=>{const s=ln.getState(t),o=s.doc,a=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding===null?Wt.create(t.doc,[]):(e.getStates().forEach((l,u)=>{if(n(o.clientID,u,l)&&l.cursor!=null){const c=l.user||{};c.color==null?c.color="#ffa500":aY.test(c.color)||console.warn("A user uses an unsupported color format",c),c.name==null&&(c.name=`User: ${u}`);let f=cp(o,s.type,np(l.cursor.anchor),s.binding.mapping),d=cp(o,s.type,np(l.cursor.head),s.binding.mapping);if(f!==null&&d!==null){const h=po(t.doc.content.size-1,0);f=Jl(f,h),d=Jl(d,h),a.push(Un.widget(d,()=>r(c),{key:u+"",side:10}));const p=Jl(f,d),m=po(f,d);a.push(Un.inline(p,m,i(c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Wt.create(t.doc,a))},lY=(t,{awarenessStateFilter:e=sY,cursorBuilder:n=oY,selectionBuilder:r=oN,getSelection:i=o=>o.selection}={},s="cursor")=>new Ut({key:Vg,state:{init(o,a){return aN(a,t,e,n,r)},apply(o,a,l,u){const c=ln.getState(u),f=o.getMeta(Vg);return c&&c.isChangeOrigin||f&&f.awarenessUpdated?aN(u,t,e,n,r):a.map(o.mapping,o.doc)}},props:{decorations:o=>Vg.getState(o)},view:o=>{const a=()=>{o.docView&&rY(o,Vg,{awarenessUpdated:!0})},l=()=>{const u=ln.getState(o.state),c=t.getLocalState()||{};if(u.binding!=null)if(o.hasFocus()){const f=i(o.state),d=Kg(f.anchor,u.type,u.binding.mapping),h=Kg(f.head,u.type,u.binding.mapping);(c.cursor==null||!gM(np(c.cursor.anchor),d)||!gM(np(c.cursor.head),h))&&t.setLocalStateField(s,{anchor:d,head:h})}else c.cursor!=null&&cp(u.doc,u.type,np(c.cursor.anchor),u.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",a),o.dom.addEventListener("focusin",l),o.dom.addEventListener("focusout",l),{update:l,destroy:()=>{o.dom.removeEventListener("focusin",l),o.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(s,null)}}}}),uY=t=>{const e=bo.getState(t).undoManager;if(e!=null)return e.undo(),!0},cY=t=>{const e=bo.getState(t).undoManager;if(e!=null)return e.redo(),!0},fY=new Set(["paragraph"]),dY=(t,e)=>!(t instanceof Kt)||!(t.content instanceof es)||!(t.content.type instanceof nu||t.content.type instanceof Or&&e.has(t.content.type.nodeName))||t.content.type._length===0,hY=({protectedNodes:t=fY,trackedOrigins:e=[],undoManager:n=null}={})=>new Ut({key:bo,state:{init:(r,i)=>{const s=ln.getState(i),o=n||new DM(s.type,{trackedOrigins:new Set([ln].concat(e)),deleteFilter:a=>dY(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const a=ln.getState(o).binding,l=i.undoManager,u=l.undoStack.length>0,c=l.redoStack.length>0;return a?{undoManager:l,prevSel:Ux(a,s),hasUndoOps:u,hasRedoOps:c}:u!==i.hasUndoOps||c!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):i}},view:r=>{const i=ln.getState(r.state),s=bo.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const a=i.binding;a&&o.meta.set(a,bo.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const a=i.binding;a&&(a.beforeTransactionSelection=o.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),pY=It.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),bo.getState(e).undoManager.undoStack.length===0?!1:n?uY(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),bo.getState(e).undoManager.redoStack.length===0?!1:n?cY(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){const t=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),e=hY(),n=e.spec.view;e.spec.view=s=>{const{undoManager:o}=bo.getState(s.state);o.restore&&(o.restore(),o.restore=()=>{});const a=n?n(s):void 0;return{destroy:()=>{const l=o.trackedOrigins.has(o),u=o._observers;o.restore=()=>{l&&o.trackedOrigins.add(o),o.doc.on("afterTransaction",o.afterTransactionHandler),o._observers=u},a!=null&&a.destroy&&a.destroy()}}};const r={...this.options.ySyncOptions?{...this.options.ySyncOptions}:{},...this.options.onFirstRender?{...this.options.onFirstRender}:{}};return[qJ(t,r),e]}}),mY=/^\s*>\s$/,gY=ot.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Cc({find:mY,type:this.type})]}}),yY=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,bY=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,wY=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,vY=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,AY=In.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ul({find:yY,type:this.type}),Ul({find:wY,type:this.type})]},addPasteRules(){return[pa({find:bY,type:this.type}),pa({find:vY,type:this.type})]}}),xY=ot.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",gt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),lN=In.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=wh(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),uN=/^\s*([-+*])\s$/,cN=ot.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(xY.name,this.editor.getAttributes(lN.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Cc({find:uN,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Cc({find:uN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(lN.name),editor:this.editor})),[t]}}),EY=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,kY=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,SY=In.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ul({find:EY,type:this.type})]},addPasteRules(){return[pa({find:kY,type:this.type})]}}),CY=/^```([a-z]+)?[\s\n]$/,DY=/^~~~([a-z]+)?[\s\n]$/,TY=ot.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",gt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
476
-
477
- `);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0||r.nodeAt(a)?!1:t.commands.exitCode()}}},addInputRules(){return[Cv({find:CY,type:this.type,getAttributes:t=>({language:t[1]})}),Cv({find:DY,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ut({key:new en("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
478
- `));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(We.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),fN=ot.create({name:"doc",topNode:!0,content:"block+"});function OY(t={}){return new Ut({view(e){return new _Y(e,t)}})}class _Y{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let u=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(u){let c=u.getBoundingClientRect(),f=a?c.bottom:c.top;a&&l&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:c.left,right:c.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let a=i.getBoundingClientRect();s=a.left-i.scrollLeft,o=a.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=D3(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const dN=It.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[OY(this.options)]}});class gn extends Qe{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return gn.valid(r)?new gn(r):Qe.near(r)}content(){return Ce.empty}eq(e){return e instanceof gn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new gn(e.resolve(n.pos))}getBookmark(){return new $x(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!MY(e)||!NY(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&gn.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(gn.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ze.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(gn.valid(a))return a}return null}}}gn.prototype.visible=!1,gn.findFrom=gn.findGapCursorFrom,Qe.jsonID("gapcursor",gn);class $x{constructor(e){this.pos=e}map(e){return new $x(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return gn.valid(n)?new gn(n):Qe.near(n)}}function MY(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function NY(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function PY(){return new Ut({props:{decorations:BY,createSelectionBetween(t,e,n){return e.pos==n.pos&&gn.valid(n)?new gn(n):null},handleClick:RY,handleKeyDown:IY,handleDOMEvents:{beforeinput:LY}}})}const IY=lv({ArrowLeft:qg("horiz",-1),ArrowRight:qg("horiz",1),ArrowUp:qg("vert",-1),ArrowDown:qg("vert",1)});function qg(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof We){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=gn.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new gn(u))),!0):!1}}function RY(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!gn.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&ze.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new gn(r))),!0)}function LY(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof gn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=Ae.empty;for(let o=r.length-1;o>=0;o--)i=Ae.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new Ce(i,0,0));return s.setSelection(We.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function BY(t){if(!(t.selection instanceof gn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Wt.create(t.doc,[Un.widget(t.selection.head,e,{key:"gapcursor"})])}const hN=It.create({name:"gapCursor",addProseMirrorPlugins(){return[PY()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=dt(je(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),FY=ot.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",gt(this.options.HTMLAttributes,t)]},renderText(){return`
479
- `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&o){const f=l.filter(d=>a.includes(d.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),UY=ot.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,gt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Cv({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Qg=200,Gn=function(){};Gn.prototype.append=function(e){return e.length?(e=Gn.from(e),!this.length&&e||e.length<Qg&&this.leafAppend(e)||this.length<Qg&&e.leafPrepend(this)||this.appendInner(e)):this},Gn.prototype.prepend=function(e){return e.length?Gn.from(e).append(this):this},Gn.prototype.appendInner=function(e){return new jY(this,e)},Gn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Gn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Gn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Gn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)},Gn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i},Gn.from=function(e){return e instanceof Gn?e:e&&e.length?new pN(e):Gn.empty};var pN=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Qg)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Qg)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Gn);Gn.empty=new pN([]);var jY=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Gn);const HY=500;class ts{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,u=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),s=i.maps.length),s--,c.push(f);return}if(i){c.push(new Ps(f.map));let h=f.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],u.push(new Ps(p,void 0,void 0,u.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(s)):f.selection,l=new ts(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let f=e.steps[c].invert(e.docs[c]),d=new Ps(e.mapping.maps[c],f,n),h;(h=l&&l.merge(d))&&(d=h,c?s.pop():a=a.slice(0,a.length-1)),s.push(d),n&&(o++,n=void 0),i||(l=d)}let u=o-r.depth;return u>zY&&(a=VY(a,u),o-=u),new ts(a.append(s),o)}remapping(e,n){let r=new fc;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new ts(this.items.append(e.map(n=>new Ps(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(d=>{d.selection&&a--},i);let l=n;this.items.forEach(d=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(d.step){let m=e.steps[h].invert(e.docs[h]),g=d.selection&&d.selection.map(s.slice(l+1,h));g&&a++,r.push(new Ps(p,m,g))}else r.push(new Ps(p))},i);let u=[];for(let d=n;d<o;d++)u.push(new Ps(s.maps[d]));let c=this.items.slice(0,i).append(u).append(r),f=new ts(c,a);return f.emptyItemCount()>HY&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let f=new Ps(u.invert(),l,c),d,h=i.length-1;(d=i.length&&i[h].merge(f))?i[h]=d:i.push(f)}}else o.map&&r--},this.items.length,0),new ts(Gn.from(i.reverse()),s)}}ts.empty=new ts(Gn.empty,0);function VY(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Ps{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ps(n.getMap().invert(),n,this.selection)}}}class Da{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const zY=20;function $Y(t,e,n,r){let i=n.getMeta(ou),s;if(i)return i.historyState;n.getMeta(KY)&&(t=new Da(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ou))return o.getMeta(ou).redo?new Da(t.done.addTransform(n,void 0,r,Jg(e)),t.undone,mN(n.mapping.maps),t.prevTime,t.prevComposition):new Da(t.done,t.undone.addTransform(n,void 0,r,Jg(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!GY(n,t.prevRanges)),u=o?Gx(t.prevRanges,n.mapping):mN(n.mapping.maps);return new Da(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Jg(e)),ts.empty,u,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Da(t.done.rebased(n,s),t.undone.rebased(n,s),Gx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Da(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Gx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function GY(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function mN(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function Gx(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function WY(t,e,n){let r=Jg(e),i=ou.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Da(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(ou,{redo:n,historyState:l})}let Wx=!1,gN=null;function Jg(t){let e=t.plugins;if(gN!=e){Wx=!1,gN=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Wx=!0;break}}return Wx}const ou=new en("history"),KY=new en("closeHistory");function qY(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ut({key:ou,state:{init(){return new Da(ts.empty,ts.empty,null,0,-1)},apply(e,n,r){return $Y(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?bN:r=="historyRedo"?wN:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function yN(t,e){return(n,r)=>{let i=ou.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=WY(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const bN=yN(!1,!0),wN=yN(!0,!0),vN=It.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>bN(t,e),redo:()=>({state:t,dispatch:e})=>wN(t,e)}},addProseMirrorPlugins(){return[qY(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),AN=ot.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",gt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):xv(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:a})=>{var l;if(a){const{$to:u}=o.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(We.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(ze.create(o.doc,u.pos)):o.setSelection(We.create(o.doc,u.pos));else{const f=(l=u.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();f&&(o.insert(c,f),o.setSelection(We.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Sv({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),QY=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,JY=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,YY=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,XY=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ZY=In.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ul({find:QY,type:this.type}),Ul({find:YY,type:this.type})]},addPasteRules(){return[pa({find:JY,type:this.type}),pa({find:XY,type:this.type})]}}),xN=ot.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",gt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),eX=ot.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",gt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),EN=In.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=wh(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),kN=/^(\d+)\.\s$/,tX=ot.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",gt(this.options.HTMLAttributes,n),0]:["ol",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(eX.name,this.editor.getAttributes(EN.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Cc({find:kN,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Cc({find:kN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(EN.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),nX=ot.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),rX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,iX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sX=In.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ul({find:rX,type:this.type})]},addPasteRules(){return[pa({find:iX,type:this.type})]}}),oX=ot.create({name:"text",group:"inline"}),aX=It.create({name:"starterKit",addExtensions(){var t,e,n,r,i,s,o,a,l,u,c,f,d,h,p,m,g,y;const v=[];return this.options.bold!==!1&&v.push(AY.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&v.push(gY.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&v.push(cN.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&v.push(SY.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&v.push(TY.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&v.push(fN.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&v.push(dN.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&v.push(hN.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&v.push(FY.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&v.push(UY.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&v.push(vN.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&v.push(AN.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&v.push(ZY.configure((d=this.options)===null||d===void 0?void 0:d.italic)),this.options.listItem!==!1&&v.push(xN.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&v.push(tX.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&v.push(nX.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&v.push(sX.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&v.push(oX.configure((y=this.options)===null||y===void 0?void 0:y.text)),v}}),lX=In.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=wh(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),uX=It.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=t.style.fontFamily)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),cX=It.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),fX="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",dX="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Zc=(t,e)=>{for(const n in e)t[n]=e[n];return t},Kx="numeric",qx="ascii",Qx="alpha",Yg="asciinumeric",Xg="alphanumeric",Jx="domain",SN="emoji",hX="scheme",pX="slashscheme",CN="whitespace";function mX(t,e){return t in e||(e[t]=[]),e[t]}function au(t,e,n){e[Kx]&&(e[Yg]=!0,e[Xg]=!0),e[qx]&&(e[Yg]=!0,e[Qx]=!0),e[Yg]&&(e[Xg]=!0),e[Qx]&&(e[Xg]=!0),e[Xg]&&(e[Jx]=!0),e[SN]&&(e[Jx]=!0);for(const r in e){const i=mX(r,n);i.indexOf(t)<0&&i.push(t)}}function gX(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function qr(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}qr.groups={},qr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e){return e===void 0&&(e=!1),e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||qr.groups;let i;return e&&e.j?i=e:(i=new qr(e),n&&r&&au(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||qr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new qr,Zc(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new qr,s){if(r)if(o.t&&typeof o.t=="string"){const l=Zc(gX(o.t,r),n);au(s,l,r)}else n&&au(s,n,r);o.t=s}return i.j[t]=o,o}};const ut=(t,e,n,r,i)=>t.ta(e,n,r,i),Mi=(t,e,n,r,i)=>t.tr(e,n,r,i),DN=(t,e,n,r,i)=>t.ts(e,n,r,i),Oe=(t,e,n,r,i)=>t.tt(e,n,r,i),wo="WORD",Yx="UWORD",fp="LOCALHOST",Xx="TLD",Zx="UTLD",Zg="SCHEME",ef="SLASH_SCHEME",e2="NUM",TN="WS",t2="NL",dp="OPENBRACE",hp="CLOSEBRACE",ey="OPENBRACKET",ty="CLOSEBRACKET",ny="OPENPAREN",ry="CLOSEPAREN",iy="OPENANGLEBRACKET",sy="CLOSEANGLEBRACKET",oy="FULLWIDTHLEFTPAREN",ay="FULLWIDTHRIGHTPAREN",ly="LEFTCORNERBRACKET",uy="RIGHTCORNERBRACKET",cy="LEFTWHITECORNERBRACKET",fy="RIGHTWHITECORNERBRACKET",dy="FULLWIDTHLESSTHAN",hy="FULLWIDTHGREATERTHAN",py="AMPERSAND",my="APOSTROPHE",gy="ASTERISK",Ta="AT",yy="BACKSLASH",by="BACKTICK",wy="CARET",Oa="COLON",n2="COMMA",vy="DOLLAR",Is="DOT",Ay="EQUALS",r2="EXCLAMATION",Rs="HYPHEN",xy="PERCENT",Ey="PIPE",ky="PLUS",Sy="POUND",Cy="QUERY",i2="QUOTE",s2="SEMI",Ls="SLASH",pp="TILDE",Dy="UNDERSCORE",ON="EMOJI",Ty="SYM";var _N=Object.freeze({__proto__:null,WORD:wo,UWORD:Yx,LOCALHOST:fp,TLD:Xx,UTLD:Zx,SCHEME:Zg,SLASH_SCHEME:ef,NUM:e2,WS:TN,NL:t2,OPENBRACE:dp,CLOSEBRACE:hp,OPENBRACKET:ey,CLOSEBRACKET:ty,OPENPAREN:ny,CLOSEPAREN:ry,OPENANGLEBRACKET:iy,CLOSEANGLEBRACKET:sy,FULLWIDTHLEFTPAREN:oy,FULLWIDTHRIGHTPAREN:ay,LEFTCORNERBRACKET:ly,RIGHTCORNERBRACKET:uy,LEFTWHITECORNERBRACKET:cy,RIGHTWHITECORNERBRACKET:fy,FULLWIDTHLESSTHAN:dy,FULLWIDTHGREATERTHAN:hy,AMPERSAND:py,APOSTROPHE:my,ASTERISK:gy,AT:Ta,BACKSLASH:yy,BACKTICK:by,CARET:wy,COLON:Oa,COMMA:n2,DOLLAR:vy,DOT:Is,EQUALS:Ay,EXCLAMATION:r2,HYPHEN:Rs,PERCENT:xy,PIPE:Ey,PLUS:ky,POUND:Sy,QUERY:Cy,QUOTE:i2,SEMI:s2,SLASH:Ls,TILDE:pp,UNDERSCORE:Dy,EMOJI:ON,SYM:Ty});const tf=/[a-z]/,o2=new RegExp("\\p{L}","u"),a2=new RegExp("\\p{Emoji}","u"),l2=/\d/,MN=/\s/,NN=`
480
- `,yX="️",bX="‍";let Oy=null,_y=null;function wX(t){t===void 0&&(t=[]);const e={};qr.groups=e;const n=new qr;Oy==null&&(Oy=PN(fX)),_y==null&&(_y=PN(dX)),Oe(n,"'",my),Oe(n,"{",dp),Oe(n,"}",hp),Oe(n,"[",ey),Oe(n,"]",ty),Oe(n,"(",ny),Oe(n,")",ry),Oe(n,"<",iy),Oe(n,">",sy),Oe(n,"(",oy),Oe(n,")",ay),Oe(n,"「",ly),Oe(n,"」",uy),Oe(n,"『",cy),Oe(n,"』",fy),Oe(n,"<",dy),Oe(n,">",hy),Oe(n,"&",py),Oe(n,"*",gy),Oe(n,"@",Ta),Oe(n,"`",by),Oe(n,"^",wy),Oe(n,":",Oa),Oe(n,",",n2),Oe(n,"$",vy),Oe(n,".",Is),Oe(n,"=",Ay),Oe(n,"!",r2),Oe(n,"-",Rs),Oe(n,"%",xy),Oe(n,"|",Ey),Oe(n,"+",ky),Oe(n,"#",Sy),Oe(n,"?",Cy),Oe(n,'"',i2),Oe(n,"/",Ls),Oe(n,";",s2),Oe(n,"~",pp),Oe(n,"_",Dy),Oe(n,"\\",yy);const r=Mi(n,l2,e2,{[Kx]:!0});Mi(r,l2,r);const i=Mi(n,tf,wo,{[qx]:!0});Mi(i,tf,i);const s=Mi(n,o2,Yx,{[Qx]:!0});Mi(s,tf),Mi(s,o2,s);const o=Mi(n,MN,TN,{[CN]:!0});Oe(n,NN,t2,{[CN]:!0}),Oe(o,NN),Mi(o,MN,o);const a=Mi(n,a2,ON,{[SN]:!0});Mi(a,a2,a),Oe(a,yX,a);const l=Oe(a,bX);Mi(l,a2,a);const u=[[tf,i]],c=[[tf,null],[o2,s]];for(let f=0;f<Oy.length;f++)_a(n,Oy[f],Xx,wo,u);for(let f=0;f<_y.length;f++)_a(n,_y[f],Zx,Yx,c);au(Xx,{tld:!0,ascii:!0},e),au(Zx,{utld:!0,alpha:!0},e),_a(n,"file",Zg,wo,u),_a(n,"mailto",Zg,wo,u),_a(n,"http",ef,wo,u),_a(n,"https",ef,wo,u),_a(n,"ftp",ef,wo,u),_a(n,"ftps",ef,wo,u),au(Zg,{scheme:!0,ascii:!0},e),au(ef,{slashscheme:!0,ascii:!0},e),t=t.sort((f,d)=>f[0]>d[0]?1:-1);for(let f=0;f<t.length;f++){const d=t[f][0],p=t[f][1]?{[hX]:!0}:{[pX]:!0};d.indexOf("-")>=0?p[Jx]=!0:tf.test(d)?l2.test(d)?p[Yg]=!0:p[qx]=!0:p[Kx]=!0,DN(n,d,d,p)}return DN(n,"localhost",fp,{ascii:!0}),n.jd=new qr(Ty),{start:n,tokens:Zc({groups:e},_N)}}function vX(t,e){const n=AX(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let a=t,l=null,u=0,c=null,f=-1,d=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(f=0,d=0,c=a):f>=0&&(f+=n[o].length,d++),u+=n[o].length,s+=n[o].length,o++;s-=f,o-=d,u-=f,i.push({t:c.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function AX(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function _a(t,e,n,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new qr(r),s.jr=i.slice(),t.j[l]=s),t=s}return s=new qr(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function PN(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const mp={defaultProtocol:"http",events:null,format:IN,formatHref:IN,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function u2(t,e){e===void 0&&(e=null);let n=Zc({},mp);t&&(n=Zc(n,t instanceof u2?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}u2.prototype={o:mp,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:mp[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function IN(t){return t}function RN(t,e){this.t="token",this.v=t,this.tk=e}RN.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return t===void 0&&(t=mp.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),c=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),u&&(o.rel=u),c&&Zc(o,c),{tagName:i,attributes:o,content:s,eventListeners:f}}};function My(t,e){class n extends RN{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const LN=My("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),BN=My("text"),xX=My("nl"),Ny=My("url",{isLink:!0,toHref(t){return t===void 0&&(t=mp.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fp&&t[1].t===Oa}}),Ni=t=>new qr(t);function EX(t){let{groups:e}=t;const n=e.domain.concat([py,gy,Ta,yy,by,wy,vy,Ay,Rs,e2,xy,Ey,ky,Sy,Ls,Ty,pp,Dy]),r=[my,Oa,n2,Is,r2,Cy,i2,s2,iy,sy,dp,hp,ty,ey,ny,ry,oy,ay,ly,uy,cy,fy,dy,hy],i=[py,my,gy,yy,by,wy,vy,Ay,Rs,dp,hp,xy,Ey,ky,Sy,Cy,Ls,Ty,pp,Dy],s=Ni(),o=Oe(s,pp);ut(o,i,o),ut(o,e.domain,o);const a=Ni(),l=Ni(),u=Ni();ut(s,e.domain,a),ut(s,e.scheme,l),ut(s,e.slashscheme,u),ut(a,i,o),ut(a,e.domain,a);const c=Oe(a,Ta);Oe(o,Ta,c),Oe(l,Ta,c),Oe(u,Ta,c);const f=Oe(o,Is);ut(f,i,o),ut(f,e.domain,o);const d=Ni();ut(c,e.domain,d),ut(d,e.domain,d);const h=Oe(d,Is);ut(h,e.domain,d);const p=Ni(LN);ut(h,e.tld,p),ut(h,e.utld,p),Oe(c,fp,p);const m=Oe(d,Rs);ut(m,e.domain,d),ut(p,e.domain,d),Oe(p,Is,h),Oe(p,Rs,m);const g=Oe(p,Oa);ut(g,e.numeric,LN);const y=Oe(a,Rs),v=Oe(a,Is);ut(y,e.domain,a),ut(v,i,o),ut(v,e.domain,a);const w=Ni(Ny);ut(v,e.tld,w),ut(v,e.utld,w),ut(w,e.domain,a),ut(w,i,o),Oe(w,Is,v),Oe(w,Rs,y),Oe(w,Ta,c);const b=Oe(w,Oa),E=Ni(Ny);ut(b,e.numeric,E);const x=Ni(Ny),O=Ni();ut(x,n,x),ut(x,r,O),ut(O,n,x),ut(O,r,O),Oe(w,Ls,x),Oe(E,Ls,x);const S=Oe(l,Oa),D=Oe(u,Oa),I=Oe(D,Ls),F=Oe(I,Ls);ut(l,e.domain,a),Oe(l,Is,v),Oe(l,Rs,y),ut(u,e.domain,a),Oe(u,Is,v),Oe(u,Rs,y),ut(S,e.domain,x),Oe(S,Ls,x),ut(F,e.domain,x),ut(F,n,x),Oe(F,Ls,x);const Q=[[dp,hp],[ey,ty],[ny,ry],[iy,sy],[oy,ay],[ly,uy],[cy,fy],[dy,hy]];for(let V=0;V<Q.length;V++){const[B,N]=Q[V],H=Oe(x,B);Oe(O,B,H),Oe(H,N,x);const K=Ni(Ny);ut(H,n,K);const J=Ni();ut(H,r),ut(K,n,K),ut(K,r,J),ut(J,n,K),ut(J,r,J),Oe(K,N,x),Oe(J,N,x)}return Oe(s,fp,w),Oe(s,t2,xX),{start:s,tokens:_N}}function kX(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=t,l=null,u=null,c=0,f=null,d=-1;for(;i<r&&!(l=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(u=l||a.go(n[i].t));)l=null,a=u,a.accepts()?(d=0,f=a):d>=0&&d++,i++,c++;if(d<0)i-=c,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(c2(BN,e,o)),o=[]),i-=d,c-=d;const h=f.t,p=n.slice(i-c,i);s.push(c2(h,e,p))}}return o.length>0&&s.push(c2(BN,e,o)),s}function c2(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const SX=typeof console<"u"&&console&&console.warn||(()=>{}),CX="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",un={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function DX(){qr.groups={},un.scanner=null,un.parser=null,un.tokenQueue=[],un.pluginQueue=[],un.customSchemes=[],un.initialized=!1}function FN(t,e){if(e===void 0&&(e=!1),un.initialized&&SX(`linkifyjs: already initialized - will not register custom scheme "${t}" ${CX}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
481
- 1. Must only contain digits, lowercase ASCII letters or "-"
482
- 2. Cannot start or end with "-"
483
- 3. "-" cannot repeat`);un.customSchemes.push([t,e])}function TX(){un.scanner=wX(un.customSchemes);for(let t=0;t<un.tokenQueue.length;t++)un.tokenQueue[t][1]({scanner:un.scanner});un.parser=EX(un.scanner.tokens);for(let t=0;t<un.pluginQueue.length;t++)un.pluginQueue[t][1]({scanner:un.scanner,parser:un.parser});un.initialized=!0}function UN(t){return un.initialized||TX(),kX(un.parser.start,t,vX(un.scanner.start,t))}function jN(t,e,n){if(e===void 0&&(e=null),n===void 0&&(n=null),e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new u2(n),i=UN(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}function OX(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function _X(t){return new Ut({key:new en("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=wV(n.doc,[...e]);if(CV(a).forEach(({newRange:u})=>{const c=AV(r.doc,u,h=>h.isTextblock);let f,d;if(c.length>1?(f=c[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):c.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(f=c[0],d=r.doc.textBetween(f.pos,u.to,void 0," ")),f&&d){const h=d.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;const g=UN(p).map(y=>y.toObject(t.defaultProtocol));if(!OX(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).forEach(y=>{vv(y.from,y.to,r.doc).some(v=>v.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function MX(t){return new Ut({key:new en("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(d=>d.nodeName==="A"))return!1;const l=wT(e.state,t.type.name),u=r.target,c=(i=u==null?void 0:u.href)!==null&&i!==void 0?i:l.href,f=(s=u==null?void 0:u.target)!==null&&s!==void 0?s:l.target;return u&&c?(window.open(c,f),!0):!1}}})}function NX(t){return new Ut({key:new en("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=jN(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:(t.editor.commands.setMark(t.type,{href:l.href}),!0)}}})}const PX=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,IX=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;function HN(t){return!t||t.replace(PX,"").match(IX)}const RX=In.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.protocols.forEach(t=>{if(typeof t=="string"){FN(t);return}FN(t.scheme,t.optionalSlashes)})},onDestroy(){DX()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:t=>!!t}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!HN(e)?!1:{href:e}}}]},renderHTML({HTMLAttributes:t}){return HN(t.href)?["a",gt(this.options.HTMLAttributes,t),0]:["a",gt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[pa({find:t=>{const e=[];if(t){const{validate:n}=this.options,r=jN(t).filter(i=>i.isLink&&n(i.value));r.length&&r.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[];return this.options.autolink&&t.push(_X({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:this.options.validate})),this.options.openOnClick===!0&&t.push(MX({type:this.type})),this.options.linkOnPaste&&t.push(NX({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),LX=It.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ut({key:new en("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,u=!o.isLeaf&&AT(o);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];s&&c.push(this.options.emptyEditorClass);const f=Un.node(a,a+o.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),Wt.create(t,i)}}})]}}),BX=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,FX=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,UX=In.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Ul({find:BX,type:this.type})]},addPasteRules(){return[pa({find:FX,type:this.type})]}}),jX=ot.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",gt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),HX=/^\s*(\[([( |x])?\])\s$/,VX=ot.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>t.getAttribute("data-checked")==="true",renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",gt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return s.contentEditable="false",a.type="checkbox",a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:c}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const d=n(),h=f.doc.nodeAt(d);return f.setNodeMarkup(d,void 0,{...h==null?void 0:h.attrs,checked:c}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,c)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,c])=>{i.setAttribute(u,c)}),i.dataset.checked=t.attrs.checked,t.attrs.checked&&a.setAttribute("checked","checked"),s.append(a,o),i.append(s,l),Object.entries(e).forEach(([u,c])=>{i.setAttribute(u,c)}),{dom:i,contentDOM:l,update:u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,u.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[Cc({find:HX,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),zX=In.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),$X=AN.extend({renderHTML(){return["div",gt(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),GX=It.create({name:"columnExtension",addExtensions(){const t=[];return this.options.column!==!1&&t.push(v_),this.options.columns!==!1&&t.push(bg),t}}),WX=It.create({name:"CustomKeymap",addCommands(){return{selectTextWithinNodeBoundaries:()=>({editor:t,commands:e})=>{const{state:n}=t,{tr:r}=n,i=r.selection.$from.start(),s=r.selection.$to.end();return e.setTextSelection({from:i,to:s})}}},addKeyboardShortcuts(){return{"Mod-a":({editor:t})=>{const{state:e}=t,{tr:n}=e,r=n.selection.from,i=n.selection.to,s=n.selection.$from.start(),o=n.selection.$to.end();return r>s||i<o?(t.chain().selectTextWithinNodeBoundaries().run(),!0):!1}}}}),KX=It.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),VN=[{tooltip:"Align left",action:t=>t({dataAlign:"start",dataFloat:null}),icon:"AlignLeft",isActive:t=>t.dataAlign==="start"},{tooltip:"Align center",action:t=>t({dataAlign:"center",dataFloat:null}),icon:"AlignCenter",isActive:t=>t.dataAlign==="center"},{tooltip:"Align right",action:t=>t({dataAlign:"end",dataFloat:null}),icon:"AlignRight",isActive:t=>t.dataAlign==="end"},{tooltip:"Delete",icon:"Trash2",delete:t=>t()}];let nf;const zN=({node:t,updateAttributes:e,deleteNode:n})=>{const r=wg(),[i,s]=_.useState(),[o,a]=_.useState(0),[l,u]=_.useState(0),[c,f]=_.useState({}),d=_.useRef(null),[h,p]=_.useState(!1),m=()=>{const V={};VN.forEach(({tooltip:B,isActive:N})=>{V[B]=!!(N!=null&&N(t.attrs))}),f(V)},g=()=>{const V=document.querySelector(".ProseMirror");if(V&&u(V==null?void 0:V.clientWidth),!!d.current){if(i==="video"){const B=d.current;B.addEventListener("loadeddata",function(){a(B.videoWidth/B.videoHeight),x("left",0)})}else if(i==="iframe"){const B=d.current;B.onload=()=>{a(B.offsetWidth/B.offsetHeight),x("left",0)}}else d.current.onload=()=>{a(d.current.naturalWidth/d.current.naturalHeight)};setTimeout(()=>m(),200)}},y=V=>{nf=V};_.useEffect(()=>{g()},[]);const v=({width:V,height:B})=>V<200||B<200,w=V=>{const B=V instanceof TouchEvent?V.touches[0].clientX:V.clientX;setTimeout(()=>O(B))},b=V=>{nf=V instanceof TouchEvent?V.touches[0].clientX:V.clientX,setTimeout(()=>{document.addEventListener("mousemove",w),document.addEventListener("mouseup",E),document.addEventListener("touchmove",w),document.addEventListener("touchend",E)}),p(!0)},E=()=>{nf=-1,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",E),p(!1)},x=(V,B)=>{var J,X;if(!d.current){console.error("Media ref is undefined|null",{resizableImg:d.current});return}const N={width:(J=d.current)==null?void 0:J.width,height:(X=d.current)==null?void 0:X.height},H={width:-1,height:-1};let K=parseFloat(N.width.toString());if(isNaN(K)&&(K=0),V==="left"?H.width=K-Math.abs(B):H.width=K+Math.abs(B),H.width>l&&(H.width=l),i==="iframe")H.height=H.width/(16/9);else{const ie=isNaN(o)?1:o;H.height=H.width/ie}H.width=isNaN(H.width)?0:H.width,H.height=isNaN(H.height)?0:H.height,!v(H)&&e(H)},O=V=>{if(nf===-1)return;const B=nf-V;if(B===0)return;const N=B>0?"left":"right";setTimeout(()=>{x(N,Math.abs(B)),nf=V})},[S,D]=_.useState(),[I,F]=_.useState();_.useEffect(()=>{s(t.attrs["media-type"]),m(),D(t.attrs.dataFloat),F(t.attrs.dataAlign)},[t.attrs]);const Q=V=>{switch(V){case"AlignLeft":return k.jsx(Mh,{size:16});case"AlignCenter":return k.jsx(Jv,{size:16});case"AlignRight":return k.jsx(Yv,{size:16});case"Trash2":return k.jsx(sA,{size:16});default:return null}};return k.jsx(_h,{as:"article",className:Ne("media-node-view not-prose transition-all ease-in-out w-full",S&&`f-${t.attrs.dataFloat}`,I&&`justify-${t.attrs.dataAlign}`),children:k.jsxs("div",{className:"w-fit flex relative group transition-all ease-in-out",children:[i==="img"&&k.jsx("img",{src:t.attrs.src,ref:d,className:"rounded-lg",alt:t.attrs.src,width:t.attrs.width,height:t.attrs.height}),i==="video"&&k.jsx("video",{ref:d,className:"rounded-lg",controls:!0,width:t.attrs.width,height:t.attrs.height,children:k.jsx("source",{src:t.attrs.src})}),i==="iframe"&&k.jsx("iframe",{ref:d,className:Ne("rounded-lg max-w-full",h&&"pointer-events-none"),src:t.attrs.src,width:t.attrs.width,height:t.attrs.height}),!r&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"horizontal-resize-handle group-hover:bg-black group-hover:border-2 group-hover:border-white/80",title:"Resize",onClick:({clientX:V})=>y(V),onMouseDown:V=>b(V),onMouseUp:E,onTouchStart:V=>b(V),onTouchEnd:E}),k.jsx("section",{className:"media-control-buttons opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex",children:VN.map((V,B)=>k.jsx("div",{className:"tooltip","data-tip":V.tooltip,children:k.jsx("button",{type:"button",className:Ne("btn rounded-none h-6 transition",c[V.tooltip]&&"active"),onClick:()=>{var N;return V.tooltip==="Delete"?n():(N=V.action)==null?void 0:N.call(V,e)},children:V.icon&&Q(V.icon)})},B))})]})]})})},qX=ot.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},"media-type":{default:"iframe"},alt:{default:null},title:{default:null},width:{default:this.options.width},height:{default:this.options.height},dataAlign:{default:"left"},dataFloat:{default:null}}},addNodeView(){return $l(zN)},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){return["iframe",gt(this.options.HTMLAttributes,t)]},addCommands(){return{setIframe:t=>({tr:e,dispatch:n})=>{const{selection:r}=e,i=this.type.create(t);return n&&e.replaceRangeWith(r.from-1,r.to,i),!0}}}});var QX="https://platform.twitter.com/widgets.js",f2="createTweet",JX=function(e){var n=_.useRef(null),r=_.useState(!0),i=r[0],s=r[1];return _.useEffect(function(){var o=!0,a=require("scriptjs");return a(QX,"twitter-embed",function(){if(!window.twttr){console.error("Failure to load window.twttr, aborting load");return}if(o){if(!window.twttr.widgets[f2]){console.error("Method "+f2+" is not present anymore in twttr.widget api");return}window.twttr.widgets[f2](e.tweetId,n==null?void 0:n.current,e.options).then(function(l){s(!1),e.onLoad&&e.onLoad(l)})}}),function(){o=!1}},[]),_.createElement(_.Fragment,null,i&&_.createElement(_.Fragment,null,e.placeholder),_.createElement("div",{ref:n}))};const YX=({node:t,editor:e})=>{const[n,r]=_.useState(!0);return _.useEffect(()=>{e==null||e.chain().focus()},[]),k.jsx(_h,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:k.jsxs("div",{className:"w-full max-w-sm",children:[n&&k.jsx(M_,{width:5,height:5}),k.jsx(JX,{tweetId:t.attrs.tweetId,onLoad:()=>r(!1)})]})})},XX=ot.create({name:"embeddedTweet",group:"block",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:""}}},addAttributes(){return{tweetId:{default:null},align:{default:"center"}}},parseHTML(){return[{tag:"div[data-tweet-id]"}]},renderHTML({HTMLAttributes:t}){return["div",gt(this.options.HTMLAttributes,t)]},addNodeView(){return $l(YX)},addCommands(){return{setTweetEmbed:t=>({commands:e})=>e.insertContent({type:this.name,attrs:{tweetId:t.tweetId,align:"center"},content:[]})}}}),ZX=t=>new Ut({key:new en("media-paste-drop"),props:{handlePaste(e,n){var i;return Array.from(((i=n.clipboardData)==null?void 0:i.items)||[]).forEach(s=>{const o=s.getAsFile();if(((o==null?void 0:o.type.indexOf("image"))===0||(o==null?void 0:o.type.indexOf("video"))===0)&&(n.preventDefault(),o&&o.size>zh))throw new Error("Image too large")}),!1},handleDrop(e,n){var a;if(!(n.dataTransfer&&n.dataTransfer.files&&n.dataTransfer.files.length))return!1;const i=Array.from(((a=n.dataTransfer)==null?void 0:a.files)??[]).filter(({type:l})=>/image|video/i.test(l));if(i.length===0)return!1;n.preventDefault();const{schema:s}=e.state,o=e.posAtCoords({left:n.clientX,top:n.clientY});return o?(i.forEach(async l=>{const u=new FileReader;if(t){const c=s.nodes.resizableMedia.create({src:await t(l),"media-type":l.type.includes("image")?"img":"video"}),f=e.state.tr.insert(o.pos,c);e.dispatch(f)}else u.onload=c=>{var h;const f=s.nodes.resizableMedia.create({src:(h=c.target)==null?void 0:h.result,"media-type":l.type.includes("image")?"img":"video"}),d=e.state.tr.insert(o.pos,f);e.dispatch(d)},u.readAsDataURL(l)}),!0):!1}}}),eZ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,tZ=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,nZ=ot.create({name:"resizableMedia",addOptions(){return{HTMLAttributes:{class:"rounded-lg border border-stone-200"},uploadFn:async()=>""}},inline:!1,group:"block",draggable:!0,addAttributes(){return{src:{default:null},"media-type":{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},dataAlign:{default:"left"},dataFloat:{default:null}}},selectable:!0,parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:t=>({src:t.getAttribute("src"),"media-type":"img"})},{tag:"video",getAttrs:t=>({src:t.getAttribute("src"),"media-type":"video"})}]},renderHTML({HTMLAttributes:t}){const{"media-type":e}=t;return e==="img"?["img",gt(this.options.HTMLAttributes,t)]:e==="video"?["video",{controls:"true",style:"width: 100%",...t},["source",t]]:(e||console.error("TiptapMediaExtension-renderHTML method: Media Type not set, going default with image"),["img",gt(this.options.HTMLAttributes,t)])},addCommands(){return{setMedia:t=>({commands:e})=>{const{"media-type":n}=t;return n==="img"?e.insertContent({type:this.name,attrs:t}):n==="video"?e.insertContent({type:this.name,attrs:{...t,controls:"true"}}):(n||console.error("TiptapMediaExtension-setMedia: Media Type not set, going default with image"),e.insertContent({type:this.name,attrs:t}))}}},addNodeView(){return $l(zN)},addKeyboardShortcuts(){return{Enter:({editor:t})=>{const{selection:e}=t.state;if(e.empty)return!1;const n=e.$to.pos;return t.commands.insertContentAt(n,{type:"dBlock",content:[{type:"paragraph"}]})}}},addInputRules(){return[Sv({find:eZ,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r,"media-type":"img"}}}),Sv({find:tZ,type:this.type,getAttributes:t=>{const[,,e]=t;return{src:e,"media-type":"video"}}})]},addProseMirrorPlugins(){return[ZX(this.options.uploadFn),yG()]}});function $N(t,e){let n;return(...i)=>{clearTimeout(n),n=setTimeout(()=>t(...i),e)}}const rZ=["top","right","bottom","left"],Bs=Math.min,fi=Math.max,Py=Math.round,Iy=Math.floor,Ma=t=>({x:t,y:t}),iZ={left:"right",right:"left",bottom:"top",top:"bottom"},sZ={start:"end",end:"start"};function d2(t,e,n){return fi(t,Bs(e,n))}function vo(t,e){return typeof t=="function"?t(e):t}function Ao(t){return t.split("-")[0]}function rf(t){return t.split("-")[1]}function h2(t){return t==="x"?"y":"x"}function p2(t){return t==="y"?"height":"width"}function sf(t){return["top","bottom"].includes(Ao(t))?"y":"x"}function m2(t){return h2(sf(t))}function oZ(t,e,n){n===void 0&&(n=!1);const r=rf(t),i=m2(t),s=p2(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Ry(o)),[o,Ry(o)]}function aZ(t){const e=Ry(t);return[g2(t),e,g2(e)]}function g2(t){return t.replace(/start|end/g,e=>sZ[e])}function lZ(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function uZ(t,e,n,r){const i=rf(t);let s=lZ(Ao(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(g2)))),s}function Ry(t){return t.replace(/left|right|bottom|top/g,e=>iZ[e])}function cZ(t){return{top:0,right:0,bottom:0,left:0,...t}}function GN(t){return typeof t!="number"?cZ(t):{top:t,right:t,bottom:t,left:t}}function Ly(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function WN(t,e,n){let{reference:r,floating:i}=t;const s=sf(e),o=m2(e),a=p2(o),l=Ao(e),u=s==="y",c=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:c,y:r.y-i.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(rf(e)){case"start":h[o]-=d*(n&&u?-1:1);break;case"end":h[o]+=d*(n&&u?-1:1);break}return h}const fZ=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:f}=WN(u,r,l),d=r,h={},p=0;for(let m=0;m<a.length;m++){const{name:g,fn:y}=a[m],{x:v,y:w,data:b,reset:E}=await y({x:c,y:f,initialPlacement:r,placement:d,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:t,floating:e}});c=v??c,f=w??f,h={...h,[g]:{...h[g],...b}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(d=E.placement),E.rects&&(u=E.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):E.rects),{x:c,y:f}=WN(u,d,l)),m=-1)}return{x:c,y:f,placement:d,strategy:i,middlewareData:h}};async function gp(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=vo(e,t),p=GN(h),g=a[d?f==="floating"?"reference":"floating":f],y=Ly(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),v=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},E=Ly(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:l}):v);return{top:(y.top-E.top+p.top)/b.y,bottom:(E.bottom-y.bottom+p.bottom)/b.y,left:(y.left-E.left+p.left)/b.x,right:(E.right-y.right+p.right)/b.x}}const dZ=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:u,padding:c=0}=vo(t,e)||{};if(u==null)return{};const f=GN(c),d={x:n,y:r},h=m2(i),p=p2(h),m=await o.getDimensions(u),g=h==="y",y=g?"top":"left",v=g?"bottom":"right",w=g?"clientHeight":"clientWidth",b=s.reference[p]+s.reference[h]-d[h]-s.floating[p],E=d[h]-s.reference[h],x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let O=x?x[w]:0;(!O||!await(o.isElement==null?void 0:o.isElement(x)))&&(O=a.floating[w]||s.floating[p]);const S=b/2-E/2,D=O/2-m[p]/2-1,I=Bs(f[y],D),F=Bs(f[v],D),Q=I,V=O-m[p]-F,B=O/2-m[p]/2+S,N=d2(Q,B,V),H=!l.arrow&&rf(i)!=null&&B!==N&&s.reference[p]/2-(B<Q?I:F)-m[p]/2<0,K=H?B<Q?B-Q:B-V:0;return{[h]:d[h]+K,data:{[h]:N,centerOffset:B-N-K,...H&&{alignmentOffset:K}},reset:H}}}),hZ=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=vo(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Ao(i),v=Ao(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=d||(v||!m?[Ry(a)]:aZ(a));!d&&p!=="none"&&b.push(...uZ(a,m,p,w));const E=[a,...b],x=await gp(e,g),O=[];let S=((r=s.flip)==null?void 0:r.overflows)||[];if(c&&O.push(x[y]),f){const Q=oZ(i,o,w);O.push(x[Q[0]],x[Q[1]])}if(S=[...S,{placement:i,overflows:O}],!O.every(Q=>Q<=0)){var D,I;const Q=(((D=s.flip)==null?void 0:D.index)||0)+1,V=E[Q];if(V)return{data:{index:Q,overflows:S},reset:{placement:V}};let B=(I=S.filter(N=>N.overflows[0]<=0).sort((N,H)=>N.overflows[1]-H.overflows[1])[0])==null?void 0:I.placement;if(!B)switch(h){case"bestFit":{var F;const N=(F=S.map(H=>[H.placement,H.overflows.filter(K=>K>0).reduce((K,J)=>K+J,0)]).sort((H,K)=>H[1]-K[1])[0])==null?void 0:F[0];N&&(B=N);break}case"initialPlacement":B=a;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function KN(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function qN(t){return rZ.some(e=>t[e]>=0)}const pZ=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=vo(t,e);switch(r){case"referenceHidden":{const s=await gp(e,{...i,elementContext:"reference"}),o=KN(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:qN(o)}}}case"escaped":{const s=await gp(e,{...i,altBoundary:!0}),o=KN(s,n.floating);return{data:{escapedOffsets:o,escaped:qN(o)}}}default:return{}}}}};async function mZ(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ao(n),a=rf(n),l=sf(n)==="y",u=["left","top"].includes(o)?-1:1,c=s&&l?-1:1,f=vo(e,t);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*c,y:d*u}:{x:d*u,y:h*c}}const gZ=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await mZ(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},yZ=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:y,y:v}=g;return{x:y,y:v}}},...l}=vo(t,e),u={x:n,y:r},c=await gp(e,l),f=sf(Ao(i)),d=h2(f);let h=u[d],p=u[f];if(s){const g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",v=h+c[g],w=h-c[y];h=d2(v,h,w)}if(o){const g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=p+c[g],w=p-c[y];p=d2(v,p,w)}const m=a.fn({...e,[d]:h,[f]:p});return{...m,data:{x:m.x-n,y:m.y-r}}}}},bZ=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=vo(t,e),c={x:n,y:r},f=sf(i),d=h2(f);let h=c[d],p=c[f];const m=vo(a,e),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=d==="y"?"height":"width",b=s.reference[d]-s.floating[w]+g.mainAxis,E=s.reference[d]+s.reference[w]-g.mainAxis;h<b?h=b:h>E&&(h=E)}if(u){var y,v;const w=d==="y"?"width":"height",b=["top","left"].includes(Ao(i)),E=s.reference[f]-s.floating[w]+(b&&((y=o.offset)==null?void 0:y[f])||0)+(b?0:g.crossAxis),x=s.reference[f]+s.reference[w]+(b?0:((v=o.offset)==null?void 0:v[f])||0)-(b?g.crossAxis:0);p<E?p=E:p>x&&(p=x)}return{[d]:h,[f]:p}}}},wZ=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:s}=e,{apply:o=()=>{},...a}=vo(t,e),l=await gp(e,a),u=Ao(n),c=rf(n),f=sf(n)==="y",{width:d,height:h}=r.floating;let p,m;u==="top"||u==="bottom"?(p=u,m=c===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(m=u,p=c==="end"?"top":"bottom");const g=h-l.top-l.bottom,y=d-l.left-l.right,v=Bs(h-l[p],g),w=Bs(d-l[m],y),b=!e.middlewareData.shift;let E=v,x=w;if(f?x=c||b?Bs(w,y):y:E=c||b?Bs(v,g):g,b&&!c){const S=fi(l.left,0),D=fi(l.right,0),I=fi(l.top,0),F=fi(l.bottom,0);f?x=d-2*(S!==0||D!==0?S+D:fi(l.left,l.right)):E=h-2*(I!==0||F!==0?I+F:fi(l.top,l.bottom))}await o({...e,availableWidth:x,availableHeight:E});const O=await i.getDimensions(s.floating);return d!==O.width||h!==O.height?{reset:{rects:!0}}:{}}}};function of(t){return QN(t)?(t.nodeName||"").toLowerCase():"#document"}function di(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function xo(t){var e;return(e=(QN(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function QN(t){return t instanceof Node||t instanceof di(t).Node}function Fs(t){return t instanceof Element||t instanceof di(t).Element}function Us(t){return t instanceof HTMLElement||t instanceof di(t).HTMLElement}function JN(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof di(t).ShadowRoot}function yp(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ns(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function vZ(t){return["table","td","th"].includes(of(t))}function y2(t){const e=b2(),n=ns(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function AZ(t){let e=Na(t);for(;Us(e)&&!af(e);){if(y2(e))return e;e=Na(e)}return null}function b2(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function af(t){return["html","body","#document"].includes(of(t))}function ns(t){return di(t).getComputedStyle(t)}function By(t){return Fs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Na(t){if(of(t)==="html")return t;const e=t.assignedSlot||t.parentNode||JN(t)&&t.host||xo(t);return JN(e)?e.host:e}function YN(t){const e=Na(t);return af(e)?t.ownerDocument?t.ownerDocument.body:t.body:Us(e)&&yp(e)?e:YN(e)}function bp(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=YN(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=di(i);return s?e.concat(o,o.visualViewport||[],yp(i)?i:[],o.frameElement&&n?bp(o.frameElement):[]):e.concat(i,bp(i,[],n))}function XN(t){const e=ns(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Us(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=Py(n)!==s||Py(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function w2(t){return Fs(t)?t:t.contextElement}function lf(t){const e=w2(t);if(!Us(e))return Ma(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=XN(e);let o=(s?Py(n.width):n.width)/r,a=(s?Py(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const xZ=Ma(0);function ZN(t){const e=di(t);return!b2()||!e.visualViewport?xZ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function EZ(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==di(t)?!1:e}function lu(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=w2(t);let o=Ma(1);e&&(r?Fs(r)&&(o=lf(r)):o=lf(t));const a=EZ(s,n,r)?ZN(s):Ma(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,c=i.width/o.x,f=i.height/o.y;if(s){const d=di(s),h=r&&Fs(r)?di(r):r;let p=d,m=p.frameElement;for(;m&&r&&h!==p;){const g=lf(m),y=m.getBoundingClientRect(),v=ns(m),w=y.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,b=y.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,f*=g.y,l+=w,u+=b,p=di(m),m=p.frameElement}}return Ly({width:c,height:f,x:l,y:u})}const kZ=[":popover-open",":modal"];function v2(t){return kZ.some(e=>{try{return t.matches(e)}catch{return!1}})}function SZ(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=xo(r),a=e?v2(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Ma(1);const c=Ma(0),f=Us(r);if((f||!f&&!s)&&((of(r)!=="body"||yp(o))&&(l=By(r)),Us(r))){const d=lu(r);u=lf(r),c.x=d.x+r.clientLeft,c.y=d.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x,y:n.y*u.y-l.scrollTop*u.y+c.y}}function CZ(t){return Array.from(t.getClientRects())}function e4(t){return lu(xo(t)).left+By(t).scrollLeft}function DZ(t){const e=xo(t),n=By(t),r=t.ownerDocument.body,i=fi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=fi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+e4(t);const a=-n.scrollTop;return ns(r).direction==="rtl"&&(o+=fi(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function TZ(t,e){const n=di(t),r=xo(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=b2();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function OZ(t,e){const n=lu(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Us(t)?lf(t):Ma(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function t4(t,e,n){let r;if(e==="viewport")r=TZ(t,n);else if(e==="document")r=DZ(xo(t));else if(Fs(e))r=OZ(e,n);else{const i=ZN(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Ly(r)}function n4(t,e){const n=Na(t);return n===e||!Fs(n)||af(n)?!1:ns(n).position==="fixed"||n4(n,e)}function _Z(t,e){const n=e.get(t);if(n)return n;let r=bp(t,[],!1).filter(a=>Fs(a)&&of(a)!=="body"),i=null;const s=ns(t).position==="fixed";let o=s?Na(t):t;for(;Fs(o)&&!af(o);){const a=ns(o),l=y2(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||yp(o)&&!l&&n4(t,o))?r=r.filter(c=>c!==o):i=a,o=Na(o)}return e.set(t,r),r}function MZ(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?v2(e)?[]:_Z(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((u,c)=>{const f=t4(e,c,i);return u.top=fi(f.top,u.top),u.right=Bs(f.right,u.right),u.bottom=Bs(f.bottom,u.bottom),u.left=fi(f.left,u.left),u},t4(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function NZ(t){const{width:e,height:n}=XN(t);return{width:e,height:n}}function PZ(t,e,n){const r=Us(e),i=xo(e),s=n==="fixed",o=lu(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Ma(0);if(r||!r&&!s)if((of(e)!=="body"||yp(i))&&(a=By(e)),r){const f=lu(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&(l.x=e4(i));const u=o.left+a.scrollLeft-l.x,c=o.top+a.scrollTop-l.y;return{x:u,y:c,width:o.width,height:o.height}}function A2(t){return ns(t).position==="static"}function r4(t,e){return!Us(t)||ns(t).position==="fixed"?null:e?e(t):t.offsetParent}function i4(t,e){const n=di(t);if(v2(t))return n;if(!Us(t)){let i=Na(t);for(;i&&!af(i);){if(Fs(i)&&!A2(i))return i;i=Na(i)}return n}let r=r4(t,e);for(;r&&vZ(r)&&A2(r);)r=r4(r,e);return r&&af(r)&&A2(r)&&!y2(r)?n:r||AZ(t)||n}const IZ=async function(t){const e=this.getOffsetParent||i4,n=this.getDimensions,r=await n(t.floating);return{reference:PZ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function RZ(t){return ns(t).direction==="rtl"}const LZ={convertOffsetParentRelativeRectToViewportRelativeRect:SZ,getDocumentElement:xo,getClippingRect:MZ,getOffsetParent:i4,getElementRects:IZ,getClientRects:CZ,getDimensions:NZ,getScale:lf,isElement:Fs,isRTL:RZ};function BZ(t,e){let n=null,r;const i=xo(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:u,top:c,width:f,height:d}=t.getBoundingClientRect();if(a||e(),!f||!d)return;const h=Iy(c),p=Iy(i.clientWidth-(u+f)),m=Iy(i.clientHeight-(c+d)),g=Iy(u),v={rootMargin:-h+"px "+-p+"px "+-m+"px "+-g+"px",threshold:fi(0,Bs(1,l))||1};let w=!0;function b(E){const x=E[0].intersectionRatio;if(x!==l){if(!w)return o();x?o(!1,x):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(t)}return o(!0),s}function FZ(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=w2(t),c=i||s?[...u?bp(u):[],...bp(e)]:[];c.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=u&&a?BZ(u,n):null;let d=-1,h=null;o&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(e)})),n()}),u&&!l&&h.observe(u),h.observe(e));let p,m=l?lu(t):null;l&&g();function g(){const y=lu(t);m&&(y.x!==m.x||y.y!==m.y||y.width!==m.width||y.height!==m.height)&&n(),m=y,p=requestAnimationFrame(g)}return n(),()=>{var y;c.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const UZ=gZ,jZ=yZ,HZ=hZ,VZ=wZ,zZ=pZ,s4=dZ,$Z=bZ,GZ=(t,e,n)=>{const r=new Map,i={platform:LZ,...n},s={...i.platform,_c:r};return fZ(t,e,{...i,platform:s})};var Fy=typeof document<"u"?_.useLayoutEffect:_.useEffect;function Uy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Uy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!Uy(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function o4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function a4(t,e){const n=o4(t);return Math.round(e*n)/n}function l4(t){const e=Y.useRef(t);return Fy(()=>{e.current=t}),e}function WZ(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:u}=t,[c,f]=Y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=Y.useState(r);Uy(d,r)||h(r);const[p,m]=Y.useState(null),[g,y]=Y.useState(null),v=Y.useCallback(K=>{K!==x.current&&(x.current=K,m(K))},[]),w=Y.useCallback(K=>{K!==O.current&&(O.current=K,y(K))},[]),b=s||p,E=o||g,x=Y.useRef(null),O=Y.useRef(null),S=Y.useRef(c),D=l!=null,I=l4(l),F=l4(i),Q=Y.useCallback(()=>{if(!x.current||!O.current)return;const K={placement:e,strategy:n,middleware:d};F.current&&(K.platform=F.current),GZ(x.current,O.current,K).then(J=>{const X={...J,isPositioned:!0};V.current&&!Uy(S.current,X)&&(S.current=X,bw.flushSync(()=>{f(X)}))})},[d,e,n,F]);Fy(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,f(K=>({...K,isPositioned:!1})))},[u]);const V=Y.useRef(!1);Fy(()=>(V.current=!0,()=>{V.current=!1}),[]),Fy(()=>{if(b&&(x.current=b),E&&(O.current=E),b&&E){if(I.current)return I.current(b,E,Q);Q()}},[b,E,Q,I,D]);const B=Y.useMemo(()=>({reference:x,floating:O,setReference:v,setFloating:w}),[v,w]),N=Y.useMemo(()=>({reference:b,floating:E}),[b,E]),H=Y.useMemo(()=>{const K={position:n,left:0,top:0};if(!N.floating)return K;const J=a4(N.floating,c.x),X=a4(N.floating,c.y);return a?{...K,transform:"translate("+J+"px, "+X+"px)",...o4(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:X}},[n,a,N.floating,c.x,c.y]);return Y.useMemo(()=>({...c,update:Q,refs:B,elements:N,floatingStyles:H}),[c,Q,B,N,H])}const KZ=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?s4({element:r.current,padding:i}).fn(n):{}:r?s4({element:r,padding:i}).fn(n):{}}}},qZ=(t,e)=>({...UZ(t),options:[t,e]}),QZ=(t,e)=>({...jZ(t),options:[t,e]}),JZ=(t,e)=>({...$Z(t),options:[t,e]}),YZ=(t,e)=>({...HZ(t),options:[t,e]}),XZ=(t,e)=>({...VZ(t),options:[t,e]}),ZZ=(t,e)=>({...zZ(t),options:[t,e]}),eee=(t,e)=>({...KZ(t),options:[t,e]});var tee="Arrow",u4=Y.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return k.jsx($r.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:k.jsx("polygon",{points:"0,0 30,0 15,10"})})});u4.displayName=tee;var nee=u4;function ree(t){const[e,n]=Y.useState(void 0);return Gl(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;o=u.inlineSize,a=u.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var x2="Popper",[c4,f4]=uA(x2),[iee,d4]=c4(x2),h4=t=>{const{__scopePopper:e,children:n}=t,[r,i]=Y.useState(null);return k.jsx(iee,{scope:e,anchor:r,onAnchorChange:i,children:n})};h4.displayName=x2;var p4="PopperAnchor",m4=Y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=d4(p4,n),o=Y.useRef(null),a=Di(e,o);return Y.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:k.jsx($r.div,{...i,ref:a})});m4.displayName=p4;var E2="PopperContent",[see,oee]=c4(E2),g4=Y.forwardRef((t,e)=>{var ne,G,Z,A,P,ue;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,g=d4(E2,n),[y,v]=Y.useState(null),w=Di(e,de=>v(de)),[b,E]=Y.useState(null),x=ree(b),O=(x==null?void 0:x.width)??0,S=(x==null?void 0:x.height)??0,D=r+(s!=="center"?"-"+s:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},F=Array.isArray(u)?u:[u],Q=F.length>0,V={padding:I,boundary:F.filter(lee),altBoundary:Q},{refs:B,floatingStyles:N,placement:H,isPositioned:K,middlewareData:J}=WZ({strategy:"fixed",placement:D,whileElementsMounted:(...de)=>FZ(...de,{animationFrame:h==="always"}),elements:{reference:g.anchor},middleware:[qZ({mainAxis:i+S,alignmentAxis:o}),l&&QZ({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?JZ():void 0,...V}),l&&YZ({...V}),XZ({...V,apply:({elements:de,rects:oe,availableWidth:we,availableHeight:De})=>{const{width:pe,height:Ke}=oe.reference,qe=de.floating.style;qe.setProperty("--radix-popper-available-width",`${we}px`),qe.setProperty("--radix-popper-available-height",`${De}px`),qe.setProperty("--radix-popper-anchor-width",`${pe}px`),qe.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),b&&eee({element:b,padding:a}),uee({arrowWidth:O,arrowHeight:S}),d&&ZZ({strategy:"referenceHidden",...V})]}),[X,ie]=w4(H),le=ga(p);Gl(()=>{K&&(le==null||le())},[K,le]);const Pe=(ne=J.arrow)==null?void 0:ne.x,xe=(G=J.arrow)==null?void 0:G.y,Ie=((Z=J.arrow)==null?void 0:Z.centerOffset)!==0,[ke,$]=Y.useState();return Gl(()=>{y&&$(window.getComputedStyle(y).zIndex)},[y]),k.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:K?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ke,"--radix-popper-transform-origin":[(A=J.transformOrigin)==null?void 0:A.x,(P=J.transformOrigin)==null?void 0:P.y].join(" "),...((ue=J.hide)==null?void 0:ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:k.jsx(see,{scope:n,placedSide:X,onArrowChange:E,arrowX:Pe,arrowY:xe,shouldHideArrow:Ie,children:k.jsx($r.div,{"data-side":X,"data-align":ie,...m,ref:w,style:{...m.style,animation:K?void 0:"none"}})})})});g4.displayName=E2;var y4="PopperArrow",aee={top:"bottom",right:"left",bottom:"top",left:"right"},b4=Y.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=oee(y4,r),o=aee[s.placedSide];return k.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:k.jsx(nee,{...i,ref:n,style:{...i.style,display:"block"}})})});b4.displayName=y4;function lee(t){return t!==null}var uee=t=>({name:"transformOrigin",options:t,fn(e){var g,y,v;const{placement:n,rects:r,middlewareData:i}=e,o=((g=i.arrow)==null?void 0:g.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[u,c]=w4(n),f={start:"0%",center:"50%",end:"100%"}[c],d=(((y=i.arrow)==null?void 0:y.x)??0)+a/2,h=(((v=i.arrow)==null?void 0:v.y)??0)+l/2;let p="",m="";return u==="bottom"?(p=o?f:`${d}px`,m=`${-l}px`):u==="top"?(p=o?f:`${d}px`,m=`${r.floating.height+l}px`):u==="right"?(p=`${-l}px`,m=o?f:`${h}px`):u==="left"&&(p=`${r.floating.width+l}px`,m=o?f:`${h}px`),{data:{x:p,y:m}}}});function w4(t){const[e,n="center"]=t.split("-");return[e,n]}var cee=h4,v4=m4,fee=g4,dee=b4,k2="Popover",[A4,awe]=uA(k2,[f4]),wp=f4(),[hee,uu]=A4(k2),x4=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=wp(e),l=Y.useRef(null),[u,c]=Y.useState(!1),[f=!1,d]=UO({prop:r,defaultProp:i,onChange:s});return k.jsx(cee,{...a,children:k.jsx(hee,{scope:e,contentId:Xm(),triggerRef:l,open:f,onOpenChange:d,onOpenToggle:Y.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:u,onCustomAnchorAdd:Y.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Y.useCallback(()=>c(!1),[]),modal:o,children:n})})};x4.displayName=k2;var E4="PopoverAnchor",pee=Y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=uu(E4,n),s=wp(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return Y.useEffect(()=>(o(),()=>a()),[o,a]),k.jsx(v4,{...s,...r,ref:e})});pee.displayName=E4;var k4="PopoverTrigger",S4=Y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=uu(k4,n),s=wp(n),o=Di(e,i.triggerRef),a=k.jsx($r.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":_4(i.open),...r,ref:o,onClick:ai(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:k.jsx(v4,{asChild:!0,...s,children:a})});S4.displayName=k4;var mee="PopoverPortal",[lwe,gee]=A4(mee,{forceMount:void 0}),uf="PopoverContent",C4=Y.forwardRef((t,e)=>{const n=gee(uf,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=uu(uf,t.__scopePopover);return k.jsx(Ih,{present:r||s.open,children:s.modal?k.jsx(yee,{...i,ref:e}):k.jsx(bee,{...i,ref:e})})});C4.displayName=uf;var yee=Y.forwardRef((t,e)=>{const n=uu(uf,t.__scopePopover),r=Y.useRef(null),i=Di(e,r),s=Y.useRef(!1);return Y.useEffect(()=>{const o=r.current;if(o)return f6(o)},[]),k.jsx(vA,{as:Zm,allowPinchZoom:!0,children:k.jsx(D4,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ai(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ai(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ai(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),bee=Y.forwardRef((t,e)=>{const n=uu(uf,t.__scopePopover),r=Y.useRef(!1),i=Y.useRef(!1);return k.jsx(D4,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),D4=Y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:c,...f}=t,d=uu(uf,n),h=wp(n);return JO(),k.jsx(Ic,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:k.jsx(dA,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:c,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>d.onOpenChange(!1),children:k.jsx(fee,{"data-state":_4(d.open),role:"dialog",id:d.contentId,...h,...f,ref:e,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),T4="PopoverClose",O4=Y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=uu(T4,n);return k.jsx($r.button,{type:"button",...r,ref:e,onClick:ai(t.onClick,()=>i.onOpenChange(!1))})});O4.displayName=T4;var wee="PopoverArrow",vee=Y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=wp(n);return k.jsx(dee,{...i,...r,ref:e})});vee.displayName=wee;function _4(t){return t?"open":"closed"}var Aee=x4,xee=S4,Eee=C4,jy=O4;const Hy=({children:t,isActive:e,onClick:n,disabled:r,className:i})=>{const s=Ne("flex items-center gap-2 p-1.5 text-xs font-medium text-neutral-500 text-left w-full rounded-md border border-transparent transition-all",!e&&!r,"hover:border-neutral-200 hover:bg-neutral-100",e&&!r&&"bg-neutral-200 text-neutral-800",r&&"text-neutral-300 cursor-not-allowed",i);return k.jsx("button",{className:s,disabled:r,onClick:n,children:t})},kee=(t,e,n)=>{const r=_.useCallback(()=>{const a=t.chain();a.setNodeSelection(n).unsetAllMarks(),(e==null?void 0:e.type.name)!=="paragraph"&&a.setParagraph(),a.run()},[t,n,e==null?void 0:e.type.name]),i=_.useCallback(()=>{t.commands.setNodeSelection(n);const{$anchor:a}=t.state.selection,l=a.node(1)||t.state.selection.node;t.chain().setMeta("hideDragHandle",!0).insertContentAt(n+((e==null?void 0:e.nodeSize)||0),l.toJSON()).run()},[t,n,e==null?void 0:e.nodeSize]),s=_.useCallback(()=>{t.chain().setMeta("hideDragHandle",!0).setNodeSelection(n).run(),document.execCommand("copy"),alert("copied")},[t,n]),o=_.useCallback(()=>{t.chain().setMeta("hideDragHandle",!0).setNodeSelection(n).deleteSelection().run()},[t,n]);return{resetTextFormatting:r,duplicateNode:i,copyNodeToClipboard:s,deleteNode:o}},See=({node:t,getPos:e,editor:n,deleteNode:r})=>{const[i,s]=_.useState(!1),o=kee(n,t,e()),a=wg(),l=["https://twitter.com","https://x.com"],u=_.useMemo(()=>{const{content:D}=t.content;return D[0].type.name==="table"},[t.content]),c=_.useMemo(()=>{var I;const{content:D}=t.content;return(I=D[0].content.content[0])==null?void 0:I.text},[t.content]),f=_.useMemo(()=>{var I;const{content:D}=t.content;return(I=D[0].content.content[1])==null?void 0:I.text},[t.content]),d=_.useMemo(()=>{const{content:D}=t.content;return D[0].content.content.find(I=>{var F;return(F=I==null?void 0:I.text)==null?void 0:F.match(/\/status\/([0-9]*)/)})},[t.content]),h=()=>{if(!c)return;let D=c;if(c.includes("<iframe"))D=f;else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(c):{const B=c.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);B&&B.length>0&&(D=`https://www.youtube.com/embed/${B[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(c):{const B=c.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);B&&B.length>0&&(D=`https://player.vimeo.com/video/${B[1]}`);break}default:return}const I=640,F=360,Q=e(),V=Q+t.nodeSize;D&&(n==null||n.chain().focus(Q).deleteRange({from:Q===0?Q:Q+1,to:V}).setIframe({src:D,width:I,height:F}).run())},p=D=>{const I=D.match(/\/status\/([0-9]*)/);return I&&I.length>0?I[1]:null},m=()=>{if(!c)return;let D=c;const I=l.some(B=>c.includes(B)),F=p(c);I&&F?D=F:d&&(D=p(d.text));const Q=e(),V=Q+t.nodeSize;D&&(n==null||n.chain().focus(Q).deleteRange({from:Q===2?Q:Q+1,to:V}).setTweetEmbed({tweetId:D}).run())},g=()=>{const D=e()+t.nodeSize;n.commands.insertContentAt(D,{type:"dBlock",content:[{type:"paragraph"}]})},y=()=>{const D=e();n.commands.insertContentAt(D,{type:"dBlock",content:[{type:"paragraph"}]})},v=()=>{r()},w=D=>{D.altKey?E():b()},b=()=>{g()},E=()=>{y()},x=D=>{D.altKey&&v()},S=$N(()=>{if(l.some(D=>c.includes(D))||d!=null&&d.text){m();return}else{h();return}},1e3);return _.useEffect(()=>{c&&S()},[c]),k.jsxs(_h,{as:"div",className:Ne("flex gap-2 group w-full relative justify-center items-start",a&&"pointer-events-none",u&&"pointer-events-auto"),children:[k.jsxs("section",{className:"lg:flex gap-1 hidden","aria-label":"left-menu",contentEditable:!1,children:[k.jsx(C_,{content:k.jsxs("div",{className:"flex flex-col w-40",children:[k.jsx("div",{className:"text-xs",children:"Click to add below"}),k.jsx("div",{className:"text-xs",children:"Opt + Click to add above"})]}),children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,onClick:w,children:k.jsx(aG,{size:18})})}),k.jsx(Ic,{onMountAutoFocus:D=>D.preventDefault(),trapped:!1,children:k.jsxs(Aee,{open:i,onOpenChange:s,children:[k.jsx(xee,{asChild:!0,children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,draggable:!0,"data-drag-handle":!0,onClick:x,children:k.jsx(eG,{size:18})})}),k.jsx(Eee,{side:"bottom",align:"start",sideOffset:8,className:"z-10",children:k.jsxs(qA,{className:"p-2 flex flex-col min-w-[16rem]",children:[k.jsx(jy,{children:k.jsxs(Hy,{onClick:o.resetTextFormatting,children:[k.jsx(uG,{size:18}),"Clear formatting"]})}),k.jsx(jy,{children:k.jsxs(Hy,{onClick:o.copyNodeToClipboard,children:[k.jsx(J$,{size:18}),"Copy to clipboard"]})}),k.jsx(jy,{children:k.jsxs(Hy,{onClick:o.duplicateNode,children:[k.jsx(X$,{size:18}),"Duplicate"]})}),k.jsx(Uc.Divider,{horizontal:!0}),k.jsx(jy,{children:k.jsxs(Hy,{onClick:o.deleteNode,className:"text-red-500 hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20",children:[k.jsx(sA,{size:18}),"Delete"]})})]})})]})})]}),k.jsx(DO,{className:Ne("node-view-content w-full",{"is-table":u})})]})},Cee=ot.create({name:"dBlock",priority:1e3,group:"dBlock",content:"(block|columns)",draggable:!0,selectable:!1,inline:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="d-block"]'}]},renderHTML({HTMLAttributes:t}){return["div",gt(t,{"data-type":"d-block"}),0]},addCommands(){return{setDBlock:t=>({state:e,chain:n})=>{const{selection:{from:r}}=e,i=t!==void 0||t!==null?r:t;return n().insertContentAt(i,{type:this.name,content:[{type:"paragraph"}]}).focus(i+2).run()}}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setDBlock(),Enter:({editor:t})=>{var u;const{selection:{$head:e,from:n,to:r},doc:i}=t.state,s=e.node(e.depth-1);if((s==null?void 0:s.type.name)!=="dBlock"){const f=e.toString().split("/"),d=f.some(E=>E.includes("bulletList_0")||E.includes("orderedList_0")||E.includes("taskList_0")),h=f.some(E=>E.includes("paragraph_0:0")),p=e.parent.content.size===0,m=f.length===4&&h,g=f.some(E=>E.includes("paragraph_0:0"))&&f.length!==4,y=e.parent.content.size===0&&f.some(E=>E.includes("listItem_0")),v=f.some(E=>E.includes("paragraph_1:0"))&&e.parent.content.size===0,w=e.parent.content.size>0,b=f.some(E=>/paragraph_\d+:0/.test(E));if(m)return t.chain().liftListItem("listItem").focus().run();if(w&&b){const E=e.before(e.depth-1),x=()=>{var D;const O=e.node(e.depth-1);return(D=O==null?void 0:O.lastChild)==null?void 0:D.textContent};return t.chain().deleteRange({from:n,to:E+1+s.nodeSize}).insertContent({type:"dBlock",content:[{type:"paragraph",content:[{type:"text",text:x()}]}]}).run()}if(v)return t.chain().insertContent({type:"dBlock",content:[{type:"paragraph"}]}).focus().run();if(g&&d||y)return t.chain().liftListItem("listItem").focus().run();if(p&&d){const E=e.before(e.depth-1);return t.chain().deleteRange({from:E,to:E+s.nodeSize}).insertContentAt(n,{type:"dBlock",content:[{type:"paragraph"}]}).focus().run()}return!1}let o=-1,a="";i.descendants((c,f)=>{if(o!==-1)return!1;if(c.type.name===this.name)return;const[d,h]=[f,f+c.nodeSize];return d<=n&&r<=h&&(o=h,a=c.type.name),!1});const l=(u=i.slice(n,o))==null?void 0:u.toJSON().content;try{return a==="codeBlock"?t.chain().newlineInCode().focus().run():["columns","heading"].includes(a)?t.chain().insertContent({type:"dBlock",content:[{type:"paragraph"}]}).focus().run():t.chain().insertContentAt({from:n,to:o},{type:this.name,content:l}).focus().run()}catch(c){return console.error(`Error inserting content into dBlock node: ${c}`),!1}},Backspace:({editor:t})=>{const{selection:{$head:e,from:n}}=t.state,r=e.node(e.depth-1),s=e.toString().split("/"),o=s.some(l=>l.includes("bulletList_0")||l.includes("orderedList_0")||l.includes("taskList_0"));if((r==null?void 0:r.type.name)!=="dBlock"){const u=s.some(p=>p.includes("listItem_0")||p.includes("taskItem_0"))&&s.some(p=>p.includes("paragraph_0:0")),f=s.some(p=>p.includes("dBlock_0"))&&u&&o,d=e.parent.content.size===0&&s.some(p=>p.includes("paragraph_0:0"))&&s.some(p=>p.includes("listItem_0")||p.includes("taskItem_0"))&&o&&s.length===4,h=e.node(e.depth-2).childCount>1;if(d){const p=e.before(e.depth-2);return h?t.chain().deleteRange({from:p+1,to:p+1+r.nodeSize}).insertContentAt(n-4,{type:"dBlock",content:[{type:"paragraph",content:[{type:"text",text:""}]}]}).focus().run():t.chain().liftListItem("listItem").focus().run()}if(f&&s.length===4)return t.chain().liftListItem("listItem").insertContentAt(n-4,{type:"dBlock",content:[{type:"paragraph"}]}).focus().run()}return e.toString().includes("dBlock_0")&&e.parent.content.size===0&&!o?t.chain().deleteNode("dBlock").focus().run():!1}}},addNodeView(){return $l(See)}});let S2,C2;if(typeof WeakMap<"u"){let t=new WeakMap;S2=e=>t.get(e),C2=(e,n)=>(t.set(e,n),n)}else{let t=[],e=10,n=0;S2=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},C2=(r,i)=>(n==e&&(n=0),t[n++]=r,t[n++]=i)}class cf{constructor(e,n,r,i){this.left=e,this.top=n,this.right=r,this.bottom=i}}class yn{constructor(e,n,r,i){this.width=e,this.height=n,this.map=r,this.problems=i}findCell(e){for(let n=0;n<this.map.length;n++){let r=this.map[n];if(r!=e)continue;let i=n%this.width,s=n/this.width|0,o=i+1,a=s+1;for(let l=1;o<this.width&&this.map[n+l]==r;l++)o++;for(let l=1;a<this.height&&this.map[n+this.width*l]==r;l++)a++;return new cf(i,s,o,a)}throw new RangeError("No cell with offset "+e+" found")}colCount(e){for(let n=0;n<this.map.length;n++)if(this.map[n]==e)return n%this.width;throw new RangeError("No cell with offset "+e+" found")}nextCell(e,n,r){let{left:i,right:s,top:o,bottom:a}=this.findCell(e);return n=="horiz"?(r<0?i==0:s==this.width)?null:this.map[o*this.width+(r<0?i-1:s)]:(r<0?o==0:a==this.height)?null:this.map[i+this.width*(r<0?o-1:a)]}rectBetween(e,n){let{left:r,right:i,top:s,bottom:o}=this.findCell(e),{left:a,right:l,top:u,bottom:c}=this.findCell(n);return new cf(Math.min(r,a),Math.min(s,u),Math.max(i,l),Math.max(o,c))}cellsInRect(e){let n=[],r={};for(let i=e.top;i<e.bottom;i++)for(let s=e.left;s<e.right;s++){let o=i*this.width+s,a=this.map[o];r[a]||(r[a]=!0,(s!=e.left||!s||this.map[o-1]!=a)&&(i!=e.top||!i||this.map[o-this.width]!=a)&&n.push(a))}return n}positionAt(e,n,r){for(let i=0,s=0;;i++){let o=s+r.child(i).nodeSize;if(i==e){let a=n+e*this.width,l=(e+1)*this.width;for(;a<l&&this.map[a]<s;)a++;return a==l?o-1:this.map[a]}s=o}}static get(e){return S2(e)||C2(e,Dee(e))}}function Dee(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);let e=Tee(t),n=t.childCount,r=[],i=0,s=null,o=[];for(let u=0,c=e*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){let f=t.child(u);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==f.childCount)break;let m=f.child(p),{colspan:g,rowspan:y,colwidth:v}=m.attrs;for(let w=0;w<y;w++){if(w+u>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:y-w});break}let b=i+w*e;for(let E=0;E<g;E++){r[b+E]==0?r[b+E]=c:(s||(s=[])).push({type:"collision",row:u,pos:c,n:g-E});let x=v&&v[E];if(x){let O=(b+E)%e*2,S=o[O];S==null||S!=x&&o[O+1]==1?(o[O]=x,o[O+1]=1):S==x&&o[O+1]++}}}i+=g,c+=m.nodeSize}let d=(u+1)*e,h=0;for(;i<d;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:u,n:h}),c++}let a=new yn(e,n,r,s),l=!1;for(let u=0;!l&&u<o.length;u+=2)o[u]!=null&&o[u+1]<n&&(l=!0);return l&&Oee(a,o,t),a}function Tee(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){let i=t.child(r),s=0;if(n)for(let o=0;o<r;o++){let a=t.child(o);for(let l=0;l<a.childCount;l++){let u=a.child(l);o+u.attrs.rowspan>r&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){let a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function Oee(t,e,n){t.problems||(t.problems=[]);for(let r=0,i={};r<t.map.length;r++){let s=t.map[r];if(i[s])continue;i[s]=!0;let o=n.nodeAt(s),a=null;for(let l=0;l<o.attrs.colspan;l++){let u=(r+l)%t.width,c=e[u*2];c!=null&&(!o.attrs.colwidth||o.attrs.colwidth[l]!=c)&&((a||(a=_ee(o.attrs)))[l]=c)}a&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function _ee(t){if(t.colwidth)return t.colwidth.slice();let e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function yr(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(let n in t.nodes){let r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Pa=new en("selectingCells");function ff(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Mee(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function rs(t){let e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Vy(t){let e=t.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&e.node.type.spec.tableRole=="cell"?e.$anchor:ff(e.$head)||Nee(e.$head)}function Nee(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function D2(t){return t.parent.type.spec.tableRole=="row"&&t.nodeAfter}function Pee(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function T2(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function M4(t,e,n){let r=t.start(-1),s=yn.get(t.node(-1)).nextCell(t.pos-r,e,n);return s==null?null:t.node(0).resolve(r+s)}function Wn(t,e,n){let r={};for(let i in t)r[i]=t[i];return r[e]=n,r}function cu(t,e,n=1){let r=Wn(t,"colspan",t.colspan-n);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function N4(t,e,n=1){let r=Wn(t,"colspan",t.colspan+n);if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function Iee(t,e,n){let r=yr(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}class xt extends Qe{constructor(e,n=e){let r=e.node(-1),i=yn.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(c=>c!=n.pos-s);l.unshift(n.pos-s);let u=l.map(c=>{let f=r.nodeAt(c),d=c+s+1;return new Pw(a.resolve(d),a.resolve(d+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(D2(r)&&D2(i)&&T2(r,i)){let s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?xt.rowSelection(r,i):s&&this.isColSelection()?xt.colSelection(r,i):new xt(r,i)}return We.between(r,i)}content(){let e=this.$anchorCell.node(-1),n=yn.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let l=i.top;l<i.bottom;l++){let u=[];for(let c=l*n.width+i.left,f=i.left;f<i.right;f++,c++){let d=n.map[c];if(!s[d]){s[d]=!0;let h=n.findCell(d),p=e.nodeAt(d),m=i.left-h.left,g=h.right-i.right;if(m>0||g>0){let y=p.attrs;m>0&&(y=cu(y,0,m)),g>0&&(y=cu(y,y.colspan-g,g)),h.left<i.left?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}if(h.top<i.top||h.bottom>i.bottom){let y=Wn(p.attrs,"rowspan",Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top));h.top<i.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}u.push(p)}}o.push(e.child(l).copy(Ae.from(u)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new Ce(Ae.from(a),1,1)}replace(e,n=Ce.empty){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:l}=i[o],u=e.mapping.slice(r);e.replace(u.map(a.pos),u.map(l.pos),o?Ce.empty:n)}let s=Qe.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Ce(Ae.from(n),0,0))}forEachCell(e){let n=this.$anchorCell.node(-1),r=yn.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){let e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=yn.get(e.node(-1)),i=e.start(-1),s=r.findCell(e.pos-i),o=r.findCell(n.pos-i),a=e.node(0);return s.top<=o.top?(s.top>0&&(e=a.resolve(i+r.map[s.left])),o.bottom<r.height&&(n=a.resolve(i+r.map[r.width*(r.height-1)+o.right-1]))):(o.top>0&&(n=a.resolve(i+r.map[o.left])),s.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new xt(e,n)}isRowSelection(){let e=yn.get(this.$anchorCell.node(-1)),n=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-n),i=e.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let s=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,o)==e.width}eq(e){return e instanceof xt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=yn.get(e.node(-1)),i=e.start(-1),s=r.findCell(e.pos-i),o=r.findCell(n.pos-i),a=e.node(0);return s.left<=o.left?(s.left>0&&(e=a.resolve(i+r.map[s.top*r.width])),o.right<r.width&&(n=a.resolve(i+r.map[r.width*(o.top+1)-1]))):(o.left>0&&(n=a.resolve(i+r.map[o.top*r.width])),s.right<r.width&&(e=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new xt(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new xt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new xt(e.resolve(n),e.resolve(r))}getBookmark(){return new O2(this.$anchorCell.pos,this.$headCell.pos)}}xt.prototype.visible=!1,Qe.jsonID("cell",xt);class O2{constructor(e,n){this.anchor=e,this.head=n}map(e){return new O2(e.map(this.anchor),e.map(this.head))}resolve(e){let n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&T2(n,r)?new xt(n,r):Qe.near(r,1)}}function Ree(t){if(!(t.selection instanceof xt))return null;let e=[];return t.selection.forEachCell((n,r)=>{e.push(Un.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Wt.create(t.doc,e)}function Lee({$from:t,$to:e}){if(t.pos==e.pos||t.pos<t.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function Bee({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){let s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){let s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function Fee(t,e,n){let r=(e||t).selection,i=(e||t).doc,s,o;if(r instanceof ze&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=xt.create(i,r.from);else if(o=="row"){let a=i.resolve(r.from+1);s=xt.rowSelection(a,a)}else if(!n){let a=yn.get(r.node),l=r.from+1,u=l+a.map[a.width*a.height-1];s=xt.create(i,l+1,u)}}else r instanceof We&&Lee(r)?s=We.create(i,r.from):r instanceof We&&Bee(r)&&(s=We.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}function Uee(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.firstChild.type.spec.tableRole=="table");)n--,r--,e=e.firstChild.content;let i=e.firstChild,s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l<e.childCount;l++){let u=e.child(l).content,c=l?0:Math.max(0,n-1),f=l<e.childCount-1?0:Math.max(0,r-1);(c||f)&&(u=_2(yr(o).row,new Ce(u,c,f)).content),a.push(u)}else if(s=="cell"||s=="header_cell")a.push(n||r?_2(yr(o).row,new Ce(e,n,r)).content:e);else return null;return jee(o,a)}function jee(t,e){let n=[];for(let i=0;i<e.length;i++){let s=e[i];for(let o=s.childCount-1;o>=0;o--){let{rowspan:a,colspan:l}=s.child(o).attrs;for(let u=i;u<i+a;u++)n[u]=(n[u]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(Ae.empty),n[i]<r){let s=yr(t).cell.createAndFill(),o=[];for(let a=n[i];a<r;a++)o.push(s);e[i]=e[i].append(Ae.from(o))}return{height:e.length,width:r,rows:e}}function _2(t,e){let n=t.createAndFill();return new Mw(n).replace(0,n.content.size,e).doc}function Hee({width:t,height:e,rows:n},r,i){if(t!=r){let s=[],o=[];for(let a=0;a<n.length;a++){let l=n[a],u=[];for(let c=s[a]||0,f=0;c<r;f++){let d=l.child(f%l.childCount);c+d.attrs.colspan>r&&(d=d.type.create(cu(d.attrs,d.attrs.colspan,c+d.attrs.colspan-r),d.content)),u.push(d),c+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)s[a+h]=(s[a+h]||0)+d.attrs.colspan}o.push(Ae.from(u))}n=o,t=r}if(e!=i){let s=[];for(let o=0,a=0;o<i;o++,a++){let l=[],u=n[a%e];for(let c=0;c<u.childCount;c++){let f=u.child(c);o+f.attrs.rowspan>i&&(f=f.type.create(Wn(f.attrs,"rowspan",Math.max(1,i-f.attrs.rowspan)),f.content)),l.push(f)}s.push(Ae.from(l))}n=s,e=i}return{width:t,height:e,rows:n}}function Vee(t,e,n,r,i,s,o){let a=t.doc.type.schema,l=yr(a),u,c;if(i>e.width)for(let f=0,d=0;f<e.height;f++){let h=n.child(f);d+=h.nodeSize;let p=[],m;h.lastChild==null||h.lastChild.type==l.cell?m=u||(u=l.cell.createAndFill()):m=c||(c=l.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);t.insert(t.mapping.slice(o).map(d-1+r),p)}if(s>e.height){let f=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){let g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==l.header_cell;f.push(g?c||(c=l.header_cell.createAndFill()):u||(u=l.cell.createAndFill()))}let d=l.row.create(null,Ae.from(f)),h=[];for(let p=e.height;p<s;p++)h.push(d);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),h)}return!!(u||c)}function P4(t,e,n,r,i,s,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let u=i;u<s;u++){let c=o*e.width+u,f=e.map[c];if(e.map[c-e.width]==f){l=!0;let d=n.nodeAt(f),{top:h,left:p}=e.findCell(f);t.setNodeMarkup(t.mapping.slice(a).map(f+r),null,Wn(d.attrs,"rowspan",o-h)),t.insert(t.mapping.slice(a).map(e.positionAt(o,p,n)),d.type.createAndFill(Wn(d.attrs,"rowspan",h+d.attrs.rowspan-o))),u+=d.attrs.colspan-1}}return l}function I4(t,e,n,r,i,s,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let u=i;u<s;u++){let c=u*e.width+o,f=e.map[c];if(e.map[c-1]==f){l=!0;let d=n.nodeAt(f),h=e.colCount(f),p=t.mapping.slice(a).map(f+r);t.setNodeMarkup(p,null,cu(d.attrs,o-h,d.attrs.colspan-(o-h))),t.insert(p+d.nodeSize,d.type.createAndFill(cu(d.attrs,0,o-h))),u+=d.attrs.rowspan-1}}return l}function R4(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc,o=yn.get(s),{top:a,left:l}=r,u=l+i.width,c=a+i.height,f=t.tr,d=0;function h(){s=n?f.doc.nodeAt(n-1):f.doc,o=yn.get(s),d=f.mapping.maps.length}Vee(f,o,s,n,u,c,d)&&h(),P4(f,o,s,n,l,u,a,d)&&h(),P4(f,o,s,n,l,u,c,d)&&h(),I4(f,o,s,n,a,c,l,d)&&h(),I4(f,o,s,n,a,c,u,d)&&h();for(let p=a;p<c;p++){let m=o.positionAt(p,l,s),g=o.positionAt(p,u,s);f.replace(f.mapping.slice(d).map(m+n),f.mapping.slice(d).map(g+n),new Ce(i.rows[p-a],0,0))}h(),f.setSelection(new xt(f.doc.resolve(n+o.positionAt(a,l,s)),f.doc.resolve(n+o.positionAt(c-1,u-1,s)))),e(f)}const zee=lv({ArrowLeft:$y("horiz",-1),ArrowRight:$y("horiz",1),ArrowUp:$y("vert",-1),ArrowDown:$y("vert",1),"Shift-ArrowLeft":Gy("horiz",-1),"Shift-ArrowRight":Gy("horiz",1),"Shift-ArrowUp":Gy("vert",-1),"Shift-ArrowDown":Gy("vert",1),Backspace:Wy,"Mod-Backspace":Wy,Delete:Wy,"Mod-Delete":Wy});function zy(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function $y(t,e){return(n,r,i)=>{let s=n.selection;if(s instanceof xt)return zy(n,r,Qe.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;let o=L4(i,t,e);if(o==null)return!1;if(t=="horiz")return zy(n,r,Qe.near(n.doc.resolve(s.head+e),e));{let a=n.doc.resolve(o),l=M4(a,t,e),u;return l?u=Qe.near(l,1):e<0?u=Qe.near(n.doc.resolve(a.before(-1)),-1):u=Qe.near(n.doc.resolve(a.after(-1)),1),zy(n,r,u)}}}function Gy(t,e){return(n,r,i)=>{let s=n.selection;if(!(s instanceof xt)){let a=L4(i,t,e);if(a==null)return!1;s=new xt(n.doc.resolve(a))}let o=M4(s.$headCell,t,e);return o?zy(n,r,new xt(s.$anchorCell,o)):!1}}function Wy(t,e){let n=t.selection;if(!(n instanceof xt))return!1;if(e){let r=t.tr,i=yr(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new Ce(i,0,0))}),r.docChanged&&e(r)}return!0}function $ee(t,e){let n=t.state.doc,r=ff(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new xt(r))),!0):!1}function Gee(t,e,n){if(!rs(t.state))return!1;let r=Uee(n),i=t.state.selection;if(i instanceof xt){r||(r={width:1,height:1,rows:[Ae.from(_2(yr(t.state.schema).cell,n))]});let s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=yn.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=Hee(r,a.right-a.left,a.bottom-a.top),R4(t.state,t.dispatch,o,a,r),!0}else if(r){let s=Vy(t.state),o=s.start(-1);return R4(t.state,t.dispatch,o,yn.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function Wee(t,e){if(e.ctrlKey||e.metaKey)return;let n=B4(t,e.target),r;if(e.shiftKey&&t.state.selection instanceof xt)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(r=ff(t.state.selection.$anchor))!=null&&M2(t,e).pos!=r.pos)i(r,e),e.preventDefault();else if(!n)return;function i(a,l){let u=M2(t,l),c=Pa.getState(t.state)==null;if(!u||!T2(a,u))if(c)u=a;else return;let f=new xt(a,u);if(c||!t.state.selection.eq(f)){let d=t.state.tr.setSelection(f);c&&d.setMeta(Pa,a.pos),t.dispatch(d)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",o),Pa.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Pa,-1))}function o(a){let l=Pa.getState(t.state),u;if(l!=null)u=t.state.doc.resolve(l);else if(B4(t,a.target)!=n&&(u=M2(t,e),!u))return s();u&&i(u,a)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",o)}function L4(t,e,n){if(!(t.state.selection instanceof We))return null;let{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){let s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){let a=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}function B4(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e}function M2(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?ff(t.state.doc.resolve(n.pos)):null}const Kee=new en("fix-tables");function F4(t,e,n,r){let i=t.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){let l=e.child(o);for(let u=a,c=Math.min(i,o+3);u<c;u++)if(t.child(u)==l){a=u+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?F4(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function U4(t,e){let n,r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=qee(t,i,s,n))};return e?e.doc!=t.doc&&F4(e.doc,t.doc,0,r):t.doc.descendants(r),n}function qee(t,e,n,r){let i=yn.get(e);if(!i.problems)return r;r||(r=t.tr);let s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){let u=i.problems[l];if(u.type=="collision"){let c=e.nodeAt(u.pos);for(let f=0;f<c.attrs.rowspan;f++)s[u.row+f]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,cu(c.attrs,c.attrs.colspan-u.n,u.n))}else if(u.type=="missing")s[u.row]+=u.n;else if(u.type=="overlong_rowspan"){let c=e.nodeAt(u.pos);r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,Wn(c.attrs,"rowspan",c.attrs.rowspan-u.n))}else if(u.type=="colwidth mismatch"){let c=e.nodeAt(u.pos);r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,Wn(c.attrs,"colwidth",u.colwidth))}}let o,a;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),a=l);for(let l=0,u=n+1;l<i.height;l++){let c=e.child(l),f=u+c.nodeSize,d=s[l];if(d>0){let h="cell";c.firstChild&&(h=c.firstChild.type.spec.tableRole);let p=[];for(let g=0;g<d;g++)p.push(yr(t.schema)[h].createAndFill());let m=(l==0||o==l-1)&&a==l?u+1:f-1;r.insert(r.mapping.map(m),p)}u=f}return r.setMeta(Kee,{fixTables:!0})}function js(t){let e=t.selection,n=Vy(t),r=n.node(-1),i=n.start(-1),s=yn.get(r),o;return e instanceof xt?o=s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o=s.findCell(n.pos-i),o.tableStart=i,o.map=s,o.table=r,o}function j4(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;Iee(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){let a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){let l=e.map[a],u=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,N4(u.attrs,i-e.colCount(l))),o+=u.attrs.rowspan-1}else{let l=s==null?yr(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,u=e.positionAt(o,i,r);t.insert(t.mapping.map(n+u),l.createAndFill())}}return t}function Qee(t,e){if(!rs(t))return!1;if(e){let n=js(t);e(j4(t.tr,n,n.left))}return!0}function Jee(t,e){if(!rs(t))return!1;if(e){let n=js(t);e(j4(t.tr,n,n.right))}return!0}function Yee(t,{map:e,table:n,tableStart:r},i){let s=t.mapping.maps.length;for(let o=0;o<e.height;){let a=o*e.width+i,l=e.map[a],u=n.nodeAt(l);if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(s).map(r+l),null,cu(u.attrs,i-e.colCount(l)));else{let c=t.mapping.slice(s).map(r+l);t.delete(c,c+u.nodeSize)}o+=u.attrs.rowspan}}function Xee(t,e){if(!rs(t))return!1;if(e){let n=js(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;Yee(r,n,i),i!=n.left;i--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=yn.get(n.table);e(r)}return!0}function Zee(t,e,n){let r=yr(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(e.nodeAt(t.map[i+n*t.width]).type!=r)return!1;return!0}function H4(t,{map:e,tableStart:n,table:r},i){let s=n;for(let l=0;l<i;l++)s+=r.child(l).nodeSize;let o=[],a=i>0?-1:0;Zee(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let l=0,u=e.width*i;l<e.width;l++,u++)if(i>0&&i<e.height&&e.map[u]==e.map[u-e.width]){let c=e.map[u],f=r.nodeAt(c).attrs;t.setNodeMarkup(n+c,null,Wn(f,"rowspan",f.rowspan+1)),l+=f.colspan-1}else{let c=a==null?yr(r.type.schema).cell:r.nodeAt(e.map[u+a*e.width]).type;o.push(c.createAndFill())}return t.insert(s,yr(r.type.schema).row.create(null,o)),t}function ete(t,e){if(!rs(t))return!1;if(e){let n=js(t);e(H4(t.tr,n,n.top))}return!0}function tte(t,e){if(!rs(t))return!1;if(e){let n=js(t);e(H4(t.tr,n,n.bottom))}return!0}function nte(t,{map:e,table:n,tableStart:r},i){let s=0;for(let l=0;l<i;l++)s+=n.child(l).nodeSize;let o=s+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(s+r,o+r);for(let l=0,u=i*e.width;l<e.width;l++,u++){let c=e.map[u];if(i>0&&c==e.map[u-e.width]){let f=n.nodeAt(c).attrs;t.setNodeMarkup(t.mapping.slice(a).map(c+r),null,Wn(f,"rowspan",f.rowspan-1)),l+=f.colspan-1}else if(i<e.width&&c==e.map[u+e.width]){let f=n.nodeAt(c),d=f.type.create(Wn(f.attrs,"rowspan",f.attrs.rowspan-1),f.content),h=e.positionAt(i+1,l,n);t.insert(t.mapping.slice(a).map(r+h),d),l+=f.attrs.colspan-1}}}function rte(t,e){if(!rs(t))return!1;if(e){let n=js(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;nte(r,n,i),i!=n.top;i--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=yn.get(n.table);e(r)}return!0}function V4(t){let e=t.content;return e.childCount==1&&e.firstChild.isTextblock&&e.firstChild.childCount==0}function ite({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[a]==n[a+1])return!0;s+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function z4(t,e){let n=t.selection;if(!(n instanceof xt)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=js(t),{map:i}=r;if(ite(i,r))return!1;if(e){let s=t.tr,o={},a=Ae.empty,l,u;for(let c=r.top;c<r.bottom;c++)for(let f=r.left;f<r.right;f++){let d=i.map[c*i.width+f],h=r.table.nodeAt(d);if(!o[d])if(o[d]=!0,l==null)l=d,u=h;else{V4(h)||(a=a.append(h.content));let p=s.mapping.map(d+r.tableStart);s.delete(p,p+h.nodeSize)}}if(s.setNodeMarkup(l+r.tableStart,null,Wn(N4(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),"rowspan",r.bottom-r.top)),a.size){let c=l+1+u.content.size,f=V4(u)?l+1:c;s.replaceWith(f+r.tableStart,c+r.tableStart,a)}s.setSelection(new xt(s.doc.resolve(l+r.tableStart))),e(s)}return!0}function $4(t,e){const n=yr(t.schema);return ste(({node:r})=>n[r.type.spec.tableRole])(t,e)}function ste(t){return(e,n)=>{let r=e.selection,i,s;if(r instanceof xt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{if(i=Mee(r.$from),!i)return!1;s=ff(r.$from).pos}if(i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,a=[],l=o.colwidth;o.rowspan>1&&(o=Wn(o,"rowspan",1)),o.colspan>1&&(o=Wn(o,"colspan",1));let u=js(e),c=e.tr;for(let d=0;d<u.right-u.left;d++)a.push(l?Wn(o,"colwidth",l&&l[d]?[l[d]]:null):o);let f;for(let d=u.top;d<u.bottom;d++){let h=u.map.positionAt(d,u.left,u.table);d==u.top&&(h+=i.nodeSize);for(let p=u.left,m=0;p<u.right;p++,m++)p==u.left&&d==u.top||c.insert(f=c.mapping.map(h+u.tableStart,1),t({node:i,row:d,col:p}).createAndFill(a[m]))}c.setNodeMarkup(s,t({node:i,row:u.top,col:u.left}),a[0]),r instanceof xt&&c.setSelection(new xt(c.doc.resolve(r.$anchorCell.pos),f&&c.doc.resolve(f))),n(c)}return!0}}function ote(t,e){return function(n,r){if(!rs(n))return!1;let i=Vy(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){let s=n.tr;n.selection instanceof xt?n.selection.forEachCell((o,a)=>{o.attrs[t]!==e&&s.setNodeMarkup(a,null,Wn(o.attrs,t,e))}):s.setNodeMarkup(i.pos,null,Wn(i.nodeAfter.attrs,t,e)),r(s)}return!0}}function ate(t){return function(e,n){if(!rs(e))return!1;if(n){let r=yr(e.schema),i=js(e),s=e.tr,o=i.map.cellsInRect(t=="column"?new cf(i.left,0,i.right,i.map.height):t=="row"?new cf(0,i.top,i.map.width,i.bottom):i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[l],r.cell,a[l].attrs);if(s.steps.length==0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],r.header_cell,a[l].attrs);n(s)}return!0}}function G4(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function vp(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?ate(t):function(n,r){if(!rs(n))return!1;if(r){let i=yr(n.schema),s=js(n),o=n.tr,a=G4("row",s,i),l=G4("column",s,i),c=(t==="column"?a:t==="row"?l:!1)?1:0,f=t=="column"?new cf(0,c,1,s.map.height):t=="row"?new cf(c,0,s.map.width,1):s,d=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(f).forEach(h=>{const p=h+s.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,d,m.attrs)}),r(o)}return!0}}vp("row",{useDeprecatedLogic:!0}),vp("column",{useDeprecatedLogic:!0});let lte=vp("cell",{useDeprecatedLogic:!0});function ute(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){let s=t.node(-1).child(r);if(s.childCount)return i-1-s.lastChild.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;let n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){let s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}}function W4(t){return function(e,n){if(!rs(e))return!1;let r=ute(Vy(e),t);if(r!=null){if(n){let i=e.doc.resolve(r);n(e.tr.setSelection(We.between(i,Pee(i))).scrollIntoView())}return!0}}}function cte(t,e){let n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}let fte=class{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),N2(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,N2(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function N2(t,e,n,r,i,s){let o=0,a=!0,l=e.firstChild,u=t.firstChild;for(let c=0,f=0;c<u.childCount;c++){let{colspan:d,colwidth:h}=u.child(c).attrs;for(let p=0;p<d;p++,f++){let m=i==f?s:h&&h[p],g=m?m+"px":"";o+=m||r,m||(a=!1),l?(l.style.width!=g&&(l.style.width=g),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=g}}for(;l;){let c=l.nextSibling;l.parentNode.removeChild(l),l=c}a?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}const Pi=new en("tableColumnResizing");function dte({handleWidth:t=5,cellMinWidth:e=25,View:n=fte,lastColumnResizable:r=!0}={}){return new Ut({key:Pi,state:{init(s,o){return this.spec.props.nodeViews[yr(o.schema).table.name]=(a,l)=>new n(a,e,l),new Ap(-1,!1)},apply(s,o){return o.apply(s)}},props:{attributes(s){return Pi.getState(s).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove(s,o){hte(s,o,t,e,r)},mouseleave(s){pte(s)},mousedown(s,o){mte(s,o,e)}},decorations(s){let o=Pi.getState(s);if(o.activeHandle>-1)return Ate(s,o.activeHandle)},nodeViews:{}}})}class Ap{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(Pi);if(r&&r.setHandle!=null)return new Ap(r.setHandle,null);if(r&&r.setDragging!==void 0)return new Ap(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);D2(e.doc.resolve(i))||(i=null),n=new Ap(i,n.dragging)}return n}}function hte(t,e,n,r,i){let s=Pi.getState(t.state);if(!s.dragging){let o=yte(e.target),a=-1;if(o){let{left:l,right:u}=o.getBoundingClientRect();e.clientX-l<=n?a=K4(t,e,"left"):u-e.clientX<=n&&(a=K4(t,e,"right"))}if(a!=s.activeHandle){if(!i&&a!==-1){let l=t.state.doc.resolve(a),u=l.node(-1),c=yn.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Q4(t,a)}}}function pte(t){let e=Pi.getState(t.state);e.activeHandle>-1&&!e.dragging&&Q4(t,-1)}function mte(t,e,n){let r=Pi.getState(t.state);if(r.activeHandle==-1||r.dragging)return!1;let i=t.state.doc.nodeAt(r.activeHandle),s=gte(t,r.activeHandle,i.attrs);t.dispatch(t.state.tr.setMeta(Pi,{setDragging:{startX:e.clientX,startWidth:s}}));function o(l){window.removeEventListener("mouseup",o),window.removeEventListener("mousemove",a);let u=Pi.getState(t.state);u.dragging&&(bte(t,u.activeHandle,q4(u.dragging,l,n)),t.dispatch(t.state.tr.setMeta(Pi,{setDragging:null})))}function a(l){if(!l.which)return o(l);let u=Pi.getState(t.state),c=q4(u.dragging,l,n);wte(t,u.activeHandle,c,n)}return window.addEventListener("mouseup",o),window.addEventListener("mousemove",a),e.preventDefault(),!0}function gte(t,e,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let s=t.domAtPos(e),a=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let u=0;u<n;u++)r[u]&&(a-=r[u],l--);return a/l}function yte(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList.contains("ProseMirror")?null:t.parentNode;return t}function K4(t,e,n){let r=t.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;let{pos:i}=r,s=ff(t.state.doc.resolve(i));if(!s)return-1;if(n=="right")return s.pos;let o=yn.get(s.node(-1)),a=s.start(-1),l=o.map.indexOf(s.pos-a);return l%o.width==0?-1:a+o.map[l-1]}function q4(t,e,n){let r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Q4(t,e){t.dispatch(t.state.tr.setMeta(Pi,{setHandle:e}))}function bte(t,e,n){let r=t.state.doc.resolve(e),i=r.node(-1),s=yn.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let u=0;u<s.height;u++){let c=u*s.width+a;if(u&&s.map[c]==s.map[c-s.width])continue;let f=s.map[c],{attrs:d}=i.nodeAt(f),h=d.colspan==1?0:a-s.colCount(f);if(d.colwidth&&d.colwidth[h]==n)continue;let p=d.colwidth?d.colwidth.slice():vte(d.colspan);p[h]=n,l.setNodeMarkup(o+f,null,Wn(d,"colwidth",p))}l.docChanged&&t.dispatch(l)}function wte(t,e,n,r){let i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=yn.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,l=t.domAtPos(i.start(-1)).node;for(;l.nodeName!="TABLE";)l=l.parentNode;N2(s,l.firstChild,l,r,a,n)}function vte(t){let e=[];for(let n=0;n<t;n++)e.push(0);return e}function Ate(t,e){let n=[],r=t.doc.resolve(e),i=r.node(-1),s=yn.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan;for(let l=0;l<s.height;l++){let u=a+l*s.width-1;if((a==s.width||s.map[u]!=s.map[u+1])&&(l==0||s.map[u-1]!=s.map[u-1-s.width])){let c=s.map[u],f=o+c+i.nodeAt(c).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",n.push(Un.widget(f,d))}}return Wt.create(t.doc,n)}function xte({allowTableNodeSelection:t=!1}={}){return new Ut({key:Pa,state:{init(){return null},apply(e,n){let r=e.getMeta(Pa);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;let{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:Ree,handleDOMEvents:{mousedown:Wee},createSelectionBetween(e){if(Pa.getState(e.state)!=null)return e.state.selection},handleTripleClick:$ee,handleKeyDown:zee,handlePaste:Gee},appendTransaction(e,n,r){return Fee(r,U4(r,n),t)}})}function J4(t,e,n,r,i,s){var c;let o=0,a=!0,l=e.firstChild;const u=t.firstChild;if(u)for(let f=0,d=0;f<u.childCount;f+=1){const{colspan:h,colwidth:p}=u.child(f).attrs;for(let m=0;m<h;m+=1,d+=1){const g=i===d?s:p&&p[m],y=g?`${g}px`:"";o+=g||r,g||(a=!1),l?(l.style.width!==y&&(l.style.width=y),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;l;){const f=l.nextSibling;(c=l==null?void 0:l.parentNode)==null||c.removeChild(l),l=f}a?(n.style.width=`${o}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${o}px`)}class Ete{constructor(e,n){W(this,"node");W(this,"cellMinWidth");W(this,"dom");W(this,"table");W(this,"colgroup");W(this,"contentDOM");this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),J4(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,J4(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function Y4(t,e){return t.createAndFill()}function kte(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function Ste(t,e,n,r,i){const s=kte(t),o=[],a=[];for(let u=0;u<n;u+=1){const c=Y4(s.cell);if(c&&a.push(c),r){const f=Y4(s.header_cell);f&&o.push(f)}}const l=[];for(let u=0;u<e;u+=1)l.push(s.row.createChecked(null,r&&u===0?o:a));return s.table.createChecked(null,l)}function Cte(t){return t instanceof xt}const Ky=({editor:t})=>{const{selection:e}=t.state;if(!Cte(e))return!1;let n=0;const r=yv(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Dte=ot.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Ete,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let n=0,r=!0;try{t.content.firstChild.content.forEach(s=>{if(s.attrs.colwidth)s.attrs.colwidth.forEach(o=>{o?n+=o:(r=!1,n+=this.options.cellMinWidth)});else{r=!1;const o=s.attrs.colspan?s.attrs.colspan:1;n+=this.options.cellMinWidth*o}})}catch{r=!1}return r&&n>0?e.style=`width: ${n}px;`:n&&n>0?e.style=`min-width: ${n}px`:e.style=null,["div",{class:"table-wrapper"},["table",gt(this.options.HTMLAttributes,e),["tbody",0]]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const{selection:o}=r,a=Ste(s.schema,t,e,n);if(i){const l=r.selection.anchor+1;r.replaceRangeWith(o.from-1,o.to,a).scrollIntoView().setSelection(We.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Qee(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Jee(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Xee(t,e),addRowBefore:()=>({state:t,dispatch:e})=>ete(t,e),addRowAfter:()=>({state:t,dispatch:e})=>tte(t,e),deleteRow:()=>({state:t,dispatch:e})=>rte(t,e),deleteTable:()=>({state:t,dispatch:e})=>cte(t,e),mergeCells:()=>({state:t,dispatch:e})=>z4(t,e),splitCell:()=>({state:t,dispatch:e})=>$4(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>vp("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>vp("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>lte(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>z4(t,e)?!0:$4(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>ote(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>W4(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>W4(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&U4(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=xt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ky,"Mod-Backspace":Ky,Delete:Ky,"Mod-Delete":Ky}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[dte({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],xte({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:dt(je(t,"tableRole",e))}}});function X4(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Z4=typeof window<"u"&&typeof document<"u";function P2(t,e){t&&(typeof t=="function"&&t(e),{}.hasOwnProperty.call(t,"current")&&(t.current=e))}function e8(){return Z4&&document.createElement("div")}function Tte(t){var e={"data-placement":t.placement};return t.referenceHidden&&(e["data-reference-hidden"]=""),t.escaped&&(e["data-escaped"]=""),e}function t8(t,e){if(t===e)return!0;if(typeof t=="object"&&t!=null&&typeof e=="object"&&e!=null){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var n in t)if(e.hasOwnProperty(n)){if(!t8(t[n],e[n]))return!1}else return!1;return!0}else return!1}function Ote(t){var e=[];return t.forEach(function(n){e.find(function(r){return t8(n,r)})||e.push(n)}),e}function _te(t,e){var n,r;return Object.assign({},e,{popperOptions:Object.assign({},t.popperOptions,e.popperOptions,{modifiers:Ote([].concat(((n=t.popperOptions)==null?void 0:n.modifiers)||[],((r=e.popperOptions)==null?void 0:r.modifiers)||[]))})})}var I2=Z4?_.useLayoutEffect:_.useEffect;function Mte(t){var e=_.useRef();return e.current||(e.current=typeof t=="function"?t():t),e.current}function n8(t,e,n){n.split(/\s+/).forEach(function(r){r&&t.classList[e](r)})}var Nte={name:"className",defaultValue:"",fn:function(e){var n=e.popper.firstElementChild,r=function(){var a;return!!((a=e.props.render)!=null&&a.$$tippy)};function i(){if(e.props.className&&!r()){process.env.NODE_ENV!=="production"&&console.warn(["@tippyjs/react: Cannot use `className` prop in conjunction with","`render` prop. Place the className on the element you are","rendering."].join(" "));return}n8(n,"add",e.props.className)}function s(){r()&&n8(n,"remove",e.props.className)}return{onCreate:i,onBeforeUpdate:s,onAfterUpdate:i}}};function Pte(t){function e(n){var r=n.children,i=n.content,s=n.visible,o=n.singleton,a=n.render,l=n.reference,u=n.disabled,c=u===void 0?!1:u,f=n.ignoreAttributes,d=f===void 0?!0:f;n.__source,n.__self;var h=X4(n,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"]),p=s!==void 0,m=o!==void 0,g=_.useState(!1),y=g[0],v=g[1],w=_.useState({}),b=w[0],E=w[1],x=_.useState(),O=x[0],S=x[1],D=Mte(function(){return{container:e8(),renders:1}}),I=Object.assign({ignoreAttributes:d},h,{content:D.container});p&&(process.env.NODE_ENV!=="production"&&["trigger","hideOnClick","showOnCreate"].forEach(function(B){I[B]!==void 0&&console.warn(["@tippyjs/react: Cannot specify `"+B+"` prop in","controlled mode (`visible` prop)"].join(" "))}),I.trigger="manual",I.hideOnClick=!1),m&&(c=!0);var F=I,Q=I.plugins||[];a&&(F=Object.assign({},I,{plugins:m&&o.data!=null?[].concat(Q,[{fn:function(){return{onTrigger:function(H,K){var J=o.data.children.find(function(X){var ie=X.instance;return ie.reference===K.currentTarget});H.state.$$activeSingletonInstance=J.instance,S(J.content)}}}}]):Q,render:function(){return{popper:D.container}}}));var V=[l].concat(r?[r.type]:[]);return I2(function(){var B=l;l&&l.hasOwnProperty("current")&&(B=l.current);var N=t(B||D.ref||e8(),Object.assign({},F,{plugins:[Nte].concat(I.plugins||[])}));return D.instance=N,c&&N.disable(),s&&N.show(),m&&o.hook({instance:N,content:i,props:F,setSingletonContent:S}),v(!0),function(){N.destroy(),o==null||o.cleanup(N)}},V),I2(function(){var B;if(D.renders===1){D.renders++;return}var N=D.instance;N.setProps(_te(N.props,F)),(B=N.popperInstance)==null||B.forceUpdate(),c?N.disable():N.enable(),p&&(s?N.show():N.hide()),m&&o.hook({instance:N,content:i,props:F,setSingletonContent:S})}),I2(function(){var B;if(a){var N=D.instance;N.setProps({popperOptions:Object.assign({},N.props.popperOptions,{modifiers:[].concat((((B=N.props.popperOptions)==null?void 0:B.modifiers)||[]).filter(function(H){var K=H.name;return K!=="$$tippyReact"}),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(K){var J,X=K.state,ie=(J=X.modifiersData)==null?void 0:J.hide;(b.placement!==X.placement||b.referenceHidden!==(ie==null?void 0:ie.isReferenceHidden)||b.escaped!==(ie==null?void 0:ie.hasPopperEscaped))&&E({placement:X.placement,referenceHidden:ie==null?void 0:ie.isReferenceHidden,escaped:ie==null?void 0:ie.hasPopperEscaped}),X.attributes.popper={}}}])})})}},[b.placement,b.referenceHidden,b.escaped].concat(V)),_.createElement(_.Fragment,null,r?_.cloneElement(r,{ref:function(N){D.ref=N,P2(r.ref,N)}}):null,y&&Zt.createPortal(a?a(Tte(b),O,D.instance):i,D.container))}return e}var Ite=function(t,e){return _.forwardRef(function(r,i){var s=r.children,o=X4(r,["children"]);return _.createElement(t,Object.assign({},e,o),s?_.cloneElement(s,{ref:function(l){P2(i,l),P2(s.ref,l)}}):null)})},Rte=Ite(Pte(zl));const Lte=[{name:"Add row above",action:t=>t.chain().focus().addRowBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7h2v-2h4v2h2v-2h4v2h2v-2h4v2h2v-7M4 14h4v3H4v-3m6 0h4v3h-4v-3m10 0v3h-4v-3h4m-9-4h2V7h3V5h-3V2h-2v3H8v2h3v3Z"})})},{name:"Add row below",action:t=>t.chain().focus().addRowAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3h2v2h4V3h2v2h4V3h2v2h4V3h2v7M4 10h4V7H4v3m6 0h4V7h-4v3m10 0V7h-4v3h4m-9 4h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z"})})},{name:"Add left column",action:t=>t.chain().focus().addColumnBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M13 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9V2h-9m7 8v4h-7v-4h7m0 6v4h-7v-4h7m0-12v4h-7V4h7M9 11H6V8H4v3H1v2h3v3h2v-3h3v-2Z"})})},{name:"Add right column",action:t=>t.chain().focus().addColumnAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M11 2a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2V2h9m-7 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m11 7h3V8h2v3h3v2h-3v3h-2v-3h-3v-2Z"})})},{name:"Remove row",action:t=>t.chain().focus().deleteRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41L9.41 13M22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3M4 9h4V6H4v3m6 0h4V6h-4v3m6 0h4V6h-4v3Z"})})},{name:"Remove column",action:t=>t.chain().focus().deleteColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59L17.59 12Z"})})},{name:"Toggle header row",action:t=>t.chain().focus().toggleHeaderRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4Z"})})},{name:"Toggle header column",action:t=>t.chain().focus().toggleHeaderColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M8 2h8a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8Z"})})},{name:"Toggle header cell",action:t=>t.chain().focus().toggleHeaderCell().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M21 19a1 1 0 0 1-1 1h-1v-2h2v1m-6 1v-2h2v2h-2m-4 0v-2h2v2h-2m-4 0v-2h2v2H7m-3 0a1 1 0 0 1-1-1v-1h2v2H4M19 4H5a2 2 0 0 0-2 2v2h18V6c0-1.11-.89-2-2-2M5 14H3v2h2v-2m0-4H3v2h2v-2m16 0h-2v2h2v-2m0 4h-2v2h2v-2m-10 2v-2h2v2h-2m0-4v-2h2v2h-2"})})},{name:"Remove table",action:t=>t.chain().focus().deleteTable().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M12.35 20H10v-3h2.09c.12-.72.37-1.39.72-2H10v-3h4v1.54c.58-.54 1.25-.93 2-1.19V12h4v.35c.75.26 1.42.65 2 1.19V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h9.54c-.54-.58-.93-1.25-1.19-2M16 7h4v3h-4V7m-6 0h4v3h-4V7M8 20H4v-3h4v3m0-5H4v-3h4v3m0-5H4V7h4v3m6.46 5.88l1.42-1.42L18 16.59l2.12-2.13l1.42 1.42L19.41 18l2.13 2.12l-1.42 1.42L18 19.41l-2.12 2.13l-1.42-1.42L16.59 18l-2.13-2.12"})})}],r8=({node:t,getPos:e,selected:n,editor:r})=>{const[i,s]=_.useState(!1),o=wg(),a=_.useRef(null),l=()=>{const{from:c,to:f}=r.state.selection,d=e(),h=d+t.nodeSize;s(d<=c&&f<=h)};_.useEffect(()=>(r.on("selectionUpdate",l),setTimeout(l,100),()=>{r.off("selectionUpdate",l)}));const u=()=>{var d,h;let c=(d=a.current)==null?void 0:d.clientTop;c&&(c+=5);let f=(h=a.current)==null?void 0:h.clientLeft;return f&&(f+=5),{top:`${c}px`,left:`${f}px`}};return k.jsxs(_h,{className:"group",children:[k.jsx(DO,{as:"span"}),(i||n)&&k.jsx(Rte,{appendTo:document.body,trigger:"click",interactive:!0,animation:"shift-toward-subtle",placement:"bottom-start",content:k.jsx("article",{className:"w-screen lg:w-full",contentEditable:!1,children:k.jsx("ul",{tabIndex:0,className:"static top-8 right-1/2 translate-x-1/2 lg:-translate-x-full menu menu-compact p-2 shadow bg-base-100 rounded-lg w-56",style:u(),children:Lte.map(c=>k.jsx("li",{children:k.jsx(ba,{variant:"ghost",className:"!items-center w-full !justify-start !font-[400]",onClick:()=>c.action(r),children:k.jsx("span",{children:c.name})})},c.name))})}),children:k.jsx("label",{tabIndex:0,className:Ne("trigger-button",{hidden:o}),contentEditable:!1,children:k.jsx(Z$,{size:20})})})]})},Bte=ot.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",gt(this.options.HTMLAttributes,t),0]},addNodeView(){return $l(r8,{as:"td",className:"relative"})}}),Fte=ot.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",gt(this.options.HTMLAttributes,t),0]},addNodeView(){return $l(r8,{as:"th",className:"relative"})}}),i8=t=>(t.stopPropagation(),t.preventDefault(),t),Ute=function(t){const e=t.scrollHeight>t.clientHeight,r=window.getComputedStyle(t).overflowY.indexOf("hidden")!==-1;return e&&!r},s8=function(t){return!t||t===document.body?document.body:Ute(t)?t:s8(t.parentNode)},R2=(t,e,n)=>{const r=document.createElement(t);if(!r)throw new Error(`Element with name ${t} can't be created.`);return e&&Object.entries(e).forEach(([i,s])=>r.setAttribute(i,s)),n&&Object.entries(n).forEach(([i,s])=>r.addEventListener(i,s)),r},jte=ot.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",gt(this.options.HTMLAttributes,t),0]},addNodeView(){return({editor:t,HTMLAttributes:e,getPos:n})=>{const r=()=>n(),i=s8(t.options.element);let s=!1;const o={deleteRow:()=>{this.editor.chain().deleteNode("tableRow").focus().run()},selectRow:()=>{const y=r(),v=t.state.doc.resolve(y),w=new ze(v);t.view.dispatch(t.state.tr.setSelection(w))}},a=()=>{s=!0},l=()=>{s=!1},u=R2("section",{class:"absolute hidden flex items-center w-2 bg-gray-200 z-50 cursor-pointer border-1 border-indigo-600 rounded-l opacity-25 hover:opacity-100",contenteditable:"false"},{click:y=>{y&&i8(y),o.selectRow()},mouseenter:()=>{a()},mouseover:()=>{a()},mouseleave:()=>{l(),d()}}),c=R2("button",{class:"text-sm px-1 absolute -translate-x-[125%] hover:active:-translate-x-[125%] mr-2"},{click:y=>{y&&i8(y),o.deleteRow()}}),f=()=>{m(),u.classList.remove("hidden")},d=()=>{setTimeout(()=>{s||u.classList.add("hidden")},100)},h=R2("tr",{...e},{mouseenter:f,mouseover:f,mouseleave:d});u.append(c),document.body.append(u);let p="";const m=()=>{setTimeout(()=>{const y=h.getBoundingClientRect(),v=JSON.stringify(y);p!==v&&(u.style.top=`${y.top+document.documentElement.scrollTop}px`,u.style.left=`${y.x+document.documentElement.scrollLeft-8}px`,u.style.height=`${y.height+1}px`,p=v)})};return setTimeout(()=>{m()},100),t.on("selectionUpdate",m),t.on("update",m),i==null||i.addEventListener("scroll",m),document.addEventListener("scroll",m),{dom:h,contentDOM:h,destroy:()=>{u.remove(),t.off("selectionUpdate",m),t.off("update",m),i==null||i.removeEventListener("scroll",m),document.removeEventListener("scroll",m)}}}}}),Hte=[Dte.configure({resizable:!0}),Bte,Fte,jte],Vte=fN.extend({content:"(dBlock|columns)+"});function o8({types:t,node:e}){return e!=null&&e.type?Array.isArray(t)&&t.includes(e.type)||e.type===t:!1}const zte=It.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const t=new en(this.name),e=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>this.options.notAfter.includes(n.name));return[new Ut({key:t,appendTransaction:(n,r,i)=>{const{doc:s,tr:o,schema:a}=i,l=t.getState(i),u=s.content.size,c=a.nodes[this.options.node];if(l)return o.insert(u,c.create())},state:{init:(n,r)=>{const i=r.tr.doc.lastChild;return!o8({node:i,types:e})},apply:(n,r)=>{var s,o,a;if(!n.docChanged)return r;const i=(a=(o=(s=n.doc.lastChild)==null?void 0:s.content)==null?void 0:o.content)==null?void 0:a[0];return!o8({node:i,types:e})}}})]}}),$te=({node:t,editor:e,getPos:n})=>{const[r,i]=_.useState(""),s=wg(),o=["https://twitter.com","https://x.com"],a=()=>{switch(t.attrs.data){case"twitter":return k.jsx(LO,{size:20});case"iframe":return k.jsx(BO,{size:20});default:return k.jsx(cG,{size:20})}},l=()=>{switch(t.attrs.data){case"twitter":return"Embed a Twitter tweet";case"iframe":return"Embed a video";default:return"Embed an URL"}},u=()=>{if(!r){alert("Please enter a url");return}let p=r;if(r.includes("<iframe")){const w=r.match(/src="([^"]*)"/);w&&w.length>0&&(p=w[1])}else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(r):{const w=r.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);w&&w.length>0&&(p=`https://www.youtube.com/embed/${w[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(r):{const w=r.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);w&&w.length>0&&(p=`https://player.vimeo.com/video/${w[1]}`);break}default:{alert("Please enter a valid url");return}}const m=640,g=360,y=n(),v=y+t.nodeSize;p&&(e==null||e.chain().focus(y).deleteRange({from:y,to:v}).setIframe({src:p,width:m,height:g}).run())},c=()=>{if(!r){alert("Please enter a url");return}let p=r;const m=o.some(b=>r.includes(b)),g=r.match(/\/status\/([0-9]*)/),y=g&&g.length>0;if(m&&y)p=g[1];else{alert("invalid url");return}const v=n(),w=v+t.nodeSize;p&&(e==null||e.chain().focus(v).deleteRange({from:v,to:w}).setTweetEmbed({tweetId:p}).run())},d=$N(()=>{switch(t.attrs.data){case"twitter":c();break;default:u();break}},500);_.useEffect(()=>{const p=m=>{if(m.key==="Backspace"&&r===""){const g=n(),y=g+t.nodeSize;(t.content.size===0||t.textContent==="")&&(e==null||e.chain().focus(g).deleteRange({from:g,to:y}).run(),m.preventDefault())}};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[r,e,n,t]),_.useEffect(()=>{r&&d()},[r]),_.useEffect(()=>{e==null||e.chain().focus()},[]);const h=_.useRef(null);return _.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]),k.jsx(_h,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:!s&&k.jsxs("div",{className:"relative w-full",children:[k.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[#A1AAB1]",children:a()}),k.jsx("input",{ref:h,value:r,placeholder:l(),onChange:p=>i(p.target.value),onClick:p=>p.stopPropagation(),className:"rounded bg-[#f2f2f2] p-3 pl-10 w-full cursor-pointer transition-all ease-in-out text-sm"})]})})},Gte=ot.create({name:"actionButton",group:"block",content:"block*",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{data:{default:null}}},addNodeView(){return $l($te)},parseHTML(){return[{tag:"div[data-action-node]"}]},renderHTML({HTMLAttributes:t}){return["div",gt(t,{"data-action-node":""}),0]},addCommands(){return{setActionButton:t=>({commands:e})=>e.insertContent({type:this.name,attrs:{data:t},content:[]})}}}),a8={};function Wte(t){let e=a8[t];if(e)return e;e=a8[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return e}function df(t,e){typeof e!="string"&&(e=df.defaultChars);const n=Wte(e);return t.replace(/(%[a-f0-9]{2})+/gi,function(r){let i="";for(let s=0,o=r.length;s<o;s+=3){const a=parseInt(r.slice(s+1,s+3),16);if(a<128){i+=n[a];continue}if((a&224)===192&&s+3<o){const l=parseInt(r.slice(s+4,s+6),16);if((l&192)===128){const u=a<<6&1984|l&63;u<128?i+="��":i+=String.fromCharCode(u),s+=3;continue}}if((a&240)===224&&s+6<o){const l=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16);if((l&192)===128&&(u&192)===128){const c=a<<12&61440|l<<6&4032|u&63;c<2048||c>=55296&&c<=57343?i+="���":i+=String.fromCharCode(c),s+=6;continue}}if((a&248)===240&&s+9<o){const l=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16),c=parseInt(r.slice(s+10,s+12),16);if((l&192)===128&&(u&192)===128&&(c&192)===128){let f=a<<18&1835008|l<<12&258048|u<<6&4032|c&63;f<65536||f>1114111?i+="����":(f-=65536,i+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),s+=9;continue}}i+="�"}return i})}df.defaultChars=";/?:@&=+$,#",df.componentChars="";const l8={};function Kte(t){let e=l8[t];if(e)return e;e=l8[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=t[n];return e}function xp(t,e,n){typeof e!="string"&&(n=e,e=xp.defaultChars),typeof n>"u"&&(n=!0);const r=Kte(e);let i="";for(let s=0,o=t.length;s<o;s++){const a=t.charCodeAt(s);if(n&&a===37&&s+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(s+1,s+3))){i+=t.slice(s,s+3),s+=2;continue}if(a<128){i+=r[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&s+1<o){const l=t.charCodeAt(s+1);if(l>=56320&&l<=57343){i+=encodeURIComponent(t[s]+t[s+1]),s++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(t[s])}return i}xp.defaultChars=";/?:@&=+$,-_.!~*'()#",xp.componentChars="-_.!~*'()";function L2(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function qy(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const qte=/^([a-z0-9.+-]+:)/i,Qte=/:[0-9]*$/,Jte=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Yte=["<",">",'"',"`"," ","\r",`
484
- `," "],Xte=["{","}","|","\\","^","`"].concat(Yte),Zte=["'"].concat(Xte),u8=["%","/","?",";","#"].concat(Zte),c8=["/","?","#"],ene=255,f8=/^[+a-z0-9A-Z_-]{0,63}$/,tne=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d8={javascript:!0,"javascript:":!0},h8={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function B2(t,e){if(t&&t instanceof qy)return t;const n=new qy;return n.parse(t,e),n}qy.prototype.parse=function(t,e){let n,r,i,s=t;if(s=s.trim(),!e&&t.split("#").length===1){const u=Jte.exec(s);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let o=qte.exec(s);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,s=s.substr(o.length)),(e||o||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=s.substr(0,2)==="//",i&&!(o&&d8[o])&&(s=s.substr(2),this.slashes=!0)),!d8[o]&&(i||o&&!h8[o])){let u=-1;for(let p=0;p<c8.length;p++)r=s.indexOf(c8[p]),r!==-1&&(u===-1||r<u)&&(u=r);let c,f;u===-1?f=s.lastIndexOf("@"):f=s.lastIndexOf("@",u),f!==-1&&(c=s.slice(0,f),s=s.slice(f+1),this.auth=c),u=-1;for(let p=0;p<u8.length;p++)r=s.indexOf(u8[p]),r!==-1&&(u===-1||r<u)&&(u=r);u===-1&&(u=s.length),s[u-1]===":"&&u--;const d=s.slice(0,u);s=s.slice(u),this.parseHost(d),this.hostname=this.hostname||"";const h=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!h){const p=this.hostname.split(/\./);for(let m=0,g=p.length;m<g;m++){const y=p[m];if(y&&!y.match(f8)){let v="";for(let w=0,b=y.length;w<b;w++)y.charCodeAt(w)>127?v+="x":v+=y[w];if(!v.match(f8)){const w=p.slice(0,m),b=p.slice(m+1),E=y.match(tne);E&&(w.push(E[1]),b.unshift(E[2])),b.length&&(s=b.join(".")+s),this.hostname=w.join(".");break}}}}this.hostname.length>ene&&(this.hostname=""),h&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const l=s.indexOf("?");return l!==-1&&(this.search=s.substr(l),s=s.slice(0,l)),s&&(this.pathname=s),h8[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this},qy.prototype.parseHost=function(t){let e=Qte.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const nne=Object.freeze(Object.defineProperty({__proto__:null,decode:df,encode:xp,format:L2,parse:B2},Symbol.toStringTag,{value:"Module"})),p8=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m8=/[\0-\x1F\x7F-\x9F]/,rne=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,F2=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,g8=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,y8=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,ine=Object.freeze(Object.defineProperty({__proto__:null,Any:p8,Cc:m8,Cf:rne,P:F2,S:g8,Z:y8},Symbol.toStringTag,{value:"Module"})),sne=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),one=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var U2;const ane=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),lne=(U2=String.fromCodePoint)!==null&&U2!==void 0?U2:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function une(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=ane.get(t))!==null&&e!==void 0?e:t}var Kn;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Kn||(Kn={}));const cne=32;var Ia;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Ia||(Ia={}));function j2(t){return t>=Kn.ZERO&&t<=Kn.NINE}function fne(t){return t>=Kn.UPPER_A&&t<=Kn.UPPER_F||t>=Kn.LOWER_A&&t<=Kn.LOWER_F}function dne(t){return t>=Kn.UPPER_A&&t<=Kn.UPPER_Z||t>=Kn.LOWER_A&&t<=Kn.LOWER_Z||j2(t)}function hne(t){return t===Kn.EQUALS||dne(t)}var qn;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(qn||(qn={}));var Ra;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Ra||(Ra={}));class pne{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=qn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ra.Strict}startEntity(e){this.decodeMode=e,this.state=qn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case qn.EntityStart:return e.charCodeAt(n)===Kn.NUM?(this.state=qn.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=qn.NamedEntity,this.stateNamedEntity(e,n));case qn.NumericStart:return this.stateNumericStart(e,n);case qn.NumericDecimal:return this.stateNumericDecimal(e,n);case qn.NumericHex:return this.stateNumericHex(e,n);case qn.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|cne)===Kn.LOWER_X?(this.state=qn.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=qn.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(j2(i)||fne(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(j2(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Kn.SEMI)this.consumed+=1;else if(this.decodeMode===Ra.Strict)return 0;return this.emitCodePoint(une(this.result),this.consumed),this.errors&&(e!==Kn.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&Ia.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=mne(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===Ra.Attribute&&(s===0||hne(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&Ia.VALUE_LENGTH)>>14,s!==0){if(o===Kn.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Ra.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&Ia.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~Ia.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case qn.NamedEntity:return this.result!==0&&(this.decodeMode!==Ra.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case qn.NumericDecimal:return this.emitNumericEntity(0,2);case qn.NumericHex:return this.emitNumericEntity(0,3);case qn.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case qn.EntityStart:return 0}}}function b8(t){let e="";const n=new pne(t,r=>e+=lne(r));return function(i,s){let o=0,a=0;for(;(a=i.indexOf("&",a))>=0;){e+=i.slice(o,a),n.startEntity(s);const u=n.write(i,a+1);if(u<0){o=a+n.end();break}o=a+u,a=u===0?o+1:o}const l=e+i.slice(o);return e="",l}}function mne(t,e,n,r){const i=(e&Ia.BRANCH_LENGTH)>>7,s=e&Ia.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:t[n+l]-1}let o=n,a=o+i-1;for(;o<=a;){const l=o+a>>>1,u=t[l];if(u<r)o=l+1;else if(u>r)a=l-1;else return t[l+i]}return-1}const gne=b8(sne);b8(one);function w8(t,e=Ra.Legacy){return gne(t,e)}function yne(t){return Object.prototype.toString.call(t)}function H2(t){return yne(t)==="[object String]"}const bne=Object.prototype.hasOwnProperty;function wne(t,e){return bne.call(t,e)}function Qy(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function v8(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function V2(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function Jy(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const A8=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,vne=/&([a-z#][a-z0-9]{1,31});/gi,Ane=new RegExp(A8.source+"|"+vne.source,"gi"),xne=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Ene(t,e){if(e.charCodeAt(0)===35&&xne.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return V2(r)?Jy(r):t}const n=w8(t);return n!==t?n:t}function kne(t){return t.indexOf("\\")<0?t:t.replace(A8,"$1")}function hf(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(Ane,function(e,n,r){return n||Ene(e,r)})}const Sne=/[&<>"]/,Cne=/[&<>"]/g,Dne={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function Tne(t){return Dne[t]}function La(t){return Sne.test(t)?t.replace(Cne,Tne):t}const One=/[.?*+^$[\]\\(){}|-]/g;function _ne(t){return t.replace(One,"\\$&")}function qt(t){switch(t){case 9:case 32:return!0}return!1}function Ep(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function kp(t){return F2.test(t)||g8.test(t)}function Sp(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Yy(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const Mne=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:v8,assign:Qy,escapeHtml:La,escapeRE:_ne,fromCodePoint:Jy,has:wne,isMdAsciiPunct:Sp,isPunctChar:kp,isSpace:qt,isString:H2,isValidEntityCode:V2,isWhiteSpace:Ep,lib:{mdurl:nne,ucmicro:ine},normalizeReference:Yy,unescapeAll:hf,unescapeMd:kne},Symbol.toStringTag,{value:"Module"}));function Nne(t,e,n){let r,i,s,o;const a=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos<a;){if(s=t.src.charCodeAt(t.pos),s===93&&(r--,r===0)){i=!0;break}if(o=t.pos,t.md.inline.skipToken(t),s===91){if(o===t.pos-1)r++;else if(n)return t.pos=l,-1}}let u=-1;return i&&(u=t.pos),t.pos=l,u}function Pne(t,e,n){let r,i=e;const s={ok:!1,pos:0,str:""};if(t.charCodeAt(i)===60){for(i++;i<n;){if(r=t.charCodeAt(i),r===10||r===60)return s;if(r===62)return s.pos=i+1,s.str=hf(t.slice(e+1,i)),s.ok=!0,s;if(r===92&&i+1<n){i+=2;continue}i++}return s}let o=0;for(;i<n&&(r=t.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(t.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return s;if(r===41){if(o===0)break;o--}i++}return e===i||o!==0||(s.str=hf(t.slice(e,i)),s.pos=i,s.ok=!0),s}function Ine(t,e,n,r){let i,s=e;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(s>=n)return o;let a=t.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return o;e++,s++,a===40&&(a=41),o.marker=a}for(;s<n;){if(i=t.charCodeAt(s),i===o.marker)return o.pos=s+1,o.str+=hf(t.slice(e,s)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&s+1<n&&s++,s++}return o.can_continue=!0,o.str+=hf(t.slice(e,s)),o}const Rne=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:Pne,parseLinkLabel:Nne,parseLinkTitle:Ine},Symbol.toStringTag,{value:"Module"})),Hs={};Hs.code_inline=function(t,e,n,r,i){const s=t[e];return"<code"+i.renderAttrs(s)+">"+La(s.content)+"</code>"},Hs.code_block=function(t,e,n,r,i){const s=t[e];return"<pre"+i.renderAttrs(s)+"><code>"+La(t[e].content)+`</code></pre>
485
- `},Hs.fence=function(t,e,n,r,i){const s=t[e],o=s.info?hf(s.info).trim():"";let a="",l="";if(o){const c=o.split(/(\s+)/g);a=c[0],l=c.slice(2).join("")}let u;if(n.highlight?u=n.highlight(s.content,a,l)||La(s.content):u=La(s.content),u.indexOf("<pre")===0)return u+`
486
- `;if(o){const c=s.attrIndex("class"),f=s.attrs?s.attrs.slice():[];c<0?f.push(["class",n.langPrefix+a]):(f[c]=f[c].slice(),f[c][1]+=" "+n.langPrefix+a);const d={attrs:f};return`<pre><code${i.renderAttrs(d)}>${u}</code></pre>
487
- `}return`<pre><code${i.renderAttrs(s)}>${u}</code></pre>
488
- `},Hs.image=function(t,e,n,r,i){const s=t[e];return s.attrs[s.attrIndex("alt")][1]=i.renderInlineAsText(s.children,n,r),i.renderToken(t,e,n)},Hs.hardbreak=function(t,e,n){return n.xhtmlOut?`<br />
489
- `:`<br>
490
- `},Hs.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`<br />
491
- `:`<br>
492
- `:`
493
- `},Hs.text=function(t,e){return La(t[e].content)},Hs.html_block=function(t,e){return t[e].content},Hs.html_inline=function(t,e){return t[e].content};function pf(){this.rules=Qy({},Hs)}pf.prototype.renderAttrs=function(e){let n,r,i;if(!e.attrs)return"";for(i="",n=0,r=e.attrs.length;n<r;n++)i+=" "+La(e.attrs[n][0])+'="'+La(e.attrs[n][1])+'"';return i},pf.prototype.renderToken=function(e,n,r){const i=e[n];let s="";if(i.hidden)return"";i.block&&i.nesting!==-1&&n&&e[n-1].hidden&&(s+=`
494
- `),s+=(i.nesting===-1?"</":"<")+i.tag,s+=this.renderAttrs(i),i.nesting===0&&r.xhtmlOut&&(s+=" /");let o=!1;if(i.block&&(o=!0,i.nesting===1&&n+1<e.length)){const a=e[n+1];(a.type==="inline"||a.hidden||a.nesting===-1&&a.tag===i.tag)&&(o=!1)}return s+=o?`>
495
- `:">",s},pf.prototype.renderInline=function(t,e,n){let r="";const i=this.rules;for(let s=0,o=t.length;s<o;s++){const a=t[s].type;typeof i[a]<"u"?r+=i[a](t,s,e,n,this):r+=this.renderToken(t,s,e)}return r},pf.prototype.renderInlineAsText=function(t,e,n){let r="";for(let i=0,s=t.length;i<s;i++)switch(t[i].type){case"text":r+=t[i].content;break;case"image":r+=this.renderInlineAsText(t[i].children,e,n);break;case"html_inline":case"html_block":r+=t[i].content;break;case"softbreak":case"hardbreak":r+=`
496
- `;break}return r},pf.prototype.render=function(t,e,n){let r="";const i=this.rules;for(let s=0,o=t.length;s<o;s++){const a=t[s].type;a==="inline"?r+=this.renderInline(t[s].children,e,n):typeof i[a]<"u"?r+=i[a](t,s,e,n,this):r+=this.renderToken(t,s,e,n)}return r};function Qr(){this.__rules__=[],this.__cache__=null}Qr.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1},Qr.prototype.__compile__=function(){const t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(r){r.enabled&&(n&&r.alt.indexOf(n)<0||t.__cache__[n].push(r.fn))})})},Qr.prototype.at=function(t,e,n){const r=this.__find__(t),i=n||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=i.alt||[],this.__cache__=null},Qr.prototype.before=function(t,e,n,r){const i=this.__find__(t),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i,0,{name:e,enabled:!0,fn:n,alt:s.alt||[]}),this.__cache__=null},Qr.prototype.after=function(t,e,n,r){const i=this.__find__(t),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i+1,0,{name:e,enabled:!0,fn:n,alt:s.alt||[]}),this.__cache__=null},Qr.prototype.push=function(t,e,n){const r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null},Qr.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!0,n.push(r)},this),this.__cache__=null,n},Qr.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)},Qr.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!1,n.push(r)},this),this.__cache__=null,n},Qr.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function is(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}is.prototype.attrIndex=function(e){if(!this.attrs)return-1;const n=this.attrs;for(let r=0,i=n.length;r<i;r++)if(n[r][0]===e)return r;return-1},is.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},is.prototype.attrSet=function(e,n){const r=this.attrIndex(e),i=[e,n];r<0?this.attrPush(i):this.attrs[r]=i},is.prototype.attrGet=function(e){const n=this.attrIndex(e);let r=null;return n>=0&&(r=this.attrs[n][1]),r},is.prototype.attrJoin=function(e,n){const r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function x8(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}x8.prototype.Token=is;const Lne=/\r\n?|\n/g,Bne=/\0/g;function Fne(t){let e;e=t.src.replace(Lne,`
497
- `),e=e.replace(Bne,"�"),t.src=e}function Une(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function jne(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const i=e[n];i.type==="inline"&&t.md.inline.parse(i.content,t.md,t.env,i.children)}}function Hne(t){return/^<a[>\s]/i.test(t)}function Vne(t){return/^<\/a\s*>/i.test(t)}function zne(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if(e[n].type!=="inline"||!t.md.linkify.pretest(e[n].content))continue;let i=e[n].children,s=0;for(let o=i.length-1;o>=0;o--){const a=i[o];if(a.type==="link_close"){for(o--;i[o].level!==a.level&&i[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(Hne(a.content)&&s>0&&s--,Vne(a.content)&&s++),!(s>0)&&a.type==="text"&&t.md.linkify.test(a.content)){const l=a.content;let u=t.md.linkify.match(l);const c=[];let f=a.level,d=0;u.length>0&&u[0].index===0&&o>0&&i[o-1].type==="text_special"&&(u=u.slice(1));for(let h=0;h<u.length;h++){const p=u[h].url,m=t.md.normalizeLink(p);if(!t.md.validateLink(m))continue;let g=u[h].text;u[h].schema?u[h].schema==="mailto:"&&!/^mailto:/i.test(g)?g=t.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=t.md.normalizeLinkText(g):g=t.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,"");const y=u[h].index;if(y>d){const E=new t.Token("text","",0);E.content=l.slice(d,y),E.level=f,c.push(E)}const v=new t.Token("link_open","a",1);v.attrs=[["href",m]],v.level=f++,v.markup="linkify",v.info="auto",c.push(v);const w=new t.Token("text","",0);w.content=g,w.level=f,c.push(w);const b=new t.Token("link_close","a",-1);b.level=--f,b.markup="linkify",b.info="auto",c.push(b),d=u[h].lastIndex}if(d<l.length){const h=new t.Token("text","",0);h.content=l.slice(d),h.level=f,c.push(h)}e[n].children=i=v8(i,o,c)}}}}const E8=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,$ne=/\((c|tm|r)\)/i,Gne=/\((c|tm|r)\)/ig,Wne={c:"©",r:"®",tm:"™"};function Kne(t,e){return Wne[e.toLowerCase()]}function qne(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(Gne,Kne)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function Qne(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&E8.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function Jne(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&($ne.test(t.tokens[e].content)&&qne(t.tokens[e].children),E8.test(t.tokens[e].content)&&Qne(t.tokens[e].children))}const Yne=/['"]/,k8=/['"]/g,S8="’";function Xy(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function Xne(t,e){let n;const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,s.type!=="text")continue;let a=s.content,l=0,u=a.length;e:for(;l<u;){k8.lastIndex=l;const c=k8.exec(a);if(!c)break;let f=!0,d=!0;l=c.index+1;const h=c[0]==="'";let p=32;if(c.index-1>=0)p=a.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){p=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(l<u)m=a.charCodeAt(l);else for(n=i+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){m=t[n].content.charCodeAt(0);break}const g=Sp(p)||kp(String.fromCharCode(p)),y=Sp(m)||kp(String.fromCharCode(m)),v=Ep(p),w=Ep(m);if(w?f=!1:y&&(v||g||(f=!1)),v?d=!1:g&&(w||y||(d=!1)),m===34&&c[0]==='"'&&p>=48&&p<=57&&(d=f=!1),f&&d&&(f=g,d=y),!f&&!d){h&&(s.content=Xy(s.content,c.index,S8));continue}if(d)for(n=r.length-1;n>=0;n--){let b=r[n];if(r[n].level<o)break;if(b.single===h&&r[n].level===o){b=r[n];let E,x;h?(E=e.md.options.quotes[2],x=e.md.options.quotes[3]):(E=e.md.options.quotes[0],x=e.md.options.quotes[1]),s.content=Xy(s.content,c.index,x),t[b.token].content=Xy(t[b.token].content,b.pos,E),l+=x.length-1,b.token===i&&(l+=E.length-1),a=s.content,u=a.length,r.length=n;continue e}}f?r.push({token:i,pos:c.index,single:h,level:o}):d&&h&&(s.content=Xy(s.content,c.index,S8))}}}function Zne(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!Yne.test(t.tokens[e].content)||Xne(t.tokens[e].children,t)}function ere(t){let e,n;const r=t.tokens,i=r.length;for(let s=0;s<i;s++){if(r[s].type!=="inline")continue;const o=r[s].children,a=o.length;for(e=0;e<a;e++)o[e].type==="text_special"&&(o[e].type="text");for(e=n=0;e<a;e++)o[e].type==="text"&&e+1<a&&o[e+1].type==="text"?o[e+1].content=o[e].content+o[e+1].content:(e!==n&&(o[n]=o[e]),n++);e!==n&&(o.length=n)}}const z2=[["normalize",Fne],["block",Une],["inline",jne],["linkify",zne],["replacements",Jne],["smartquotes",Zne],["text_join",ere]];function $2(){this.ruler=new Qr;for(let t=0;t<z2.length;t++)this.ruler.push(z2[t][0],z2[t][1])}$2.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)},$2.prototype.State=x8;function Vs(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const i=this.src;for(let s=0,o=0,a=0,l=0,u=i.length,c=!1;o<u;o++){const f=i.charCodeAt(o);if(!c)if(qt(f)){a++,f===9?l+=4-l%4:l++;continue}else c=!0;(f===10||o===u-1)&&(f!==10&&o++,this.bMarks.push(s),this.eMarks.push(o),this.tShift.push(a),this.sCount.push(l),this.bsCount.push(0),c=!1,a=0,l=0,s=o+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}Vs.prototype.push=function(t,e,n){const r=new is(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},Vs.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},Vs.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},Vs.prototype.skipSpaces=function(e){for(let n=this.src.length;e<n;e++){const r=this.src.charCodeAt(e);if(!qt(r))break}return e},Vs.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!qt(this.src.charCodeAt(--e)))return e+1;return e},Vs.prototype.skipChars=function(e,n){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e},Vs.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e},Vs.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const s=new Array(n-e);for(let o=0,a=e;a<n;a++,o++){let l=0;const u=this.bMarks[a];let c=u,f;for(a+1<n||i?f=this.eMarks[a]+1:f=this.eMarks[a];c<f&&l<r;){const d=this.src.charCodeAt(c);if(qt(d))d===9?l+=4-(l+this.bsCount[a])%4:l++;else if(c-u<this.tShift[a])l++;else break;c++}l>r?s[o]=new Array(l-r+1).join(" ")+this.src.slice(c,f):s[o]=this.src.slice(c,f)}return s.join("")},Vs.prototype.Token=is;const tre=65536;function G2(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function C8(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),s=!1,o=0,a="";for(;r<n;)i===124&&(s?(a+=t.substring(o,r-1),o=r):(e.push(a+t.substring(o,r)),a="",o=r+1)),s=i===92,r++,i=t.charCodeAt(r);return e.push(a+t.substring(o)),e}function nre(t,e,n,r){if(e+2>n)return!1;let i=e+1;if(t.sCount[i]<t.blkIndent||t.sCount[i]-t.blkIndent>=4)return!1;let s=t.bMarks[i]+t.tShift[i];if(s>=t.eMarks[i])return!1;const o=t.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=t.eMarks[i])return!1;const a=t.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!qt(a)||o===45&&qt(a))return!1;for(;s<t.eMarks[i];){const b=t.src.charCodeAt(s);if(b!==124&&b!==45&&b!==58&&!qt(b))return!1;s++}let l=G2(t,e+1),u=l.split("|");const c=[];for(let b=0;b<u.length;b++){const E=u[b].trim();if(!E){if(b===0||b===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(E))return!1;E.charCodeAt(E.length-1)===58?c.push(E.charCodeAt(0)===58?"center":"right"):E.charCodeAt(0)===58?c.push("left"):c.push("")}if(l=G2(t,e).trim(),l.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;u=C8(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const f=u.length;if(f===0||f!==c.length)return!1;if(r)return!0;const d=t.parentType;t.parentType="table";const h=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),m=[e,0];p.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const y=t.push("tr_open","tr",1);y.map=[e,e+1];for(let b=0;b<u.length;b++){const E=t.push("th_open","th",1);c[b]&&(E.attrs=[["style","text-align:"+c[b]]]);const x=t.push("inline","",0);x.content=u[b].trim(),x.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let v,w=0;for(i=e+2;i<n&&!(t.sCount[i]<t.blkIndent);i++){let b=!1;for(let x=0,O=h.length;x<O;x++)if(h[x](t,i,n,!0)){b=!0;break}if(b||(l=G2(t,i).trim(),!l)||t.sCount[i]-t.blkIndent>=4||(u=C8(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),w+=f-u.length,w>tre))break;if(i===e+2){const x=t.push("tbody_open","tbody",1);x.map=v=[e+2,0]}const E=t.push("tr_open","tr",1);E.map=[i,i+1];for(let x=0;x<f;x++){const O=t.push("td_open","td",1);c[x]&&(O.attrs=[["style","text-align:"+c[x]]]);const S=t.push("inline","",0);S.content=u[x]?u[x].trim():"",S.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return v&&(t.push("tbody_close","tbody",-1),v[1]=i),t.push("table_close","table",-1),m[1]=i,t.parentType=d,t.line=i,!0}function rre(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,i=r;for(;r<n;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,i=r;continue}break}t.line=i;const s=t.push("code_block","code",0);return s.content=t.getLines(e,i,4+t.blkIndent,!1)+`
498
- `,s.map=[e,t.line],!0}function ire(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>s)return!1;const o=t.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let a=i;i=t.skipChars(i,o);let l=i-a;if(l<3)return!1;const u=t.src.slice(a,i),c=t.src.slice(i,s);if(o===96&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let f=e,d=!1;for(;f++,!(f>=n||(i=a=t.bMarks[f]+t.tShift[f],s=t.eMarks[f],i<s&&t.sCount[f]<t.blkIndent));)if(t.src.charCodeAt(i)===o&&!(t.sCount[f]-t.blkIndent>=4)&&(i=t.skipChars(i,o),!(i-a<l)&&(i=t.skipSpaces(i),!(i<s)))){d=!0;break}l=t.sCount[e],t.line=f+(d?1:0);const h=t.push("fence","code",0);return h.info=c,h.content=t.getLines(e+1,f,l,!0),h.markup=u,h.map=[e,t.line],!0}function sre(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];const o=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const a=[],l=[],u=[],c=[],f=t.md.block.ruler.getRules("blockquote"),d=t.parentType;t.parentType="blockquote";let h=!1,p;for(p=e;p<n;p++){const w=t.sCount[p]<t.blkIndent;if(i=t.bMarks[p]+t.tShift[p],s=t.eMarks[p],i>=s)break;if(t.src.charCodeAt(i++)===62&&!w){let E=t.sCount[p]+1,x,O;t.src.charCodeAt(i)===32?(i++,E++,O=!1,x=!0):t.src.charCodeAt(i)===9?(x=!0,(t.bsCount[p]+E)%4===3?(i++,E++,O=!1):O=!0):x=!1;let S=E;for(a.push(t.bMarks[p]),t.bMarks[p]=i;i<s;){const D=t.src.charCodeAt(i);if(qt(D))D===9?S+=4-(S+t.bsCount[p]+(O?1:0))%4:S++;else break;i++}h=i>=s,l.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(x?1:0),u.push(t.sCount[p]),t.sCount[p]=S-E,c.push(t.tShift[p]),t.tShift[p]=i-t.bMarks[p];continue}if(h)break;let b=!1;for(let E=0,x=f.length;E<x;E++)if(f[E](t,p,n,!0)){b=!0;break}if(b){t.lineMax=p,t.blkIndent!==0&&(a.push(t.bMarks[p]),l.push(t.bsCount[p]),c.push(t.tShift[p]),u.push(t.sCount[p]),t.sCount[p]-=t.blkIndent);break}a.push(t.bMarks[p]),l.push(t.bsCount[p]),c.push(t.tShift[p]),u.push(t.sCount[p]),t.sCount[p]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const y=[e,0];g.map=y,t.md.block.tokenize(t,e,p);const v=t.push("blockquote_close","blockquote",-1);v.markup=">",t.lineMax=o,t.parentType=d,y[1]=t.line;for(let w=0;w<c.length;w++)t.bMarks[w+e]=a[w],t.tShift[w+e]=c[w],t.sCount[w+e]=u[w],t.bsCount[w+e]=l[w];return t.blkIndent=m,!0}function ore(t,e,n,r){const i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.bMarks[e]+t.tShift[e];const o=t.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;s<i;){const u=t.src.charCodeAt(s++);if(u!==o&&!qt(u))return!1;u===o&&a++}if(a<3)return!1;if(r)return!0;t.line=e+1;const l=t.push("hr","hr",0);return l.map=[e,t.line],l.markup=Array(a+1).join(String.fromCharCode(o)),!0}function D8(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(r++);if(i!==42&&i!==45&&i!==43)return-1;if(r<n){const s=t.src.charCodeAt(r);if(!qt(s))return-1}return r}function T8(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let i=n;if(i+1>=r)return-1;let s=t.src.charCodeAt(i++);if(s<48||s>57)return-1;for(;;){if(i>=r)return-1;if(s=t.src.charCodeAt(i++),s>=48&&s<=57){if(i-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return i<r&&(s=t.src.charCodeAt(i),!qt(s))?-1:i}function are(t,e){const n=t.level+2;for(let r=e+2,i=t.tokens.length-2;r<i;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function lre(t,e,n,r){let i,s,o,a,l=e,u=!0;if(t.sCount[l]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[l]>=t.blkIndent&&(c=!0);let f,d,h;if((h=T8(t,l))>=0){if(f=!0,o=t.bMarks[l]+t.tShift[l],d=Number(t.src.slice(o,h-1)),c&&d!==1)return!1}else if((h=D8(t,l))>=0)f=!1;else return!1;if(c&&t.skipSpaces(h)>=t.eMarks[l])return!1;if(r)return!0;const p=t.src.charCodeAt(h-1),m=t.tokens.length;f?(a=t.push("ordered_list_open","ol",1),d!==1&&(a.attrs=[["start",d]])):a=t.push("bullet_list_open","ul",1);const g=[l,0];a.map=g,a.markup=String.fromCharCode(p);let y=!1;const v=t.md.block.ruler.getRules("list"),w=t.parentType;for(t.parentType="list";l<n;){s=h,i=t.eMarks[l];const b=t.sCount[l]+h-(t.bMarks[l]+t.tShift[l]);let E=b;for(;s<i;){const N=t.src.charCodeAt(s);if(N===9)E+=4-(E+t.bsCount[l])%4;else if(N===32)E++;else break;s++}const x=s;let O;x>=i?O=1:O=E-b,O>4&&(O=1);const S=b+O;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const D=[l,0];a.map=D,f&&(a.info=t.src.slice(o,h-1));const I=t.tight,F=t.tShift[l],Q=t.sCount[l],V=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=S,t.tight=!0,t.tShift[l]=x-t.bMarks[l],t.sCount[l]=E,x>=i&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),(!t.tight||y)&&(u=!1),y=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=V,t.tShift[l]=F,t.sCount[l]=Q,t.tight=I,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),l=t.line,D[1]=l,l>=n||t.sCount[l]<t.blkIndent||t.sCount[l]-t.blkIndent>=4)break;let B=!1;for(let N=0,H=v.length;N<H;N++)if(v[N](t,l,n,!0)){B=!0;break}if(B)break;if(f){if(h=T8(t,l),h<0)break;o=t.bMarks[l]+t.tShift[l]}else if(h=D8(t,l),h<0)break;if(p!==t.src.charCodeAt(h-1))break}return f?a=t.push("ordered_list_close","ol",-1):a=t.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),g[1]=l,t.line=l,t.parentType=w,u&&are(t,m),!0}function ure(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],o=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==91)return!1;function a(v){const w=t.lineMax;if(v>=w||t.isEmpty(v))return null;let b=!1;if(t.sCount[v]-t.blkIndent>3&&(b=!0),t.sCount[v]<0&&(b=!0),!b){const O=t.md.block.ruler.getRules("reference"),S=t.parentType;t.parentType="reference";let D=!1;for(let I=0,F=O.length;I<F;I++)if(O[I](t,v,w,!0)){D=!0;break}if(t.parentType=S,D)return null}const E=t.bMarks[v]+t.tShift[v],x=t.eMarks[v];return t.src.slice(E,x+1)}let l=t.src.slice(i,s+1);s=l.length;let u=-1;for(i=1;i<s;i++){const v=l.charCodeAt(i);if(v===91)return!1;if(v===93){u=i;break}else if(v===10){const w=a(o);w!==null&&(l+=w,s=l.length,o++)}else if(v===92&&(i++,i<s&&l.charCodeAt(i)===10)){const w=a(o);w!==null&&(l+=w,s=l.length,o++)}}if(u<0||l.charCodeAt(u+1)!==58)return!1;for(i=u+2;i<s;i++){const v=l.charCodeAt(i);if(v===10){const w=a(o);w!==null&&(l+=w,s=l.length,o++)}else if(!qt(v))break}const c=t.md.helpers.parseLinkDestination(l,i,s);if(!c.ok)return!1;const f=t.md.normalizeLink(c.str);if(!t.md.validateLink(f))return!1;i=c.pos;const d=i,h=o,p=i;for(;i<s;i++){const v=l.charCodeAt(i);if(v===10){const w=a(o);w!==null&&(l+=w,s=l.length,o++)}else if(!qt(v))break}let m=t.md.helpers.parseLinkTitle(l,i,s);for(;m.can_continue;){const v=a(o);if(v===null)break;l+=v,i=s,s=l.length,o++,m=t.md.helpers.parseLinkTitle(l,i,s,m)}let g;for(i<s&&p!==i&&m.ok?(g=m.str,i=m.pos):(g="",i=d,o=h);i<s;){const v=l.charCodeAt(i);if(!qt(v))break;i++}if(i<s&&l.charCodeAt(i)!==10&&g)for(g="",i=d,o=h;i<s;){const v=l.charCodeAt(i);if(!qt(v))break;i++}if(i<s&&l.charCodeAt(i)!==10)return!1;const y=Yy(l.slice(1,u));return y?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[y]>"u"&&(t.env.references[y]={title:g,href:f}),t.line=o),!0):!1}const cre=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],fre="[a-zA-Z_:][a-zA-Z0-9:._-]*",dre="(?:"+"[^\"'=<>`\\x00-\\x20]+"+"|"+"'[^']*'"+"|"+'"[^"]*"'+")",O8="<[A-Za-z][A-Za-z0-9\\-]*"+("(?:\\s+"+fre+"(?:\\s*=\\s*"+dre+")?)")+"*\\s*\\/?>",_8="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",hre="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",pre="<[?][\\s\\S]*?[?]>",mre="<![A-Za-z][^>]*>",gre="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",yre=new RegExp("^(?:"+O8+"|"+_8+"|"+hre+"|"+pre+"|"+mre+"|"+gre+")"),bre=new RegExp("^(?:"+O8+"|"+_8+")"),mf=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+cre.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(bre.source+"\\s*$"),/^$/,!1]];function wre(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let o=t.src.slice(i,s),a=0;for(;a<mf.length&&!mf[a][0].test(o);a++);if(a===mf.length)return!1;if(r)return mf[a][2];let l=e+1;if(!mf[a][1].test(o)){for(;l<n&&!(t.sCount[l]<t.blkIndent);l++)if(i=t.bMarks[l]+t.tShift[l],s=t.eMarks[l],o=t.src.slice(i,s),mf[a][1].test(o)){o.length!==0&&l++;break}}t.line=l;const u=t.push("html_block","",0);return u.map=[e,l],u.content=t.getLines(e,l,t.blkIndent,!0),!0}function vre(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.src.charCodeAt(i);if(o!==35||i>=s)return!1;let a=1;for(o=t.src.charCodeAt(++i);o===35&&i<s&&a<=6;)a++,o=t.src.charCodeAt(++i);if(a>6||i<s&&!qt(o))return!1;if(r)return!0;s=t.skipSpacesBack(s,i);const l=t.skipCharsBack(s,35,i);l>i&&qt(t.src.charCodeAt(l-1))&&(s=l),t.line=e+1;const u=t.push("heading_open","h"+String(a),1);u.markup="########".slice(0,a),u.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(i,s).trim(),c.map=[e,t.line],c.children=[];const f=t.push("heading_close","h"+String(a),-1);return f.markup="########".slice(0,a),!0}function Are(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let s=0,o,a=e+1;for(;a<n&&!t.isEmpty(a);a++){if(t.sCount[a]-t.blkIndent>3)continue;if(t.sCount[a]>=t.blkIndent){let h=t.bMarks[a]+t.tShift[a];const p=t.eMarks[a];if(h<p&&(o=t.src.charCodeAt(h),(o===45||o===61)&&(h=t.skipChars(h,o),h=t.skipSpaces(h),h>=p))){s=o===61?1:2;break}}if(t.sCount[a]<0)continue;let d=!1;for(let h=0,p=r.length;h<p;h++)if(r[h](t,a,n,!0)){d=!0;break}if(d)break}if(!s)return!1;const l=t.getLines(e,a,t.blkIndent,!1).trim();t.line=a+1;const u=t.push("heading_open","h"+String(s),1);u.markup=String.fromCharCode(o),u.map=[e,t.line];const c=t.push("inline","",0);c.content=l,c.map=[e,t.line-1],c.children=[];const f=t.push("heading_close","h"+String(s),-1);return f.markup=String.fromCharCode(o),t.parentType=i,!0}function xre(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),i=t.parentType;let s=e+1;for(t.parentType="paragraph";s<n&&!t.isEmpty(s);s++){if(t.sCount[s]-t.blkIndent>3||t.sCount[s]<0)continue;let u=!1;for(let c=0,f=r.length;c<f;c++)if(r[c](t,s,n,!0)){u=!0;break}if(u)break}const o=t.getLines(e,s,t.blkIndent,!1).trim();t.line=s;const a=t.push("paragraph_open","p",1);a.map=[e,t.line];const l=t.push("inline","",0);return l.content=o,l.map=[e,t.line],l.children=[],t.push("paragraph_close","p",-1),t.parentType=i,!0}const Zy=[["table",nre,["paragraph","reference"]],["code",rre],["fence",ire,["paragraph","reference","blockquote","list"]],["blockquote",sre,["paragraph","reference","blockquote","list"]],["hr",ore,["paragraph","reference","blockquote","list"]],["list",lre,["paragraph","reference","blockquote"]],["reference",ure],["html_block",wre,["paragraph","reference","blockquote"]],["heading",vre,["paragraph","reference","blockquote"]],["lheading",Are],["paragraph",xre]];function eb(){this.ruler=new Qr;for(let t=0;t<Zy.length;t++)this.ruler.push(Zy[t][0],Zy[t][1],{alt:(Zy[t][2]||[]).slice()})}eb.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),i=r.length,s=t.md.options.maxNesting;let o=e,a=!1;for(;o<n&&(t.line=o=t.skipEmptyLines(o),!(o>=n||t.sCount[o]<t.blkIndent));){if(t.level>=s){t.line=n;break}const l=t.line;let u=!1;for(let c=0;c<i;c++)if(u=r[c](t,o,n,!1),u){if(l>=t.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),o=t.line,o<n&&t.isEmpty(o)&&(a=!0,o++,t.line=o)}},eb.prototype.parse=function(t,e,n,r){if(!t)return;const i=new this.State(t,e,n,r);this.tokenize(i,i.line,i.lineMax)},eb.prototype.State=Vs;function Cp(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}Cp.prototype.pushPending=function(){const t=new is("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},Cp.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new is(t,e,n);let i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},Cp.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let s=t;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const o=s-t,a=s<n?this.src.charCodeAt(s):32,l=Sp(i)||kp(String.fromCharCode(i)),u=Sp(a)||kp(String.fromCharCode(a)),c=Ep(i),f=Ep(a),d=!f&&(!u||c||l),h=!c&&(!l||f||u);return{can_open:d&&(e||!h||l),can_close:h&&(e||!d||u),length:o}},Cp.prototype.Token=is;function Ere(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function kre(t,e){let n=t.pos;for(;n<t.posMax&&!Ere(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const Sre=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Cre(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(Sre);if(!i)return!1;const s=i[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let a=o.url;if(a.length<=s.length)return!1;a=a.replace(/\*+$/,"");const l=t.md.normalizeLink(a);if(!t.md.validateLink(l))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const u=t.push("link_open","a",1);u.attrs=[["href",l]],u.markup="linkify",u.info="auto";const c=t.push("text","",0);c.content=t.md.normalizeLinkText(a);const f=t.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return t.pos+=a.length-s.length,!0}function Dre(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&t.pending.charCodeAt(s-1)===32;)s--;t.pending=t.pending.slice(0,s),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<i&&qt(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const W2=[];for(let t=0;t<256;t++)W2.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){W2[t.charCodeAt(0)]=1});function Tre(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(i=t.src.charCodeAt(n),!!qt(i));)n++;return t.pos=n,!0}let s=t.src[n];if(i>=55296&&i<=56319&&n+1<r){const a=t.src.charCodeAt(n+1);a>=56320&&a<=57343&&(s+=t.src[n+1],n++)}const o="\\"+s;if(!e){const a=t.push("text_special","",0);i<256&&W2[i]!==0?a.content=s:a.content=o,a.markup=o,a.info="escape"}return t.pos=n+1,!0}function Ore(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const s=t.posMax;for(;n<s&&t.src.charCodeAt(n)===96;)n++;const o=t.src.slice(i,n),a=o.length;if(t.backticksScanned&&(t.backticks[a]||0)<=i)return e||(t.pending+=o),t.pos+=a,!0;let l=n,u;for(;(u=t.src.indexOf("`",l))!==-1;){for(l=u+1;l<s&&t.src.charCodeAt(l)===96;)l++;const c=l-u;if(c===a){if(!e){const f=t.push("code_inline","code",0);f.markup=o,f.content=t.src.slice(n,u).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=l,!0}t.backticks[c]=u}return t.backticksScanned=!0,e||(t.pending+=o),t.pos+=a,!0}function _re(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const i=t.scanDelims(t.pos,!0);let s=i.length;const o=String.fromCharCode(r);if(s<2)return!1;let a;s%2&&(a=t.push("text","",0),a.content=o,s--);for(let l=0;l<s;l+=2)a=t.push("text","",0),a.content=o+o,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return t.pos+=i.length,!0}function M8(t,e){let n;const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(o.marker!==126||o.end===-1)continue;const a=e[o.end];n=t.tokens[o.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[a.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[a.token-1].type==="text"&&t.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const s=r.pop();let o=s+1;for(;o<t.tokens.length&&t.tokens[o].type==="s_close";)o++;o--,s!==o&&(n=t.tokens[o],t.tokens[o]=t.tokens[s],t.tokens[s]=n)}}function Mre(t){const e=t.tokens_meta,n=t.tokens_meta.length;M8(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&M8(t,e[r].delimiters)}const N8={tokenize:_re,postProcess:Mre};function Nre(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const i=t.scanDelims(t.pos,r===42);for(let s=0;s<i.length;s++){const o=t.push("text","",0);o.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:i.length,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return t.pos+=i.length,!0}function P8(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const s=e[i.end],o=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===s.token+1,a=String.fromCharCode(i.marker),l=t.tokens[i.token];l.type=o?"strong_open":"em_open",l.tag=o?"strong":"em",l.nesting=1,l.markup=o?a+a:a,l.content="";const u=t.tokens[s.token];u.type=o?"strong_close":"em_close",u.tag=o?"strong":"em",u.nesting=-1,u.markup=o?a+a:a,u.content="",o&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function Pre(t){const e=t.tokens_meta,n=t.tokens_meta.length;P8(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&P8(t,e[r].delimiters)}const I8={tokenize:Nre,postProcess:Pre};function Ire(t,e){let n,r,i,s,o="",a="",l=t.pos,u=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,f=t.posMax,d=t.pos+1,h=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(h<0)return!1;let p=h+1;if(p<f&&t.src.charCodeAt(p)===40){for(u=!1,p++;p<f&&(n=t.src.charCodeAt(p),!(!qt(n)&&n!==10));p++);if(p>=f)return!1;if(l=p,i=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),i.ok){for(o=t.md.normalizeLink(i.str),t.md.validateLink(o)?p=i.pos:o="",l=p;p<f&&(n=t.src.charCodeAt(p),!(!qt(n)&&n!==10));p++);if(i=t.md.helpers.parseLinkTitle(t.src,p,t.posMax),p<f&&l!==p&&i.ok)for(a=i.str,p=i.pos;p<f&&(n=t.src.charCodeAt(p),!(!qt(n)&&n!==10));p++);}(p>=f||t.src.charCodeAt(p)!==41)&&(u=!0),p++}if(u){if(typeof t.env.references>"u")return!1;if(p<f&&t.src.charCodeAt(p)===91?(l=p+1,p=t.md.helpers.parseLinkLabel(t,p),p>=0?r=t.src.slice(l,p++):p=h+1):p=h+1,r||(r=t.src.slice(d,h)),s=t.env.references[Yy(r)],!s)return t.pos=c,!1;o=s.href,a=s.title}if(!e){t.pos=d,t.posMax=h;const m=t.push("link_open","a",1),g=[["href",o]];m.attrs=g,a&&g.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=f,!0}function Rre(t,e){let n,r,i,s,o,a,l,u,c="";const f=t.pos,d=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const h=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(s=p+1,s<d&&t.src.charCodeAt(s)===40){for(s++;s<d&&(n=t.src.charCodeAt(s),!(!qt(n)&&n!==10));s++);if(s>=d)return!1;for(u=s,a=t.md.helpers.parseLinkDestination(t.src,s,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?s=a.pos:c=""),u=s;s<d&&(n=t.src.charCodeAt(s),!(!qt(n)&&n!==10));s++);if(a=t.md.helpers.parseLinkTitle(t.src,s,t.posMax),s<d&&u!==s&&a.ok)for(l=a.str,s=a.pos;s<d&&(n=t.src.charCodeAt(s),!(!qt(n)&&n!==10));s++);else l="";if(s>=d||t.src.charCodeAt(s)!==41)return t.pos=f,!1;s++}else{if(typeof t.env.references>"u")return!1;if(s<d&&t.src.charCodeAt(s)===91?(u=s+1,s=t.md.helpers.parseLinkLabel(t,s),s>=0?i=t.src.slice(u,s++):s=p+1):s=p+1,i||(i=t.src.slice(h,p)),o=t.env.references[Yy(i)],!o)return t.pos=f,!1;c=o.href,l=o.title}if(!e){r=t.src.slice(h,p);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),y=[["src",c],["alt",""]];g.attrs=y,g.children=m,g.content=r,l&&y.push(["title",l])}return t.pos=s,t.posMax=d,!0}const Lre=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Bre=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Fre(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const o=t.src.charCodeAt(n);if(o===60)return!1;if(o===62)break}const s=t.src.slice(r+1,n);if(Bre.test(s)){const o=t.md.normalizeLink(s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(s);const u=t.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return t.pos+=s.length+2,!0}if(Lre.test(s)){const o=t.md.normalizeLink("mailto:"+s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(s);const u=t.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return t.pos+=s.length+2,!0}return!1}function Ure(t){return/^<a[>\s]/i.test(t)}function jre(t){return/^<\/a\s*>/i.test(t)}function Hre(t){const e=t|32;return e>=97&&e<=122}function Vre(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!Hre(i))return!1;const s=t.src.slice(r).match(yre);if(!s)return!1;if(!e){const o=t.push("html_inline","",0);o.content=s[0],Ure(o.content)&&t.linkLevel++,jre(o.content)&&t.linkLevel--}return t.pos+=s[0].length,!0}const zre=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,$re=/^&([a-z][a-z0-9]{1,31});/i;function Gre(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const s=t.src.slice(n).match(zre);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=t.push("text_special","",0);a.content=V2(o)?Jy(o):Jy(65533),a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}else{const s=t.src.slice(n).match($re);if(s){const o=w8(s[0]);if(o!==s[0]){if(!e){const a=t.push("text_special","",0);a.content=o,a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}}return!1}function R8(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const s=[];for(let o=0;o<n;o++){const a=t[o];if(s.push(0),(t[r].marker!==a.marker||i!==a.token-1)&&(r=o),i=a.token,a.length=a.length||0,!a.close)continue;e.hasOwnProperty(a.marker)||(e[a.marker]=[-1,-1,-1,-1,-1,-1]);const l=e[a.marker][(a.open?3:0)+a.length%3];let u=r-s[r]-1,c=u;for(;u>l;u-=s[u]+1){const f=t[u];if(f.marker===a.marker&&f.open&&f.end<0){let d=!1;if((f.close||a.open)&&(f.length+a.length)%3===0&&(f.length%3!==0||a.length%3!==0)&&(d=!0),!d){const h=u>0&&!t[u-1].open?s[u-1]+1:0;s[o]=o-u+h,s[u]=h,a.open=!1,f.end=o,f.close=!1,c=-1,i=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function Wre(t){const e=t.tokens_meta,n=t.tokens_meta.length;R8(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&R8(e[r].delimiters)}function Kre(t){let e,n,r=0;const i=t.tokens,s=t.tokens.length;for(e=n=0;e<s;e++)i[e].nesting<0&&r--,i[e].level=r,i[e].nesting>0&&r++,i[e].type==="text"&&e+1<s&&i[e+1].type==="text"?i[e+1].content=i[e].content+i[e+1].content:(e!==n&&(i[n]=i[e]),n++);e!==n&&(i.length=n)}const K2=[["text",kre],["linkify",Cre],["newline",Dre],["escape",Tre],["backticks",Ore],["strikethrough",N8.tokenize],["emphasis",I8.tokenize],["link",Ire],["image",Rre],["autolink",Fre],["html_inline",Vre],["entity",Gre]],q2=[["balance_pairs",Wre],["strikethrough",N8.postProcess],["emphasis",I8.postProcess],["fragments_join",Kre]];function Dp(){this.ruler=new Qr;for(let t=0;t<K2.length;t++)this.ruler.push(K2[t][0],K2[t][1]);this.ruler2=new Qr;for(let t=0;t<q2.length;t++)this.ruler2.push(q2[t][0],q2[t][1])}Dp.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,i=t.md.options.maxNesting,s=t.cache;if(typeof s[e]<"u"){t.pos=s[e];return}let o=!1;if(t.level<i){for(let a=0;a<r;a++)if(t.level++,o=n[a](t,!0),t.level--,o){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;o||t.pos++,s[e]=t.pos},Dp.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos<r;){const s=t.pos;let o=!1;if(t.level<i){for(let a=0;a<n;a++)if(o=e[a](t,!1),o){if(s>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},Dp.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let a=0;a<o;a++)s[a](i)},Dp.prototype.State=Cp;function qre(t){const e={};t=t||{},e.src_Any=p8.source,e.src_Cc=m8.source,e.src_Z=y8.source,e.src_P=F2.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Q2(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function tb(t){return Object.prototype.toString.call(t)}function Qre(t){return tb(t)==="[object String]"}function Jre(t){return tb(t)==="[object Object]"}function Yre(t){return tb(t)==="[object RegExp]"}function L8(t){return tb(t)==="[object Function]"}function Xre(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const B8={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Zre(t){return Object.keys(t||{}).reduce(function(e,n){return e||B8.hasOwnProperty(n)},!1)}const eie={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},tie="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",nie="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function rie(t){t.__index__=-1,t.__text_cache__=""}function iie(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function F8(){return function(t,e){e.normalize(t)}}function nb(t){const e=t.re=qre(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(tie),n.push(e.src_xn),e.src_tlds=n.join("|");function r(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function s(a,l){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+l)}Object.keys(t.__schemas__).forEach(function(a){const l=t.__schemas__[a];if(l===null)return;const u={validate:null,link:null};if(t.__compiled__[a]=u,Jre(l)){Yre(l.validate)?u.validate=iie(l.validate):L8(l.validate)?u.validate=l.validate:s(a,l),L8(l.normalize)?u.normalize=l.normalize:l.normalize?s(a,l):u.normalize=F8();return}if(Qre(l)){i.push(a);return}s(a,l)}),i.forEach(function(a){t.__compiled__[t.__schemas__[a]]&&(t.__compiled__[a].validate=t.__compiled__[t.__schemas__[a]].validate,t.__compiled__[a].normalize=t.__compiled__[t.__schemas__[a]].normalize)}),t.__compiled__[""]={validate:null,normalize:F8()};const o=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(Xre).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),rie(t)}function sie(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function J2(t,e){const n=new sie(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function hi(t,e){if(!(this instanceof hi))return new hi(t,e);e||Zre(t)&&(e=t,t={}),this.__opts__=Q2({},B8,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Q2({},eie,t),this.__compiled__={},this.__tlds__=nie,this.__tlds_replaced__=!1,this.re={},nb(this)}hi.prototype.add=function(e,n){return this.__schemas__[e]=n,nb(this),this},hi.prototype.set=function(e){return this.__opts__=Q2(this.__opts__,e),this},hi.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,s,o,a,l,u,c;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(n=l.exec(e))!==null;)if(s=this.testSchemaAt(e,n[2],l.lastIndex),s){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=e.search(this.re.host_fuzzy_test),u>=0&&(this.__index__<0||u<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=r.index+r[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(i=e.match(this.re.email_fuzzy))!==null&&(o=i.index+i[1].length,a=i.index+i[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=a))),this.__index__>=0},hi.prototype.pretest=function(e){return this.re.pretest.test(e)},hi.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0},hi.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(J2(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(J2(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null},hi.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,J2(this,0)):null},hi.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,s){return r!==s[i-1]}).reverse(),nb(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,nb(this),this)},hi.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)},hi.prototype.onCompile=function(){};const gf=2147483647,zs=36,Y2=1,Tp=26,oie=38,aie=700,U8=72,j8=128,H8="-",lie=/^xn--/,uie=/[^\0-\x7F]/,cie=/[\x2E\u3002\uFF0E\uFF61]/g,fie={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},X2=zs-Y2,$s=Math.floor,Z2=String.fromCharCode;function Ba(t){throw new RangeError(fie[t])}function die(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function V8(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(cie,".");const i=t.split("."),s=die(i,e).join(".");return r+s}function z8(t){const e=[];let n=0;const r=t.length;for(;n<r;){const i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const s=t.charCodeAt(n++);(s&64512)==56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e}const hie=t=>String.fromCodePoint(...t),pie=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:zs},$8=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},G8=function(t,e,n){let r=0;for(t=n?$s(t/aie):t>>1,t+=$s(t/e);t>X2*Tp>>1;r+=zs)t=$s(t/X2);return $s(r+(X2+1)*t/(t+oie))},W8=function(t){const e=[],n=t.length;let r=0,i=j8,s=U8,o=t.lastIndexOf(H8);o<0&&(o=0);for(let a=0;a<o;++a)t.charCodeAt(a)>=128&&Ba("not-basic"),e.push(t.charCodeAt(a));for(let a=o>0?o+1:0;a<n;){const l=r;for(let c=1,f=zs;;f+=zs){a>=n&&Ba("invalid-input");const d=pie(t.charCodeAt(a++));d>=zs&&Ba("invalid-input"),d>$s((gf-r)/c)&&Ba("overflow"),r+=d*c;const h=f<=s?Y2:f>=s+Tp?Tp:f-s;if(d<h)break;const p=zs-h;c>$s(gf/p)&&Ba("overflow"),c*=p}const u=e.length+1;s=G8(r-l,u,l==0),$s(r/u)>gf-i&&Ba("overflow"),i+=$s(r/u),r%=u,e.splice(r++,0,i)}return String.fromCodePoint(...e)},K8=function(t){const e=[];t=z8(t);const n=t.length;let r=j8,i=0,s=U8;for(const l of t)l<128&&e.push(Z2(l));const o=e.length;let a=o;for(o&&e.push(H8);a<n;){let l=gf;for(const c of t)c>=r&&c<l&&(l=c);const u=a+1;l-r>$s((gf-i)/u)&&Ba("overflow"),i+=(l-r)*u,r=l;for(const c of t)if(c<r&&++i>gf&&Ba("overflow"),c===r){let f=i;for(let d=zs;;d+=zs){const h=d<=s?Y2:d>=s+Tp?Tp:d-s;if(f<h)break;const p=f-h,m=zs-h;e.push(Z2($8(h+p%m,0))),f=$s(p/m)}e.push(Z2($8(f,0))),s=G8(i,u,a===o),i=0,++a}++i,++r}return e.join("")},q8={version:"2.3.1",ucs2:{decode:z8,encode:hie},decode:W8,encode:K8,toASCII:function(t){return V8(t,function(e){return uie.test(e)?"xn--"+K8(e):e})},toUnicode:function(t){return V8(t,function(e){return lie.test(e)?W8(e.slice(4).toLowerCase()):e})}},mie={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},gie=/^(vbscript|javascript|file|data):/,yie=/^data:image\/(gif|png|jpeg|webp);/;function bie(t){const e=t.trim().toLowerCase();return gie.test(e)?yie.test(e):!0}const Q8=["http:","https:","mailto:"];function wie(t){const e=B2(t,!0);if(e.hostname&&(!e.protocol||Q8.indexOf(e.protocol)>=0))try{e.hostname=q8.toASCII(e.hostname)}catch{}return xp(L2(e))}function vie(t){const e=B2(t,!0);if(e.hostname&&(!e.protocol||Q8.indexOf(e.protocol)>=0))try{e.hostname=q8.toUnicode(e.hostname)}catch{}return df(L2(e),df.defaultChars+"%")}function _r(t,e){if(!(this instanceof _r))return new _r(t,e);e||H2(t)||(e=t||{},t="default"),this.inline=new Dp,this.block=new eb,this.core=new $2,this.renderer=new pf,this.linkify=new hi,this.validateLink=bie,this.normalizeLink=wie,this.normalizeLinkText=vie,this.utils=Mne,this.helpers=Qy({},Rne),this.options={},this.configure(t),e&&this.set(e)}_r.prototype.set=function(t){return Qy(this.options,t),this},_r.prototype.configure=function(t){const e=this;if(H2(t)){const n=t;if(t=mie[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this},_r.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this},_r.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this},_r.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},_r.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens},_r.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},_r.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},_r.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const Aie=new xw({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function xie(t,e){if(t.isText&&e.isText&&Nt.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class Eie{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:Nt.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let n=this.top(),r=n.content,i=r[r.length-1],s=this.schema.text(e,n.marks),o;i&&(o=xie(i,s))?r[r.length-1]=o:r.push(s)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],i=this.tokenHandlers[r.type];if(!i)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");i(this,r,e,n)}}addNode(e,n,r){let i=this.top(),s=e.createAndFill(n,r,i?i.marks:[]);return s?(this.push(s),s):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:Nt.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function Op(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function eE(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function J8(t){return t[t.length-1]==`
499
- `?t.slice(0,t.length-1):t}function tE(){}function kie(t,e){let n=Object.create(null);for(let r in e){let i=e[r];if(i.block){let s=t.nodeType(i.block);eE(i,r)?n[r]=(o,a,l,u)=>{o.openNode(s,Op(i,a,l,u)),o.addText(J8(a.content)),o.closeNode()}:(n[r+"_open"]=(o,a,l,u)=>o.openNode(s,Op(i,a,l,u)),n[r+"_close"]=o=>o.closeNode())}else if(i.node){let s=t.nodeType(i.node);n[r]=(o,a,l,u)=>o.addNode(s,Op(i,a,l,u))}else if(i.mark){let s=t.marks[i.mark];eE(i,r)?n[r]=(o,a,l,u)=>{o.openMark(s.create(Op(i,a,l,u))),o.addText(J8(a.content)),o.closeMark(s)}:(n[r+"_open"]=(o,a,l,u)=>o.openMark(s.create(Op(i,a,l,u))),n[r+"_close"]=o=>o.closeMark(s))}else if(i.ignore)eE(i,r)?n[r]=tE:(n[r+"_open"]=tE,n[r+"_close"]=tE);else throw new RangeError("Unrecognized parsing spec "+JSON.stringify(i))}return n.text=(r,i)=>r.addText(i.content),n.inline=(r,i)=>r.parseTokens(i.children),n.softbreak=n.softbreak||(r=>r.addText(" ")),n}let Sie=class{constructor(e,n,r){this.schema=e,this.tokenizer=n,this.tokens=r,this.tokenHandlers=kie(e,r)}parse(e,n={}){let r=new Eie(this.schema,this.tokenHandlers),i;r.parseTokens(this.tokenizer.parse(e,n));do i=r.closeNode();while(r.stack.length);return i||this.schema.topNodeType.createAndFill()}};function Y8(t,e){for(;++e<t.length;)if(t[e].type!="list_item_open")return t[e].hidden;return!1}new Sie(Aie,_r("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(t,e,n)=>({tight:Y8(e,n)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,n)=>({order:+t.attrGet("start")||1,tight:Y8(e,n)})},heading:{block:"heading",getAttrs:t=>({level:+t.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:t=>({params:t.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:t=>({src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:t=>({href:t.attrGet("href"),title:t.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}});const Cie={open:"",close:"",mixable:!0};let Die=class{constructor(e,n,r={}){this.nodes=e,this.marks=n,this.options=r}serialize(e,n={}){n=Object.assign({},this.options,n);let r=new Z8(this.nodes,this.marks,n);return r.renderContent(e),r.out}};const Gs=new Die({blockquote(t,e){t.wrapBlock("> ",null,e,()=>t.renderContent(e))},code_block(t,e){const n=e.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";t.write(r+(e.attrs.params||"")+`
500
- `),t.text(e.textContent,!1),t.write(`
501
- `),t.write(r),t.closeBlock(e)},heading(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e,!1),t.closeBlock(e)},horizontal_rule(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list(t,e){t.renderList(e," ",()=>(e.attrs.bullet||"*")+" ")},ordered_list(t,e){let n=e.attrs.order||1,r=String(n+e.childCount-1).length,i=t.repeat(" ",r+2);t.renderList(e,i,s=>{let o=String(n+s);return t.repeat(" ",r-o.length)+o+". "})},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+e.attrs.src.replace(/[\(\)]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(`\\
502
- `);return}},text(t,e){t.text(e.text,!t.inAutolink)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open(t,e,n,r){return t.inAutolink=Tie(e,n,r),t.inAutolink?"<":"["},close(t,e,n,r){let{inAutolink:i}=t;return t.inAutolink=void 0,i?">":"]("+e.attrs.href.replace(/[\(\)"]/g,"\\$&")+(e.attrs.title?` "${e.attrs.title.replace(/"/g,'\\"')}"`:"")+")"},mixable:!0},code:{open(t,e,n,r){return X8(n.child(r),-1)},close(t,e,n,r){return X8(n.child(r-1),1)},escape:!1}});function X8(t,e){let n=/`+/g,r,i=0;if(t.isText)for(;r=n.exec(t.text);)i=Math.max(i,r[0].length);let s=i>0&&e>0?" `":"`";for(let o=0;o<i;o++)s+="`";return i>0&&e<0&&(s+=" "),s}function Tie(t,e,n){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;let r=e.child(n);return!r.isText||r.text!=t.attrs.href||r.marks[r.marks.length-1]!=t?!1:n==e.childCount-1||!t.isInSet(e.child(n+1).marks)}let Z8=class{constructor(e,n,r){this.nodes=e,this.marks=n,this.options=r,this.delim="",this.out="",this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,typeof this.options.tightLists>"u"&&(this.options.tightLists=!1),typeof this.options.hardBreakNodeName>"u"&&(this.options.hardBreakNodeName="hard_break")}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
503
- `),e>1){let n=this.delim,r=/\s+$/.exec(n);r&&(n=n.slice(0,n.length-r[0].length));for(let i=1;i<e;i++)this.out+=n+`
504
- `}this.closed=null}}getMark(e){let n=this.marks[e];if(!n){if(this.options.strict!==!1)throw new Error(`Mark type \`${e}\` not supported by Markdown renderer`);n=Cie}return n}wrapBlock(e,n,r,i){let s=this.delim;this.write(n??e),this.delim+=e,i(),this.delim=s,this.closeBlock(r)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
505
- `)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,n=!0){let r=e.split(`
506
- `);for(let i=0;i<r.length;i++)this.write(),!n&&r[i][0]=="["&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+"\\!"),this.out+=n?this.esc(r[i],this.atBlockStart):r[i],i!=r.length-1&&(this.out+=`
507
- `)}render(e,n,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,n,r);else{if(this.options.strict!==!1)throw new Error("Token type `"+e.type.name+"` not supported by Markdown renderer");e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}}renderContent(e){e.forEach((n,r,i)=>this.render(n,e,i))}renderInline(e,n=!0){this.atBlockStart=n;let r=[],i="",s=(o,a,l)=>{let u=o?o.marks:[];o&&o.type.name===this.options.hardBreakNodeName&&(u=u.filter(m=>{if(l+1==e.childCount)return!1;let g=e.child(l+1);return m.isInSet(g.marks)&&(!g.isText||/\S/.test(g.text))}));let c=i;if(i="",o&&o.isText&&u.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!m.isInSet(r)})){let[m,g,y]=/^(\s*)(.*)$/m.exec(o.text);g&&(c+=g,o=y?o.withText(y):null,o||(u=r))}if(o&&o.isText&&u.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&(l==e.childCount-1||!m.isInSet(e.child(l+1).marks))})){let[m,g,y]=/^(.*?)(\s*)$/m.exec(o.text);y&&(i=y,o=g?o.withText(g):null,o||(u=r))}let f=u.length?u[u.length-1]:null,d=f&&this.getMark(f.type.name).escape===!1,h=u.length-(d?1:0);e:for(let m=0;m<h;m++){let g=u[m];if(!this.getMark(g.type.name).mixable)break;for(let y=0;y<r.length;y++){let v=r[y];if(!this.getMark(v.type.name).mixable)break;if(g.eq(v)){m>y?u=u.slice(0,y).concat(g).concat(u.slice(y,m)).concat(u.slice(m+1,h)):y>m&&(u=u.slice(0,m).concat(u.slice(m+1,y)).concat(g).concat(u.slice(y,h)));continue e}}}let p=0;for(;p<Math.min(r.length,h)&&u[p].eq(r[p]);)++p;for(;p<r.length;)this.text(this.markString(r.pop(),!1,e,l),!1);if(c&&this.text(c),o){for(;r.length<h;){let m=u[r.length];r.push(m),this.text(this.markString(m,!0,e,l),!1),this.atBlockStart=!1}d&&o.isText?this.text(this.markString(f,!0,e,l)+o.text+this.markString(f,!1,e,l+1),!1):this.render(o,e,l),this.atBlockStart=!1}o!=null&&o.isText&&o.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(s),s(null,0,e.childCount),this.atBlockStart=!1}renderList(e,n,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let i=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,s=this.inTightList;this.inTightList=i,e.forEach((o,a,l)=>{l&&i&&this.flushClose(1),this.wrapBlock(n,r(l),e,()=>this.render(o,e,l))}),this.inTightList=s}esc(e,n=!1){return e=e.replace(/[`*\\~\[\]_]/g,(r,i)=>r=="_"&&i>0&&i+1<e.length&&e[i-1].match(/\w/)&&e[i+1].match(/\w/)?r:"\\"+r),n&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,"\\$&")),e}quote(e){let n=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return n[0]+e+n[1]}repeat(e,n){let r="";for(let i=0;i<n;i++)r+=e;return r}markString(e,n,r,i){let s=this.getMark(e.type.name),o=n?s.open:s.close;return typeof o=="string"?o:o(this,e,r,i)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}};var nE=!0,eP=!1,tP=!1,Oie=function(t,e){e&&(nE=!e.enabled,eP=!!e.label,tP=!!e.labelAfter),t.core.ruler.after("inline","github-task-lists",function(n){for(var r=n.tokens,i=2;i<r.length;i++)Mie(r,i)&&(Nie(r[i],n.Token),nP(r[i-2],"class","task-list-item"+(nE?"":" enabled")),nP(r[_ie(r,i-2)],"class","contains-task-list"))})};function nP(t,e,n){var r=t.attrIndex(e),i=[e,n];r<0?t.attrPush(i):t.attrs[r]=i}function _ie(t,e){for(var n=t[e].level-1,r=e-1;r>=0;r--)if(t[r].level===n)return r;return-1}function Mie(t,e){return Bie(t[e])&&Fie(t[e-1])&&Uie(t[e-2])&&jie(t[e])}function Nie(t,e){if(t.children.unshift(Pie(t,e)),t.children[1].content=t.children[1].content.slice(3),t.content=t.content.slice(3),eP)if(tP){t.children.pop();var n="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);t.children[0].content=t.children[0].content.slice(0,-1)+' id="'+n+'">',t.children.push(Lie(t.content,n,e))}else t.children.unshift(Iie(e)),t.children.push(Rie(e))}function Pie(t,e){var n=new e("html_inline","",0),r=nE?' disabled="" ':"";return t.content.indexOf("[ ] ")===0?n.content='<input class="task-list-item-checkbox"'+r+'type="checkbox">':(t.content.indexOf("[x] ")===0||t.content.indexOf("[X] ")===0)&&(n.content='<input class="task-list-item-checkbox" checked=""'+r+'type="checkbox">'),n}function Iie(t){var e=new t("html_inline","",0);return e.content="<label>",e}function Rie(t){var e=new t("html_inline","",0);return e.content="</label>",e}function Lie(t,e,n){var r=new n("html_inline","",0);return r.content='<label class="task-list-item-label" for="'+e+'">'+t+"</label>",r.attrs=[{for:e}],r}function Bie(t){return t.type==="inline"}function Fie(t){return t.type==="paragraph_open"}function Uie(t){return t.type==="list_item_open"}function jie(t){return t.content.indexOf("[ ] ")===0||t.content.indexOf("[x] ")===0||t.content.indexOf("[X] ")===0}const Hie=Jd(Oie);var Vie=Object.defineProperty,zie=(t,e,n)=>e in t?Vie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rb=(t,e,n)=>(zie(t,typeof e!="symbol"?e+"":e,n),n);const $ie=It.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:t=>t.getAttribute("data-tight")==="true"||!t.querySelector("p"),renderHTML:t=>({class:t.tight?this.options.tightClass:null,"data-tight":t.tight?"true":null})}}}]},addCommands(){var t=this;return{toggleTight:function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function s(o){if(!r.isActive(o))return!1;const a=r.getAttributes(o);return i.updateAttributes(o,{tight:e??!(a!=null&&a.tight)})}return t.options.listTypes.some(o=>s(o))}}}}}),rP=_r();function iP(t,e){return rP.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new rP.inline.State(t,null,null,[]).scanDelims(e,!0)}function sP(t,e,n,r){let i=t.substring(0,n)+t.substring(n+e.length);return i=i.substring(0,n+r)+e+i.substring(n+r),i}function Gie(t,e,n,r){let i=n,s=t;for(;i<r&&!iP(s,i).can_open;)s=sP(s,e,i,1),i++;return{text:s,from:i,to:r}}function Wie(t,e,n,r){let i=r,s=t;for(;i>n&&!iP(s,i).can_close;)s=sP(s,e,i,-1),i--;return{text:s,from:n,to:i}}function Kie(t,e,n,r){let i={text:t,from:n,to:r};return i=Gie(i.text,e,i.from,i.to),i=Wie(i.text,e,i.from,i.to),i.to-i.from<e.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+e.length)),i.text}class qie extends Z8{constructor(e,n,r){super(e,n,r??{}),rb(this,"inTable",!1),this.inlines=[]}render(e,n,r){super.render(e,n,r);const i=this.inlines[this.inlines.length-1];if(i!=null&&i.start&&i!==null&&i!==void 0&&i.end){const{delimiter:s,start:o,end:a}=this.normalizeInline(i);this.out=Kie(this.out,s,o,a),this.inlines.pop()}}markString(e,n,r,i){const s=this.marks[e.type.name];if(s.expelEnclosingWhitespace)if(n)this.inlines.push({start:this.out.length,delimiter:s.open});else{const o=this.inlines.pop();this.inlines.push({...o,end:this.out.length})}return super.markString(e,n,r,i)}normalizeInline(e){let{start:n,end:r}=e;for(;this.out.charAt(n).match(/\s/);)n++;return{...e,start:n}}}const oP=In.create({name:"markdownHTMLMark",addStorage(){return{markdown:{serialize:{open(t,e){var n,r;return this.editor.storage.markdown.options.html?(n=(r=aP(e))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:"":(console.warn(`Tiptap Markdown: "${e.type.name}" mark is only available in html mode`),"")},close(t,e){var n,r;return this.editor.storage.markdown.options.html&&(n=(r=aP(e))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}},parse:{}}}}});function aP(t){const e=t.type.schema,n=e.text(" ",[t]),i=wv(Ae.from(n),e).match(/^(<.*?>) (<\/.*?>)$/);return i?[i[1],i[2]]:null}function rE(t){const e=`<body>${t}</body>`;return new window.DOMParser().parseFromString(e,"text/html").body}function Qie(t){return t==null?void 0:t.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Jie(t){const e=t.parentElement,n=e.cloneNode();for(;e.firstChild&&e.firstChild!==t;)n.appendChild(e.firstChild);n.childNodes.length>0&&e.parentElement.insertBefore(n,e),e.parentElement.insertBefore(t,e),e.childNodes.length===0&&e.remove()}function Yie(t){const e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}const ib=ot.create({name:"markdownHTMLNode",addStorage(){return{markdown:{serialize(t,e,n){this.editor.storage.markdown.options.html?t.write(Xie(e,n)):(console.warn(`Tiptap Markdown: "${e.type.name}" node is only available in html mode`),t.write(`[${e.type.name}]`)),e.isBlock&&t.closeBlock(e)},parse:{}}}}});function Xie(t,e){const n=t.type.schema,r=wv(Ae.from(t),n);return t.isBlock&&(e instanceof Ae||e.type.name===n.topNodeType.name)?Zie(r):r}function Zie(t){const n=rE(t).firstElementChild;return n.innerHTML=n.innerHTML.trim()?`
508
- ${n.innerHTML}
509
- `:`
510
- `,n.outerHTML}const ese=ot.create({name:"blockquote"}).extend({addStorage(){return{markdown:{serialize:Gs.nodes.blockquote,parse:{}}}}}),lP=ot.create({name:"bulletList"}).extend({addStorage(){return{markdown:{serialize(t,e){return t.renderList(e," ",()=>(this.editor.storage.markdown.options.bulletListMarker||"-")+" ")},parse:{}}}}}),tse=ot.create({name:"codeBlock"}).extend({addStorage(){return{markdown:{serialize(t,e){t.write("```"+(e.attrs.language||"")+`
511
- `),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:(e=this.options.languageClassPrefix)!==null&&e!==void 0?e:"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}}}}),uP=ot.create({name:"hardBreak"}).extend({addStorage(){return{markdown:{serialize(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(t.inTable?ib.storage.markdown.serialize.call(this,t,e,n):`\\
512
- `);return}},parse:{}}}}}),nse=ot.create({name:"heading"}).extend({addStorage(){return{markdown:{serialize:Gs.nodes.heading,parse:{}}}}}),rse=ot.create({name:"horizontalRule"}).extend({addStorage(){return{markdown:{serialize:Gs.nodes.horizontal_rule,parse:{}}}}}),ise=ot.create({name:"image"}).extend({addStorage(){return{markdown:{serialize:Gs.nodes.image,parse:{}}}}}),sse=ot.create({name:"listItem"}).extend({addStorage(){return{markdown:{serialize:Gs.nodes.list_item,parse:{}}}}}),ose=ot.create({name:"orderedList"});function ase(t,e,n){let r=0;for(;n-r>0&&e.child(n-r-1).type.name===t.type.name;r++);return r}const lse=ose.extend({addStorage(){return{markdown:{serialize(t,e,n,r){const i=e.attrs.start||1,s=String(i+e.childCount-1).length,o=t.repeat(" ",s+2),l=ase(e,n,r)%2?") ":". ";t.renderList(e,o,u=>{const c=String(i+u);return t.repeat(" ",s-c.length)+c+l})},parse:{}}}}}),use=ot.create({name:"paragraph"}).extend({addStorage(){return{markdown:{serialize:Gs.nodes.paragraph,parse:{}}}}});function iE(t){var e,n;return(e=t==null||(n=t.content)===null||n===void 0?void 0:n.content)!==null&&e!==void 0?e:[]}const cse=ot.create({name:"table"}).extend({addStorage(){return{markdown:{serialize(t,e,n){if(!fse(e)){ib.storage.markdown.serialize.call(this,t,e,n);return}t.inTable=!0,e.forEach((r,i,s)=>{if(t.write("| "),r.forEach((o,a,l)=>{l&&t.write(" | ");const u=o.firstChild;u.textContent.trim()&&t.renderInline(u)}),t.write(" |"),t.ensureNewLine(),!s){const o=Array.from({length:r.childCount}).map(()=>"---").join(" | ");t.write(`| ${o} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function cP(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function fse(t){const e=iE(t),n=e[0],r=e.slice(1);return!(iE(n).some(i=>i.type.name!=="tableHeader"||cP(i)||i.childCount>1)||r.some(i=>iE(i).some(s=>s.type.name==="tableHeader"||cP(s)||s.childCount>1)))}const dse=ot.create({name:"taskItem"}).extend({addStorage(){return{markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){[...t.querySelectorAll(".task-list-item")].forEach(e=>{const n=e.querySelector("input");e.setAttribute("data-type","taskItem"),n&&(e.setAttribute("data-checked",n.checked),n.remove())})}}}}}}),hse=ot.create({name:"taskList"}).extend({addStorage(){return{markdown:{serialize:lP.storage.markdown.serialize,parse:{setup(t){t.use(Hie)},updateDOM(t){[...t.querySelectorAll(".contains-task-list")].forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),pse=ot.create({name:"text"}).extend({addStorage(){return{markdown:{serialize(t,e){t.text(Qie(e.text))},parse:{}}}}}),mse=In.create({name:"bold"}).extend({addStorage(){return{markdown:{serialize:Gs.marks.strong,parse:{}}}}}),gse=In.create({name:"code"}).extend({addStorage(){return{markdown:{serialize:Gs.marks.code,parse:{}}}}}),yse=In.create({name:"italic"}).extend({addStorage(){return{markdown:{serialize:Gs.marks.em,parse:{}}}}}),bse=In.create({name:"link"}).extend({addStorage(){return{markdown:{serialize:Gs.marks.link,parse:{}}}}}),wse=In.create({name:"strike"}).extend({addStorage(){return{markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}}}}),vse=[ese,lP,tse,uP,nse,rse,ib,ise,sse,lse,use,cse,dse,hse,pse,mse,gse,oP,yse,bse,wse];function sb(t){var e,n;const r=(e=t.storage)===null||e===void 0?void 0:e.markdown,i=(n=vse.find(s=>s.name===t.name))===null||n===void 0?void 0:n.storage.markdown;return r||i?{...i,...r}:null}class Ase{constructor(e){rb(this,"editor",null),this.editor=e}serialize(e){const n=new qie(this.nodes,this.marks,{hardBreakNodeName:uP.name});return n.renderContent(e),n.out}get nodes(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(n=>[n,this.serializeNode(ib)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="node"&&this.serializeNode(n)).map(n=>[n.name,this.serializeNode(n)]))!==null&&e!==void 0?e:[])}}get marks(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(n=>[n,this.serializeMark(oP)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="mark"&&this.serializeMark(n)).map(n=>[n.name,this.serializeMark(n)]))!==null&&e!==void 0?e:[])}}serializeNode(e){var n;return(n=sb(e))===null||n===void 0||(n=n.serialize)===null||n===void 0?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;const r=(n=sb(e))===null||n===void 0?void 0:n.serialize;return r?{...r,open:typeof r.open=="function"?r.open.bind({editor:this.editor,options:e.options}):r.open,close:typeof r.close=="function"?r.close.bind({editor:this.editor,options:e.options}):r.close}:null}}class xse{constructor(e,n){rb(this,"editor",null),rb(this,"md",null);let{html:r,linkify:i,breaks:s}=n;this.editor=e,this.md=this.withPatchedRenderer(_r({html:r,linkify:i,breaks:s}))}parse(e){let{inline:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(s=>{var o;return(o=sb(s))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.setup)===null||o===void 0?void 0:o.call({editor:this.editor,options:s.options},this.md)});const r=this.md.render(e),i=rE(r);return this.editor.extensionManager.extensions.forEach(s=>{var o;return(o=sb(s))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.updateDOM)===null||o===void 0?void 0:o.call({editor:this.editor,options:s.options},i)}),this.normalizeDOM(i,{inline:n,content:e}),i.innerHTML}return e}normalizeDOM(e,n){let{inline:r,content:i}=n;return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(s=>{var o;((o=s.nextSibling)===null||o===void 0?void 0:o.nodeType)===Node.TEXT_NODE&&!s.closest("pre")&&(s.nextSibling.textContent=s.nextSibling.textContent.replace(/^\n/,""))}),r&&this.normalizeInline(e,i),e}normalizeBlocks(e){const r=Object.values(this.editor.schema.nodes).filter(i=>i.isBlock).map(i=>{var s;return(s=i.spec.parseDOM)===null||s===void 0?void 0:s.map(o=>o.tag)}).flat().filter(Boolean).join(",");r&&[...e.querySelectorAll(r)].forEach(i=>{i.parentElement.matches("p")&&Jie(i)})}normalizeInline(e,n){var r;if((r=e.firstElementChild)!==null&&r!==void 0&&r.matches("p")){var i,s,o,a;const l=e.firstElementChild,{nextElementSibling:u}=l,c=(i=(s=n.match(/^\s+/))===null||s===void 0?void 0:s[0])!==null&&i!==void 0?i:"",f=u?"":(o=(a=n.match(/\s+$/))===null||a===void 0?void 0:a[0])!==null&&o!==void 0?o:"";if(n.match(/^\n\n/)){l.innerHTML=`${l.innerHTML}${f}`;return}Yie(l),e.innerHTML=`${c}${e.innerHTML}${f}`}}withPatchedRenderer(e){const n=r=>function(){const i=r(...arguments);return i===`
513
- `?i:i[i.length-1]===`
514
- `?i.slice(0,-1):i};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const Ese=It.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new Ut({key:new en("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return th.fromSchema(this.editor.schema).parseSlice(rE(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),kse=It.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=UV.Commands.config.addCommands();return{setContent:(e,n,r)=>i=>t.setContent(i.editor.storage.markdown.parser.parse(e),n,r)(i),insertContentAt:(e,n,r)=>i=>t.insertContentAt(e,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new xse(this.editor,this.options),serializer:new Ase(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[$ie.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),Ese.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),Sse=t=>mn({find:/--$/,replace:t??"—"}),Cse=t=>mn({find:/\.\.\.$/,replace:t??"…"}),Dse=t=>mn({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Tse=t=>mn({find:/"$/,replace:t??"”"}),Ose=t=>mn({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),_se=t=>mn({find:/'$/,replace:t??"’"}),Mse=t=>mn({find:/<-$/,replace:t??"←"}),Nse=t=>mn({find:/->$/,replace:t??"→"}),Pse=t=>mn({find:/\(c\)$/,replace:t??"©"}),Ise=t=>mn({find:/\(tm\)$/,replace:t??"™"}),Rse=t=>mn({find:/\(sm\)$/,replace:t??"℠"}),Lse=t=>mn({find:/\(r\)$/,replace:t??"®"}),Bse=t=>mn({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),Fse=t=>mn({find:/\+\/-$/,replace:t??"±"}),Use=t=>mn({find:/!=$/,replace:t??"≠"}),jse=t=>mn({find:/<<$/,replace:t??"«"}),Hse=t=>mn({find:/>>$/,replace:t??"»"}),Vse=t=>mn({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),zse=t=>mn({find:/\^2$/,replace:t??"²"}),$se=t=>mn({find:/\^3$/,replace:t??"³"}),Gse=t=>mn({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),Wse=t=>mn({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),Kse=It.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(Sse(this.options.emDash)),this.options.ellipsis!==!1&&t.push(Cse(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(Dse(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(Tse(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(Ose(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(_se(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(Mse(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(Nse(this.options.rightArrow)),this.options.copyright!==!1&&t.push(Pse(this.options.copyright)),this.options.trademark!==!1&&t.push(Ise(this.options.trademark)),this.options.servicemark!==!1&&t.push(Rse(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(Lse(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(Bse(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(Fse(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(Use(this.options.notEqual)),this.options.laquo!==!1&&t.push(jse(this.options.laquo)),this.options.raquo!==!1&&t.push(Hse(this.options.raquo)),this.options.multiplication!==!1&&t.push(Vse(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(zse(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push($se(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(Gse(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(Wse(this.options.threeQuarters)),t}});/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */const{entries:fP,setPrototypeOf:dP,isFrozen:qse,getPrototypeOf:Qse,getOwnPropertyDescriptor:Jse}=Object;let{freeze:Mr,seal:Ii,create:hP}=Object,{apply:sE,construct:oE}=typeof Reflect<"u"&&Reflect;Mr||(Mr=function(e){return e}),Ii||(Ii=function(e){return e}),sE||(sE=function(e,n,r){return e.apply(n,r)}),oE||(oE=function(e,n){return new e(...n)});const ob=pi(Array.prototype.forEach),pP=pi(Array.prototype.pop),_p=pi(Array.prototype.push),ab=pi(String.prototype.toLowerCase),aE=pi(String.prototype.toString),mP=pi(String.prototype.match),Mp=pi(String.prototype.replace),Yse=pi(String.prototype.indexOf),Xse=pi(String.prototype.trim),ss=pi(Object.prototype.hasOwnProperty),Nr=pi(RegExp.prototype.test),Np=Zse(TypeError);function pi(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return sE(t,e,r)}}function Zse(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return oE(t,n)}}function bt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ab;dP&&dP(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=n(i);s!==i&&(qse(e)||(e[r]=s),i=s)}t[i]=!0}return t}function eoe(t){for(let e=0;e<t.length;e++)ss(t,e)||(t[e]=null);return t}function fu(t){const e=hP(null);for(const[n,r]of fP(t))ss(t,n)&&(Array.isArray(r)?e[n]=eoe(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=fu(r):e[n]=r);return e}function Pp(t,e){for(;t!==null;){const r=Jse(t,e);if(r){if(r.get)return pi(r.get);if(typeof r.value=="function")return pi(r.value)}t=Qse(t)}function n(){return null}return n}const gP=Mr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),lE=Mr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),uE=Mr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),toe=Mr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cE=Mr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),noe=Mr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yP=Mr(["#text"]),bP=Mr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),fE=Mr(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),wP=Mr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),lb=Mr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),roe=Ii(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ioe=Ii(/<%[\w\W]*|[\w\W]*%>/gm),soe=Ii(/\${[\w\W]*}/gm),ooe=Ii(/^data-[\-\w.\u00B7-\uFFFF]/),aoe=Ii(/^aria-[\-\w]+$/),vP=Ii(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),loe=Ii(/^(?:\w+script|data):/i),uoe=Ii(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),AP=Ii(/^html$/i),coe=Ii(/^[a-z][.\w]*(-[.\w]+)+$/i);var xP=Object.freeze({__proto__:null,MUSTACHE_EXPR:roe,ERB_EXPR:ioe,TMPLIT_EXPR:soe,DATA_ATTR:ooe,ARIA_ATTR:aoe,IS_ALLOWED_URI:vP,IS_SCRIPT_OR_DATA:loe,ATTR_WHITESPACE:uoe,DOCTYPE_NAME:AP,CUSTOM_ELEMENT:coe});const Ip={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},foe=function(){return typeof window>"u"?null:window},doe=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}};function EP(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:foe();const e=Ee=>EP(Ee);if(e.version="3.1.6",e.removed=[],!t||!t.document||t.document.nodeType!==Ip.document)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:u,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:d,trustedTypes:h}=t,p=l.prototype,m=Pp(p,"cloneNode"),g=Pp(p,"remove"),y=Pp(p,"nextSibling"),v=Pp(p,"childNodes"),w=Pp(p,"parentNode");if(typeof o=="function"){const Ee=n.createElement("template");Ee.content&&Ee.content.ownerDocument&&(n=Ee.content.ownerDocument)}let b,E="";const{implementation:x,createNodeIterator:O,createDocumentFragment:S,getElementsByTagName:D}=n,{importNode:I}=r;let F={};e.isSupported=typeof fP=="function"&&typeof w=="function"&&x&&x.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Q,ERB_EXPR:V,TMPLIT_EXPR:B,DATA_ATTR:N,ARIA_ATTR:H,IS_SCRIPT_OR_DATA:K,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:X}=xP;let{IS_ALLOWED_URI:ie}=xP,le=null;const Pe=bt({},[...gP,...lE,...uE,...cE,...yP]);let xe=null;const Ie=bt({},[...bP,...fE,...wP,...lb]);let ke=Object.seal(hP(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,ne=null,G=!0,Z=!0,A=!1,P=!0,ue=!1,de=!0,oe=!1,we=!1,De=!1,pe=!1,Ke=!1,qe=!1,tt=!0,lt=!1;const ft="user-content-";let Ze=!0,Se=!1,Ue={},C=null;const M=bt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let R=null;const z=bt({},["audio","video","img","source","image","track"]);let se=null;const te=bt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",he="http://www.w3.org/2000/svg",U="http://www.w3.org/1999/xhtml";let re=U,ce=!1,ye=null;const ge=bt({},[fe,he,U],aE);let Le=null;const Ve=["application/xhtml+xml","text/html"],pt="text/html";let nt=null,et=null;const Lt=n.createElement("form"),Ct=function(q){return q instanceof RegExp||q instanceof Function},kt=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(et&&et===q)){if((!q||typeof q!="object")&&(q={}),q=fu(q),Le=Ve.indexOf(q.PARSER_MEDIA_TYPE)===-1?pt:q.PARSER_MEDIA_TYPE,nt=Le==="application/xhtml+xml"?aE:ab,le=ss(q,"ALLOWED_TAGS")?bt({},q.ALLOWED_TAGS,nt):Pe,xe=ss(q,"ALLOWED_ATTR")?bt({},q.ALLOWED_ATTR,nt):Ie,ye=ss(q,"ALLOWED_NAMESPACES")?bt({},q.ALLOWED_NAMESPACES,aE):ge,se=ss(q,"ADD_URI_SAFE_ATTR")?bt(fu(te),q.ADD_URI_SAFE_ATTR,nt):te,R=ss(q,"ADD_DATA_URI_TAGS")?bt(fu(z),q.ADD_DATA_URI_TAGS,nt):z,C=ss(q,"FORBID_CONTENTS")?bt({},q.FORBID_CONTENTS,nt):M,$=ss(q,"FORBID_TAGS")?bt({},q.FORBID_TAGS,nt):{},ne=ss(q,"FORBID_ATTR")?bt({},q.FORBID_ATTR,nt):{},Ue=ss(q,"USE_PROFILES")?q.USE_PROFILES:!1,G=q.ALLOW_ARIA_ATTR!==!1,Z=q.ALLOW_DATA_ATTR!==!1,A=q.ALLOW_UNKNOWN_PROTOCOLS||!1,P=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ue=q.SAFE_FOR_TEMPLATES||!1,de=q.SAFE_FOR_XML!==!1,oe=q.WHOLE_DOCUMENT||!1,pe=q.RETURN_DOM||!1,Ke=q.RETURN_DOM_FRAGMENT||!1,qe=q.RETURN_TRUSTED_TYPE||!1,De=q.FORCE_BODY||!1,tt=q.SANITIZE_DOM!==!1,lt=q.SANITIZE_NAMED_PROPS||!1,Ze=q.KEEP_CONTENT!==!1,Se=q.IN_PLACE||!1,ie=q.ALLOWED_URI_REGEXP||vP,re=q.NAMESPACE||U,ke=q.CUSTOM_ELEMENT_HANDLING||{},q.CUSTOM_ELEMENT_HANDLING&&Ct(q.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ke.tagNameCheck=q.CUSTOM_ELEMENT_HANDLING.tagNameCheck),q.CUSTOM_ELEMENT_HANDLING&&Ct(q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ke.attributeNameCheck=q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ke.allowCustomizedBuiltInElements=q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ue&&(Z=!1),Ke&&(pe=!0),Ue&&(le=bt({},yP),xe=[],Ue.html===!0&&(bt(le,gP),bt(xe,bP)),Ue.svg===!0&&(bt(le,lE),bt(xe,fE),bt(xe,lb)),Ue.svgFilters===!0&&(bt(le,uE),bt(xe,fE),bt(xe,lb)),Ue.mathMl===!0&&(bt(le,cE),bt(xe,wP),bt(xe,lb))),q.ADD_TAGS&&(le===Pe&&(le=fu(le)),bt(le,q.ADD_TAGS,nt)),q.ADD_ATTR&&(xe===Ie&&(xe=fu(xe)),bt(xe,q.ADD_ATTR,nt)),q.ADD_URI_SAFE_ATTR&&bt(se,q.ADD_URI_SAFE_ATTR,nt),q.FORBID_CONTENTS&&(C===M&&(C=fu(C)),bt(C,q.FORBID_CONTENTS,nt)),Ze&&(le["#text"]=!0),oe&&bt(le,["html","head","body"]),le.table&&(bt(le,["tbody"]),delete $.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Np('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Np('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=q.TRUSTED_TYPES_POLICY,E=b.createHTML("")}else b===void 0&&(b=doe(h,i)),b!==null&&typeof E=="string"&&(E=b.createHTML(""));Mr&&Mr(q),et=q}},Jt=bt({},["mi","mo","mn","ms","mtext"]),Yt=bt({},["foreignobject","annotation-xml"]),Xt=bt({},["title","style","font","a","script"]),Dn=bt({},[...lE,...uE,...toe]),Tn=bt({},[...cE,...noe]),On=function(q){let be=w(q);(!be||!be.tagName)&&(be={namespaceURI:re,tagName:"template"});const _e=ab(q.tagName),mt=ab(be.tagName);return ye[q.namespaceURI]?q.namespaceURI===he?be.namespaceURI===U?_e==="svg":be.namespaceURI===fe?_e==="svg"&&(mt==="annotation-xml"||Jt[mt]):!!Dn[_e]:q.namespaceURI===fe?be.namespaceURI===U?_e==="math":be.namespaceURI===he?_e==="math"&&Yt[mt]:!!Tn[_e]:q.namespaceURI===U?be.namespaceURI===he&&!Yt[mt]||be.namespaceURI===fe&&!Jt[mt]?!1:!Tn[_e]&&(Xt[_e]||!Dn[_e]):!!(Le==="application/xhtml+xml"&&ye[q.namespaceURI]):!1},Bt=function(q){_p(e.removed,{element:q});try{w(q).removeChild(q)}catch{g(q)}},hn=function(q,be){try{_p(e.removed,{attribute:be.getAttributeNode(q),from:be})}catch{_p(e.removed,{attribute:null,from:be})}if(be.removeAttribute(q),q==="is"&&!xe[q])if(pe||Ke)try{Bt(be)}catch{}else try{be.setAttribute(q,"")}catch{}},_n=function(q){let be=null,_e=null;if(De)q="<remove></remove>"+q;else{const sn=mP(q,/^[\r\n\t ]+/);_e=sn&&sn[0]}Le==="application/xhtml+xml"&&re===U&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const mt=b?b.createHTML(q):q;if(re===U)try{be=new d().parseFromString(mt,Le)}catch{}if(!be||!be.documentElement){be=x.createDocument(re,"template",null);try{be.documentElement.innerHTML=ce?E:mt}catch{}}const pn=be.body||be.documentElement;return q&&_e&&pn.insertBefore(n.createTextNode(_e),pn.childNodes[0]||null),re===U?D.call(be,oe?"html":"body")[0]:oe?be.documentElement:pn},Mn=function(q){return O.call(q.ownerDocument||q,q,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Nn=function(q){return q instanceof f&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof c)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},j=function(q){return typeof a=="function"&&q instanceof a},ve=function(q,be,_e){F[q]&&ob(F[q],mt=>{mt.call(e,be,_e,et)})},Re=function(q){let be=null;if(ve("beforeSanitizeElements",q,null),Nn(q))return Bt(q),!0;const _e=nt(q.nodeName);if(ve("uponSanitizeElement",q,{tagName:_e,allowedTags:le}),q.hasChildNodes()&&!j(q.firstElementChild)&&Nr(/<[/\w]/g,q.innerHTML)&&Nr(/<[/\w]/g,q.textContent)||q.nodeType===Ip.progressingInstruction||de&&q.nodeType===Ip.comment&&Nr(/<[/\w]/g,q.data))return Bt(q),!0;if(!le[_e]||$[_e]){if(!$[_e]&&Tt(_e)&&(ke.tagNameCheck instanceof RegExp&&Nr(ke.tagNameCheck,_e)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(_e)))return!1;if(Ze&&!C[_e]){const mt=w(q)||q.parentNode,pn=v(q)||q.childNodes;if(pn&&mt){const sn=pn.length;for(let Vt=sn-1;Vt>=0;--Vt){const ri=m(pn[Vt],!0);ri.__removalCount=(q.__removalCount||0)+1,mt.insertBefore(ri,y(q))}}}return Bt(q),!0}return q instanceof l&&!On(q)||(_e==="noscript"||_e==="noembed"||_e==="noframes")&&Nr(/<\/no(script|embed|frames)/i,q.innerHTML)?(Bt(q),!0):(ue&&q.nodeType===Ip.text&&(be=q.textContent,ob([Q,V,B],mt=>{be=Mp(be,mt," ")}),q.textContent!==be&&(_p(e.removed,{element:q.cloneNode()}),q.textContent=be)),ve("afterSanitizeElements",q,null),!1)},Ye=function(q,be,_e){if(tt&&(be==="id"||be==="name")&&(_e in n||_e in Lt))return!1;if(!(Z&&!ne[be]&&Nr(N,be))){if(!(G&&Nr(H,be))){if(!xe[be]||ne[be]){if(!(Tt(q)&&(ke.tagNameCheck instanceof RegExp&&Nr(ke.tagNameCheck,q)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(q))&&(ke.attributeNameCheck instanceof RegExp&&Nr(ke.attributeNameCheck,be)||ke.attributeNameCheck instanceof Function&&ke.attributeNameCheck(be))||be==="is"&&ke.allowCustomizedBuiltInElements&&(ke.tagNameCheck instanceof RegExp&&Nr(ke.tagNameCheck,_e)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(_e))))return!1}else if(!se[be]){if(!Nr(ie,Mp(_e,J,""))){if(!((be==="src"||be==="xlink:href"||be==="href")&&q!=="script"&&Yse(_e,"data:")===0&&R[q])){if(!(A&&!Nr(K,Mp(_e,J,"")))){if(_e)return!1}}}}}}return!0},Tt=function(q){return q!=="annotation-xml"&&mP(q,X)},Ft=function(q){ve("beforeSanitizeAttributes",q,null);const{attributes:be}=q;if(!be)return;const _e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe};let mt=be.length;for(;mt--;){const pn=be[mt],{name:sn,namespaceURI:Vt,value:ri}=pn,uc=nt(sn);let hr=sn==="value"?ri:Xse(ri);if(_e.attrName=uc,_e.attrValue=hr,_e.keepAttr=!0,_e.forceKeepAttr=void 0,ve("uponSanitizeAttribute",q,_e),hr=_e.attrValue,de&&Nr(/((--!?|])>)|<\/(style|title)/i,hr)){hn(sn,q);continue}if(_e.forceKeepAttr||(hn(sn,q),!_e.keepAttr))continue;if(!P&&Nr(/\/>/i,hr)){hn(sn,q);continue}ue&&ob([Q,V,B],K9=>{hr=Mp(hr,K9," ")});const W9=nt(q.nodeName);if(Ye(W9,uc,hr)){if(lt&&(uc==="id"||uc==="name")&&(hn(sn,q),hr=ft+hr),b&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Vt)switch(h.getAttributeType(W9,uc)){case"TrustedHTML":{hr=b.createHTML(hr);break}case"TrustedScriptURL":{hr=b.createScriptURL(hr);break}}try{Vt?q.setAttributeNS(Vt,sn,hr):q.setAttribute(sn,hr),Nn(q)?Bt(q):pP(e.removed)}catch{}}}ve("afterSanitizeAttributes",q,null)},vt=function Ee(q){let be=null;const _e=Mn(q);for(ve("beforeSanitizeShadowDOM",q,null);be=_e.nextNode();)ve("uponSanitizeShadowNode",be,null),!Re(be)&&(be.content instanceof s&&Ee(be.content),Ft(be));ve("afterSanitizeShadowDOM",q,null)};return e.sanitize=function(Ee){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},be=null,_e=null,mt=null,pn=null;if(ce=!Ee,ce&&(Ee="<!-->"),typeof Ee!="string"&&!j(Ee))if(typeof Ee.toString=="function"){if(Ee=Ee.toString(),typeof Ee!="string")throw Np("dirty is not a string, aborting")}else throw Np("toString is not a function");if(!e.isSupported)return Ee;if(we||kt(q),e.removed=[],typeof Ee=="string"&&(Se=!1),Se){if(Ee.nodeName){const ri=nt(Ee.nodeName);if(!le[ri]||$[ri])throw Np("root node is forbidden and cannot be sanitized in-place")}}else if(Ee instanceof a)be=_n("<!---->"),_e=be.ownerDocument.importNode(Ee,!0),_e.nodeType===Ip.element&&_e.nodeName==="BODY"||_e.nodeName==="HTML"?be=_e:be.appendChild(_e);else{if(!pe&&!ue&&!oe&&Ee.indexOf("<")===-1)return b&&qe?b.createHTML(Ee):Ee;if(be=_n(Ee),!be)return pe?null:qe?E:""}be&&De&&Bt(be.firstChild);const sn=Mn(Se?Ee:be);for(;mt=sn.nextNode();)Re(mt)||(mt.content instanceof s&&vt(mt.content),Ft(mt));if(Se)return Ee;if(pe){if(Ke)for(pn=S.call(be.ownerDocument);be.firstChild;)pn.appendChild(be.firstChild);else pn=be;return(xe.shadowroot||xe.shadowrootmode)&&(pn=I.call(r,pn,!0)),pn}let Vt=oe?be.outerHTML:be.innerHTML;return oe&&le["!doctype"]&&be.ownerDocument&&be.ownerDocument.doctype&&be.ownerDocument.doctype.name&&Nr(AP,be.ownerDocument.doctype.name)&&(Vt="<!DOCTYPE "+be.ownerDocument.doctype.name+`>
515
- `+Vt),ue&&ob([Q,V,B],ri=>{Vt=Mp(Vt,ri," ")}),b&&qe?b.createHTML(Vt):Vt},e.setConfig=function(){let Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kt(Ee),we=!0},e.clearConfig=function(){et=null,we=!1},e.isValidAttribute=function(Ee,q,be){et||kt({});const _e=nt(Ee),mt=nt(q);return Ye(_e,mt,be)},e.addHook=function(Ee,q){typeof q=="function"&&(F[Ee]=F[Ee]||[],_p(F[Ee],q))},e.removeHook=function(Ee){if(F[Ee])return pP(F[Ee])},e.removeHooks=function(Ee){F[Ee]&&(F[Ee]=[])},e.removeAllHooks=function(){F={}},e}var hoe=EP();const poe=new _r,moe=It.create({name:"markdownPasteHandler",addProseMirrorPlugins(){return[new Ut({props:{handlePaste:(t,e)=>{e.preventDefault();const n=e.clipboardData;if(!n)return!1;const r=n.getData("text/plain");if(!(r.startsWith("#")||r.startsWith("*")||r.startsWith("-")||r.startsWith(">")||r.startsWith("```")||r.match(/\[.*\]\(.*\)/)||r.match(/!\[.*\]\(.*\)/)||r.match(/\*\*(.*?)\*\*/g)||r.match(/\*(.*?)\*/g)||r.match(/`{1,3}[^`]+`{1,3}/g)))return!1;let s=poe.render(r);s=hoe.sanitize(s);const l=new DOMParser().parseFromString(s,"text/html").body,u=th.fromSchema(t.state.schema).parse(l),c=t.state.tr.replaceSelectionWith(u,!1);return t.dispatch(c),!0}}})]}}),goe=It.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize"}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;return((t==null?void 0:t.mode)||this.options.mode)==="textSize"?e.textBetween(0,e.content.size,void 0," ").length:e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;return e.textBetween(0,e.content.size," "," ").split(" ").filter(i=>i!=="").length}},addProseMirrorPlugins(){return[new Ut({key:new en("characterCount"),filterTransaction:(t,e)=>{const n=this.options.limit;if(!t.docChanged||n===0||n===null||n===void 0)return!0;const r=this.storage.characters({node:e.doc}),i=this.storage.characters({node:t.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!t.getMeta("paste"))return!1;const o=t.selection.$head.pos,a=i-n,l=o-a,u=o;return t.deleteRange(l,u),!(this.storage.characters({node:t.doc})>n)}})]}}),yoe=[uX,aX.configure({strike:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bold:{HTMLAttributes:{class:"select-text pointer-events-auto"}},italic:{HTMLAttributes:{class:"select-text pointer-events-auto"}},heading:{HTMLAttributes:{class:"select-text pointer-events-auto"}},paragraph:{HTMLAttributes:{class:"select-text pointer-events-auto"}},orderedList:{HTMLAttributes:{class:"flex flex-col items-start list-decimal list-outside space-y-4 ml-6"}},blockquote:{HTMLAttributes:{class:"rounded-lg bg-[#E8EBEC] p-5 font-serif italic text-black"}},codeBlock:{HTMLAttributes:{class:"rounded-lg bg-transparent border border-[#DDE2E4] p-5 font-mono font-medium text-black"},exitOnArrowDown:!0},code:{HTMLAttributes:{class:"rounded bg-transparent p-1.5 font-mono font-medium text-black text-sm",spellcheck:"false"}},history:!1,gapcursor:!1,dropcursor:!1,document:!1,horizontalRule:!1,bulletList:!1,listItem:!1}),vN,Kse,cX.configure({types:["heading","paragraph"]}),$X,RX.extend({exitable:!0,inclusive:!1}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto",rel:"noopener noreferrer"},validate:t=>/^https?:\/\//.test(t),openOnClick:!0,autolink:!0}),LX.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),UX.configure({multicolor:!0}),zX.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),lX,KX,jX.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),VX.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),cN.configure({HTMLAttributes:{class:"space-y-4 !ml-6"}}),xN.configure({HTMLAttributes:{class:"leading-normal"}}),dN.configure({width:3,color:"#d1d5db"}),hN,Cee,zte,Vte,...Hte,nZ.configure({uploadFn:wG}),WX,qX,XX,Gte,GX,moe,kse.configure({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!0,breaks:!0,transformPastedText:!0,transformCopiedText:!1}),goe],boe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",woe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",voe=t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},Aoe=t=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.classList.add("custom-cursor__label-container"),n.setAttribute("style",`border: 1px solid ${t.color}`);const r=document.createElement("img");r.src=boe,r.classList.add("custom-cursor__icon");const i=document.createElement("div");i.classList.add("custom-cursor__label");const s=document.createElement("span");s.classList.add("custom-cursor__text"),s.textContent=t.name;const o=document.createElement("img");return o.src=woe,o.classList.add("custom-cursor__badge"),i.appendChild(s),n.appendChild(r),n.appendChild(i),n.appendChild(o),e.appendChild(n),e},xoe=t=>t.isEns?Aoe(t):voe(t),Eoe="6.13.1";function koe(t,e,n){const r=e.split("|").map(s=>s.trim());for(let s=0;s<r.length;s++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const i=new Error(`invalid value for type ${e}`);throw i.code="INVALID_ARGUMENT",i.argument=`value.${n}`,i.value=t,i}async function br(t){const e=Object.keys(t);return(await Promise.all(e.map(r=>Promise.resolve(t[r])))).reduce((r,i,s)=>(r[e[s]]=i,r),{})}function $e(t,e,n){for(let r in e){let i=e[r];const s=n?n[r]:null;s&&koe(i,s,r),Object.defineProperty(t,r,{enumerable:!0,value:i,writable:!1})}}function yf(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(yf).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[t[r]&15];return n}if(typeof t=="object"&&typeof t.toJSON=="function")return yf(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(n=>`${yf(n)}: ${yf(t[n])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Qn(t,e){return t&&t.code===e}function dE(t){return Qn(t,"CALL_EXCEPTION")}function an(t,e,n){let r=t;{const s=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${yf(n)}`);for(const o in n){if(o==="shortMessage")continue;const a=n[o];s.push(o+"="+yf(a))}}s.push(`code=${e}`),s.push(`version=${Eoe}`),s.length&&(t+=" ("+s.join(", ")+")")}let i;switch(e){case"INVALID_ARGUMENT":i=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(t);break;default:i=new Error(t)}return $e(i,{code:e}),n&&Object.assign(i,n),i.shortMessage==null&&$e(i,{shortMessage:r}),i}function me(t,e,n,r){if(!t)throw an(e,n,r)}function ee(t,e,n,r){me(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function kP(t,e,n){n==null&&(n=""),n&&(n=": "+n),me(t>=e,"missing arguemnt"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),me(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function ub(t,e,n){if(n==null&&(n=""),t!==e){let r=n,i="new";n&&(r+=".",i+=" "+n),me(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function SP(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((t.length-2)/2);let i=2;for(let s=0;s<r.length;s++)r[s]=parseInt(t.substring(i,i+2),16),i+=2;return r}ee(!1,"invalid BytesLike value",e||"value",t)}function Dt(t,e){return SP(t,e,!1)}function Pr(t,e){return SP(t,e,!0)}function Qt(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function hE(t){return Qt(t,!0)||t instanceof Uint8Array}const CP="0123456789abcdef";function Be(t){const e=Dt(t);let n="0x";for(let r=0;r<e.length;r++){const i=e[r];n+=CP[(i&240)>>4]+CP[i&15]}return n}function An(t){return"0x"+t.map(e=>Be(e).substring(2)).join("")}function bf(t){return Qt(t,!0)?(t.length-2)/2:Dt(t).length}function bn(t,e,n){const r=Dt(t);return n!=null&&n>r.length&&me(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),Be(r.slice(e??0,n??r.length))}function DP(t,e,n){const r=Dt(t);me(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),n?i.set(r,e-r.length):i.set(r,0),Be(i)}function du(t,e){return DP(t,e,!0)}function Soe(t,e){return DP(t,e,!1)}const cb=BigInt(0),as=BigInt(1),wf=9007199254740991;function Coe(t,e){const n=fb(t,"value"),r=BigInt(st(e,"width"));if(me(n>>r===cb,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-as){const i=(as<<r)-as;return-((~n&i)+as)}return n}function TP(t,e){let n=He(t,"value");const r=BigInt(st(e,"width")),i=as<<r-as;if(n<cb){n=-n,me(n<=i,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const s=(as<<r)-as;return(~n&s)+as}else me(n<i,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function Rp(t,e){const n=fb(t,"value"),r=BigInt(st(e,"bits"));return n&(as<<r)-as}function He(t,e){switch(typeof t){case"bigint":return t;case"number":return ee(Number.isInteger(t),"underflow",e||"value",t),ee(t>=-wf&&t<=wf,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(n){ee(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}ee(!1,"invalid BigNumberish value",e||"value",t)}function fb(t,e){const n=He(t,e);return me(n>=cb,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const OP="0123456789abcdef";function pE(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=OP[n>>4],e+=OP[n&15];return BigInt(e)}return He(t)}function st(t,e){switch(typeof t){case"bigint":return ee(t>=-wf&&t<=wf,"overflow",e||"value",t),Number(t);case"number":return ee(Number.isInteger(t),"underflow",e||"value",t),ee(t>=-wf&&t<=wf,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return st(BigInt(t),e)}catch(n){ee(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}ee(!1,"invalid numeric value",e||"value",t)}function Doe(t){return st(pE(t))}function Fa(t,e){let r=fb(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const i=st(e,"width");for(me(i*2>=r.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<i*2;)r="0"+r}return"0x"+r}function Ir(t){const e=fb(t,"value");if(e===cb)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let i=0;i<r.length;i++){const s=i*2;r[i]=parseInt(n.substring(s,s+2),16)}return r}function hu(t){let e=Be(hE(t)?t:Ir(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const _P="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const MP=BigInt(58);function Toe(t){const e=Dt(t);let n=pE(e),r="";for(;n;)r=_P[Number(n%MP)]+r,n/=MP;for(let i=0;i<e.length&&!e[i];i++)r=_P[0]+r;return r}function Ooe(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return Dt(e)}function _oe(t){const e=Dt(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}class NP{constructor(e,n,r){W(this,"filter");W(this,"emitter");ae(this,rd);L(this,rd,n),$e(this,{emitter:e,filter:r})}async removeListener(){T(this,rd)!=null&&await this.emitter.off(this.filter,T(this,rd))}}rd=new WeakMap;function Moe(t,e,n,r,i){ee(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function PP(t,e,n,r,i){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let s=0;for(let o=e+1;o<n.length&&n[o]>>6===2;o++)s++;return s}return t==="OVERRUN"?n.length-e-1:0}function Noe(t,e,n,r,i){return t==="OVERLONG"?(ee(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),r.push(i),0):(r.push(65533),PP(t,e,n))}const Poe=Object.freeze({error:Moe,ignore:PP,replace:Noe});function Ioe(t,e){e==null&&(e=Poe.error);const n=Dt(t,"bytes"),r=[];let i=0;for(;i<n.length;){const s=n[i++];if(!(s>>7)){r.push(s);continue}let o=null,a=null;if((s&224)===192)o=1,a=127;else if((s&240)===224)o=2,a=2047;else if((s&248)===240)o=3,a=65535;else{(s&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,n,r):i+=e("BAD_PREFIX",i-1,n,r);continue}if(i-1+o>=n.length){i+=e("OVERRUN",i-1,n,r);continue}let l=s&(1<<8-o-1)-1;for(let u=0;u<o;u++){let c=n[i];if((c&192)!=128){i+=e("MISSING_CONTINUE",i,n,r),l=null;break}l=l<<6|c&63,i++}if(l!==null){if(l>1114111){i+=e("OUT_OF_RANGE",i-1-o,n,r,l);continue}if(l>=55296&&l<=57343){i+=e("UTF16_SURROGATE",i-1-o,n,r,l);continue}if(l<=a){i+=e("OVERLONG",i-1-o,n,r,l);continue}r.push(l)}}return r}function Eo(t,e){ee(typeof t=="string","invalid string value","str",t);let n=[];for(let r=0;r<t.length;r++){const i=t.charCodeAt(r);if(i<128)n.push(i);else if(i<2048)n.push(i>>6|192),n.push(i&63|128);else if((i&64512)==55296){r++;const s=t.charCodeAt(r);ee(r<t.length&&(s&64512)===56320,"invalid surrogate pair","str",t);const o=65536+((i&1023)<<10)+(s&1023);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128)}else n.push(i>>12|224),n.push(i>>6&63|128),n.push(i&63|128)}return new Uint8Array(n)}function Roe(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function vf(t,e){return Roe(Ioe(t,e))}function IP(t){async function e(n,r){me(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const i=n.url.split(":")[0].toLowerCase();me(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),me(i==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s=null;const o=new AbortController,a=setTimeout(()=>{s=an("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{s=an("request cancelled","CANCELLED"),o.abort()});const l={method:n.method,headers:new Headers(Array.from(n)),body:n.body||void 0,signal:o.signal};let u;try{u=await fetch(n.url,l)}catch(h){throw clearTimeout(a),s||h}clearTimeout(a);const c={};u.headers.forEach((h,p)=>{c[p.toLowerCase()]=h});const f=await u.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:c,body:d}}return e}const Loe=12,Boe=250;let RP=IP();const Foe=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Uoe=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let mE=!1;async function LP(t,e){try{const n=t.match(Foe);if(!n)throw new Error("invalid data");return new Ua(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?Ooe(n[3]):Hoe(n[3]))}catch{return new Ua(599,"BAD REQUEST (invalid data: URI)",{},null,new Rr(t))}}function BP(t){async function e(n,r){try{const i=n.match(Uoe);if(!i)throw new Error("invalid link");return new Rr(`${t}${i[2]}`)}catch{return new Ua(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Rr(n))}}return e}const db={data:LP,ipfs:BP("https://gateway.ipfs.io/ipfs/")},FP=new WeakMap;class joe{constructor(e){ae(this,Bu);ae(this,rl);L(this,Bu,[]),L(this,rl,!1),FP.set(e,()=>{if(!T(this,rl)){L(this,rl,!0);for(const n of T(this,Bu))setTimeout(()=>{n()},0);L(this,Bu,[])}})}addListener(e){me(!T(this,rl),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,Bu).push(e)}get cancelled(){return T(this,rl)}checkSignal(){me(!this.cancelled,"cancelled","CANCELLED",{})}}Bu=new WeakMap,rl=new WeakMap;function hb(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}const iw=class iw{constructor(e){ae(this,Hu);ae(this,id);ae(this,sd);ae(this,ps);ae(this,jo);ae(this,od);ae(this,ad);ae(this,Xn);ae(this,yi);ae(this,Ho);ae(this,Fu);ae(this,Uu);ae(this,ju);ae(this,Ys);ae(this,ms);ae(this,il);L(this,ad,String(e)),L(this,id,!1),L(this,sd,!0),L(this,ps,{}),L(this,jo,""),L(this,od,3e5),L(this,ms,{slotInterval:Boe,maxAttempts:Loe}),L(this,il,null)}get url(){return T(this,ad)}set url(e){L(this,ad,String(e))}get body(){return T(this,Xn)==null?null:new Uint8Array(T(this,Xn))}set body(e){if(e==null)L(this,Xn,void 0),L(this,yi,void 0);else if(typeof e=="string")L(this,Xn,Eo(e)),L(this,yi,"text/plain");else if(e instanceof Uint8Array)L(this,Xn,e),L(this,yi,"application/octet-stream");else if(typeof e=="object")L(this,Xn,Eo(JSON.stringify(e))),L(this,yi,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,Xn)!=null}get method(){return T(this,jo)?T(this,jo):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),L(this,jo,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,ps));return T(this,Ho)&&(e.authorization=`Basic ${_oe(Eo(T(this,Ho)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,yi)&&(e["content-type"]=T(this,yi)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){T(this,ps)[String(e).toLowerCase()]=String(n)}clearHeaders(){L(this,ps,{})}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const i=n[r++];return{value:[i,e[i]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,Ho)||null}setCredentials(e,n){ee(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),L(this,Ho,`${e}:${n}`)}get allowGzip(){return T(this,sd)}set allowGzip(e){L(this,sd,!!e)}get allowInsecureAuthentication(){return!!T(this,id)}set allowInsecureAuthentication(e){L(this,id,!!e)}get timeout(){return T(this,od)}set timeout(e){ee(e>=0,"timeout must be non-zero","timeout",e),L(this,od,e)}get preflightFunc(){return T(this,Fu)||null}set preflightFunc(e){L(this,Fu,e)}get processFunc(){return T(this,Uu)||null}set processFunc(e){L(this,Uu,e)}get retryFunc(){return T(this,ju)||null}set retryFunc(e){L(this,ju,e)}get getUrlFunc(){return T(this,il)||RP}set getUrlFunc(e){L(this,il,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,Xn)?Be(T(this,Xn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,ms).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,ms).maxAttempts=e.maxAttempts)}send(){return me(T(this,Ys)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),L(this,Ys,new joe(this)),Te(this,Hu,X0).call(this,0,UP()+this.timeout,0,this,new Ua(0,"",{},null,this))}cancel(){me(T(this,Ys)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=FP.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();me(this.method==="GET"&&(n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new iw(e);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,L(i,ps,Object.assign({},T(this,ps))),T(this,Xn)&&L(i,Xn,new Uint8Array(T(this,Xn))),L(i,yi,T(this,yi)),i}clone(){const e=new iw(this.url);return L(e,jo,T(this,jo)),T(this,Xn)&&L(e,Xn,T(this,Xn)),L(e,yi,T(this,yi)),L(e,ps,Object.assign({},T(this,ps))),L(e,Ho,T(this,Ho)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),L(e,Fu,T(this,Fu)),L(e,Uu,T(this,Uu)),L(e,ju,T(this,ju)),L(e,ms,Object.assign({},T(this,ms))),L(e,il,T(this,il)),e}static lockConfig(){mE=!0}static getGateway(e){return db[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(mE)throw new Error("gateways locked");db[e]=n}static registerGetUrl(e){if(mE)throw new Error("gateways locked");RP=e}static createGetUrlFunc(e){return IP()}static createDataGateway(){return LP}static createIpfsGatewayFunc(e){return BP(e)}};id=new WeakMap,sd=new WeakMap,ps=new WeakMap,jo=new WeakMap,od=new WeakMap,ad=new WeakMap,Xn=new WeakMap,yi=new WeakMap,Ho=new WeakMap,Fu=new WeakMap,Uu=new WeakMap,ju=new WeakMap,Ys=new WeakMap,ms=new WeakMap,il=new WeakMap,Hu=new WeakSet,X0=async function(e,n,r,i,s){var c,f,d;if(e>=T(this,ms).maxAttempts)return s.makeServerError("exceeded maximum retry limit");me(UP()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),r>0&&await Voe(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in db){const h=await db[a](o.url,hb(T(i,Ys)));if(h instanceof Ua){let p=h;if(this.processFunc){hb(T(i,Ys));try{p=await this.processFunc(o,p)}catch(m){(m.throttle==null||typeof m.stall!="number")&&p.makeServerError("error in post-processing function",m).assertOk()}}return p}o=h}this.preflightFunc&&(o=await this.preflightFunc(o));const l=await this.getUrlFunc(o,hb(T(i,Ys)));let u=new Ua(l.statusCode,l.statusMessage,l.headers,l.body,i);if(u.statusCode===301||u.statusCode===302){try{const h=u.headers.location||"";return Te(c=o.redirect(h),Hu,X0).call(c,e+1,n,0,i,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const h=u.headers["retry-after"];let p=T(this,ms).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),Te(f=o.clone(),Hu,X0).call(f,e+1,n,p,i,u)}if(this.processFunc){hb(T(i,Ys));try{u=await this.processFunc(o,u)}catch(h){(h.throttle==null||typeof h.stall!="number")&&u.makeServerError("error in post-processing function",h).assertOk();let p=T(this,ms).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),Te(d=o.clone(),Hu,X0).call(d,e+1,n,p,i,u)}}return u};let Rr=iw;const kC=class kC{constructor(e,n,r,i,s){ae(this,L0);ae(this,B0);ae(this,F0);ae(this,bi);ae(this,ld);ae(this,Vu);L(this,L0,e),L(this,B0,n),L(this,F0,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),L(this,bi,i==null?null:new Uint8Array(i)),L(this,ld,s||null),L(this,Vu,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,bi)?Be(T(this,bi)):"null"}>`}get statusCode(){return T(this,L0)}get statusMessage(){return T(this,B0)}get headers(){return Object.assign({},T(this,F0))}get body(){return T(this,bi)==null?null:new Uint8Array(T(this,bi))}get bodyText(){try{return T(this,bi)==null?"":vf(T(this,bi))}catch{me(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{me(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const i=n[r++];return{value:[i,e[i]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const i=new kC(599,r,this.headers,this.body,T(this,ld)||void 0);return L(i,Vu,{message:e,error:n}),i}throwThrottleError(e,n){n==null?n=-1:ee(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw $e(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,bi)!=null}get request(){return T(this,ld)}ok(){return T(this,Vu).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=T(this,Vu);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let i=null;try{T(this,bi)&&(i=vf(T(this,bi)))}catch{}me(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};L0=new WeakMap,B0=new WeakMap,F0=new WeakMap,bi=new WeakMap,ld=new WeakMap,Vu=new WeakMap;let Ua=kC;function UP(){return new Date().getTime()}function Hoe(t){return Eo(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function Voe(t){return new Promise(e=>setTimeout(e,t))}function zoe(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function jP(t,e,n){let r=0;for(let i=0;i<n;i++)r=r*256+t[e+i];return r}function HP(t,e,n,r){const i=[];for(;n<e+1+r;){const s=VP(t,n);i.push(s.result),n+=s.consumed,me(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:i}}function VP(t,e){me(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{me(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const i=jP(t,e+1,r);return n(e+1+r+i),HP(t,e,e+1+r,r+i)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),HP(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const i=jP(t,e+1,r);n(e+1+r+i);const s=Be(t.slice(e+1+r,e+1+r+i));return{consumed:1+r+i,result:s}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const i=Be(t.slice(e+1,e+1+r));return{consumed:1+r,result:i}}return{consumed:1,result:zoe(t[e])}}function pb(t){const e=Dt(t,"data"),n=VP(e,0);return ee(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function zP(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function $P(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(s){r=r.concat($P(s))}),r.length<=55)return r.unshift(192+r.length),r;const i=zP(r.length);return i.unshift(247+i.length),i.concat(r)}const e=Array.prototype.slice.call(Dt(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=zP(e.length);return n.unshift(183+n.length),n.concat(e)}const GP="0123456789abcdef";function pu(t){let e="0x";for(const n of $P(t))e+=GP[n>>4],e+=GP[n&15];return e}const Lr=32,gE=new Uint8Array(Lr),$oe=["then"],mb={},WP=new WeakMap;function mu(t){return WP.get(t)}function KP(t,e){WP.set(t,e)}function Lp(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function yE(t,e,n){return t.indexOf(null)>=0?e.map((r,i)=>r instanceof Af?yE(mu(r),r,n):r):t.reduce((r,i,s)=>{let o=e.getValue(i);return i in r||(n&&o instanceof Af&&(o=yE(mu(o),o,n)),r[i]=o),r},{})}const cd=class cd extends Array{constructor(...n){const r=n[0];let i=n[1],s=(n[2]||[]).slice(),o=!0;r!==mb&&(i=n,s=[],o=!1);super(i.length);ae(this,ud);i.forEach((u,c)=>{this[c]=u});const a=s.reduce((u,c)=>(typeof c=="string"&&u.set(c,(u.get(c)||0)+1),u),new Map);if(KP(this,Object.freeze(i.map((u,c)=>{const f=s[c];return f!=null&&a.get(f)===1?f:null}))),L(this,ud,[]),T(this,ud)==null&&T(this,ud),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(u,c,f)=>{if(typeof c=="string"){if(c.match(/^[0-9]+$/)){const h=st(c,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=u[h];return p instanceof Error&&Lp(`index ${h}`,p),p}if($oe.indexOf(c)>=0)return Reflect.get(u,c,f);const d=u[c];if(d instanceof Function)return function(...h){return d.apply(this===f?u:this,h)};if(!(c in u))return u.getValue.apply(this===f?u:this,[c])}return Reflect.get(u,c,f)}});return KP(l,mu(this)),l}toArray(n){const r=[];return this.forEach((i,s)=>{i instanceof Error&&Lp(`index ${s}`,i),n&&i instanceof cd&&(i=i.toArray(n)),r.push(i)}),r}toObject(n){const r=mu(this);return r.reduce((i,s,o)=>(me(s!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),yE(r,this,n)),{})}slice(n,r){n==null&&(n=0),n<0&&(n+=this.length,n<0&&(n=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const i=mu(this),s=[],o=[];for(let a=n;a<r;a++)s.push(this[a]),o.push(i[a]);return new cd(mb,s,o)}filter(n,r){const i=mu(this),s=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&Lp(`index ${a}`,l),n.call(r,l,a,this)&&(s.push(l),o.push(i[a]))}return new cd(mb,s,o)}map(n,r){const i=[];for(let s=0;s<this.length;s++){const o=this[s];o instanceof Error&&Lp(`index ${s}`,o),i.push(n.call(r,o,s,this))}return i}getValue(n){const r=mu(this).indexOf(n);if(r===-1)return;const i=this[r];return i instanceof Error&&Lp(`property ${JSON.stringify(n)}`,i.error),i}static fromItems(n,r){return new cd(mb,n,r)}};ud=new WeakMap;let Af=cd;function qP(t){let e=Ir(t);return me(e.length<=Lr,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Lr,offset:e.length}),e.length!==Lr&&(e=Pr(An([gE.slice(e.length%Lr),e]))),e}class ko{constructor(e,n,r,i){W(this,"name");W(this,"type");W(this,"localName");W(this,"dynamic");$e(this,{name:e,type:n,localName:r,dynamic:i},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){ee(!1,e,this.localName,n)}}class bE{constructor(){ae(this,fd);ae(this,Vo);ae(this,zu);L(this,Vo,[]),L(this,zu,0)}get data(){return An(T(this,Vo))}get length(){return T(this,zu)}appendWriter(e){return Te(this,fd,fw).call(this,Pr(e.data))}writeBytes(e){let n=Pr(e);const r=n.length%Lr;return r&&(n=Pr(An([n,gE.slice(r)]))),Te(this,fd,fw).call(this,n)}writeValue(e){return Te(this,fd,fw).call(this,qP(e))}writeUpdatableValue(){const e=T(this,Vo).length;return T(this,Vo).push(gE),L(this,zu,T(this,zu)+Lr),n=>{T(this,Vo)[e]=qP(n)}}}Vo=new WeakMap,zu=new WeakMap,fd=new WeakSet,fw=function(e){return T(this,Vo).push(e),L(this,zu,T(this,zu)+e.length),e.length};const SC=class SC{constructor(e,n,r){ae(this,Wu);W(this,"allowLoose");ae(this,Zr);ae(this,wi);ae(this,$u);ae(this,Gu);ae(this,sl);$e(this,{allowLoose:!!n}),L(this,Zr,Pr(e)),L(this,$u,0),L(this,Gu,null),L(this,sl,r??1024),L(this,wi,0)}get data(){return Be(T(this,Zr))}get dataLength(){return T(this,Zr).length}get consumed(){return T(this,wi)}get bytes(){return new Uint8Array(T(this,Zr))}subReader(e){const n=new SC(T(this,Zr).slice(T(this,wi)+e),this.allowLoose,T(this,sl));return L(n,Gu,this),n}readBytes(e,n){let r=Te(this,Wu,J9).call(this,0,e,!!n);return Te(this,Wu,PC).call(this,e),L(this,wi,T(this,wi)+r.length),r.slice(0,e)}readValue(){return pE(this.readBytes(Lr))}readIndex(){return Doe(this.readBytes(Lr))}};Zr=new WeakMap,wi=new WeakMap,$u=new WeakMap,Gu=new WeakMap,sl=new WeakMap,Wu=new WeakSet,PC=function(e){var n;if(T(this,Gu))return Te(n=T(this,Gu),Wu,PC).call(n,e);L(this,$u,T(this,$u)+e),me(T(this,sl)<1||T(this,$u)<=T(this,sl)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,sl)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Pr(T(this,Zr)),offset:T(this,wi),length:e,info:{bytesRead:T(this,$u),dataLength:this.dataLength}})},J9=function(e,n,r){let i=Math.ceil(n/Lr)*Lr;return T(this,wi)+i>T(this,Zr).length&&(this.allowLoose&&r&&T(this,wi)+n<=T(this,Zr).length?i=n:me(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Pr(T(this,Zr)),length:T(this,Zr).length,offset:T(this,wi)+i})),T(this,Zr).slice(T(this,wi),T(this,wi)+i)};let wE=SC;function gb(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function vE(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Goe(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");gb(t.outputLen),gb(t.blockLen)}function xf(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function QP(t,e){vE(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const AE=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const JP=t=>t instanceof Uint8Array,Woe=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),xE=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Ws=(t,e)=>t<<32-e|t>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function Koe(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function yb(t){if(typeof t=="string"&&(t=Koe(t)),!JP(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function qoe(...t){const e=new Uint8Array(t.reduce((r,i)=>r+i.length,0));let n=0;return t.forEach(r=>{if(!JP(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}class EE{clone(){return this._cloneInto()}}function kE(t){const e=r=>t().update(yb(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Qoe(t=32){if(AE&&typeof AE.getRandomValues=="function")return AE.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class YP extends EE{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Goe(e);const r=yb(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(e){return xf(this),this.iHash.update(e),this}digestInto(e){xf(this),vE(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:i,destroyed:s,blockLen:o,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const XP=(t,e,n)=>new YP(t,e).update(n).digest();XP.create=(t,e)=>new YP(t,e);function Joe(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,u=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+u,a,r)}class ZP extends EE{constructor(e,n,r,i){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=xE(this.buffer)}update(e){xf(this);const{view:n,buffer:r,blockLen:i}=this;e=yb(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=xE(e);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){xf(this),QP(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;Joe(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=xE(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,c[f],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%n&&e.buffer.set(r),e}}const Yoe=(t,e,n)=>t&e^~t&n,Xoe=(t,e,n)=>t&e^t&n^e&n,Zoe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ja=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ha=new Uint32Array(64);class eae extends ZP{constructor(){super(64,32,8,!1),this.A=ja[0]|0,this.B=ja[1]|0,this.C=ja[2]|0,this.D=ja[3]|0,this.E=ja[4]|0,this.F=ja[5]|0,this.G=ja[6]|0,this.H=ja[7]|0}get(){const{A:e,B:n,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[e,n,r,i,s,o,a,l]}set(e,n,r,i,s,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)Ha[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const d=Ha[f-15],h=Ha[f-2],p=Ws(d,7)^Ws(d,18)^d>>>3,m=Ws(h,17)^Ws(h,19)^h>>>10;Ha[f]=m+Ha[f-7]+p+Ha[f-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:u,H:c}=this;for(let f=0;f<64;f++){const d=Ws(a,6)^Ws(a,11)^Ws(a,25),h=c+d+Yoe(a,l,u)+Zoe[f]+Ha[f]|0,m=(Ws(r,2)^Ws(r,13)^Ws(r,22))+Xoe(r,i,s)|0;c=u,u=l,l=a,a=o+h|0,o=s,s=i,i=r,r=h+m|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,i,s,o,a,l,u,c)}roundClean(){Ha.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const eI=kE(()=>new eae),bb=BigInt(2**32-1),SE=BigInt(32);function tI(t,e=!1){return e?{h:Number(t&bb),l:Number(t>>SE&bb)}:{h:Number(t>>SE&bb)|0,l:Number(t&bb)|0}}function nI(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:o}=tI(t[i],e);[n[i],r[i]]=[s,o]}return[n,r]}const tae=(t,e)=>BigInt(t>>>0)<<SE|BigInt(e>>>0),nae=(t,e,n)=>t>>>n,rae=(t,e,n)=>t<<32-n|e>>>n,iae=(t,e,n)=>t>>>n|e<<32-n,sae=(t,e,n)=>t<<32-n|e>>>n,oae=(t,e,n)=>t<<64-n|e>>>n-32,aae=(t,e,n)=>t>>>n-32|e<<64-n,lae=(t,e)=>e,uae=(t,e)=>t,rI=(t,e,n)=>t<<n|e>>>32-n,iI=(t,e,n)=>e<<n|t>>>32-n,sI=(t,e,n)=>e<<n-32|t>>>64-n,oI=(t,e,n)=>t<<n-32|e>>>64-n;function cae(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:i|0}}const ct={fromBig:tI,split:nI,toBig:tae,shrSH:nae,shrSL:rae,rotrSH:iae,rotrSL:sae,rotrBH:oae,rotrBL:aae,rotr32H:lae,rotr32L:uae,rotlSH:rI,rotlSL:iI,rotlBH:sI,rotlBL:oI,add:cae,add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,s)=>e+n+r+i+s+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[fae,dae]=ct.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Va=new Uint32Array(80),za=new Uint32Array(80);class hae extends ZP{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:i,Ch:s,Cl:o,Dh:a,Dl:l,Eh:u,El:c,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:g}=this;return[e,n,r,i,s,o,a,l,u,c,f,d,h,p,m,g]}set(e,n,r,i,s,o,a,l,u,c,f,d,h,p,m,g){this.Ah=e|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=u|0,this.El=c|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(e,n){for(let w=0;w<16;w++,n+=4)Va[w]=e.getUint32(n),za[w]=e.getUint32(n+=4);for(let w=16;w<80;w++){const b=Va[w-15]|0,E=za[w-15]|0,x=ct.rotrSH(b,E,1)^ct.rotrSH(b,E,8)^ct.shrSH(b,E,7),O=ct.rotrSL(b,E,1)^ct.rotrSL(b,E,8)^ct.shrSL(b,E,7),S=Va[w-2]|0,D=za[w-2]|0,I=ct.rotrSH(S,D,19)^ct.rotrBH(S,D,61)^ct.shrSH(S,D,6),F=ct.rotrSL(S,D,19)^ct.rotrBL(S,D,61)^ct.shrSL(S,D,6),Q=ct.add4L(O,F,za[w-7],za[w-16]),V=ct.add4H(Q,x,I,Va[w-7],Va[w-16]);Va[w]=V|0,za[w]=Q|0}let{Ah:r,Al:i,Bh:s,Bl:o,Ch:a,Cl:l,Dh:u,Dl:c,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:g,Hh:y,Hl:v}=this;for(let w=0;w<80;w++){const b=ct.rotrSH(f,d,14)^ct.rotrSH(f,d,18)^ct.rotrBH(f,d,41),E=ct.rotrSL(f,d,14)^ct.rotrSL(f,d,18)^ct.rotrBL(f,d,41),x=f&h^~f&m,O=d&p^~d&g,S=ct.add5L(v,E,O,dae[w],za[w]),D=ct.add5H(S,y,b,x,fae[w],Va[w]),I=S|0,F=ct.rotrSH(r,i,28)^ct.rotrBH(r,i,34)^ct.rotrBH(r,i,39),Q=ct.rotrSL(r,i,28)^ct.rotrBL(r,i,34)^ct.rotrBL(r,i,39),V=r&s^r&a^s&a,B=i&o^i&l^o&l;y=m|0,v=g|0,m=h|0,g=p|0,h=f|0,p=d|0,{h:f,l:d}=ct.add(u|0,c|0,D|0,I|0),u=a|0,c=l|0,a=s|0,l=o|0,s=r|0,o=i|0;const N=ct.add3L(I,Q,B);r=ct.add3H(N,D,F,V),i=N|0}({h:r,l:i}=ct.add(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:o}=ct.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l}=ct.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:u,l:c}=ct.add(this.Dh|0,this.Dl|0,u|0,c|0),{h:f,l:d}=ct.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=ct.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:g}=ct.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:y,l:v}=ct.add(this.Hh|0,this.Hl|0,y|0,v|0),this.set(r,i,s,o,a,l,u,c,f,d,h,p,m,g,y,v)}roundClean(){Va.fill(0),za.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const pae=kE(()=>new hae);function mae(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const aI=mae();aI.crypto||aI.msCrypto;function gae(t){switch(t){case"sha256":return eI.create();case"sha512":return pae.create()}ee(!1,"invalid hashing algorithm name","algorithm",t)}const[lI,uI,cI]=[[],[],[]],yae=BigInt(0),Bp=BigInt(1),bae=BigInt(2),wae=BigInt(7),vae=BigInt(256),Aae=BigInt(113);for(let t=0,e=Bp,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],lI.push(2*(5*r+n)),uI.push((t+1)*(t+2)/2%64);let i=yae;for(let s=0;s<7;s++)e=(e<<Bp^(e>>wae)*Aae)%vae,e&bae&&(i^=Bp<<(Bp<<BigInt(s))-Bp);cI.push(i)}const[xae,Eae]=nI(cI,!0),fI=(t,e,n)=>n>32?sI(t,e,n):rI(t,e,n),dI=(t,e,n)=>n>32?oI(t,e,n):iI(t,e,n);function kae(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,u=n[l],c=n[l+1],f=fI(u,c,1)^n[a],d=dI(u,c,1)^n[a+1];for(let h=0;h<50;h+=10)t[o+h]^=f,t[o+h+1]^=d}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=uI[o],l=fI(i,s,a),u=dI(i,s,a),c=lI[o];i=t[c],s=t[c+1],t[c]=l,t[c+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}t[0]^=xae[r],t[1]^=Eae[r]}n.fill(0)}class CE extends EE{constructor(e,n,r,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,gb(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Woe(this.state)}keccak(){kae(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){xf(this);const{blockLen:n,state:r}=this;e=yb(e);const i=e.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)r[this.pos++]^=e[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:i}=this;e[r]^=n,n&128&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){xf(this,!1),vE(e),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=e.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);e.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return gb(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(QP(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new CE(n,r,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=r,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Sae=((t,e,n)=>kE(()=>new CE(e,t,n)))(1,136,256/8);let hI=!1;const pI=function(t){return Sae(t)};let mI=pI;function Bn(t){const e=Dt(t,"data");return Be(mI(e))}Bn._=pI,Bn.lock=function(){hI=!0},Bn.register=function(t){if(hI)throw new TypeError("keccak256 is locked");mI=t},Object.freeze(Bn);const gI=function(t){return gae("sha256").update(t).digest()};let yI=gI,bI=!1;function Ef(t){const e=Dt(t,"data");return Be(yI(e))}Ef._=gI,Ef.lock=function(){bI=!0},Ef.register=function(t){if(bI)throw new Error("sha256 is locked");yI=t},Object.freeze(Ef),Object.freeze(Ef);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const wI=BigInt(0),wb=BigInt(1),Cae=BigInt(2),vb=t=>t instanceof Uint8Array,Dae=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function kf(t){if(!vb(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=Dae[t[n]];return e}function vI(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function DE(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function Sf(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const i=r*2,s=t.slice(i,i+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function gu(t){return DE(kf(t))}function TE(t){if(!vb(t))throw new Error("Uint8Array expected");return DE(kf(Uint8Array.from(t).reverse()))}function Cf(t,e){return Sf(t.toString(16).padStart(e*2,"0"))}function OE(t,e){return Cf(t,e).reverse()}function Tae(t){return Sf(vI(t))}function ls(t,e,n){let r;if(typeof e=="string")try{r=Sf(e)}catch(s){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${s}`)}else if(vb(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(`${t} expected ${n} bytes, got ${i}`);return r}function Fp(...t){const e=new Uint8Array(t.reduce((r,i)=>r+i.length,0));let n=0;return t.forEach(r=>{if(!vb(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function Oae(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function _ae(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Mae(t){let e;for(e=0;t>wI;t>>=wb,e+=1);return e}function Nae(t,e){return t>>BigInt(e)&wb}const Pae=(t,e,n)=>t|(n?wb:wI)<<BigInt(e),_E=t=>(Cae<<BigInt(t-1))-wb,ME=t=>new Uint8Array(t),AI=t=>Uint8Array.from(t);function xI(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=ME(t),i=ME(t),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...f)=>n(i,r,...f),l=(f=ME())=>{i=a(AI([0]),f),r=a(),f.length!==0&&(i=a(AI([1]),f),r=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<e;){r=a();const h=r.slice();d.push(h),f+=r.length}return Fp(...d)};return(f,d)=>{o(),l(f);let h;for(;!(h=d(u()));)l();return o(),h}}const Iae={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Up(t,e,n={}){const r=(i,s,o)=>{const a=Iae[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const l=t[i];if(!(o&&l===void 0)&&!a(l,t))throw new Error(`Invalid param ${String(i)}=${l} (${typeof l}), expected ${s}`)};for(const[i,s]of Object.entries(e))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return t}const Rae=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Nae,bitLen:Mae,bitMask:_E,bitSet:Pae,bytesToHex:kf,bytesToNumberBE:gu,bytesToNumberLE:TE,concatBytes:Fp,createHmacDrbg:xI,ensureBytes:ls,equalBytes:Oae,hexToBytes:Sf,hexToNumber:DE,numberToBytesBE:Cf,numberToBytesLE:OE,numberToHexUnpadded:vI,numberToVarBytesBE:Tae,utf8ToBytes:_ae,validateObject:Up},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Jn=BigInt(0),xn=BigInt(1),yu=BigInt(2),Lae=BigInt(3),NE=BigInt(4),EI=BigInt(5),kI=BigInt(8);BigInt(9),BigInt(16);function Jr(t,e){const n=t%e;return n>=Jn?n:e+n}function Bae(t,e,n){if(n<=Jn||e<Jn)throw new Error("Expected power/modulo > 0");if(n===xn)return Jn;let r=xn;for(;e>Jn;)e&xn&&(r=r*t%n),t=t*t%n,e>>=xn;return r}function Ri(t,e,n){let r=t;for(;e-- >Jn;)r*=r,r%=n;return r}function PE(t,e){if(t===Jn||e<=Jn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Jr(t,e),r=e,i=Jn,s=xn;for(;n!==Jn;){const a=r/n,l=r%n,u=i-s*a;r=n,n=l,i=s,s=u}if(r!==xn)throw new Error("invert: does not exist");return Jr(i,e)}function Fae(t){const e=(t-xn)/yu;let n,r,i;for(n=t-xn,r=0;n%yu===Jn;n/=yu,r++);for(i=yu;i<t&&Bae(i,e,t)!==t-xn;i++);if(r===1){const o=(t+xn)/NE;return function(l,u){const c=l.pow(u,o);if(!l.eql(l.sqr(c),u))throw new Error("Cannot find square root");return c}}const s=(n+xn)/yu;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,c=a.pow(a.mul(a.ONE,i),n),f=a.pow(l,s),d=a.pow(l,n);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<u&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(c,xn<<BigInt(u-h-1));c=a.sqr(p),f=a.mul(f,p),d=a.mul(d,c),u=h}return f}}function Uae(t){if(t%NE===Lae){const e=(t+xn)/NE;return function(r,i){const s=r.pow(i,e);if(!r.eql(r.sqr(s),i))throw new Error("Cannot find square root");return s}}if(t%kI===EI){const e=(t-EI)/kI;return function(r,i){const s=r.mul(i,yu),o=r.pow(s,e),a=r.mul(i,o),l=r.mul(r.mul(a,yu),o),u=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return Fae(t)}const jae=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Hae(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=jae.reduce((r,i)=>(r[i]="function",r),e);return Up(t,n)}function Vae(t,e,n){if(n<Jn)throw new Error("Expected power > 0");if(n===Jn)return t.ONE;if(n===xn)return e;let r=t.ONE,i=e;for(;n>Jn;)n&xn&&(r=t.mul(r,i)),i=t.sqr(i),n>>=xn;return r}function zae(t,e){const n=new Array(e.length),r=e.reduce((s,o,a)=>t.is0(o)?s:(n[a]=s,t.mul(s,o)),t.ONE),i=t.inv(r);return e.reduceRight((s,o,a)=>t.is0(o)?s:(n[a]=t.mul(s,n[a]),t.mul(s,o)),i),n}function SI(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function $ae(t,e,n=!1,r={}){if(t<=Jn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=SI(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Uae(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:_E(i),ZERO:Jn,ONE:xn,create:l=>Jr(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return Jn<=l&&l<t},is0:l=>l===Jn,isOdd:l=>(l&xn)===xn,neg:l=>Jr(-l,t),eql:(l,u)=>l===u,sqr:l=>Jr(l*l,t),add:(l,u)=>Jr(l+u,t),sub:(l,u)=>Jr(l-u,t),mul:(l,u)=>Jr(l*u,t),pow:(l,u)=>Vae(a,l,u),div:(l,u)=>Jr(l*PE(u,t),t),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>PE(l,t),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>zae(a,l),cmov:(l,u,c)=>c?u:l,toBytes:l=>n?OE(l,s):Cf(l,s),fromBytes:l=>{if(l.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${l.length}`);return n?TE(l):gu(l)}});return Object.freeze(a)}function CI(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function DI(t){const e=CI(t);return e+Math.ceil(e/2)}function Gae(t,e,n=!1){const r=t.length,i=CI(e),s=DI(e);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);const o=n?gu(t):TE(t),a=Jr(o,e-xn)+xn;return n?OE(a,i):Cf(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Wae=BigInt(0),IE=BigInt(1);function Kae(t,e){const n=(i,s)=>{const o=s.negate();return i?o:s},r=i=>{const s=Math.ceil(e/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:n,unsafeLadder(i,s){let o=t.ZERO,a=i;for(;s>Wae;)s&IE&&(o=o.add(a)),a=a.double(),s>>=IE;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=r(s),l=[];let u=i,c=u;for(let f=0;f<o;f++){c=u,l.push(c);for(let d=1;d<a;d++)c=c.add(u),l.push(c);u=c.double()}return l},wNAF(i,s,o){const{windows:a,windowSize:l}=r(i);let u=t.ZERO,c=t.BASE;const f=BigInt(2**i-1),d=2**i,h=BigInt(i);for(let p=0;p<a;p++){const m=p*l;let g=Number(o&f);o>>=h,g>l&&(g-=d,o+=IE);const y=m,v=m+Math.abs(g)-1,w=p%2!==0,b=g<0;g===0?c=c.add(n(w,s[y])):u=u.add(n(b,s[v]))}return{p:u,f:c}},wNAFCached(i,s,o,a){const l=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,l),l!==1&&s.set(i,a(u))),this.wNAF(l,u,o)}}}function TI(t){return Hae(t.Fp),Up(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...SI(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qae(t){const e=TI(t);Up(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Qae,hexToBytes:Jae}=Rae,bu={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=bu;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Qae(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=bu,n=typeof t=="string"?Jae(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=bu._parseInt(n.subarray(2)),{d:o,l:a}=bu._parseInt(s);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const c=u.toString(16);return c.length&1?`0${c}`:c},r=e(n(t.s)),i=e(n(t.r)),s=r.length/2,o=i.length/2,a=n(s),l=n(o);return`30${n(o+s+4)}02${l}${i}02${a}${r}`}},So=BigInt(0),Li=BigInt(1);BigInt(2);const OI=BigInt(3);BigInt(4);function Yae(t){const e=qae(t),{Fp:n}=e,r=e.toBytes||((p,m,g)=>{const y=m.toAffine();return Fp(Uint8Array.from([4]),n.toBytes(y.x),n.toBytes(y.y))}),i=e.fromBytes||(p=>{const m=p.subarray(1),g=n.fromBytes(m.subarray(0,n.BYTES)),y=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:g,y}});function s(p){const{a:m,b:g}=e,y=n.sqr(p),v=n.mul(y,p);return n.add(n.add(v,n.mul(p,m)),g)}if(!n.eql(n.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&So<p&&p<e.n}function a(p){if(!o(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(p){const{allowedPrivateKeyLengths:m,nByteLength:g,wrapPrivateKey:y,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=kf(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(g*2,"0")}let w;try{w=typeof p=="bigint"?p:gu(ls("private key",p,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`)}return y&&(w=Jr(w,v)),a(w),w}const u=new Map;function c(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,g,y){if(this.px=m,this.py=g,this.pz=y,m==null||!n.isValid(m))throw new Error("x required");if(g==null||!n.isValid(g))throw new Error("y required");if(y==null||!n.isValid(y))throw new Error("z required")}static fromAffine(m){const{x:g,y}=m||{};if(!m||!n.isValid(g)||!n.isValid(y))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=w=>n.eql(w,n.ZERO);return v(g)&&v(y)?f.ZERO:new f(g,y,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const g=n.invertBatch(m.map(y=>y.pz));return m.map((y,v)=>y.toAffine(g[v])).map(f.fromAffine)}static fromHex(m){const g=f.fromAffine(i(ls("pointHex",m)));return g.assertValidity(),g}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:g}=this.toAffine();if(!n.isValid(m)||!n.isValid(g))throw new Error("bad point: x or y not FE");const y=n.sqr(g),v=s(m);if(!n.eql(y,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){c(m);const{px:g,py:y,pz:v}=this,{px:w,py:b,pz:E}=m,x=n.eql(n.mul(g,E),n.mul(w,v)),O=n.eql(n.mul(y,E),n.mul(b,v));return x&&O}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,y=n.mul(g,OI),{px:v,py:w,pz:b}=this;let E=n.ZERO,x=n.ZERO,O=n.ZERO,S=n.mul(v,v),D=n.mul(w,w),I=n.mul(b,b),F=n.mul(v,w);return F=n.add(F,F),O=n.mul(v,b),O=n.add(O,O),E=n.mul(m,O),x=n.mul(y,I),x=n.add(E,x),E=n.sub(D,x),x=n.add(D,x),x=n.mul(E,x),E=n.mul(F,E),O=n.mul(y,O),I=n.mul(m,I),F=n.sub(S,I),F=n.mul(m,F),F=n.add(F,O),O=n.add(S,S),S=n.add(O,S),S=n.add(S,I),S=n.mul(S,F),x=n.add(x,S),I=n.mul(w,b),I=n.add(I,I),S=n.mul(I,F),E=n.sub(E,S),O=n.mul(I,D),O=n.add(O,O),O=n.add(O,O),new f(E,x,O)}add(m){c(m);const{px:g,py:y,pz:v}=this,{px:w,py:b,pz:E}=m;let x=n.ZERO,O=n.ZERO,S=n.ZERO;const D=e.a,I=n.mul(e.b,OI);let F=n.mul(g,w),Q=n.mul(y,b),V=n.mul(v,E),B=n.add(g,y),N=n.add(w,b);B=n.mul(B,N),N=n.add(F,Q),B=n.sub(B,N),N=n.add(g,v);let H=n.add(w,E);return N=n.mul(N,H),H=n.add(F,V),N=n.sub(N,H),H=n.add(y,v),x=n.add(b,E),H=n.mul(H,x),x=n.add(Q,V),H=n.sub(H,x),S=n.mul(D,N),x=n.mul(I,V),S=n.add(x,S),x=n.sub(Q,S),S=n.add(Q,S),O=n.mul(x,S),Q=n.add(F,F),Q=n.add(Q,F),V=n.mul(D,V),N=n.mul(I,N),Q=n.add(Q,V),V=n.sub(F,V),V=n.mul(D,V),N=n.add(N,V),F=n.mul(Q,N),O=n.add(O,F),F=n.mul(H,N),x=n.mul(B,x),x=n.sub(x,F),F=n.mul(B,Q),S=n.mul(H,S),S=n.add(S,F),new f(x,O,S)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,u,m,g=>{const y=n.invertBatch(g.map(v=>v.pz));return g.map((v,w)=>v.toAffine(y[w])).map(f.fromAffine)})}multiplyUnsafe(m){const g=f.ZERO;if(m===So)return g;if(a(m),m===Li)return this;const{endo:y}=e;if(!y)return h.unsafeLadder(this,m);let{k1neg:v,k1:w,k2neg:b,k2:E}=y.splitScalar(m),x=g,O=g,S=this;for(;w>So||E>So;)w&Li&&(x=x.add(S)),E&Li&&(O=O.add(S)),S=S.double(),w>>=Li,E>>=Li;return v&&(x=x.negate()),b&&(O=O.negate()),O=new f(n.mul(O.px,y.beta),O.py,O.pz),x.add(O)}multiply(m){a(m);let g=m,y,v;const{endo:w}=e;if(w){const{k1neg:b,k1:E,k2neg:x,k2:O}=w.splitScalar(g);let{p:S,f:D}=this.wNAF(E),{p:I,f:F}=this.wNAF(O);S=h.constTimeNegate(b,S),I=h.constTimeNegate(x,I),I=new f(n.mul(I.px,w.beta),I.py,I.pz),y=S.add(I),v=D.add(F)}else{const{p:b,f:E}=this.wNAF(g);y=b,v=E}return f.normalizeZ([y,v])[0]}multiplyAndAddUnsafe(m,g,y){const v=f.BASE,w=(E,x)=>x===So||x===Li||!E.equals(v)?E.multiplyUnsafe(x):E.multiply(x),b=w(this,g).add(w(m,y));return b.is0()?void 0:b}toAffine(m){const{px:g,py:y,pz:v}=this,w=this.is0();m==null&&(m=w?n.ONE:n.inv(v));const b=n.mul(g,m),E=n.mul(y,m),x=n.mul(v,m);if(w)return{x:n.ZERO,y:n.ZERO};if(!n.eql(x,n.ONE))throw new Error("invZ was invalid");return{x:b,y:E}}isTorsionFree(){const{h:m,isTorsionFree:g}=e;if(m===Li)return!0;if(g)return g(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:g}=e;return m===Li?this:g?g(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return kf(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const d=e.nBitLength,h=Kae(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:s,isWithinCurveOrder:o}}function Xae(t){const e=TI(t);return Up(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Zae(t){const e=Xae(t),{Fp:n,n:r}=e,i=n.BYTES+1,s=2*n.BYTES+1;function o(N){return So<N&&N<n.ORDER}function a(N){return Jr(N,r)}function l(N){return PE(N,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:f,isWithinCurveOrder:d}=Yae({...e,toBytes(N,H,K){const J=H.toAffine(),X=n.toBytes(J.x),ie=Fp;return K?ie(Uint8Array.from([H.hasEvenY()?2:3]),X):ie(Uint8Array.from([4]),X,n.toBytes(J.y))},fromBytes(N){const H=N.length,K=N[0],J=N.subarray(1);if(H===i&&(K===2||K===3)){const X=gu(J);if(!o(X))throw new Error("Point is not on curve");const ie=f(X);let le=n.sqrt(ie);const Pe=(le&Li)===Li;return(K&1)===1!==Pe&&(le=n.neg(le)),{x:X,y:le}}else if(H===s&&K===4){const X=n.fromBytes(J.subarray(0,n.BYTES)),ie=n.fromBytes(J.subarray(n.BYTES,2*n.BYTES));return{x:X,y:ie}}else throw new Error(`Point of length ${H} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),h=N=>kf(Cf(N,e.nByteLength));function p(N){const H=r>>Li;return N>H}function m(N){return p(N)?a(-N):N}const g=(N,H,K)=>gu(N.slice(H,K));class y{constructor(H,K,J){this.r=H,this.s=K,this.recovery=J,this.assertValidity()}static fromCompact(H){const K=e.nByteLength;return H=ls("compactSignature",H,K*2),new y(g(H,0,K),g(H,K,2*K))}static fromDER(H){const{r:K,s:J}=bu.toSig(ls("DER",H));return new y(K,J)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(H){return new y(this.r,this.s,H)}recoverPublicKey(H){const{r:K,s:J,recovery:X}=this,ie=O(ls("msgHash",H));if(X==null||![0,1,2,3].includes(X))throw new Error("recovery id invalid");const le=X===2||X===3?K+e.n:K;if(le>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const Pe=X&1?"03":"02",xe=u.fromHex(Pe+h(le)),Ie=l(le),ke=a(-ie*Ie),$=a(J*Ie),ne=u.BASE.multiplyAndAddUnsafe(xe,ke,$);if(!ne)throw new Error("point at infinify");return ne.assertValidity(),ne}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Sf(this.toDERHex())}toDERHex(){return bu.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Sf(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(N){try{return c(N),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const N=DI(e.n);return Gae(e.randomBytes(N),e.n)},precompute(N=8,H=u.BASE){return H._setWindowSize(N),H.multiply(BigInt(3)),H}};function w(N,H=!0){return u.fromPrivateKey(N).toRawBytes(H)}function b(N){const H=N instanceof Uint8Array,K=typeof N=="string",J=(H||K)&&N.length;return H?J===i||J===s:K?J===2*i||J===2*s:N instanceof u}function E(N,H,K=!0){if(b(N))throw new Error("first arg must be private key");if(!b(H))throw new Error("second arg must be public key");return u.fromHex(H).multiply(c(N)).toRawBytes(K)}const x=e.bits2int||function(N){const H=gu(N),K=N.length*8-e.nBitLength;return K>0?H>>BigInt(K):H},O=e.bits2int_modN||function(N){return a(x(N))},S=_E(e.nBitLength);function D(N){if(typeof N!="bigint")throw new Error("bigint expected");if(!(So<=N&&N<S))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Cf(N,e.nByteLength)}function I(N,H,K=F){if(["recovered","canonical"].some(Z=>Z in K))throw new Error("sign() legacy options not supported");const{hash:J,randomBytes:X}=e;let{lowS:ie,prehash:le,extraEntropy:Pe}=K;ie==null&&(ie=!0),N=ls("msgHash",N),le&&(N=ls("prehashed msgHash",J(N)));const xe=O(N),Ie=c(H),ke=[D(Ie),D(xe)];if(Pe!=null){const Z=Pe===!0?X(n.BYTES):Pe;ke.push(ls("extraEntropy",Z))}const $=Fp(...ke),ne=xe;function G(Z){const A=x(Z);if(!d(A))return;const P=l(A),ue=u.BASE.multiply(A).toAffine(),de=a(ue.x);if(de===So)return;const oe=a(P*a(ne+de*Ie));if(oe===So)return;let we=(ue.x===de?0:2)|Number(ue.y&Li),De=oe;return ie&&p(oe)&&(De=m(oe),we^=1),new y(de,De,we)}return{seed:$,k2sig:G}}const F={lowS:e.lowS,prehash:!1},Q={lowS:e.lowS,prehash:!1};function V(N,H,K=F){const{seed:J,k2sig:X}=I(N,H,K),ie=e;return xI(ie.hash.outputLen,ie.nByteLength,ie.hmac)(J,X)}u.BASE._setWindowSize(8);function B(N,H,K,J=Q){var ue;const X=N;if(H=ls("msgHash",H),K=ls("publicKey",K),"strict"in J)throw new Error("options.strict was renamed to lowS");const{lowS:ie,prehash:le}=J;let Pe,xe;try{if(typeof X=="string"||X instanceof Uint8Array)try{Pe=y.fromDER(X)}catch(de){if(!(de instanceof bu.Err))throw de;Pe=y.fromCompact(X)}else if(typeof X=="object"&&typeof X.r=="bigint"&&typeof X.s=="bigint"){const{r:de,s:oe}=X;Pe=new y(de,oe)}else throw new Error("PARSE");xe=u.fromHex(K)}catch(de){if(de.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ie&&Pe.hasHighS())return!1;le&&(H=e.hash(H));const{r:Ie,s:ke}=Pe,$=O(H),ne=l(ke),G=a($*ne),Z=a(Ie*ne),A=(ue=u.BASE.multiplyAndAddUnsafe(xe,G,Z))==null?void 0:ue.toAffine();return A?a(A.x)===Ie:!1}return{CURVE:e,getPublicKey:w,getSharedSecret:E,sign:V,verify:B,ProjectivePoint:u,Signature:y,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ele(t){return{hash:t,hmac:(e,...n)=>XP(t,e,qoe(...n)),randomBytes:Qoe}}function tle(t,e){const n=r=>Zae({...t,...ele(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _I=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),MI=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),nle=BigInt(1),RE=BigInt(2),NI=(t,e)=>(t+e/RE)/e;function rle(t){const e=_I,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),u=t*t*t%e,c=u*u*t%e,f=Ri(c,n,e)*c%e,d=Ri(f,n,e)*c%e,h=Ri(d,RE,e)*u%e,p=Ri(h,i,e)*h%e,m=Ri(p,s,e)*p%e,g=Ri(m,a,e)*m%e,y=Ri(g,l,e)*g%e,v=Ri(y,a,e)*m%e,w=Ri(v,n,e)*c%e,b=Ri(w,o,e)*p%e,E=Ri(b,r,e)*u%e,x=Ri(E,RE,e);if(!LE.eql(LE.sqr(x),t))throw new Error("Cannot find square root");return x}const LE=$ae(_I,void 0,void 0,{sqrt:rle}),$a=tle({a:BigInt(0),b:BigInt(7),Fp:LE,n:MI,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=MI,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-nle*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=NI(s*t,e),l=NI(-r*t,e);let u=Jr(t-a*n-l*i,e),c=Jr(-a*r-l*s,e);const f=u>o,d=c>o;if(f&&(u=e-u),d&&(c=e-c),u>o||c>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:d,k2:c}}}},eI);BigInt(0),$a.ProjectivePoint;const jp="0x0000000000000000000000000000000000000000",PI="0x0000000000000000000000000000000000000000000000000000000000000000",II=BigInt(0),RI=BigInt(1),LI=BigInt(2),BI=BigInt(27),FI=BigInt(28),Ab=BigInt(35),Df={};function UI(t){return du(Ir(t),32)}const gs=class gs{constructor(e,n,r,i){ae(this,dd);ae(this,hd);ae(this,pd);ae(this,Ku);ub(e,Df,"Signature"),L(this,dd,n),L(this,hd,r),L(this,pd,i),L(this,Ku,null)}get r(){return T(this,dd)}set r(e){ee(bf(e)===32,"invalid r","value",e),L(this,dd,Be(e))}get s(){return T(this,hd)}set s(e){ee(bf(e)===32,"invalid s","value",e);const n=Be(e);ee(parseInt(n.substring(0,3))<8,"non-canonical s","value",n),L(this,hd,n)}get v(){return T(this,pd)}set v(e){const n=st(e,"value");ee(n===27||n===28,"invalid v","v",e),L(this,pd,n)}get networkV(){return T(this,Ku)}get legacyChainId(){const e=this.networkV;return e==null?null:gs.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=Dt(this.s);return this.yParity&&(e[0]|=128),Be(e)}get compactSerialized(){return An([this.r,this.yParityAndS])}get serialized(){return An([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new gs(Df,this.r,this.s,this.v);return this.networkV&&L(e,Ku,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const n=He(e,"v");return n==BI||n==FI?II:(ee(n>=Ab,"invalid EIP-155 v","v",e),(n-Ab)/LI)}static getChainIdV(e,n){return He(e)*LI+BigInt(35+n-27)}static getNormalizedV(e){const n=He(e);return n===II||n===BI?27:n===RI||n===FI?28:(ee(n>=Ab,"invalid v","v",e),n&RI?27:28)}static from(e){function n(u,c){ee(u,c,"signature",e)}if(e==null)return new gs(Df,PI,PI,27);if(typeof e=="string"){const u=Dt(e,"signature");if(u.length===64){const c=Be(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new gs(Df,c,Be(f),d)}if(u.length===65){const c=Be(u.slice(0,32)),f=u.slice(32,64);n((f[0]&128)===0,"non-canonical s");const d=gs.getNormalizedV(u[64]);return new gs(Df,c,Be(f),d)}n(!1,"invalid raw signature length")}if(e instanceof gs)return e.clone();const r=e.r;n(r!=null,"missing r");const i=UI(r),s=function(u,c){if(u!=null)return UI(u);if(c!=null){n(Qt(c,32),"invalid yParityAndS");const f=Dt(c);return f[0]&=127,Be(f)}n(!1,"missing s")}(e.s,e.yParityAndS);n((Dt(s)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(u,c,f){if(u!=null){const d=He(u);return{networkV:d>=Ab?d:void 0,v:gs.getNormalizedV(d)}}if(c!=null)return n(Qt(c,32),"invalid yParityAndS"),{v:Dt(c)[0]&128?28:27};if(f!=null){switch(st(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new gs(Df,i,s,a);return o&&L(l,Ku,o),n(e.yParity==null||st(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};dd=new WeakMap,hd=new WeakMap,pd=new WeakMap,Ku=new WeakMap;let us=gs;const qu=class qu{constructor(e){ae(this,zo);ee(bf(e)===32,"invalid private key","privateKey","[REDACTED]"),L(this,zo,Be(e))}get privateKey(){return T(this,zo)}get publicKey(){return qu.computePublicKey(T(this,zo))}get compressedPublicKey(){return qu.computePublicKey(T(this,zo),!0)}sign(e){ee(bf(e)===32,"invalid digest length","digest",e);const n=$a.sign(Pr(e),Pr(T(this,zo)),{lowS:!0});return us.from({r:Fa(n.r,32),s:Fa(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=qu.computePublicKey(e);return Be($a.getSharedSecret(Pr(T(this,zo)),Dt(n),!1))}static computePublicKey(e,n){let r=Dt(e,"key");if(r.length===32){const s=$a.getPublicKey(r,!!n);return Be(s)}if(r.length===64){const s=new Uint8Array(65);s[0]=4,s.set(r,1),r=s}const i=$a.ProjectivePoint.fromHex(r);return Be(i.toRawBytes(n))}static recoverPublicKey(e,n){ee(bf(e)===32,"invalid digest length","digest",e);const r=us.from(n);let i=$a.Signature.fromCompact(Pr(An([r.r,r.s])));i=i.addRecoveryBit(r.yParity);const s=i.recoverPublicKey(Pr(e));return ee(s!=null,"invalid signautre for digest","signature",n),"0x"+s.toHex(!1)}static addPoints(e,n,r){const i=$a.ProjectivePoint.fromHex(qu.computePublicKey(e).substring(2)),s=$a.ProjectivePoint.fromHex(qu.computePublicKey(n).substring(2));return"0x"+i.add(s).toHex(!!r)}};zo=new WeakMap;let Hp=qu;const ile=BigInt(0),sle=BigInt(36);function jI(t){t=t.toLowerCase();const e=t.substring(2).split(""),n=new Uint8Array(40);for(let i=0;i<40;i++)n[i]=e[i].charCodeAt(0);const r=Dt(Bn(n));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const BE={};for(let t=0;t<10;t++)BE[String(t)]=String(t);for(let t=0;t<26;t++)BE[String.fromCharCode(65+t)]=String(10+t);const HI=15;function ole(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>BE[r]).join("");for(;e.length>=HI;){let r=e.substring(0,HI);e=parseInt(r,10)%97+e.substring(r.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const ale=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function lle(t){t=t.toLowerCase();let e=ile;for(let n=0;n<t.length;n++)e=e*sle+ale[t[n]];return e}function jt(t){if(ee(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=jI(t);return ee(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){ee(t.substring(2,4)===ole(t),"bad icap checksum","address",t);let e=lle(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return jI("0x"+e)}ee(!1,"invalid address","address",t)}function ule(t){const e=jt(t.from);let r=He(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,jt(bn(Bn(pu([e,r])),12))}function VI(t){return t&&typeof t.getAddress=="function"}function cle(t){try{return jt(t),!0}catch{}return!1}async function FE(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(me(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),ee(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),jt(n)}function Br(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?jt(t):(me(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),FE(t,e.resolveName(t)));if(VI(t))return FE(t,t.getAddress());if(t&&typeof t.then=="function")return FE(t,t);ee(!1,"unsupported addressable value","target",t)}const Co={};function Fe(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new wr(Co,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function Ot(t,e){return new wr(Co,`bytes${e||""}`,t,{size:e})}const zI=Symbol.for("_ethers_typed"),$o=class $o{constructor(e,n,r,i){W(this,"type");W(this,"value");ae(this,Qu);W(this,"_typedSymbol");i==null&&(i=null),ub(Co,e,"Typed"),$e(this,{_typedSymbol:zI,type:n,value:r}),L(this,Qu,i),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return T(this,Qu)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,Qu)===!0?-1:T(this,Qu)===!1?this.value.length:null}static from(e,n){return new $o(Co,e,n)}static uint8(e){return Fe(e,8)}static uint16(e){return Fe(e,16)}static uint24(e){return Fe(e,24)}static uint32(e){return Fe(e,32)}static uint40(e){return Fe(e,40)}static uint48(e){return Fe(e,48)}static uint56(e){return Fe(e,56)}static uint64(e){return Fe(e,64)}static uint72(e){return Fe(e,72)}static uint80(e){return Fe(e,80)}static uint88(e){return Fe(e,88)}static uint96(e){return Fe(e,96)}static uint104(e){return Fe(e,104)}static uint112(e){return Fe(e,112)}static uint120(e){return Fe(e,120)}static uint128(e){return Fe(e,128)}static uint136(e){return Fe(e,136)}static uint144(e){return Fe(e,144)}static uint152(e){return Fe(e,152)}static uint160(e){return Fe(e,160)}static uint168(e){return Fe(e,168)}static uint176(e){return Fe(e,176)}static uint184(e){return Fe(e,184)}static uint192(e){return Fe(e,192)}static uint200(e){return Fe(e,200)}static uint208(e){return Fe(e,208)}static uint216(e){return Fe(e,216)}static uint224(e){return Fe(e,224)}static uint232(e){return Fe(e,232)}static uint240(e){return Fe(e,240)}static uint248(e){return Fe(e,248)}static uint256(e){return Fe(e,256)}static uint(e){return Fe(e,256)}static int8(e){return Fe(e,-8)}static int16(e){return Fe(e,-16)}static int24(e){return Fe(e,-24)}static int32(e){return Fe(e,-32)}static int40(e){return Fe(e,-40)}static int48(e){return Fe(e,-48)}static int56(e){return Fe(e,-56)}static int64(e){return Fe(e,-64)}static int72(e){return Fe(e,-72)}static int80(e){return Fe(e,-80)}static int88(e){return Fe(e,-88)}static int96(e){return Fe(e,-96)}static int104(e){return Fe(e,-104)}static int112(e){return Fe(e,-112)}static int120(e){return Fe(e,-120)}static int128(e){return Fe(e,-128)}static int136(e){return Fe(e,-136)}static int144(e){return Fe(e,-144)}static int152(e){return Fe(e,-152)}static int160(e){return Fe(e,-160)}static int168(e){return Fe(e,-168)}static int176(e){return Fe(e,-176)}static int184(e){return Fe(e,-184)}static int192(e){return Fe(e,-192)}static int200(e){return Fe(e,-200)}static int208(e){return Fe(e,-208)}static int216(e){return Fe(e,-216)}static int224(e){return Fe(e,-224)}static int232(e){return Fe(e,-232)}static int240(e){return Fe(e,-240)}static int248(e){return Fe(e,-248)}static int256(e){return Fe(e,-256)}static int(e){return Fe(e,-256)}static bytes1(e){return Ot(e,1)}static bytes2(e){return Ot(e,2)}static bytes3(e){return Ot(e,3)}static bytes4(e){return Ot(e,4)}static bytes5(e){return Ot(e,5)}static bytes6(e){return Ot(e,6)}static bytes7(e){return Ot(e,7)}static bytes8(e){return Ot(e,8)}static bytes9(e){return Ot(e,9)}static bytes10(e){return Ot(e,10)}static bytes11(e){return Ot(e,11)}static bytes12(e){return Ot(e,12)}static bytes13(e){return Ot(e,13)}static bytes14(e){return Ot(e,14)}static bytes15(e){return Ot(e,15)}static bytes16(e){return Ot(e,16)}static bytes17(e){return Ot(e,17)}static bytes18(e){return Ot(e,18)}static bytes19(e){return Ot(e,19)}static bytes20(e){return Ot(e,20)}static bytes21(e){return Ot(e,21)}static bytes22(e){return Ot(e,22)}static bytes23(e){return Ot(e,23)}static bytes24(e){return Ot(e,24)}static bytes25(e){return Ot(e,25)}static bytes26(e){return Ot(e,26)}static bytes27(e){return Ot(e,27)}static bytes28(e){return Ot(e,28)}static bytes29(e){return Ot(e,29)}static bytes30(e){return Ot(e,30)}static bytes31(e){return Ot(e,31)}static bytes32(e){return Ot(e,32)}static address(e){return new $o(Co,"address",e)}static bool(e){return new $o(Co,"bool",!!e)}static bytes(e){return new $o(Co,"bytes",e)}static string(e){return new $o(Co,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new $o(Co,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===zI}static dereference(e,n){if($o.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};Qu=new WeakMap;let wr=$o;class fle extends ko{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=wr.dereference(n,"string");try{r=jt(r)}catch(i){return this._throwError(i.message,n)}return e.writeValue(r)}decode(e){return jt(Fa(e.readValue(),20))}}class dle extends ko{constructor(n){super(n.name,n.type,"_",n.dynamic);W(this,"coder");this.coder=n}defaultValue(){return this.coder.defaultValue()}encode(n,r){return this.coder.encode(n,r)}decode(n){return this.coder.decode(n)}}function $I(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let l={};r=e.map(u=>{const c=u.localName;return me(c,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),me(!l[c],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),l[c]=!0,n[c]})}else ee(!1,"invalid tuple value","tuple",n);ee(e.length===r.length,"types/value length mismatch","tuple",n);let i=new bE,s=new bE,o=[];e.forEach((l,u)=>{let c=r[u];if(l.dynamic){let f=s.length;l.encode(s,c);let d=i.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function GI(t,e){let n=[],r=[],i=t.subReader(0);return e.forEach(s=>{let o=null;if(s.dynamic){let a=t.readIndex(),l=i.subReader(a);try{o=s.decode(l)}catch(u){if(Qn(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(t)}catch(a){if(Qn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");n.push(o),r.push(s.localName||null)}),Af.fromItems(n,r)}class hle extends ko{constructor(n,r,i){const s=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",s,i,o);W(this,"coder");W(this,"length");$e(this,{coder:n,length:r})}defaultValue(){const n=this.coder.defaultValue(),r=[];for(let i=0;i<this.length;i++)r.push(n);return r}encode(n,r){const i=wr.dereference(r,"array");Array.isArray(i)||this._throwError("expected array value",i);let s=this.length;s===-1&&(s=i.length,n.writeValue(i.length)),kP(i.length,s,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<i.length;a++)o.push(this.coder);return $I(n,o,i)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),me(r*Lr<=n.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:n.bytes,offset:r*Lr,length:n.dataLength}));let i=[];for(let s=0;s<r;s++)i.push(new dle(this.coder));return GI(n,i)}}class ple extends ko{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=wr.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class WI extends ko{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=Pr(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class mle extends WI{constructor(e){super("bytes",e)}decode(e){return Be(super.decode(e))}}class gle extends ko{constructor(n,r){let i="bytes"+String(n);super(i,i,r,!1);W(this,"size");$e(this,{size:n},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(n,r){let i=Pr(wr.dereference(r,this.type));return i.length!==this.size&&this._throwError("incorrect data length",r),n.writeBytes(i)}decode(n){return Be(n.readBytes(this.size))}}const yle=new Uint8Array([]);class ble extends ko{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(yle)}decode(e){return e.readBytes(0),null}}const wle=BigInt(0),vle=BigInt(1),Ale=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class xle extends ko{constructor(n,r,i){const s=(r?"int":"uint")+n*8;super(s,s,i,!1);W(this,"size");W(this,"signed");$e(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let i=He(wr.dereference(r,this.type)),s=Rp(Ale,Lr*8);if(this.signed){let o=Rp(s,this.size*8-1);(i>o||i<-(o+vle))&&this._throwError("value out-of-bounds",r),i=TP(i,8*Lr)}else(i<wle||i>Rp(s,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(i)}decode(n){let r=Rp(n.readValue(),this.size*8);return this.signed&&(r=Coe(r,this.size*8)),r}}class Ele extends WI{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,Eo(wr.dereference(n,"string")))}decode(e){return vf(super.decode(e))}}class xb extends ko{constructor(n,r){let i=!1;const s=[];n.forEach(a=>{a.dynamic&&(i=!0),s.push(a.type)});const o="tuple("+s.join(",")+")";super("tuple",o,r,i);W(this,"coders");$e(this,{coders:Object.freeze(n.slice())})}defaultValue(){const n=[];this.coders.forEach(i=>{n.push(i.defaultValue())});const r=this.coders.reduce((i,s)=>{const o=s.localName;return o&&(i[o]||(i[o]=0),i[o]++),i},{});return this.coders.forEach((i,s)=>{let o=i.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),n[o]==null&&(n[o]=n[s]))}),Object.freeze(n)}encode(n,r){const i=wr.dereference(r,"tuple");return $I(n,this.coders,i)}decode(n){return GI(n,this.coders)}}function wu(t){return Bn(Eo(t))}var kle="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const KI=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),qI=4;function Sle(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),i=1,s=[0,1];for(let E=1;E<r;E++)s.push(i+=n());let o=n(),a=e;e+=o;let l=0,u=0;function c(){return l==0&&(u=u<<8|t[e++],l=8),u>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let g=0;for(let E=0;E<f;E++)g=g<<1|c();let y=[],v=0,w=d;for(;;){let E=Math.floor(((g-v+1)*i-1)/w),x=0,O=r;for(;O-x>1;){let I=x+O>>>1;E<s[I]?O=I:x=I}if(x==0)break;y.push(x);let S=v+Math.floor(w*s[x]/i),D=v+Math.floor(w*s[x+1]/i)-1;for(;!((S^D)&h);)g=g<<1&m|c(),S=S<<1&m,D=D<<1&m|1;for(;S&~D&p;)g=g&h|g<<1&m>>>1|c(),S=S<<1^h,D=(D^h)<<1|h|1;v=S,w=1+D-S}let b=r-4;return y.map(E=>{switch(E-b){case 3:return b+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return b+256+(t[a++]<<8|t[a++]);case 1:return b+t[a++];default:return E-1}})}function Cle(t){let e=0;return()=>t[e++]}function QI(t){return Cle(Sle(Dle(t)))}function Dle(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let n=t.length,r=new Uint8Array(6*n>>3);for(let i=0,s=0,o=0,a=0;i<n;i++)a=a<<6|e[t.charCodeAt(i)],o+=6,o>=8&&(r[s++]=a>>(o-=8));return r}function Tle(t){return t&1?~t>>1:t>>1}function Ole(t,e){let n=Array(t);for(let r=0,i=0;r<t;r++)n[r]=i+=Tle(e());return n}function Vp(t,e=0){let n=[];for(;;){let r=t(),i=t();if(!i)break;e+=r;for(let s=0;s<i;s++)n.push(e+s);e+=i+1}return n}function JI(t){return zp(()=>{let e=Vp(t);if(e.length)return e})}function YI(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(_le(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(Mle(n,t))}return e.flat()}function zp(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function XI(t,e,n){let r=Array(t).fill().map(()=>[]);for(let i=0;i<e;i++)Ole(t,n).forEach((s,o)=>r[o].push(s));return r}function _le(t,e){let n=1+e(),r=e(),i=zp(e);return XI(i.length,1+t,e).flatMap((o,a)=>{let[l,...u]=o;return Array(i[a]).fill().map((c,f)=>{let d=f*r;return[l+f*n,u.map(h=>h+d)]})})}function Mle(t,e){let n=1+e();return XI(n,1+t,e).map(i=>[i[0],i.slice(1)])}function Nle(t){let e=[],n=Vp(t);return i(r([]),[]),e;function r(s){let o=t(),a=zp(()=>{let l=Vp(t).map(u=>n[u]);if(l.length)return r(l)});return{S:o,B:a,Q:s}}function i({S:s,B:o},a,l){if(!(s&4&&l===a[a.length-1])){s&2&&(l=a[a.length-1]),s&1&&e.push(a);for(let u of o)for(let c of u.Q)i(u,[...a,c],l)}}}function Ple(t){return t.toString(16).toUpperCase().padStart(2,"0")}function ZI(t){return`{${Ple(t)}}`}function Ile(t){let e=[];for(let n=0,r=t.length;n<r;){let i=t.codePointAt(n);n+=i<65536?1:2,e.push(i)}return e}function Tf(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let i=0;i<n;)r.push(String.fromCodePoint(...t.slice(i,i+=4096)));return r.join("")}function Rle(t,e){let n=t.length,r=n-e.length;for(let i=0;r==0&&i<n;i++)r=t[i]-e[i];return r}var Lle="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEdNRW1JhBirAsJOXcG+xr2C48mrxMpevwF0xohBk0BKRr/AM8u54WwWjFcHE9fBgMLJSPHFKhQIA0lQLd4SBobBxUlqQKRQ3BKh1E2HpMh9jw9DWYuE1F8B/U8BRlPC4E8nkarRQ4R0j6NPUgiSUwsBDV/LC8niwnPD4UMuXxyAVkJIQmxDHETMREXN8UIOQcZLZckJxUIIUaVYJoE958D8xPRAwsFPwlBBxMDtRwtEy4VKQUNgSTXAvM21S6zAo9WgAEXBcsPJR/fEFBH4A7pCJsCZQODJesALRUhABcimwhDYwBfj9hTBS7LCMdqbCN0A2cU52ERcweRDlcHpxwzFb8c4XDIXguGCCijrwlbAXUJmQFfBOMICTVbjKAgQWdTi1gYmyBhQT9d/AIxDGUVn0S9h3gCiw9rEhsBNQFzBzkNAQJ3Ee0RaxCVCOuGBDW1M/g6JQRPIYMgEQonA09szgsnJvkM+GkBoxJiAww0PXfuZ6tgtiQX/QcZMsVBYCHxC5JPzQycGsEYQlQuGeQHvwPzGvMn6kFXBf8DowMTOk0z7gS9C2kIiwk/AEkOoxcH1xhqCnGM0AExiwG3mQNXkYMCb48GNwcLAGcLhwV55QAdAqcIowAFAM8DVwA5Aq0HnQAZAIVBAT0DJy8BIeUCjwOTCDHLAZUvAfMpBBvDDBUA9zduSgLDsQKAamaiBd1YAo4CSTUBTSUEBU5HUQOvceEA2wBLBhPfRwEVq0rLGuNDAd9vKwDHAPsABTUHBUEBzQHzbQC3AV8LMQmis7UBTekpAIMAFWsB1wKJAN0ANQB/8QFTAE0FWfkF0wJPSQERMRgrV2EBuwMfATMBDQB5BsuNpckHHwRtB9MCEBsV4QLvLge1AQMi3xPNQsUCvd5VoWACZIECYkJbTa9bNyACofcCaJgCZgkCn4Q4GwsCZjsCZiYEbgR/A38TA36SOQY5dxc5gjojIwJsHQIyNjgKAm3HAm2u74ozZ0UrAWcA3gDhAEoFB5gMjQD+C8IADbUCdy8CdqI/AnlLQwJ4uh1c20WuRtcCfD8CesgCfQkCfPAFWQUgSABIfWMkAoFtAoAAAoAFAn+uSVhKWxUXSswC0QEC0MxLJwOITwOH5kTFkTIC8qFdAwMDrkvOTC0lA89NTE2vAos/AorYwRsHHUNnBbcCjjcCjlxAl4ECjtkCjlx4UbRTNQpS1FSFApP7ApMMAOkAHFUeVa9V0AYsGymVhjLheGZFOzkCl58C77JYIagAWSUClo8ClnycAKlZrFoJgU0AOwKWtQKWTlxEXNECmcsCmWRcyl0HGQKcmznCOp0CnBYCn5sCnriKAB0PMSoPAp3xAp6SALU9YTRh7wKe0wKgbgGpAp6fHwKeTqVjyGQnJSsCJ68CJn4CoPsCoEwCot0CocQCpi8Cpc4Cp/8AfQKn8mh8aLEAA0lqHGrRAqzjAqyuAq1nAq0CAlcdAlXcArHh1wMfTmyXArK9DQKy6Bds4G1jbUhfAyXNArZcOz9ukAMpRQK4XgK5RxUCuSp3cDZw4QK9GQK72nCWAzIRAr6IcgIDM3ECvhpzInNPAsPLAsMEc4J0SzVFdOADPKcDPJoDPb8CxXwCxkcCxhCJAshpUQLIRALJTwLJLgJknQLd0nh5YXiueSVL0AMYo2cCAmH0GfOVJHsLXpJeuxECz2sCz2wvS1PS8xOfAMatAs9zASnqA04SfksFAtwnAtuKAtJPA1JcA1NfAQEDVYyAiT8AyxbtYEWCHILTgs6DjQLaxwLZ3oQQhEmnPAOGpQAvA2QOhnFZ+QBVAt9lAt64c3cC4i/tFAHzMCcB9JsB8tKHAuvzAulweQLq+QLq5AD5RwG5Au6JAuuclqqXAwLuPwOF4Jh5cOBxoQLzAwBpA44WmZMC9xMDkW4DkocC95gC+dkC+GaaHJqruzebHgOdgwL++gEbADmfHJ+zAwWNA6ZqA6bZANHFAwZqoYiiBQkDDEkCwAA/AwDhQRdTARHzA2sHl2cFAJMtK7evvdsBiZkUfxEEOQH7KQUhDp0JnwCS/SlXxQL3AZ0AtwW5AG8LbUEuFCaNLgFDAYD8AbUmAHUDDgRtACwCFgyhAAAKAj0CagPdA34EkQEgRQUhfAoABQBEABMANhICdwEABdUDa+8KxQIA9wqfJ7+xt+UBkSFBQgHpFH8RNMCJAAQAGwBaAkUChIsABjpTOpSNbQC4Oo860ACNOME63AClAOgAywE6gTo7Ofw5+Tt2iTpbO56JOm85GAFWATMBbAUvNV01njWtNWY1dTW2NcU1gjWRNdI14TWeNa017jX9NbI1wTYCNhE1xjXVNhY2JzXeNe02LjY9Ni41LSE2OjY9Njw2yTcIBJA8VzY4Nt03IDcPNsogN4k3MAoEsDxnNiQ3GTdsOo03IULUQwdC4EMLHA8PCZsobShRVQYA6X8A6bABFCnXAukBowC9BbcAbwNzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgBFLWZAu0BhQCjBcEAbykBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUABavAj626xQAJP0A3etzuf4NNRA7efy2Z9NQrCnC0OSyANz5BBIbJ5IFDR6miIavYS6tprjjmuKebxm5C74Q225X1pkaYYPb6f1DK4k3xMEBb9S2WMjEibTNWhsRJIA+vwNVEiXTE5iXs/wezV66oFLfp9NZGYW+Gk19J2+bCT6Ye2w6LDYdgzKMUabk595eLBCXANz9HUpWbATq9vqXVx9XDg+Pc9Xp4+bsS005SVM/BJBM4687WUuf+Uj9dEi8aDNaPxtpbDxcG1THTImUMZq4UCaaNYpsVqraNyKLJXDYsFZ/5jl7bLRtO88t7P3xZaAxhb5OdPMXqsSkp1WCieG8jXm1U99+blvLlXzPCS+M93VnJCiK+09LfaSaBAVBomyDgJua8dfUzR7ga34IvR2Nvj+A9heJ6lsl1KG4NkI1032Cnff1m1wof2B9oHJK4bi6JkEdSqeNeiuo6QoZZincoc73/TH9SXF8sCE7XyuYyW8WSgbGFCjPV0ihLKhdPs08Tx82fYAkLLc4I2wdl4apY7GU5lHRFzRWJep7Ww3wbeA3qmd59/86P4xuNaqDpygXt6M85glSBHOCGgJDnt+pN9bK7HApMguX6+06RZNjzVmcZJ+wcUrJ9//bpRNxNuKpNl9uFds+S9tdx7LaM5ZkIrPj6nIU9mnbFtVbs9s/uLgl8MVczAwet+iOEzzBlYW7RCMgE6gyNLeq6+1tIx4dpgZnd0DksJS5f+JNDpwwcPNXaaVspq1fbQajOrJgK0ofKtJ1Ne90L6VO4MOl5S886p7u6xo7OLjG8TGL+HU1JXGJgppg4nNbNJ5nlzSpuPYy21JUEcUA94PoFiZfjZue+QnyQ80ekOuZVkxx4g+cvhJfHgNl4hy1/a6+RKcKlar/J29y//EztlbVPHVUeQ1zX86eQVAjR/M3dA9w4W8LfaXp4EgM85wOWasli837PzVMOnsLzR+k3o75/lRPAJSE1xAKQzEi5v10ke+VBvRt1cwQRMd+U5mLCTGVd6XiZtgBG5cDi0w22GKcVNvHiu5LQbZEDVtz0onn7k5+heuKXVsZtSzilkLRAUmjMXEMB3J9YC50XBxPiz53SC+EhnPl9WsKCv92SM/OFFIMJZYfl0WW8tIO3UxYcwdMAj7FSmgrsZ2aAZO03BOhP1bNNZItyXYQFTpC3SG1VuPDqH9GkiCDmE+JwxyIVSO5siDErAOpEXFgjy6PQtOVDj+s6e1r8heWVvmZnTciuf4EiNZzCAd7SOMhXERIOlsHIMG399i9aLTy3m2hRLZjJVDNLS53iGIK11dPqQt0zBDyg6qc7YqkDm2M5Ve6dCWCaCbTXX2rToaIgz6+zh4lYUi/+6nqcFMAkQJKHYLK0wYk5N9szV6xihDbDDFr45lN1K4aCXBq/FitPSud9gLt5ZVn+ZqGX7cwm2z5EGMgfFpIFyhGGuDPmso6TItTMwny+7uPnLCf4W6goFQFV0oQSsc9VfMmVLcLr6ZetDZbaSFTLqnSO/bIPjA3/zAUoqgGFAEQS4IhuMzEp2I3jJzbzkk/IEmyax+rhZTwd6f+CGtwPixu8IvzACquPWPREu9ZvGkUzpRwvRRuaNN6cr0W1wWits9ICdYJ7ltbgMiSL3sTPeufgNcVqMVWFkCPDH4jG2jA0XcVgQj62Cb29v9f/z/+2KbYvIv/zzjpQAPkliaVDzNrW57TZ/ZOyZD0nlfMmAIBIAGAI0D3k/mdN4xr9v85ZbZbbqfH2jGd5hUqNZWwl5SPfoGmfElmazUIeNL1j/mkF7VNAzTq4jNt8JoQ11NQOcmhprXoxSxfRGJ9LDEOAQ+dmxAQH90iti9e2u/MoeuaGcDTHoC+xsmEeWmxEKefQuIzHbpw5Tc5cEocboAD09oipWQhtTO1wivf/O+DRe2rpl/E9wlrzBorjJsOeG1B/XPW4EaJEFdNlECEZga5ZoGRHXgYouGRuVkm8tDESiEyFNo+3s5M5puSdTyUL2llnINVHEt91XUNW4ewdMgJ4boJfEyt/iY5WXqbA+A2Fkt5Z0lutiWhe9nZIyIUjyXDC3UsaG1t+eNx6z4W/OYoTB7A6x+dNSTOi9AInctbESqm5gvOLww7OWXPrmHwVZasrl4eD113pm+JtT7JVOvnCXqdzzdTRHgJ0PiGTFYW5Gvt9R9LD6Lzfs0v/TZZHSmyVNq7viIHE6DBK7Qp07Iz55EM8SYtQvZf/obBniTWi5C2/ovHfw4VndkE5XYdjOhCMRjDeOEfXeN/CwfGduiUIfsoFeUxXeQXba7c7972XNv8w+dTjjUM0QeNAReW+J014dKAD/McQYXT7c0GQPIkn3Ll6R7gGjuiQoZD0TEeEqQpKoZ15g/0OPQI17QiSv9AUROa/V/TQN3dvLArec3RrsYlvBm1b8LWzltdugsC50lNKYLEp2a+ZZYqPejULRlOJh5zj/LVMyTDvwKhMxxwuDkxJ1QpoNI0OTWLom4Z71SNzI9TV1iXJrIu9Wcnd+MCaAw8o1jSXd94YU/1gnkrC9BUEOtQvEIQ7g0i6h+KL2JKk8Ydl7HruvgWMSAmNe+LshGhV4qnWHhO9/RIPQzY1tHRj2VqOyNsDpK0cww+56AdDC4gsWwY0XxoucIWIqs/GcwnWqlaT0KPr8mbK5U94/301i1WLt4YINTVvCFBrFZbIbY8eycOdeJ2teD5IfPLCRg7jjcFTwlMFNl9zdh/o3E/hHPwj7BWg0MU09pPrBLbrCgm54A6H+I6v27+jL5gkjWg/iYdks9jbfVP5y/n0dlgWEMlKasl7JvFZd56LfybW1eeaVO0gxTfXZwD8G4SI116yx7UKVRgui6Ya1YpixqXeNLc8IxtAwCU5IhwQgn+NqHnRaDv61CxKhOq4pOX7M6pkA+Pmpd4j1vn6ACUALoLLc4vpXci8VidLxzm7qFBe7s+quuJs6ETYmnpgS3LwSZxPIltgBDXz8M1k/W2ySNv2f9/NPhxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";const $p=44032,Eb=4352,kb=4449,Sb=4519,eR=19,tR=21,Of=28,Cb=tR*Of,Ble=eR*Cb,Fle=$p+Ble,Ule=Eb+eR,jle=kb+tR,Hle=Sb+Of;function Gp(t){return t>>24&255}function nR(t){return t&16777215}let UE,rR,jE,Db;function Vle(){let t=QI(Lle);UE=new Map(JI(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),rR=new Set(Vp(t)),jE=new Map,Db=new Map;for(let[e,n]of YI(t)){if(!rR.has(e)&&n.length==2){let[r,i]=n,s=Db.get(r);s||(s=new Map,Db.set(r,s)),s.set(i,e)}jE.set(e,n.reverse())}}function iR(t){return t>=$p&&t<Fle}function zle(t,e){if(t>=Eb&&t<Ule&&e>=kb&&e<jle)return $p+(t-Eb)*Cb+(e-kb)*Of;if(iR(t)&&e>Sb&&e<Hle&&(t-$p)%Of==0)return t+(e-Sb);{let n=Db.get(t);return n&&(n=n.get(e),n)?n:-1}}function sR(t){UE||Vle();let e=[],n=[],r=!1;function i(s){let o=UE.get(s);o&&(r=!0,s|=o),e.push(s)}for(let s of t)for(;;){if(s<128)e.push(s);else if(iR(s)){let o=s-$p,a=o/Cb|0,l=o%Cb/Of|0,u=o%Of;i(Eb+a),i(kb+l),u>0&&i(Sb+u)}else{let o=jE.get(s);o?n.push(...o):i(s)}if(!n.length)break;s=n.pop()}if(r&&e.length>1){let s=Gp(e[0]);for(let o=1;o<e.length;o++){let a=Gp(e[o]);if(a==0||s<=a){s=a;continue}let l=o-1;for(;;){let u=e[l+1];if(e[l+1]=e[l],e[l]=u,!l||(s=Gp(e[--l]),s<=a))break}s=Gp(e[o])}}return e}function $le(t){let e=[],n=[],r=-1,i=0;for(let s of t){let o=Gp(s),a=nR(s);if(r==-1)o==0?r=a:e.push(a);else if(i>0&&i>=o)o==0?(e.push(r,...n),n.length=0,r=a):n.push(a),i=o;else{let l=zle(r,a);l>=0?r=l:i==0&&o==0?(e.push(r),r=a):(n.push(a),i=o)}}return r>=0&&e.push(r,...n),e}function oR(t){return sR(t).map(nR)}function Gle(t){return $le(sR(t))}const aR=45,lR=".",uR=65039,cR=1,Tb=t=>Array.from(t);function Wp(t,e){return t.P.has(e)||t.Q.has(e)}class Wle extends Array{get is_emoji(){return!0}}let HE,fR,vu,VE,dR,_f,zE,Mf,Au,hR,$E;function GE(){if(HE)return;let t=QI(kle);const e=()=>Vp(t),n=()=>new Set(e()),r=(c,f)=>f.forEach(d=>c.add(d));HE=new Map(YI(t)),fR=n(),vu=e(),VE=new Set(e().map(c=>vu[c])),vu=new Set(vu),dR=n(),n();let i=JI(t),s=t();const o=()=>{let c=new Set;return e().forEach(f=>r(c,i[f])),r(c,e()),c};_f=zp(c=>{let f=zp(t).map(d=>d+96);if(f.length){let d=c>=s;f[0]-=32,f=Tf(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!t();return{N:f,P:h,Q:p,M:m,R:d}}}),zE=n(),Mf=new Map;let a=e().concat(Tb(zE)).sort((c,f)=>c-f);a.forEach((c,f)=>{let d=t(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(c),zE.has(c)||Mf.set(c,h)});for(let{V:c,M:f}of new Set(Mf.values())){let d=[];for(let p of c){let m=_f.filter(y=>Wp(y,p)),g=d.find(({G:y})=>m.some(v=>y.has(v)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),r(g.G,m)}let h=d.flatMap(p=>Tb(p.G));for(let{G:p,V:m}of d){let g=new Set(h.filter(y=>!p.has(y)));for(let y of m)f.set(y,g)}}Au=new Set;let l=new Set;const u=c=>Au.has(c)?l.add(c):Au.add(c);for(let c of _f){for(let f of c.P)u(f);for(let f of c.Q)u(f)}for(let c of Au)!Mf.has(c)&&!l.has(c)&&Mf.set(c,cR);r(Au,oR(Au)),hR=Nle(t).map(c=>Wle.from(c)).sort(Rle),$E=new Map;for(let c of hR){let f=[$E];for(let d of c){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===uR?f.push(...h):f=h}for(let d of f)d.V=c}}function WE(t){return(pR(t)?"":`${KE(Ob([t]))} `)+ZI(t)}function KE(t){return`"${t}"‎`}function Kle(t){if(t.length>=4&&t[2]==aR&&t[3]==aR)throw new Error(`invalid label extension: "${Tf(t.slice(0,4))}"`)}function qle(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function Qle(t){let e=t[0],n=KI.get(e);if(n)throw Kp(`leading ${n}`);let r=t.length,i=-1;for(let s=1;s<r;s++){e=t[s];let o=KI.get(e);if(o){if(i==s)throw Kp(`${n} + ${o}`);i=s+1,n=o}}if(i==r)throw Kp(`trailing ${n}`)}function Ob(t,e=1/0,n=ZI){let r=[];Jle(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,s=t.length;for(let o=0;o<s;o++){let a=t[o];pR(a)&&(r.push(Tf(t.slice(i,o))),r.push(n(a)),i=o+1)}return r.push(Tf(t.slice(i,s))),r.join("")}function Jle(t){return GE(),vu.has(t)}function pR(t){return GE(),dR.has(t)}function Yle(t){return tue(Xle(t,Gle,iue))}function Xle(t,e,n){if(!t)return[];GE();let r=0;return t.split(lR).map(i=>{let s=Ile(i),o={input:s,offset:r};r+=s.length+1;try{let a=o.tokens=rue(s,e,n),l=a.length,u;if(!l)throw new Error("empty label");let c=o.output=a.flat();if(qle(c),!(o.emoji=l>1||a[0].is_emoji)&&c.every(d=>d<128))Kle(c),u="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)u="Emoji";else{if(vu.has(c[0]))throw Kp("leading combining mark");for(let m=1;m<l;m++){let g=a[m];if(!g.is_emoji&&vu.has(g[0]))throw Kp(`emoji + combining mark: "${Tf(a[m-1])} + ${Ob([g[0]])}"`)}Qle(c);let h=Tb(new Set(d)),[p]=eue(h);nue(p,d),Zle(p,h),u=p.N}}o.type=u}catch(a){o.error=a}return o})}function Zle(t,e){let n,r=[];for(let i of e){let s=Mf.get(i);if(s===cR)return;if(s){let o=s.M.get(i);if(n=n?n.filter(a=>o.has(a)):Tb(o),!n.length)return}else r.push(i)}if(n){for(let i of n)if(r.every(s=>Wp(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function eue(t){let e=_f;for(let n of t){let r=e.filter(i=>Wp(i,n));if(!r.length)throw _f.some(i=>Wp(i,n))?gR(e[0],n):mR(n);if(e=r,r.length==1)break}return e}function tue(t){return t.map(({input:e,error:n,output:r})=>{if(n){let i=n.message;throw new Error(t.length==1?i:`Invalid label ${KE(Ob(e,63))}: ${i}`)}return Tf(r)}).join(lR)}function mR(t){return new Error(`disallowed character: ${WE(t)}`)}function gR(t,e){let n=WE(e),r=_f.find(i=>i.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function Kp(t){return new Error(`illegal placement: ${t}`)}function nue(t,e){for(let n of e)if(!Wp(t,n))throw gR(t,n);if(t.M){let n=oR(e);for(let r=1,i=n.length;r<i;r++)if(VE.has(n[r])){let s=r+1;for(let o;s<i&&VE.has(o=n[s]);s++)for(let a=r;a<s;a++)if(n[a]==o)throw new Error(`duplicate non-spacing marks: ${WE(o)}`);if(s-r>qI)throw new Error(`excessive non-spacing marks: ${KE(Ob(n.slice(r-1,s)))} (${s-r}/${qI})`);r=s}}}function rue(t,e,n){let r=[],i=[];for(t=t.slice().reverse();t.length;){let s=sue(t);if(s)i.length&&(r.push(e(i)),i=[]),r.push(n(s));else{let o=t.pop();if(Au.has(o))i.push(o);else{let a=HE.get(o);if(a)i.push(...a);else if(!fR.has(o))throw mR(o)}}}return i.length&&r.push(e(i)),r}function iue(t){return t.filter(e=>e!=uR)}function sue(t,e){let n=$E,r,i=t.length;for(;i&&(n=n.get(t[--i]),!!n);){let{V:s}=n;s&&(r=s,t.length=i)}return r}const yR=new Uint8Array(32);yR.fill(0);function bR(t){return ee(t.length!==0,"invalid ENS name; empty component","comp",t),t}function wR(t){const e=Eo(oue(t)),n=[];if(t.length===0)return n;let r=0;for(let i=0;i<e.length;i++)e[i]===46&&(n.push(bR(e.slice(r,i))),r=i+1);return ee(r<e.length,"invalid ENS name; empty component","name",t),n.push(bR(e.slice(r))),n}function oue(t){try{if(t.length===0)throw new Error("empty label");return Yle(t)}catch(e){ee(!1,`invalid ENS name (${e.message})`,"name",t)}}function qE(t){ee(typeof t=="string","invalid ENS name; not a string","name",t),ee(t.length,"invalid ENS name (empty label)","name",t);let e=yR;const n=wR(t);for(;n.length;)e=Bn(An([e,Bn(n.pop())]));return Be(e)}function aue(t,e){const n=e;return ee(n<=255,"DNS encoded label cannot exceed 255","length",n),Be(An(wR(t).map(r=>{ee(r.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const i=new Uint8Array(r.length+1);return i.set(r,1),i[0]=i.length-1,i})))+"00"}function QE(t,e){return{address:jt(t),storageKeys:e.map((n,r)=>(ee(Qt(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function Ga(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?(ee(n.length===2,"invalid slot set",`value[${r}]`,n),QE(n[0],n[1])):(ee(n!=null&&typeof n=="object","invalid address-slot set","value",t),QE(n.address,n.storageKeys)));ee(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(n=>{const r=t[n].reduce((i,s)=>(i[s]=!0,i),{});return QE(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function lue(t){let e;return typeof t=="string"?e=Hp.computePublicKey(t,!1):e=t.publicKey,jt(Bn("0x"+e.substring(4)).substring(26))}function uue(t,e){return lue(Hp.recoverPublicKey(t,e))}const Yn=BigInt(0),cue=BigInt(2),fue=BigInt(27),due=BigInt(28),hue=BigInt(35),pue=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),JE=4096*32;function vR(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=Ef(e).substring(4),"0x"+n}function _b(t){return t==="0x"?null:jt(t)}function YE(t,e){try{return Ga(t)}catch(n){ee(!1,n.message,e,t)}}function qp(t,e){return t==="0x"?0:st(t,e)}function En(t,e){if(t==="0x")return Yn;const n=He(t,e);return ee(n<=pue,"value exceeds uint size",e,n),n}function nn(t,e){const n=He(t,"value"),r=Ir(n);return ee(r.length<=32,"value too large",`tx.${e}`,n),r}function XE(t){return Ga(t).map(e=>[e.address,e.storageKeys])}function mue(t,e){ee(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)ee(Qt(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function gue(t){const e=pb(t);ee(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:qp(e[0],"nonce"),gasPrice:En(e[1],"gasPrice"),gasLimit:En(e[2],"gasLimit"),to:_b(e[3]),value:En(e[4],"value"),data:Be(e[5]),chainId:Yn};if(e.length===6)return n;const r=En(e[6],"v"),i=En(e[7],"r"),s=En(e[8],"s");if(i===Yn&&s===Yn)n.chainId=r;else{let o=(r-hue)/cue;o<Yn&&(o=Yn),n.chainId=o,ee(o!==Yn||r===fue||r===due,"non-canonical legacy v","v",e[6]),n.signature=us.from({r:du(e[7],32),s:du(e[8],32),v:r})}return n}function yue(t,e){const n=[nn(t.nonce,"nonce"),nn(t.gasPrice||0,"gasPrice"),nn(t.gasLimit,"gasLimit"),t.to||"0x",nn(t.value,"value"),t.data];let r=Yn;if(t.chainId!=Yn)r=He(t.chainId,"tx.chainId"),ee(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const s=t.signature.legacyChainId;s!=null&&(r=s)}if(!e)return r!==Yn&&(n.push(Ir(r)),n.push("0x"),n.push("0x")),pu(n);let i=BigInt(27+e.yParity);return r!==Yn?i=us.getChainIdV(r,e.v):BigInt(e.v)!==i&&ee(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(Ir(i)),n.push(Ir(e.r)),n.push(Ir(e.s)),pu(n)}function ZE(t,e){let n;try{if(n=qp(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{ee(!1,"invalid yParity","yParity",e[0])}const r=du(e[1],32),i=du(e[2],32),s=us.from({r,s:i,yParity:n});t.signature=s}function bue(t){const e=pb(Dt(t).slice(1));ee(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Be(t));const n={type:2,chainId:En(e[0],"chainId"),nonce:qp(e[1],"nonce"),maxPriorityFeePerGas:En(e[2],"maxPriorityFeePerGas"),maxFeePerGas:En(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:En(e[4],"gasLimit"),to:_b(e[5]),value:En(e[6],"value"),data:Be(e[7]),accessList:YE(e[8],"accessList")};return e.length===9||ZE(n,e.slice(9)),n}function wue(t,e){const n=[nn(t.chainId,"chainId"),nn(t.nonce,"nonce"),nn(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),nn(t.maxFeePerGas||0,"maxFeePerGas"),nn(t.gasLimit,"gasLimit"),t.to||"0x",nn(t.value,"value"),t.data,XE(t.accessList||[])];return e&&(n.push(nn(e.yParity,"yParity")),n.push(Ir(e.r)),n.push(Ir(e.s))),An(["0x02",pu(n)])}function vue(t){const e=pb(Dt(t).slice(1));ee(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Be(t));const n={type:1,chainId:En(e[0],"chainId"),nonce:qp(e[1],"nonce"),gasPrice:En(e[2],"gasPrice"),gasLimit:En(e[3],"gasLimit"),to:_b(e[4]),value:En(e[5],"value"),data:Be(e[6]),accessList:YE(e[7],"accessList")};return e.length===8||ZE(n,e.slice(8)),n}function Aue(t,e){const n=[nn(t.chainId,"chainId"),nn(t.nonce,"nonce"),nn(t.gasPrice||0,"gasPrice"),nn(t.gasLimit,"gasLimit"),t.to||"0x",nn(t.value,"value"),t.data,XE(t.accessList||[])];return e&&(n.push(nn(e.yParity,"recoveryParam")),n.push(Ir(e.r)),n.push(Ir(e.s))),An(["0x01",pu(n)])}function xue(t){let e=pb(Dt(t).slice(1)),n="3",r=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const s=e[1],o=e[2],a=e[3];ee(Array.isArray(s),"invalid network format: blobs not an array","fields[1]",s),ee(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),ee(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),ee(s.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),ee(s.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let l=0;l<e[1].length;l++)r.push({data:s[l],commitment:o[l],proof:a[l]});e=e[0]}ee(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",Be(t));const i={type:3,chainId:En(e[0],"chainId"),nonce:qp(e[1],"nonce"),maxPriorityFeePerGas:En(e[2],"maxPriorityFeePerGas"),maxFeePerGas:En(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:En(e[4],"gasLimit"),to:_b(e[5]),value:En(e[6],"value"),data:Be(e[7]),accessList:YE(e[8],"accessList"),maxFeePerBlobGas:En(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(i.blobs=r),ee(i.to!=null,`invalid address for transaction type: ${n}`,"data",t),ee(Array.isArray(i.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let s=0;s<i.blobVersionedHashes.length;s++)ee(Qt(i.blobVersionedHashes[s],32),`invalid blobVersionedHash at index ${s}: must be length 32`,"data",t);return e.length===11||ZE(i,e.slice(11)),i}function Eue(t,e,n){const r=[nn(t.chainId,"chainId"),nn(t.nonce,"nonce"),nn(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),nn(t.maxFeePerGas||0,"maxFeePerGas"),nn(t.gasLimit,"gasLimit"),t.to||jp,nn(t.value,"value"),t.data,XE(t.accessList||[]),nn(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),mue(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(nn(e.yParity,"yParity")),r.push(Ir(e.r)),r.push(Ir(e.s)),n)?An(["0x03",pu([r,n.map(i=>i.data),n.map(i=>i.commitment),n.map(i=>i.proof)])]):An(["0x03",pu(r)])}const Wo=class Wo{constructor(){ae(this,Cd);ae(this,Xs);ae(this,md);ae(this,gd);ae(this,yd);ae(this,bd);ae(this,wd);ae(this,vd);ae(this,Ad);ae(this,xd);ae(this,Ed);ae(this,kd);ae(this,Sd);ae(this,Ju);ae(this,ol);ae(this,Go);ae(this,al);L(this,Xs,null),L(this,md,null),L(this,yd,0),L(this,bd,Yn),L(this,wd,null),L(this,vd,null),L(this,Ad,null),L(this,gd,"0x"),L(this,xd,Yn),L(this,Ed,Yn),L(this,kd,null),L(this,Sd,null),L(this,Ju,null),L(this,ol,null),L(this,al,null),L(this,Go,null)}get type(){return T(this,Xs)}set type(e){switch(e){case null:L(this,Xs,null);break;case 0:case"legacy":L(this,Xs,0);break;case 1:case"berlin":case"eip-2930":L(this,Xs,1);break;case 2:case"london":case"eip-1559":L(this,Xs,2);break;case 3:case"cancun":case"eip-4844":L(this,Xs,3);break;default:ee(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=T(this,md);return e==null&&this.type===3?jp:e}set to(e){L(this,md,e==null?null:jt(e))}get nonce(){return T(this,yd)}set nonce(e){L(this,yd,st(e,"value"))}get gasLimit(){return T(this,bd)}set gasLimit(e){L(this,bd,He(e))}get gasPrice(){const e=T(this,wd);return e==null&&(this.type===0||this.type===1)?Yn:e}set gasPrice(e){L(this,wd,e==null?null:He(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,vd);return e??(this.type===2||this.type===3?Yn:null)}set maxPriorityFeePerGas(e){L(this,vd,e==null?null:He(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,Ad);return e??(this.type===2||this.type===3?Yn:null)}set maxFeePerGas(e){L(this,Ad,e==null?null:He(e,"maxFeePerGas"))}get data(){return T(this,gd)}set data(e){L(this,gd,Be(e))}get value(){return T(this,xd)}set value(e){L(this,xd,He(e,"value"))}get chainId(){return T(this,Ed)}set chainId(e){L(this,Ed,He(e))}get signature(){return T(this,kd)||null}set signature(e){L(this,kd,e==null?null:us.from(e))}get accessList(){const e=T(this,Sd)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){L(this,Sd,e==null?null:Ga(e))}get maxFeePerBlobGas(){const e=T(this,Ju);return e==null&&this.type===3?Yn:e}set maxFeePerBlobGas(e){L(this,Ju,e==null?null:He(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ol);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){ee(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)ee(Qt(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}L(this,ol,e)}get blobs(){return T(this,al)==null?null:T(this,al).map(e=>Object.assign({},e))}set blobs(e){if(e==null){L(this,al,null);return}const n=[],r=[];for(let i=0;i<e.length;i++){const s=e[i];if(hE(s)){me(T(this,Go),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=Dt(s);if(ee(o.length<=JE,"blob is too large",`blobs[${i}]`,s),o.length!==JE){const u=new Uint8Array(JE);u.set(o),o=u}const a=T(this,Go).blobToKzgCommitment(o),l=Be(T(this,Go).computeBlobKzgProof(o,a));n.push({data:Be(o),commitment:Be(a),proof:l}),r.push(vR(1,a))}else{const o=Be(s.commitment);n.push({data:Be(s.data),commitment:o,proof:Be(s.proof)}),r.push(vR(1,o))}}L(this,al,n),L(this,ol,r)}get kzg(){return T(this,Go)}set kzg(e){L(this,Go,e)}get hash(){return this.signature==null?null:Bn(Te(this,Cd,dw).call(this,!0,!1))}get unsignedHash(){return Bn(this.unsignedSerialized)}get from(){return this.signature==null?null:uue(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Hp.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return Te(this,Cd,dw).call(this,!0,!0)}get unsignedSerialized(){return Te(this,Cd,dw).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,n=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,i=T(this,Ju)!=null||T(this,ol);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&me(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),me(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),me(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return this.type!=null?s.push(this.type):n?s.push(2):e?(s.push(1),r||s.push(0)):r?(s.push(1),s.push(2)):(i&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Wo.from(this)}toJSON(){const e=n=>n==null?null:n.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Wo;if(typeof e=="string"){const r=Dt(e);if(r[0]>=127)return Wo.from(gue(r));switch(r[0]){case 1:return Wo.from(vue(r));case 2:return Wo.from(bue(r));case 3:return Wo.from(xue(r))}me(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new Wo;return e.type!=null&&(n.type=e.type),e.to!=null&&(n.to=e.to),e.nonce!=null&&(n.nonce=e.nonce),e.gasLimit!=null&&(n.gasLimit=e.gasLimit),e.gasPrice!=null&&(n.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(n.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(n.data=e.data),e.value!=null&&(n.value=e.value),e.chainId!=null&&(n.chainId=e.chainId),e.signature!=null&&(n.signature=us.from(e.signature)),e.accessList!=null&&(n.accessList=e.accessList),e.blobVersionedHashes!=null&&(n.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(n.kzg=e.kzg),e.blobs!=null&&(n.blobs=e.blobs),e.hash!=null&&(ee(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),ee(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(ee(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),ee(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}};Xs=new WeakMap,md=new WeakMap,gd=new WeakMap,yd=new WeakMap,bd=new WeakMap,wd=new WeakMap,vd=new WeakMap,Ad=new WeakMap,xd=new WeakMap,Ed=new WeakMap,kd=new WeakMap,Sd=new WeakMap,Ju=new WeakMap,ol=new WeakMap,Go=new WeakMap,al=new WeakMap,Cd=new WeakSet,dw=function(e,n){me(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return yue(this,r);case 1:return Aue(this,r);case 2:return wue(this,r);case 3:return Eue(this,r,n?this.blobs:null)}me(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let Qp=Wo;const AR=new Uint8Array(32);AR.fill(0);const kue=BigInt(-1),xR=BigInt(0),ER=BigInt(1),Sue=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Cue(t){const e=Dt(t),n=e.length%32;return n?An([e,AR.slice(n)]):Be(e)}const Due=Fa(ER,32),Tue=Fa(xR,32),kR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ek=["name","version","chainId","verifyingContract","salt"];function SR(t){return function(e){return ee(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Oue={name:SR("name"),version:SR("version"),chainId:function(t){const e=He(t,"domain.chainId");return ee(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):hu(e)},verifyingContract:function(t){try{return jt(t).toLowerCase()}catch{}ee(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=Dt(t,"domain.salt");return ee(e.length===32,'invalid domain value "salt"',"domain.salt",t),Be(e)}};function tk(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);ee(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const i=Rp(Sue,n?r-1:r),s=n?(i+ER)*kue:xR;return function(o){const a=He(o,"value");return ee(a>=s&&a<=i,`value out-of-bounds for ${t}`,"value",a),Fa(n?TP(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return ee(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const i=Dt(r);return ee(i.length===n,`invalid length for ${t}`,"value",r),Cue(r)}}}switch(t){case"address":return function(e){return du(jt(e),32)};case"bool":return function(e){return e?Due:Tue};case"bytes":return function(e){return Bn(e)};case"string":return function(e){return wu(e)}}return null}function CR(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function Mb(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}const ji=class ji{constructor(e){ae(this,sw);W(this,"primaryType");ae(this,U0);ae(this,Ko);ae(this,Dd);L(this,Ko,new Map),L(this,Dd,new Map);const n=new Map,r=new Map,i=new Map,s={};Object.keys(e).forEach(l=>{s[l]=e[l].map(({name:u,type:c})=>{let{base:f,index:d}=Mb(c);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),n.set(l,new Set),r.set(l,[]),i.set(l,new Set)}),L(this,U0,JSON.stringify(s));for(const l in s){const u=new Set;for(const c of s[l]){ee(!u.has(c.name),`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(l)}`,"types",e),u.add(c.name);const f=Mb(c.type).base;ee(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!tk(f)&&(ee(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),n.get(l).add(f))}}const o=Array.from(r.keys()).filter(l=>r.get(l).length===0);ee(o.length!==0,"missing primary type","types",e),ee(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),$e(this,{primaryType:o[0]});function a(l,u){ee(!u.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),u.add(l);for(const c of n.get(l))if(r.has(c)){a(c,u);for(const f of u)i.get(f).add(c)}u.delete(l)}a(this.primaryType,new Set);for(const[l,u]of i){const c=Array.from(u);c.sort(),T(this,Ko).set(l,CR(l,s[l])+c.map(f=>CR(f,s[f])).join(""))}}get types(){return JSON.parse(T(this,U0))}getEncoder(e){let n=T(this,Dd).get(e);return n||(n=Te(this,sw,Y9).call(this,e),T(this,Dd).set(e,n)),n}encodeType(e){const n=T(this,Ko).get(e);return ee(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return Bn(this.encodeData(e,n))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,n,r){if(tk(e))return r(e,n);const i=Mb(e).array;if(i)return ee(i.count===-1||i.count===n.length,`array length mismatch; expected length ${i.count}`,"value",n),n.map(o=>this._visit(i.prefix,o,r));const s=this.types[e];if(s)return s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,n[a],r),o),{});ee(!1,`unknown type: ${e}`,"type",e)}visit(e,n){return this._visit(this.primaryType,e,n)}static from(e){return new ji(e)}static getPrimaryType(e){return ji.from(e).primaryType}static hashStruct(e,n,r){return ji.from(n).hashStruct(e,r)}static hashDomain(e){const n=[];for(const r in e){if(e[r]==null)continue;const i=kR[r];ee(i,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:i})}return n.sort((r,i)=>ek.indexOf(r.name)-ek.indexOf(i.name)),ji.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return An(["0x1901",ji.hashDomain(e),ji.from(n).hash(r)])}static hash(e,n,r){return Bn(ji.encode(e,n,r))}static async resolveNames(e,n,r,i){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const s={};e.verifyingContract&&!Qt(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ji.from(n);o.visit(r,(a,l)=>(a==="address"&&!Qt(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=await i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:r}}static getPayload(e,n,r){ji.hashDomain(e);const i={},s=[];ek.forEach(l=>{const u=e[l];u!=null&&(i[l]=Oue[l](u),s.push({name:l,type:kR[l]}))});const o=ji.from(n);n=o.types;const a=Object.assign({},n);return ee(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),a.EIP712Domain=s,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,(l,u)=>{if(l.match(/^bytes(\d*)/))return Be(Dt(u));if(l.match(/^u?int/))return He(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return ee(typeof u=="string","invalid string","value",u),u}ee(!1,"unsupported type","type",l)})}}};U0=new WeakMap,Ko=new WeakMap,Dd=new WeakMap,sw=new WeakSet,Y9=function(e){{const i=tk(e);if(i)return i}const n=Mb(e).array;if(n){const i=n.prefix,s=this.getEncoder(i);return o=>{ee(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let a=o.map(s);return T(this,Ko).has(i)&&(a=a.map(Bn)),Bn(An(a))}}const r=this.types[e];if(r){const i=wu(T(this,Ko).get(e));return s=>{const o=r.map(({name:a,type:l})=>{const u=this.getEncoder(l)(s[a]);return T(this,Ko).has(l)?Bn(u):u});return o.unshift(i),An(o)}}ee(!1,`unknown type: ${e}`,"type",e)};let Nb=ji;function Fr(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const _ue=Fr("external public payable override".split(" ")),DR="constant external internal payable private public pure view override",Mue=Fr(DR.split(" ")),TR="constructor error event fallback function receive struct",OR=Fr(TR.split(" ")),_R="calldata memory storage payable indexed",Nue=Fr(_R.split(" ")),Pue=[TR,_R,"tuple returns",DR].join(" "),Iue=Fr(Pue.split(" ")),Rue={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Lue=new RegExp("^(\\s*)"),Bue=new RegExp("^([0-9]+)"),Fue=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),MR=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),NR=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),ow=class ow{constructor(e){ae(this,j0);ae(this,dr);ae(this,ys);L(this,dr,0),L(this,ys,e.slice())}get offset(){return T(this,dr)}get length(){return T(this,ys).length-T(this,dr)}clone(){return new ow(T(this,ys))}reset(){L(this,dr,0)}popKeyword(e){const n=this.peek();if(n.type!=="KEYWORD"||!e.has(n.text))throw new Error(`expected keyword ${n.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const n=this.peek();throw new Error(`expected ${e}; got ${n.type} ${JSON.stringify(n.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=Te(this,j0,IC).call(this,T(this,dr)+1,e.match+1);return L(this,dr,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;T(this,dr)<e.match-1;){const r=this.peek().linkNext;n.push(Te(this,j0,IC).call(this,T(this,dr)+1,r)),L(this,dr,r)}return L(this,dr,e.match+1),n}peek(){if(T(this,dr)>=T(this,ys).length)throw new Error("out-of-bounds");return T(this,ys)[T(this,dr)]}peekKeyword(e){const n=this.peekType("KEYWORD");return n!=null&&e.has(n)?n:null}peekType(e){if(this.length===0)return null;const n=this.peek();return n.type===e?n.text:null}pop(){const e=this.peek();return Y0(this,dr)._++,e}toString(){const e=[];for(let n=T(this,dr);n<T(this,ys).length;n++){const r=T(this,ys)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};dr=new WeakMap,ys=new WeakMap,j0=new WeakSet,IC=function(e=0,n=0){return new ow(T(this,ys).slice(e,n).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let cs=ow;function Wa(t){const e=[],n=o=>{const a=s<t.length?JSON.stringify(t[s]):"$EOI";throw new Error(`invalid token ${a} at ${s}: ${o}`)};let r=[],i=[],s=0;for(;s<t.length;){let o=t.substring(s),a=o.match(Lue);a&&(s+=a[1].length,o=t.substring(s));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};e.push(l);let u=Rue[o[0]]||"";if(u){if(l.type=u,l.text=o[0],s++,u==="OPEN_PAREN")r.push(e.length-1),i.push(e.length-1);else if(u=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),l.match=r.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=i.pop(),e[l.linkBack].linkNext=e.length-1;else if(u==="COMMA")l.linkBack=i.pop(),e[l.linkBack].linkNext=e.length-1,i.push(e.length-1);else if(u==="OPEN_BRACKET")l.type="BRACKET";else if(u==="CLOSE_BRACKET"){let c=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;c=f+c,e[e.length-1].value=st(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=c}continue}if(a=o.match(Fue),a){if(l.text=a[1],s+=l.text.length,Iue.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(NR)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(Bue),a){l.text=a[1],l.type="NUMBER",s+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new cs(e.map(o=>Object.freeze(o)))}function PR(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function Pb(t,e){if(e.peekKeyword(OR)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function Do(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function IR(t){let e=Do(t,Mue);return PR(e,Fr("constant payable nonpayable".split(" "))),PR(e,Fr("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function To(t,e){return t.popParams().map(n=>rr.from(n,e))}function RR(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return He(t.pop().text);throw new Error("invalid gas")}return null}function xu(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const Uue=new RegExp(/^(.*)\[([0-9]*)\]$/);function LR(t){const e=t.match(NR);if(ee(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);ee(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);ee(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const cn={},Yr=Symbol.for("_ethers_internal"),BR="_ParamTypeInternal",FR="_ErrorInternal",UR="_EventInternal",jR="_ConstructorInternal",HR="_FallbackInternal",VR="_FunctionInternal",zR="_StructInternal",Hi=class Hi{constructor(e,n,r,i,s,o,a,l){ae(this,Td);W(this,"name");W(this,"type");W(this,"baseType");W(this,"indexed");W(this,"components");W(this,"arrayLength");W(this,"arrayChildren");if(ub(e,cn,"ParamType"),Object.defineProperty(this,Yr,{value:BR}),o&&(o=Object.freeze(o.slice())),i==="array"){if(a==null||l==null)throw new Error("")}else if(a!=null||l!=null)throw new Error("");if(i==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");$e(this,{name:n,type:r,baseType:i,indexed:s,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=r,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(i=>r.arrayChildren.walk(i,n))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((i,s)=>r.components[s].walk(i,n))}return n(this.type,e)}async walkAsync(e,n){const r=[],i=[e];return Te(this,Td,hw).call(this,r,e,n,s=>{i[0]=s}),r.length&&await Promise.all(r),i[0]}static from(e,n){if(Hi.isParamType(e))return e;if(typeof e=="string")try{return Hi.from(Wa(e),n)}catch{ee(!1,"invalid param type","obj",e)}else if(e instanceof cs){let a="",l="",u=null;Do(e,Fr(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",u=e.popParams().map(m=>Hi.from(m)),a=`tuple(${u.map(m=>m.format()).join(",")})`):(a=LR(e.popType("TYPE")),l=a);let c=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();c=new Hi(cn,"",a,l,null,u,f,c),f=m.value,a+=m.text,l="array",u=null}let d=null;if(Do(e,Nue).has("indexed")){if(!n)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Hi(cn,p,a,l,d,u,f,c)}const r=e.name;ee(!r||typeof r=="string"&&r.match(MR),"invalid name","obj.name",r);let i=e.indexed;i!=null&&(ee(n,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let s=e.type,o=s.match(Uue);if(o){const a=parseInt(o[2]||"-1"),l=Hi.from({type:o[1],components:e.components});return new Hi(cn,r||"",s,"array",i,null,a,l)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const a=e.components!=null?e.components.map(u=>Hi.from(u)):null;return new Hi(cn,r||"",s,"tuple",i,a,null,null)}return s=LR(e.type),new Hi(cn,r||"",s,s,i,null,null,null)}static isParamType(e){return e&&e[Yr]===BR}};Td=new WeakSet,hw=function(e,n,r,i){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=n.slice();a.forEach((l,u)=>{var c;Te(c=o,Td,hw).call(c,e,l,r,f=>{a[u]=f})}),i(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(n))a=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in n))throw new Error(`missing value for component ${l.name}`);return n[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,u)=>{var c;Te(c=o[u],Td,hw).call(c,e,l,r,f=>{a[u]=f})}),i(a);return}const s=r(this.type,n);s.then?e.push(async function(){i(await s)}()):i(s)};let rr=Hi;class Eu{constructor(e,n,r){W(this,"type");W(this,"inputs");ub(e,cn,"Fragment"),r=Object.freeze(r.slice()),$e(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{Eu.from(JSON.parse(e))}catch{}return Eu.from(Wa(e))}if(e instanceof cs)switch(e.peekKeyword(OR)){case"constructor":return Oo.from(e);case"error":return Xr.from(e);case"event":return Ks.from(e);case"fallback":case"receive":return _o.from(e);case"function":return qs.from(e);case"struct":return ku.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Oo.from(e);case"error":return Xr.from(e);case"event":return Ks.from(e);case"fallback":case"receive":return _o.from(e);case"function":return qs.from(e);case"struct":return ku.from(e)}me(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}ee(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Oo.isFragment(e)}static isError(e){return Xr.isFragment(e)}static isEvent(e){return Ks.isFragment(e)}static isFunction(e){return qs.isFragment(e)}static isStruct(e){return ku.isFragment(e)}}class Ib extends Eu{constructor(n,r,i,s){super(n,r,s);W(this,"name");ee(typeof i=="string"&&i.match(MR),"invalid identifier","name",i),s=Object.freeze(s.slice()),$e(this,{name:i})}}function Jp(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class Xr extends Ib{constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,Yr,{value:FR})}get selector(){return wu(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+Jp(e,this.inputs)),n.join(" ")}static from(e){if(Xr.isFragment(e))return e;if(typeof e=="string")return Xr.from(Wa(e));if(e instanceof cs){const n=Pb("error",e),r=To(e);return xu(e),new Xr(cn,n,r)}return new Xr(cn,e.name,e.inputs?e.inputs.map(rr.from):[])}static isFragment(e){return e&&e[Yr]===FR}}class Ks extends Ib{constructor(n,r,i,s){super(n,"event",r,i);W(this,"anonymous");Object.defineProperty(this,Yr,{value:UR}),$e(this,{anonymous:s})}get topicHash(){return wu(this.format("sighash"))}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(n)))});const r=[];return n!=="sighash"&&r.push("event"),r.push(this.name+Jp(n,this.inputs)),n!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(n,r){return r=(r||[]).map(s=>rr.from(s)),new Ks(cn,n,r,!1).topicHash}static from(n){if(Ks.isFragment(n))return n;if(typeof n=="string")try{return Ks.from(Wa(n))}catch{ee(!1,"invalid event fragment","obj",n)}else if(n instanceof cs){const r=Pb("event",n),i=To(n,!0),s=!!Do(n,Fr(["anonymous"])).has("anonymous");return xu(n),new Ks(cn,r,i,s)}return new Ks(cn,n.name,n.inputs?n.inputs.map(r=>rr.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[Yr]===UR}}class Oo extends Eu{constructor(n,r,i,s,o){super(n,r,i);W(this,"payable");W(this,"gas");Object.defineProperty(this,Yr,{value:jR}),$e(this,{payable:s,gas:o})}format(n){if(me(n!=null&&n!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),n==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(n)))});const r=[`constructor${Jp(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(Oo.isFragment(n))return n;if(typeof n=="string")try{return Oo.from(Wa(n))}catch{ee(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof cs){Do(n,Fr(["constructor"]));const r=To(n),i=!!Do(n,_ue).has("payable"),s=RR(n);return xu(n),new Oo(cn,"constructor",r,i,s)}return new Oo(cn,"constructor",n.inputs?n.inputs.map(rr.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[Yr]===jR}}class _o extends Eu{constructor(n,r,i){super(n,"fallback",r);W(this,"payable");Object.defineProperty(this,Yr,{value:HR}),$e(this,{payable:i})}format(n){const r=this.inputs.length===0?"receive":"fallback";if(n==="json"){const i=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:i})}return`${r}()${this.payable?" payable":""}`}static from(n){if(_o.isFragment(n))return n;if(typeof n=="string")try{return _o.from(Wa(n))}catch{ee(!1,"invalid fallback fragment","obj",n)}else if(n instanceof cs){const r=n.toString(),i=n.peekKeyword(Fr(["fallback","receive"]));if(ee(i,"type must be fallback or receive","obj",r),n.popKeyword(Fr(["fallback","receive"]))==="receive"){const l=To(n);return ee(l.length===0,"receive cannot have arguments","obj.inputs",l),Do(n,Fr(["payable"])),xu(n),new _o(cn,[],!0)}let o=To(n);o.length?ee(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[rr.from("bytes")];const a=IR(n);if(ee(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Do(n,Fr(["returns"])).has("returns")){const l=To(n);ee(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return xu(n),new _o(cn,o,a==="payable")}if(n.type==="receive")return new _o(cn,[],!0);if(n.type==="fallback"){const r=[rr.from("bytes")],i=n.stateMutability==="payable";return new _o(cn,r,i)}ee(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[Yr]===HR}}class qs extends Ib{constructor(n,r,i,s,o,a){super(n,"function",r,s);W(this,"constant");W(this,"outputs");W(this,"stateMutability");W(this,"payable");W(this,"gas");Object.defineProperty(this,Yr,{value:VR}),o=Object.freeze(o.slice()),$e(this,{constant:i==="view"||i==="pure",gas:a,outputs:o,payable:i==="payable",stateMutability:i})}get selector(){return wu(this.format("sighash")).substring(0,10)}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(n))),outputs:this.outputs.map(i=>JSON.parse(i.format(n)))});const r=[];return n!=="sighash"&&r.push("function"),r.push(this.name+Jp(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(Jp(n,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(n,r){return r=(r||[]).map(s=>rr.from(s)),new qs(cn,n,"view",r,[],null).selector}static from(n){if(qs.isFragment(n))return n;if(typeof n=="string")try{return qs.from(Wa(n))}catch{ee(!1,"invalid function fragment","obj",n)}else if(n instanceof cs){const i=Pb("function",n),s=To(n),o=IR(n);let a=[];Do(n,Fr(["returns"])).has("returns")&&(a=To(n));const l=RR(n);return xu(n),new qs(cn,i,o,s,a,l)}let r=n.stateMutability;return r==null&&(r="payable",typeof n.constant=="boolean"?(r="view",n.constant||(r="payable",typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable"))):typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable")),new qs(cn,n.name,r,n.inputs?n.inputs.map(rr.from):[],n.outputs?n.outputs.map(rr.from):[],n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[Yr]===VR}}class ku extends Ib{constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,Yr,{value:zR})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return ku.from(Wa(e))}catch{ee(!1,"invalid struct fragment","obj",e)}else if(e instanceof cs){const n=Pb("struct",e),r=To(e);return xu(e),new ku(cn,n,r)}return new ku(cn,e.name,e.inputs?e.inputs.map(rr.from):[])}static isFragment(e){return e&&e[Yr]===zR}}const fs=new Map;fs.set(0,"GENERIC_PANIC"),fs.set(1,"ASSERT_FALSE"),fs.set(17,"OVERFLOW"),fs.set(18,"DIVIDE_BY_ZERO"),fs.set(33,"ENUM_RANGE_ERROR"),fs.set(34,"BAD_STORAGE_DATA"),fs.set(49,"STACK_UNDERFLOW"),fs.set(50,"ARRAY_RANGE_ERROR"),fs.set(65,"OUT_OF_MEMORY"),fs.set(81,"UNINITIALIZED_FUNCTION_CALL");const jue=new RegExp(/^bytes([0-9]*)$/),Hue=new RegExp(/^(u?int)([0-9]*)$/);let nk=null,$R=1024;function Vue(t,e,n,r){let i="missing revert data",s=null;const o=null;let a=null;if(n){i="execution reverted";const u=Dt(n);if(n=Be(n),u.length===0)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(u.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(Be(u.slice(0,4))==="0x08c379a0")try{s=r.decode(["string"],u.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[s]},i+=`: ${JSON.stringify(s)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(Be(u.slice(0,4))==="0x4e487b71")try{const c=Number(r.decode(["uint256"],u.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[c]},s=`Panic due to ${fs.get(c)||"UNKNOWN"}(${c})`,i+=`: ${s}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const l={to:e.to?jt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=jt(e.from)),an(i,"CALL_EXCEPTION",{action:t,data:n,reason:s,transaction:l,invocation:o,revert:a})}const aw=class aw{constructor(){ae(this,ll)}getDefaultValue(e){const n=e.map(i=>Te(this,ll,qd).call(this,rr.from(i)));return new xb(n,"_").defaultValue()}encode(e,n){kP(n.length,e.length,"types/values length mismatch");const r=e.map(o=>Te(this,ll,qd).call(this,rr.from(o))),i=new xb(r,"_"),s=new bE;return i.encode(s,n),s.data}decode(e,n,r){const i=e.map(o=>Te(this,ll,qd).call(this,rr.from(o)));return new xb(i,"_").decode(new wE(n,r,$R))}static _setDefaultMaxInflation(e){ee(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),$R=e}static defaultAbiCoder(){return nk==null&&(nk=new aw),nk}static getBuiltinCallException(e,n,r){return Vue(e,n,r,aw.defaultAbiCoder())}};ll=new WeakSet,qd=function(e){if(e.isArray())return new hle(Te(this,ll,qd).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new xb(e.components.map(r=>Te(this,ll,qd).call(this,r)),e.name);switch(e.baseType){case"address":return new fle(e.name);case"bool":return new ple(e.name);case"string":return new Ele(e.name);case"bytes":return new mle(e.name);case"":return new ble(e.name)}let n=e.type.match(Hue);if(n){let r=parseInt(n[2]||"256");return ee(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new xle(r/8,n[1]==="int",e.name)}if(n=e.type.match(jue),n){let r=parseInt(n[1]);return ee(r!==0&&r<=32,"invalid bytes length","param",e),new gle(r,e.name)}ee(!1,"invalid type","type",e.type)};let Nf=aw;class zue{constructor(e,n,r){W(this,"fragment");W(this,"name");W(this,"signature");W(this,"topic");W(this,"args");const i=e.name,s=e.format();$e(this,{fragment:e,name:i,signature:s,topic:n,args:r})}}class $ue{constructor(e,n,r,i){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");W(this,"value");const s=e.name,o=e.format();$e(this,{fragment:e,name:s,args:r,signature:o,selector:n,value:i})}}class Gue{constructor(e,n,r){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");const i=e.name,s=e.format();$e(this,{fragment:e,name:i,args:r,signature:s,selector:n})}}class GR{constructor(e){W(this,"hash");W(this,"_isIndexed");$e(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const WR={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},KR={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&WR[t.toString()]&&(e=WR[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}},Yu=class Yu{constructor(e){ae(this,no);W(this,"fragments");W(this,"deploy");W(this,"fallback");W(this,"receive");ae(this,Zs);ae(this,eo);ae(this,to);ae(this,xr);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,L(this,to,new Map),L(this,Zs,new Map),L(this,eo,new Map);const r=[];for(const o of n)try{r.push(Eu.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}$e(this,{fragments:Object.freeze(r)});let i=null,s=!1;L(this,xr,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}$e(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(ee(!i||o.payable!==i.payable,"conflicting fallback fragments",`fragments[${a}]`,o),i=o,s=i.payable);return;case"function":l=T(this,to);break;case"event":l=T(this,eo);break;case"error":l=T(this,Zs);break;default:return}const u=o.format();l.has(u)||l.set(u,o)}),this.deploy||$e(this,{deploy:Oo.from("constructor()")}),$e(this,{fallback:i,receive:s})}format(e){const n=e?"minimal":"full";return this.fragments.map(i=>i.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return Nf.defaultAbiCoder()}getFunctionName(e){const n=Te(this,no,pw).call(this,e,null,!1);return ee(n,"no matching function","key",e),n.name}hasFunction(e){return!!Te(this,no,pw).call(this,e,null,!1)}getFunction(e,n){return Te(this,no,pw).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(T(this,to).keys());n.sort((r,i)=>r.localeCompare(i));for(let r=0;r<n.length;r++){const i=n[r];e(T(this,to).get(i),r)}}getEventName(e){const n=Te(this,no,mw).call(this,e,null,!1);return ee(n,"no matching event","key",e),n.name}hasEvent(e){return!!Te(this,no,mw).call(this,e,null,!1)}getEvent(e,n){return Te(this,no,mw).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(T(this,eo).keys());n.sort((r,i)=>r.localeCompare(i));for(let r=0;r<n.length;r++){const i=n[r];e(T(this,eo).get(i),r)}}getError(e,n){if(Qt(e)){const i=e.toLowerCase();if(KR[i])return Xr.from(KR[i].signature);for(const s of T(this,Zs).values())if(i===s.selector)return s;return null}if(e.indexOf("(")===-1){const i=[];for(const[s,o]of T(this,Zs))s.split("(")[0]===e&&i.push(o);if(i.length===0)return e==="Error"?Xr.from("error Error(string)"):e==="Panic"?Xr.from("error Panic(uint256)"):null;if(i.length>1){const s=i.map(o=>JSON.stringify(o.format())).join(", ");ee(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return i[0]}if(e=Xr.from(e).format(),e==="Error(string)")return Xr.from("error Error(string)");if(e==="Panic(uint256)")return Xr.from("error Panic(uint256)");const r=T(this,Zs).get(e);return r||null}forEachError(e){const n=Array.from(T(this,Zs).keys());n.sort((r,i)=>r.localeCompare(i));for(let r=0;r<n.length;r++){const i=n[r];e(T(this,Zs).get(i),r)}}_decodeParams(e,n){return T(this,xr).decode(e,n)}_encodeParams(e,n){return T(this,xr).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);ee(r,"unknown error","fragment",e),e=r}return ee(bn(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,bn(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);ee(r,"unknown error","fragment",e),e=r}return An([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);ee(r,"unknown function","fragment",e),e=r}return ee(bn(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,bn(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);ee(r,"unknown function","fragment",e),e=r}return An([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const s=this.getFunction(e);ee(s,"unknown function","fragment",e),e=s}let r="invalid length for result data";const i=Pr(n);if(i.length%32===0)try{return T(this,xr).decode(e.outputs,i)}catch{r="could not decode result data"}me(!1,r,"BAD_DATA",{value:Be(i),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=Dt(e,"data"),i=Nf.getBuiltinCallException("call",n,r);if(i.message.startsWith("execution reverted (unknown custom error)")){const a=Be(r.slice(0,4)),l=this.getError(a);if(l)try{const u=T(this,xr).decode(l.inputs,r.slice(4));i.revert={name:l.name,signature:l.format(),args:u},i.reason=i.revert.signature,i.message=`execution reverted: ${i.reason}`}catch{i.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(n);return o&&(i.invocation={method:o.name,signature:o.signature,args:o.args}),i}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);ee(r,"unknown function","fragment",e),e=r}return Be(T(this,xr).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const s=this.getEvent(e);ee(s,"unknown event","eventFragment",e),e=s}me(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const i=(s,o)=>s.type==="string"?wu(o):s.type==="bytes"?Bn(Be(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=Fa(o):s.type.match(/^bytes/)?o=Soe(o,32):s.type==="address"&&T(this,xr).encode(["address"],[o]),du(Be(o),32));for(n.forEach((s,o)=>{const a=e.inputs[o];if(!a.indexed){ee(s==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?ee(!1,"filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?r.push(s.map(l=>i(a,l))):r.push(i(a,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,n){if(typeof e=="string"){const o=this.getEvent(e);ee(o,"unknown event","eventFragment",e),e=o}const r=[],i=[],s=[];return e.anonymous||r.push(e.topicHash),ee(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((o,a)=>{const l=n[a];if(o.indexed)if(o.type==="string")r.push(wu(l));else if(o.type==="bytes")r.push(Bn(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,xr).encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:T(this,xr).encode(i,s),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const h=this.getEvent(e);ee(h,"unknown event","eventFragment",e),e=h}if(r!=null&&!e.anonymous){const h=e.topicHash;ee(Qt(r[0],32)&&r[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const i=[],s=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(i.push(rr.from({type:"bytes32",name:h.name})),o.push(!0)):(i.push(h),o.push(!1)):(s.push(h),o.push(!1))});const a=r!=null?T(this,xr).decode(i,An(r)):null,l=T(this,xr).decode(s,n,!0),u=[],c=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new GR(null);else if(o[p])m=new GR(a[d++]);else try{m=a[d++]}catch(g){m=g}else try{m=l[f++]}catch(g){m=g}u.push(m),c.push(h.name||null)}),Af.fromItems(u,c)}parseTransaction(e){const n=Dt(e.data,"tx.data"),r=He(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(Be(n.slice(0,4)));if(!i)return null;const s=T(this,xr).decode(i.inputs,n.slice(4));return new $ue(i,i.selector,s,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new zue(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=Be(e),r=this.getError(bn(n,0,4));if(!r)return null;const i=T(this,xr).decode(r.inputs,bn(n,4));return new Gue(r,r.selector,i)}static from(e){return e instanceof Yu?e:typeof e=="string"?new Yu(JSON.parse(e)):typeof e.formatJson=="function"?new Yu(e.formatJson()):typeof e.format=="function"?new Yu(e.format("json")):new Yu(e)}};Zs=new WeakMap,eo=new WeakMap,to=new WeakMap,xr=new WeakMap,no=new WeakSet,pw=function(e,n,r){if(Qt(e)){const s=e.toLowerCase();for(const o of T(this,to).values())if(s===o.selector)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of T(this,to))o.split("(")[0]===e&&s.push(a);if(n){const o=n.length>0?n[n.length-1]:null;let a=n.length,l=!0;wr.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let u=s.length-1;u>=0;u--){const c=s[u].inputs.length;c!==a&&(!l||c!==a-1)&&s.splice(u,1)}for(let u=s.length-1;u>=0;u--){const c=s[u].inputs;for(let f=0;f<n.length;f++)if(wr.isTyped(n[f])){if(f>=c.length){if(n[f].type==="overrides")continue;s.splice(u,1);break}if(n[f].type!==c[f].baseType){s.splice(u,1);break}}}}if(s.length===1&&n&&n.length!==s[0].inputs.length){const o=n[n.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&r){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ee(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return s[0]}const i=T(this,to).get(qs.from(e).format());return i||null},mw=function(e,n,r){if(Qt(e)){const s=e.toLowerCase();for(const o of T(this,eo).values())if(s===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of T(this,eo))o.split("(")[0]===e&&s.push(a);if(n){for(let o=s.length-1;o>=0;o--)s[o].inputs.length<n.length&&s.splice(o,1);for(let o=s.length-1;o>=0;o--){const a=s[o].inputs;for(let l=0;l<n.length;l++)if(wr.isTyped(n[l])&&n[l].type!==a[l].baseType){s.splice(o,1);break}}}if(s.length===0)return null;if(s.length>1&&r){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ee(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return s[0]}const i=T(this,eo).get(Ks.from(e).format());return i||null};let rk=Yu;const qR=BigInt(0);function Pf(t){return t??null}function kn(t){return t==null?null:t.toString()}class QR{constructor(e,n,r){W(this,"gasPrice");W(this,"maxFeePerGas");W(this,"maxPriorityFeePerGas");$e(this,{gasPrice:Pf(e),maxFeePerGas:Pf(n),maxPriorityFeePerGas:Pf(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:kn(e),maxFeePerGas:kn(n),maxPriorityFeePerGas:kn(r)}}}function Rb(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Be(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=He(t[i],`request.${i}`));const r="type,nonce".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=st(t[i],`request.${i}`));return t.accessList&&(e.accessList=Ga(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(i=>hE(i)?Be(i):Object.assign({},i))),e}class Wue{constructor(e,n){W(this,"provider");W(this,"number");W(this,"hash");W(this,"timestamp");W(this,"parentHash");W(this,"parentBeaconBlockRoot");W(this,"nonce");W(this,"difficulty");W(this,"gasLimit");W(this,"gasUsed");W(this,"stateRoot");W(this,"receiptsRoot");W(this,"blobGasUsed");W(this,"excessBlobGas");W(this,"miner");W(this,"prevRandao");W(this,"extraData");W(this,"baseFeePerGas");ae(this,qo);L(this,qo,e.transactions.map(r=>typeof r!="string"?new Xp(r,n):r)),$e(this,{provider:n,hash:Pf(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Pf(e.prevRandao),extraData:e.extraData,baseFeePerGas:Pf(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,qo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,qo).slice();return e.length===0?[]:(me(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:i,gasUsed:s,hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:g}=this;return{_type:"Block",baseFeePerGas:kn(e),difficulty:kn(n),extraData:r,gasLimit:kn(i),gasUsed:kn(s),blobGasUsed:kn(this.blobGasUsed),excessBlobGas:kn(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const n=this.transactions;return{next:()=>e<this.length?{value:n[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,qo).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=T(this,qo)[e];else{const r=e.toLowerCase();for(const i of T(this,qo))if(typeof i=="string"){if(i!==r)continue;n=i;break}else{if(i.hash===r)continue;n=i;break}}if(n==null)throw new Error("no such tx");return typeof n=="string"?await this.provider.getTransaction(n):n}getPrefetchedTransaction(e){const n=this.prefetchedTransactions;if(typeof e=="number")return n[e];e=e.toLowerCase();for(const r of n)if(r.hash===e)return r;ee(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Kue(this)}}qo=new WeakMap;class Yp{constructor(e,n){W(this,"provider");W(this,"transactionHash");W(this,"blockHash");W(this,"blockNumber");W(this,"removed");W(this,"address");W(this,"data");W(this,"topics");W(this,"index");W(this,"transactionIndex");this.provider=n;const r=Object.freeze(e.topics.slice());$e(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:i,index:s,removed:o,topics:a,transactionHash:l,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:i,index:s,removed:o,topics:a,transactionHash:l,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return me(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return me(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return me(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return que(this)}}class JR{constructor(e,n){W(this,"provider");W(this,"to");W(this,"from");W(this,"contractAddress");W(this,"hash");W(this,"index");W(this,"blockHash");W(this,"blockNumber");W(this,"logsBloom");W(this,"gasUsed");W(this,"blobGasUsed");W(this,"cumulativeGasUsed");W(this,"gasPrice");W(this,"blobGasPrice");W(this,"type");W(this,"status");W(this,"root");ae(this,H0);L(this,H0,Object.freeze(e.logs.map(i=>new Yp(i,n))));let r=qR;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),$e(this,{provider:n,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return T(this,H0)}toJSON(){const{to:e,from:n,contractAddress:r,hash:i,index:s,blockHash:o,blockNumber:a,logsBloom:l,logs:u,status:c,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:kn(this.cumulativeGasUsed),from:n,gasPrice:kn(this.gasPrice),blobGasUsed:kn(this.blobGasUsed),blobGasPrice:kn(this.blobGasPrice),gasUsed:kn(this.gasUsed),hash:i,index:s,logs:u,logsBloom:l,root:f,status:c,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return XR(this)}reorderedEvent(e){return me(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),YR(this,e)}}H0=new WeakMap;const CC=class CC{constructor(e,n){W(this,"provider");W(this,"blockNumber");W(this,"blockHash");W(this,"index");W(this,"hash");W(this,"type");W(this,"to");W(this,"from");W(this,"nonce");W(this,"gasLimit");W(this,"gasPrice");W(this,"maxPriorityFeePerGas");W(this,"maxFeePerGas");W(this,"maxFeePerBlobGas");W(this,"data");W(this,"value");W(this,"chainId");W(this,"signature");W(this,"accessList");W(this,"blobVersionedHashes");ae(this,ul);this.provider=n,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,L(this,ul,-1)}toJSON(){const{blockNumber:e,blockHash:n,index:r,hash:i,type:s,to:o,from:a,nonce:l,data:u,signature:c,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:n,blobVersionedHashes:d,chainId:kn(this.chainId),data:u,from:a,gasLimit:kn(this.gasLimit),gasPrice:kn(this.gasPrice),hash:i,maxFeePerGas:kn(this.maxFeePerGas),maxPriorityFeePerGas:kn(this.maxPriorityFeePerGas),maxFeePerBlobGas:kn(this.maxFeePerBlobGas),nonce:l,signature:c,to:o,index:r,type:s,value:kn(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const n=this.provider.getBlock(e);if(n==null)throw new Error("TODO");return n}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:n,blockNumber:r}=await br({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return n==null||n.blockNumber==null?0:r-n.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,n){const r=e??1,i=n??0;let s=T(this,ul),o=-1,a=s===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await br({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h<this.nonce){s=d;return}if(a)return null;const p=await this.getTransaction();if(!(p&&p.blockNumber!=null))for(o===-1&&(o=s-3,o<T(this,ul)&&(o=T(this,ul)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const g of m)if(g===this.hash)return;for(let g=0;g<m.length;g++){const y=await m.getTransaction(g);if(y.from===this.from&&y.nonce===this.nonce){if(a)return null;const v=await this.provider.getTransactionReceipt(y.hash);if(v==null||d-v.blockNumber+1<r)return;let w="replaced";y.data===this.data&&y.to===this.to&&y.value===this.value?w="repriced":y.data==="0x"&&y.from===y.to&&y.value===qR&&(w="cancelled"),me(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:w==="replaced"||w==="cancelled",reason:w,replacement:y.replaceableTransaction(s),hash:y.hash,receipt:v})}}o++}},u=d=>{if(d==null||d.status!==0)return d;me(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},c=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(c);if(c){if(await c.confirmations()>=r)return u(c)}else if(await l(),r===0)return null;return await new Promise((d,h)=>{const p=[],m=()=>{p.forEach(y=>y())};if(p.push(()=>{a=!0}),i>0){const y=setTimeout(()=>{m(),h(an("wait for transaction timeout","TIMEOUT"))},i);p.push(()=>{clearTimeout(y)})}const g=async y=>{if(await y.confirmations()>=r){m();try{d(u(y))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),s>=0){const y=async()=>{try{await l()}catch(v){if(Qn(v,"TRANSACTION_REPLACED")){m(),h(v);return}}a||this.provider.once("block",y)};p.push(()=>{this.provider.off("block",y)}),this.provider.once("block",y)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return me(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),XR(this)}reorderedEvent(e){return me(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),me(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),YR(this,e)}replaceableTransaction(e){ee(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new CC(this,this.provider);return L(n,ul,e),n}};ul=new WeakMap;let Xp=CC;function Kue(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function YR(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function XR(t){return{orphan:"drop-transaction",tx:t}}function que(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class ik extends Yp{constructor(n,r,i){super(n,n.provider);W(this,"interface");W(this,"fragment");W(this,"args");const s=r.decodeEventLog(i,n.data,n.topics);$e(this,{args:s,fragment:i,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class ZR extends Yp{constructor(n,r){super(n,n.provider);W(this,"error");$e(this,{error:r})}}class Que extends JR{constructor(n,r,i){super(i,r);ae(this,Od);L(this,Od,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?T(this,Od).getEvent(n.topics[0]):null;if(r)try{return new ik(n,T(this,Od),r)}catch(i){return new ZR(n,i)}return n})}}Od=new WeakMap;class sk extends Xp{constructor(n,r,i){super(i,r);ae(this,V0);L(this,V0,n)}async wait(n,r){const i=await super.wait(n,r);return i==null?null:new Que(T(this,V0),this.provider,i)}}V0=new WeakMap;class e5 extends NP{constructor(n,r,i,s){super(n,r,i);W(this,"log");$e(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Jue extends e5{constructor(e,n,r,i,s){super(e,n,r,new ik(s,e.interface,i));const o=e.interface.decodeEventLog(i,this.log.data,this.log.topics);$e(this,{args:o,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const t5=BigInt(0);function n5(t){return t&&typeof t.call=="function"}function r5(t){return t&&typeof t.estimateGas=="function"}function Lb(t){return t&&typeof t.resolveName=="function"}function i5(t){return t&&typeof t.sendTransaction=="function"}function s5(t){if(t!=null){if(Lb(t))return t;if(t.provider)return t.provider}}class Yue{constructor(e,n,r){ae(this,z0);W(this,"fragment");if($e(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const i=Su(e.runner,"resolveName"),s=Lb(i)?i:null;L(this,z0,async function(){const o=await Promise.all(n.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(c,f)=>c==="address"?Array.isArray(f)?Promise.all(f.map(d=>Br(d,s))):Br(f,s):f)));return e.interface.encodeFilterTopics(n,o)}())}getTopicFilter(){return T(this,z0)}}z0=new WeakMap;function Su(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Cu(t){return t==null?null:t.provider||null}async function o5(t,e){const n=wr.dereference(t,"overrides");ee(typeof n=="object","invalid overrides parameter","overrides",t);const r=Rb(n);return ee(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),ee(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function Xue(t,e,n){const r=Su(t,"resolveName"),i=Lb(r)?r:null;return await Promise.all(e.map((s,o)=>s.walkAsync(n[o],(a,l)=>(l=wr.dereference(l,a),a==="address"?Br(l,i):l))))}function Zue(t){const e=async function(o){const a=await o5(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await Br(a.from,s5(t.runner)));const l=t.interface,u=He(a.value||t5,"overrides.value")===t5,c=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!c&&!u&&ee(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),ee(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return ee(f||u,"cannot send value to non-payable fallback","overrides.value",a.value),ee(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data),a},n=async function(o){const a=Su(t.runner,"call");me(n5(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(u){throw dE(u)&&u.data?t.interface.makeError(u.data,l):u}},r=async function(o){const a=t.runner;me(i5(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),u=Cu(t.runner);return new sk(t.interface,u,l)},i=async function(o){const a=Su(t.runner,"estimateGas");return me(r5(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},s=async o=>await r(o);return $e(s,{_contract:t,estimateGas:i,populateTransaction:e,send:r,staticCall:n}),s}function ece(t,e){const n=function(...u){const c=t.interface.getFunction(e,u);return me(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),c},r=async function(...u){const c=n(...u);let f={};if(c.inputs.length+1===u.length&&(f=await o5(u.pop()),f.from&&(f.from=await Br(f.from,s5(t.runner)))),c.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Xue(t.runner,c.inputs,u);return Object.assign({},f,await br({to:t.getAddress(),data:t.interface.encodeFunctionData(c,d)}))},i=async function(...u){const c=await a(...u);return c.length===1?c[0]:c},s=async function(...u){const c=t.runner;me(i5(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await c.sendTransaction(await r(...u)),d=Cu(t.runner);return new sk(t.interface,d,f)},o=async function(...u){const c=Su(t.runner,"estimateGas");return me(r5(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await r(...u))},a=async function(...u){const c=Su(t.runner,"call");me(n5(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let d="0x";try{d=await c.call(f)}catch(p){throw dE(p)&&p.data?t.interface.makeError(p.data,f):p}const h=n(...u);return t.interface.decodeFunctionResult(h,d)},l=async(...u)=>n(...u).constant?await i(...u):await s(...u);return $e(l,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:o,populateTransaction:r,send:s,staticCall:i,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return me(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),l}function tce(t,e){const n=function(...i){const s=t.interface.getEvent(e,i);return me(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),s},r=function(...i){return new Yue(t,n(...i),i)};return $e(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return me(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),r}const Bb=Symbol.for("_ethersInternal_contract"),a5=new WeakMap;function nce(t,e){a5.set(t[Bb],e)}function mi(t){return a5.get(t[Bb])}function rce(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function ok(t,e){let n,r=null;if(Array.isArray(e)){const s=function(o){if(Qt(o,32))return o;const a=t.interface.getEvent(o);return ee(a,"unknown fragment","name",o),a.topicHash};n=e.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else e==="*"?n=[null]:typeof e=="string"?Qt(e,32)?n=[e]:(r=t.interface.getEvent(e),ee(r,"unknown fragment","event",e),n=[r.topicHash]):rce(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):ee(!1,"unknown event name","event",e);n=n.map(s=>{if(s==null)return null;if(Array.isArray(s)){const o=Array.from(new Set(s.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});const i=n.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:r,tag:i,topics:n}}async function Zp(t,e){const{subs:n}=mi(t);return n.get((await ok(t,e)).tag)||null}async function l5(t,e,n){const r=Cu(t.runner);me(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:o}=await ok(t,n),{addr:a,subs:l}=mi(t);let u=l.get(s);if(!u){const f={address:a||t,topics:o},d=g=>{let y=i;if(y==null)try{y=t.interface.getEvent(g.topics[0])}catch{}if(y){const v=y,w=i?t.interface.decodeEventLog(i,g.data,g.topics):[];lk(t,n,w,b=>new Jue(t,b,n,v,g))}else lk(t,n,[],v=>new e5(t,v,n,g))};let h=[];u={tag:s,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let g=h;h=[],await Promise.all(g),r.off(f,d)}},l.set(s,u)}return u}let ak=Promise.resolve();async function ice(t,e,n,r){await ak;const i=await Zp(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter(({listener:o,once:a})=>{const l=Array.from(n);r&&l.push(r(a?null:o));try{o.call(t,...l)}catch{}return!a}),i.listeners.length===0&&(i.stop(),mi(t).subs.delete(i.tag)),s>0}async function lk(t,e,n,r){try{await ak}catch{}const i=ice(t,e,n,r);return ak=i,await i}const Fb=["then"];$9=Bb;const $0=class $0{constructor(e,n,r,i){W(this,"target");W(this,"interface");W(this,"runner");W(this,"filters");W(this,$9);W(this,"fallback");ee(typeof e=="string"||VI(e),"invalid value for Contract target","target",e),r==null&&(r=null);const s=rk.from(n);$e(this,{target:e,runner:r,interface:s}),Object.defineProperty(this,Bb,{value:{}});let o,a=null,l=null;if(i){const f=Cu(r);l=new sk(this.interface,f,i)}let u=new Map;if(typeof e=="string")if(Qt(e))a=e,o=Promise.resolve(e);else{const f=Su(r,"resolveName");if(!Lb(f))throw an("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw an("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return mi(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return mi(this).addr=f,f});nce(this,{addrPromise:o,addr:a,deployTx:l,subs:u});const c=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||Fb.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!Qn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>Fb.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return $e(this,{filters:c}),$e(this,{fallback:s.receive||s.fallback?Zue(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||Fb.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!Qn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||Fb.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new $0(this.target,this.interface,e)}attach(e){return new $0(e,this.interface,this.runner)}async getAddress(){return await mi(this).addrPromise}async getDeployedCode(){const e=Cu(this.runner);me(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Cu(this.runner);return me(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,s)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);r.once("block",o)}catch(a){s(a)}};o()})}deploymentTransaction(){return mi(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),ece(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),tce(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,n,r){n==null&&(n=0),r==null&&(r="latest");const{addr:i,addrPromise:s}=mi(this),o=i||await s,{fragment:a,topics:l}=await ok(this,e),u={address:o,topics:l,fromBlock:n,toBlock:r},c=Cu(this.runner);return me(c,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await c.getLogs(u)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new ik(f,this.interface,d)}catch(h){return new ZR(f,h)}return new Yp(f,c)})}async on(e,n){const r=await l5(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await l5(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await lk(this,e,n,null)}async listenerCount(e){if(e){const i=await Zp(this,e);return i?i.listeners.length:0}const{subs:n}=mi(this);let r=0;for(const{listeners:i}of n.values())r+=i.length;return r}async listeners(e){if(e){const i=await Zp(this,e);return i?i.listeners.map(({listener:s})=>s):[]}const{subs:n}=mi(this);let r=[];for(const{listeners:i}of n.values())r=r.concat(i.map(({listener:s})=>s));return r}async off(e,n){const r=await Zp(this,e);if(!r)return this;if(n){const i=r.listeners.map(({listener:s})=>s).indexOf(n);i>=0&&r.listeners.splice(i,1)}return(n==null||r.listeners.length===0)&&(r.stop(),mi(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await Zp(this,e);if(!n)return this;n.stop(),mi(this).subs.delete(n.tag)}else{const{subs:n}=mi(this);for(const{tag:r,stop:i}of n.values())i(),n.delete(r)}return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return await this.off(e,n)}static buildClass(e){class n extends $0{constructor(i,s=null){super(i,e,s)}}return n}static from(e,n,r){return r==null&&(r=null),new this(e,n,r)}};let uk=$0;function sce(){return uk}class If extends sce(){}function ck(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):ee(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class oce{constructor(e){W(this,"name");$e(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const u5=new RegExp("^(ipfs)://(.*)$","i"),c5=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),u5,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],_d=class _d{constructor(e,n,r){ae(this,fl);W(this,"provider");W(this,"address");W(this,"name");ae(this,cl);ae(this,Xu);$e(this,{provider:e,address:n,name:r}),L(this,cl,null),L(this,Xu,new If(n,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return T(this,cl)==null&&L(this,cl,(async()=>{try{return await T(this,Xu).supportsInterface("0x9061b923")}catch(e){if(Qn(e,"CALL_EXCEPTION"))return!1;throw L(this,cl,null),e}})()),await T(this,cl)}async getAddress(e){if(e==null&&(e=60),e===60)try{const s=await Te(this,fl,Qd).call(this,"addr(bytes32)");return s==null||s===jp?null:s}catch(s){if(Qn(s,"CALL_EXCEPTION"))return null;throw s}if(e>=0&&e<2147483648){let s=e+2147483648;const o=await Te(this,fl,Qd).call(this,"addr(bytes32,uint)",[s]);if(Qt(o,20))return jt(o)}let n=null;for(const s of this.provider.plugins)if(s instanceof oce&&s.supportsCoinType(e)){n=s;break}if(n==null)return null;const r=await Te(this,fl,Qd).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const i=await n.decodeAddress(e,r);if(i!=null)return i;me(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await Te(this,fl,Qd).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await Te(this,fl,Qd).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const n=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const i=n[1]==="e3010170"?"ipfs":"ipns",s=parseInt(n[4],16);if(n[5].length===s*2)return`${i}://${Toe("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;me(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<c5.length;r++){const i=n.match(c5[r]);if(i==null)continue;const s=i[1].toLowerCase();switch(s){case"https":case"data":return e.push({type:"url",value:n}),{linkage:e,url:n};case"ipfs":{const o=ck(n);return e.push({type:"ipfs",value:n}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=s==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:s,value:n});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(i[2]||"").split("/");if(l.length!==2)return e.push({type:`!${s}caip`,value:i[2]||""}),{url:null,linkage:e};const u=l[1],c=new If(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(s==="erc721"){const m=await c.ownerOf(u);if(a!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(s==="erc1155"){const m=await c.balanceOf(a,u);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await c[o](u);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),s==="erc1155"&&(f=f.replace("{id}",Fa(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=ck(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new Rr(f).send();h.assertOk();try{d=h.bodyJson}catch{try{e.push({type:"!metadata",value:h.bodyText})}catch{const y=h.body;return y&&e.push({type:"!metadata",value:Be(y)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!d)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(d)});let p=d.image;if(typeof p!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(u5)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=ck(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return me(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async fromName(e,n){var i;let r=n;for(;;){if(r===""||r==="."||n!=="eth"&&r==="eth")return null;const s=await Te(i=_d,lw,X9).call(i,e,r);if(s!=null){const o=new _d(e,s,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};cl=new WeakMap,Xu=new WeakMap,fl=new WeakSet,Qd=async function(e,n){n=(n||[]).slice();const r=T(this,Xu).interface;n.unshift(qE(this.name));let i=null;await this.supportsWildcard()&&(i=r.getFunction(e),me(i,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[aue(this.name,255),r.encodeFunctionData(i,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const s=await T(this,Xu)[e](...n);return i?r.decodeFunctionResult(i,s)[0]:s}catch(s){if(!Qn(s,"CALL_EXCEPTION"))throw s}return null},lw=new WeakSet,X9=async function(e,n){const r=await _d.getEnsAddress(e);try{const s=await new If(r,["function resolver(bytes32) view returns (address)"],e).resolver(qE(n),{enableCcipRead:!0});return s===jp?null:s}catch(i){throw i}return null},ae(_d,lw);let Ub=_d;const f5=BigInt(0);function St(t,e){return function(n){return n==null?e:t(n)}}function jb(t,e){return n=>{if(e&&n==null)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map(r=>t(r))}}function e0(t,e){return n=>{const r={};for(const i in t){let s=i;if(e&&i in e&&!(s in n)){for(const o of e[i])if(o in n){s=o;break}}try{const o=t[i](n[s]);o!==void 0&&(r[i]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";me(!1,`invalid value for value.${i} (${a})`,"BAD_DATA",{value:n})}}return r}}function ace(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}ee(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Rf(t){return ee(Qt(t,!0),"invalid data","value",t),t}function ir(t){return ee(Qt(t,32),"invalid hash","value",t),t}const lce=e0({address:jt,blockHash:ir,blockNumber:st,data:Rf,index:st,removed:St(ace,!1),topics:jb(ir),transactionHash:ir,transactionIndex:st},{index:["logIndex"]});function uce(t){return lce(t)}const cce=e0({hash:St(ir),parentHash:ir,parentBeaconBlockRoot:St(ir,null),number:st,timestamp:st,nonce:St(Rf),difficulty:He,gasLimit:He,gasUsed:He,stateRoot:St(ir,null),receiptsRoot:St(ir,null),blobGasUsed:St(He,null),excessBlobGas:St(He,null),miner:St(jt),prevRandao:St(ir,null),extraData:Rf,baseFeePerGas:St(He)},{prevRandao:["mixHash"]});function fce(t){const e=cce(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:d5(n)),e}const dce=e0({transactionIndex:st,blockNumber:st,transactionHash:ir,address:jt,topics:jb(ir),data:Rf,index:st,blockHash:ir},{index:["logIndex"]});function hce(t){return dce(t)}const pce=e0({to:St(jt,null),from:St(jt,null),contractAddress:St(jt,null),index:st,root:St(Be),gasUsed:He,blobGasUsed:St(He,null),logsBloom:St(Rf),blockHash:ir,hash:ir,logs:jb(hce),blockNumber:st,cumulativeGasUsed:He,effectiveGasPrice:St(He),blobGasPrice:St(He,null),status:St(st),type:St(st,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function mce(t){return pce(t)}function d5(t){t.to&&He(t.to)===f5&&(t.to="0x0000000000000000000000000000000000000000");const e=e0({hash:ir,index:St(st,void 0),type:n=>n==="0x"||n==null?0:st(n),accessList:St(Ga,null),blobVersionedHashes:St(jb(ir,!0),null),blockHash:St(ir,null),blockNumber:St(st,null),transactionIndex:St(st,null),from:jt,gasPrice:St(He),maxPriorityFeePerGas:St(He),maxFeePerGas:St(He),maxFeePerBlobGas:St(He,null),gasLimit:He,to:St(jt,null),value:He,nonce:st,data:Rf,creates:St(jt,null),chainId:St(He,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=ule(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=us.from(t.signature):e.signature=us.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&He(e.blockHash)===f5&&(e.blockHash=null),e}const gce="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class t0{constructor(e){W(this,"name");$e(this,{name:e})}clone(){return new t0(this.name)}}class Hb extends t0{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||0}`);W(this,"effectiveBlock");W(this,"txBase");W(this,"txCreate");W(this,"txDataZero");W(this,"txDataNonzero");W(this,"txAccessListStorageKey");W(this,"txAccessListAddress");const i={effectiveBlock:n};function s(o,a){let l=(r||{})[o];l==null&&(l=a),ee(typeof l=="number",`invalud value for ${o}`,"costs",r),i[o]=l}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),$e(this,i)}clone(){return new Hb(this.effectiveBlock,this)}}class Vb extends t0{constructor(n,r){super("org.ethers.plugins.network.Ens");W(this,"address");W(this,"targetNetwork");$e(this,{address:n||gce,targetNetwork:r??1})}clone(){return new Vb(this.address,this.targetNetwork)}}class yce extends t0{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");ae(this,G0);ae(this,W0);L(this,G0,n),L(this,W0,r)}get url(){return T(this,G0)}get processFunc(){return T(this,W0)}clone(){return this}}G0=new WeakMap,W0=new WeakMap;const fk=new Map,Pd=class Pd{constructor(e,n){ae(this,Md);ae(this,Nd);ae(this,dl);L(this,Md,e),L(this,Nd,He(n)),L(this,dl,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,Md)}set name(e){L(this,Md,e)}get chainId(){return T(this,Nd)}set chainId(e){L(this,Nd,He(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===He(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===He(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===He(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(T(this,dl).values())}attachPlugin(e){if(T(this,dl).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,dl).set(e.name,e.clone()),this}getPlugin(e){return T(this,dl).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new Pd(this.name,this.chainId);return this.plugins.forEach(n=>{e.attachPlugin(n.clone())}),e}computeIntrinsicGas(e){const n=this.getPlugin("org.ethers.plugins.network.GasCost")||new Hb;let r=n.txBase;if(e.to==null&&(r+=n.txCreate),e.data)for(let i=2;i<e.data.length;i+=2)e.data.substring(i,i+2)==="00"?r+=n.txDataZero:r+=n.txDataNonzero;if(e.accessList){const i=Ga(e.accessList);for(const s in i)r+=n.txAccessListAddress+n.txAccessListStorageKey*i[s].storageKeys.length}return r}static from(e){if(bce(),e==null)return Pd.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=fk.get(e);if(n)return n();if(typeof e=="bigint")return new Pd("unknown",e);ee(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){ee(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new Pd(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new Vb(e.ensAddress,e.ensNetwork)),n}ee(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=fk.get(e);r&&ee(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),fk.set(e,n)}};Md=new WeakMap,Nd=new WeakMap,dl=new WeakMap;let jn=Pd;function h5(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let i=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||i++,r[1]=i.toString()}return BigInt(r[0]+r[1])}function p5(t){return new yce(t,async(e,n,r)=>{r.setHeader("User-Agent","ethers");let i;try{const[s,o]=await Promise.all([r.send(),e()]);i=s;const a=i.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:h5(a.maxFee,9),maxPriorityFeePerGas:h5(a.maxPriorityFee,9)}}catch(s){me(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:i,error:s})}})}let m5=!1;function bce(){if(m5)return;m5=!0;function t(e,n,r){const i=function(){const s=new jn(e,n);return r.ensNetwork!=null&&s.attachPlugin(new Vb(null,r.ensNetwork)),s.attachPlugin(new Hb),(r.plugins||[]).forEach(o=>{s.attachPlugin(o)}),s};jn.register(e,i),jn.register(n,i),r.altNames&&r.altNames.forEach(s=>{jn.register(s,i)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[p5("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[p5("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function dk(t){return JSON.parse(JSON.stringify(t))}class wce{constructor(e){ae(this,Id);ae(this,Qo);ae(this,Vi);ae(this,hl);ae(this,ro);L(this,Qo,e),L(this,Vi,null),L(this,hl,4e3),L(this,ro,-2)}get pollingInterval(){return T(this,hl)}set pollingInterval(e){L(this,hl,e)}start(){T(this,Vi)||(L(this,Vi,T(this,Qo)._setTimeout(Te(this,Id,gw).bind(this),T(this,hl))),Te(this,Id,gw).call(this))}stop(){T(this,Vi)&&(T(this,Qo)._clearTimeout(T(this,Vi)),L(this,Vi,null))}pause(e){this.stop(),e&&L(this,ro,-2)}resume(){this.start()}}Qo=new WeakMap,Vi=new WeakMap,hl=new WeakMap,ro=new WeakMap,Id=new WeakSet,gw=async function(){try{const e=await T(this,Qo).getBlockNumber();if(T(this,ro)===-2){L(this,ro,e);return}if(e!==T(this,ro)){for(let n=T(this,ro)+1;n<=e;n++){if(T(this,Vi)==null)return;await T(this,Qo).emit("block",n)}L(this,ro,e)}}catch{}T(this,Vi)!=null&&L(this,Vi,T(this,Qo)._setTimeout(Te(this,Id,gw).bind(this),T(this,hl)))};class hk{constructor(e){ae(this,Zu);ae(this,ec);ae(this,pl);L(this,Zu,e),L(this,pl,!1),L(this,ec,n=>{this._poll(n,T(this,Zu))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){T(this,pl)||(L(this,pl,!0),T(this,ec).call(this,-2),T(this,Zu).on("block",T(this,ec)))}stop(){T(this,pl)&&(L(this,pl,!1),T(this,Zu).off("block",T(this,ec)))}pause(e){this.stop()}resume(){this.start()}}Zu=new WeakMap,ec=new WeakMap,pl=new WeakMap;class vce extends hk{constructor(n,r){super(n);ae(this,Rd);ae(this,Jo);L(this,Rd,r),L(this,Jo,-2)}pause(n){n&&L(this,Jo,-2),super.pause(n)}async _poll(n,r){const i=await r.getBlock(T(this,Rd));i!=null&&(T(this,Jo)===-2?L(this,Jo,i.number):i.number>T(this,Jo)&&(r.emit(T(this,Rd),i.number),L(this,Jo,i.number)))}}Rd=new WeakMap,Jo=new WeakMap;class Ace extends hk{constructor(n,r){super(n);ae(this,uw);L(this,uw,dk(r))}async _poll(n,r){throw new Error("@TODO")}}uw=new WeakMap;class xce extends hk{constructor(n,r){super(n);ae(this,Ld);L(this,Ld,r)}async _poll(n,r){const i=await r.getTransactionReceipt(T(this,Ld));i&&r.emit(T(this,Ld),i)}}Ld=new WeakMap;class pk{constructor(e,n){ae(this,cw);ae(this,Yo);ae(this,Bd);ae(this,Fd);ae(this,ml);ae(this,zi);L(this,Yo,e),L(this,Bd,dk(n)),L(this,Fd,Te(this,cw,Z9).bind(this)),L(this,ml,!1),L(this,zi,-2)}start(){T(this,ml)||(L(this,ml,!0),T(this,zi)===-2&&T(this,Yo).getBlockNumber().then(e=>{L(this,zi,e)}),T(this,Yo).on("block",T(this,Fd)))}stop(){T(this,ml)&&(L(this,ml,!1),T(this,Yo).off("block",T(this,Fd)))}pause(e){this.stop(),e&&L(this,zi,-2)}resume(){this.start()}}Yo=new WeakMap,Bd=new WeakMap,Fd=new WeakMap,ml=new WeakMap,zi=new WeakMap,cw=new WeakSet,Z9=async function(e){if(T(this,zi)===-2)return;const n=dk(T(this,Bd));n.fromBlock=T(this,zi)+1,n.toBlock=e;const r=await T(this,Yo).getLogs(n);if(r.length===0){T(this,zi)<e-60&&L(this,zi,e-60);return}for(const i of r)T(this,Yo).emit(T(this,Bd),i),L(this,zi,i.blockNumber)};const Ece=BigInt(2),kce=10;function zb(t){return t&&typeof t.then=="function"}function $b(t,e){return t+":"+JSON.stringify(e,(n,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const i=Object.keys(r);return i.sort(),i.reduce((s,o)=>(s[o]=r[o],s),{})}return r})}class Gb{constructor(e){W(this,"name");$e(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function Sce(t){return JSON.parse(JSON.stringify(t))}function mk(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function gk(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(Qt(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:$b("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:$b("orphan",n),filter:Sce(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(i=>i==null?null:Array.isArray(i)?mk(i.map(s=>s.toLowerCase())):i.toLowerCase())};if(n.address){const i=[],s=[],o=a=>{Qt(a)?i.push(a):s.push((async()=>{i.push(await Br(a,e))})())};Array.isArray(n.address)?n.address.forEach(o):o(n.address),s.length&&await Promise.all(s),r.address=mk(i.map(a=>a.toLowerCase()))}return{filter:r,tag:$b("event",r),type:"event"}}ee(!1,"unknown ProviderEvent","event",t)}function yk(){return new Date().getTime()}const Cce={cacheTimeout:250,pollingInterval:4e3};class Wb{constructor(e,n){ae(this,yt);ae(this,Er);ae(this,gl);ae(this,kr);ae(this,Ud);ae(this,vi);ae(this,tc);ae(this,yl);ae(this,Xo);ae(this,K0);ae(this,$i);ae(this,jd);ae(this,Hd);if(L(this,Hd,Object.assign({},Cce,n||{})),e==="any")L(this,tc,!0),L(this,vi,null);else if(e){const r=jn.from(e);L(this,tc,!1),L(this,vi,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else L(this,tc,!1),L(this,vi,null);L(this,Xo,-1),L(this,yl,new Map),L(this,Er,new Map),L(this,gl,new Map),L(this,kr,null),L(this,Ud,!1),L(this,K0,1),L(this,$i,new Map),L(this,jd,!1)}get pollingInterval(){return T(this,Hd).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,gl).values())}attachPlugin(e){if(T(this,gl).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,gl).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,gl).get(e)||null}get disableCcipRead(){return T(this,jd)}set disableCcipRead(e){L(this,jd,!!e)}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const i=e.to.toLowerCase(),s=n.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],u=l.replace("{sender}",i).replace("{data}",s),c=new Rr(u);l.indexOf("{data}")===-1&&(c.body={data:s,sender:i}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:c,index:a,urls:r});let f="unknown error";const d=await c.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:c,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:c,result:h})}catch{}me(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:f}}),o.push(f)}me(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,n){return new Wue(fce(e),this)}_wrapLog(e,n){return new Yp(uce(e),this)}_wrapTransactionReceipt(e,n){return new JR(mce(e),this)}_wrapTransactionResponse(e,n){return new Xp(d5(e),this)}_detectNetwork(){me(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){me(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=st(await Te(this,yt,Ai).call(this,{method:"getBlockNumber"}),"%response");return T(this,Xo)>=0&&L(this,Xo,e),e}_getAddress(e){return Br(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Qt(e))return Qt(e,32)?e:hu(e);if(typeof e=="bigint"&&(e=st(e,"blockTag")),typeof e=="number")return e>=0?hu(e):T(this,Xo)>=0?hu(T(this,Xo)+e):this.getBlockNumber().then(n=>hu(n+e));ee(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?mk(l.map(u=>u.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,i=(l,u,c)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(u!=null||c!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),n.length&&(d.topics=n),u&&(d.fromBlock=u),c&&(d.toBlock=c),r&&(d.blockHash=r),d};let s=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)s.push(this._getAddress(l));else s.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),s.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(s),o,a]).then(l=>i(l[0],l[1],l[2])):i(s,o,a)}_getTransactionRequest(e){const n=Rb(e),r=[];if(["to","from"].forEach(i=>{if(n[i]==null)return;const s=Br(n[i],this);zb(s)?r.push(async function(){n[i]=await s}()):n[i]=s}),n.blockTag!=null){const i=this._getBlockTag(n.blockTag);zb(i)?r.push(async function(){n.blockTag=await i}()):n.blockTag=i}return r.length?async function(){return await Promise.all(r),n}():n}async getNetwork(){if(T(this,vi)==null){const i=(async()=>{try{const s=await this._detectNetwork();return this.emit("network",s,null),s}catch(s){throw T(this,vi)===i&&L(this,vi,null),s}})();return L(this,vi,i),(await i).clone()}const e=T(this,vi),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(T(this,tc)?(this.emit("network",r,n),T(this,vi)===e&&L(this,vi,Promise.resolve(r))):me(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:i,gasPrice:s,priorityFee:o}=await br({_block:Te(this,yt,BC).call(this,"latest",!1),gasPrice:(async()=>{try{const c=await Te(this,yt,Ai).call(this,{method:"getGasPrice"});return He(c,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const c=await Te(this,yt,Ai).call(this,{method:"getPriorityFee"});return He(c,"%response")}catch{}return null})()});let a=null,l=null;const u=this._wrapBlock(i,e);return u&&u.baseFeePerGas&&(l=o??BigInt("1000000000"),a=u.baseFeePerGas*Ece+l),new QR(s,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const i=new Rr(r.url),s=await r.processFunc(n,this,i);return new QR(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return zb(n)&&(n=await n),He(await Te(this,yt,Ai).call(this,{method:"estimateGas",transaction:n}),"%response")}async call(e){const{tx:n,blockTag:r}=await br({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await Te(this,yt,LC).call(this,Te(this,yt,RC).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return He(await Te(this,yt,Z0).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return st(await Te(this,yt,Z0).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return Be(await Te(this,yt,Z0).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const i=He(n,"position");return Be(await Te(this,yt,Z0).call(this,{method:"getStorage",position:i},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:i}=await br({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=Qp.from(e);if(s.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,i).replaceableTransaction(n)}async getBlock(e,n){const{network:r,params:i}=await br({network:this.getNetwork(),params:Te(this,yt,BC).call(this,e,!!n)});return i==null?null:this._wrapBlock(i,r)}async getTransaction(e){const{network:n,params:r}=await br({network:this.getNetwork(),params:Te(this,yt,Ai).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await br({network:this.getNetwork(),params:Te(this,yt,Ai).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const i=await Te(this,yt,Ai).call(this,{method:"getTransaction",hash:e});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(r,n)}async getTransactionResult(e){const{result:n}=await br({network:this.getNetwork(),result:Te(this,yt,Ai).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:Be(n)}async getLogs(e){let n=this._getFilter(e);zb(n)&&(n=await n);const{network:r,params:i}=await br({network:this.getNetwork(),params:Te(this,yt,Ai).call(this,{method:"getLogs",filter:n})});return i.map(s=>this._wrapLog(s,r))}_getProvider(e){me(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Ub.fromName(this,e)}async getAvatar(e){const n=await this.getResolver(e);return n?await n.getAvatar():null}async resolveName(e){const n=await this.getResolver(e);return n?await n.getAddress():null}async lookupAddress(e){e=jt(e);const n=qE(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await Ub.getEnsAddress(this),s=await new If(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(s==null||s===jp)return null;const a=await new If(s,["function name(bytes32) view returns (string)"],this).name(n);return await this.resolveName(a)!==e?null:a}catch(r){if(Qn(r,"BAD_DATA")&&r.value==="0x"||Qn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,n,r){const i=n??1;return i===0?this.getTransactionReceipt(e):new Promise(async(s,o)=>{let a=null;const l=async u=>{try{const c=await this.getTransactionReceipt(e);if(c!=null&&u-c.blockNumber+1>=i){s(c),a&&(clearTimeout(a),a=null);return}}catch(c){console.log("EEE",c)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(an("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){me(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=T(this,$i).get(e);n&&(n.timer&&clearTimeout(n.timer),T(this,$i).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=Y0(this,K0)._++,i=()=>{T(this,$i).delete(r),e()};if(this.paused)T(this,$i).set(r,{timer:null,func:i,time:n});else{const s=setTimeout(i,n);T(this,$i).set(r,{timer:s,func:i,time:yk()})}return r}_forEachSubscriber(e){for(const n of T(this,Er).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new Gb(e.type);case"block":{const n=new wce(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new vce(this,e.type);case"event":return new pk(this,e.filter);case"transaction":return new xce(this,e.hash);case"orphan":return new Ace(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of T(this,Er).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),T(this,kr)!=null&&n.pause(T(this,kr));break}}async on(e,n){const r=await Te(this,yt,yw).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,kr)!=null&&r.subscriber.pause(T(this,kr))),this}async once(e,n){const r=await Te(this,yt,yw).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,kr)!=null&&r.subscriber.pause(T(this,kr))),this}async emit(e,...n){const r=await Te(this,yt,em).call(this,e,n);if(!r||r.listeners.length===0)return!1;const i=r.listeners.length;return r.listeners=r.listeners.filter(({listener:s,once:o})=>{const a=new NP(this,o?null:s,e);try{s.call(this,...n,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Er).delete(r.tag)),i>0}async listenerCount(e){if(e){const r=await Te(this,yt,em).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of T(this,Er).values())n+=r.length;return n}async listeners(e){if(e){const r=await Te(this,yt,em).call(this,e);return r?r.listeners.map(({listener:i})=>i):[]}let n=[];for(const{listeners:r}of T(this,Er).values())n=n.concat(r.map(({listener:i})=>i));return n}async off(e,n){const r=await Te(this,yt,em).call(this,e);if(!r)return this;if(n){const i=r.listeners.map(({listener:s})=>s).indexOf(n);i>=0&&r.listeners.splice(i,1)}return(!n||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Er).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:i}=await Te(this,yt,yw).call(this,e);r&&i.stop(),T(this,Er).delete(n)}else for(const[n,{started:r,subscriber:i}]of T(this,Er))r&&i.stop(),T(this,Er).delete(n);return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return this.off(e,n)}get destroyed(){return T(this,Ud)}destroy(){this.removeAllListeners();for(const e of T(this,$i).keys())this._clearTimeout(e);L(this,Ud,!0)}get paused(){return T(this,kr)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(L(this,Xo,-1),T(this,kr)!=null){if(T(this,kr)==!!e)return;me(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),L(this,kr,!!e);for(const n of T(this,$i).values())n.timer&&clearTimeout(n.timer),n.time=yk()-n.time}resume(){if(T(this,kr)!=null){this._forEachSubscriber(e=>e.resume()),L(this,kr,null);for(const e of T(this,$i).values()){let n=e.time;n<0&&(n=0),e.time=yk(),setTimeout(e.func,n)}}}}Er=new WeakMap,gl=new WeakMap,kr=new WeakMap,Ud=new WeakMap,vi=new WeakMap,tc=new WeakMap,yl=new WeakMap,Xo=new WeakMap,K0=new WeakMap,$i=new WeakMap,jd=new WeakMap,Hd=new WeakMap,yt=new WeakSet,Ai=async function(e){const n=T(this,Hd).cacheTimeout;if(n<0)return await this._perform(e);const r=$b(e.method,e);let i=T(this,yl).get(r);return i||(i=this._perform(e),T(this,yl).set(r,i),setTimeout(()=>{T(this,yl).get(r)===i&&T(this,yl).delete(r)},n)),await i},RC=async function(e,n,r){me(r<kce,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const i=Rb(e);try{return Be(await this._perform({method:"call",transaction:i,blockTag:n}))}catch(s){if(!this.disableCcipRead&&dE(s)&&s.data&&r>=0&&n==="latest"&&i.to!=null&&bn(s.data,0,4)==="0x556f1830"){const o=s.data,a=await Br(i.to,this);let l;try{l=Mce(bn(s.data,4))}catch(f){me(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:o}})}me(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const u=await this.ccipReadFetch(i,l.calldata,l.urls);me(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:s.data,errorArgs:l.errorArgs}});const c={to:a,data:An([l.selector,_ce([u,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const f=await Te(this,yt,RC).call(this,c,n,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:f}),f}}throw s}},LC=async function(e){const{value:n}=await br({network:this.getNetwork(),value:e});return n},Z0=async function(e,n,r){let i=this._getAddress(n),s=this._getBlockTag(r);return(typeof i!="string"||typeof s!="string")&&([i,s]=await Promise.all([i,s])),await Te(this,yt,LC).call(this,Te(this,yt,Ai).call(this,Object.assign(e,{address:i,blockTag:s})))},BC=async function(e,n){if(Qt(e,32))return await Te(this,yt,Ai).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await Te(this,yt,Ai).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},em=async function(e,n){let r=await gk(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await gk({orphan:"drop-log",log:n[0]},this)),T(this,Er).get(r.tag)||null},yw=async function(e){const n=await gk(e,this),r=n.tag;let i=T(this,Er).get(r);return i||(i={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Er).set(r,i)),i};function Dce(t,e){try{const n=bk(t,e);if(n)return vf(n)}catch{}return null}function bk(t,e){if(t==="0x")return null;try{const n=st(bn(t,e,e+32)),r=st(bn(t,n,n+32));return bn(t,n+32,n+32+r)}catch{}return null}function g5(t){const e=Ir(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function Tce(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Oce=new Uint8Array([]);function _ce(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(Oce),n+=32;for(let r=0;r<t.length;r++){const i=Dt(t[r]);e[r]=g5(n),e.push(g5(i.length)),e.push(Tce(i)),n+=32+Math.ceil(i.length/32)*32}return An(e)}const y5="0x0000000000000000000000000000000000000000000000000000000000000000";function Mce(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};me(bf(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=bn(t,0,32);me(bn(n,0,12)===bn(y5,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=bn(n,12);try{const r=[],i=st(bn(t,32,64)),s=st(bn(t,i,i+32)),o=bn(t,i+32);for(let a=0;a<s;a++){const l=Dce(o,a*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{me(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=bk(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{me(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}me(bn(t,100,128)===bn(y5,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=bn(t,96,100);try{const r=bk(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{me(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function Lf(t,e){if(t.provider)return t.provider;me(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function b5(t,e){let n=Rb(e);if(n.to!=null&&(n.to=Br(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),Br(r,t)]).then(([i,s])=>(ee(i.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),i))}else n.from=t.getAddress();return await br(n)}class Nce{constructor(e){W(this,"provider");$e(this,{provider:e||null})}async getNonce(e){return Lf(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await b5(this,e)}async populateTransaction(e){const n=Lf(this,"populateTransaction"),r=await b5(this,e);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const i=await this.provider.getNetwork();if(r.chainId!=null){const o=He(r.chainId);ee(o===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=i.chainId;const s=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||s)?ee(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&s&&ee(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await n.getFeeData();me(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await n.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(me(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):me(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await br(r)}async estimateGas(e){return Lf(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Lf(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Lf(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=Lf(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const i=Qp.from(r);return await n.broadcastTransaction(await this.signTransaction(i))}}const w5=new Set;function Bf(t){w5.has(t)||(w5.add(t),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${t} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}function Pce(t){return JSON.parse(JSON.stringify(t))}class v5{constructor(e){ae(this,wl);ae(this,Ur);ae(this,io);ae(this,nc);ae(this,bl);ae(this,rc);ae(this,Vd);L(this,Ur,e),L(this,io,null),L(this,nc,Te(this,wl,FC).bind(this)),L(this,bl,!1),L(this,rc,null),L(this,Vd,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,n){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,bl)||(L(this,bl,!0),Te(this,wl,FC).call(this,-2))}stop(){T(this,bl)&&(L(this,bl,!1),L(this,Vd,!0),Te(this,wl,UC).call(this),T(this,Ur).off("block",T(this,nc)))}pause(e){e&&Te(this,wl,UC).call(this),T(this,Ur).off("block",T(this,nc))}resume(){this.start()}}Ur=new WeakMap,io=new WeakMap,nc=new WeakMap,bl=new WeakMap,rc=new WeakMap,Vd=new WeakMap,wl=new WeakSet,FC=async function(e){try{T(this,io)==null&&L(this,io,this._subscribe(T(this,Ur)));let n=null;try{n=await T(this,io)}catch(s){if(!Qn(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(n==null){L(this,io,null),T(this,Ur)._recoverSubscriber(this,this._recover(T(this,Ur)));return}const r=await T(this,Ur).getNetwork();if(T(this,rc)||L(this,rc,r),T(this,rc).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,Vd))return;const i=await T(this,Ur).send("eth_getFilterChanges",[n]);await this._emitResults(T(this,Ur),i)}catch(n){console.log("@TODO",n)}T(this,Ur).once("block",T(this,nc))},UC=function(){const e=T(this,io);e&&(L(this,io,null),e.then(n=>{T(this,Ur).destroyed||T(this,Ur).send("eth_uninstallFilter",[n])}))};class Ice extends v5{constructor(n,r){super(n);ae(this,ic);L(this,ic,Pce(r))}_recover(n){return new pk(n,T(this,ic))}async _subscribe(n){return await n.send("eth_newFilter",[T(this,ic)])}async _emitResults(n,r){for(const i of r)n.emit(T(this,ic),n._wrapLog(i,n._network))}}ic=new WeakMap;class Rce extends v5{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const Lce="bigint,boolean,function,number,string,symbol".split(/,/g);function Kb(t){if(t==null||Lce.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(Kb);if(typeof t=="object")return Object.keys(t).reduce((e,n)=>(e[n]=t[n],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function Bce(t){return new Promise(e=>{setTimeout(e,t)})}function Ff(t){return t&&t.toLowerCase()}function A5(t){return t&&typeof t.pollingInterval=="number"}const x5={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class wk extends Nce{constructor(n,r){super(n);W(this,"address");r=jt(r),$e(this,{address:r})}connect(n){me(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(n){return await this.populateCall(n)}async sendUncheckedTransaction(n){const r=Kb(n),i=[];if(r.from){const o=r.from;i.push((async()=>{const a=await Br(o,this.provider);ee(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&i.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;i.push((async()=>{r.to=await Br(o,this.provider)})())}i.length&&await Promise.all(i);const s=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(n){const r=await this.provider.getBlockNumber(),i=await this.sendUncheckedTransaction(n);return await new Promise((s,o)=>{const a=[1e3,100];let l=0;const u=async()=>{try{const c=await this.provider.getTransaction(i);if(c!=null){s(c.replaceableTransaction(r));return}}catch(c){if(Qn(c,"CANCELLED")||Qn(c,"BAD_DATA")||Qn(c,"NETWORK_ERROR")){c.info==null&&(c.info={}),c.info.sendTransactionHash=i,o(c);return}if(Qn(c,"INVALID_ARGUMENT")&&(l++,c.info==null&&(c.info={}),c.info.sendTransactionHash=i,l>10)){o(c);return}this.provider.emit("error",an("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:c}))}this.provider._setTimeout(()=>{u()},a.pop()||4e3)};u()})}async signTransaction(n){const r=Kb(n);if(r.from){const s=await Br(r.from,this.provider);ee(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=s}else r.from=this.address;const i=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[i])}async signMessage(n){const r=typeof n=="string"?Eo(n):n;return await this.provider.send("personal_sign",[Be(r),this.address.toLowerCase()])}async signTypedData(n,r,i){const s=Kb(i),o=await Nb.resolveNames(n,r,s,async a=>{const l=await Br(a);return ee(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Nb.getPayload(o.domain,r,o.value))])}async unlock(n){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),n,null])}async _legacySignMessage(n){const r=typeof n=="string"?Eo(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Be(r)])}}class E5 extends Wb{constructor(n,r){super(n,r);ae(this,q0);ae(this,sc);ae(this,zd);ae(this,Zo);ae(this,so);ae(this,bs);ae(this,Gi);ae(this,ei);L(this,zd,1),L(this,sc,Object.assign({},x5,r||{})),L(this,Zo,[]),L(this,so,null),L(this,Gi,null),L(this,ei,null);{let s=null;const o=new Promise(a=>{s=a});L(this,bs,{promise:o,resolve:s})}const i=this._getOption("staticNetwork");typeof i=="boolean"?(ee(!i||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),i&&n!=null&&L(this,Gi,jn.from(n))):i&&(ee(n==null||i.matches(n),"staticNetwork MUST match network object","options",r),L(this,Gi,i))}_getOption(n){return T(this,sc)[n]}get _network(){return me(T(this,Gi),"network is not available yet","NETWORK_ERROR"),T(this,Gi)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let i=n.transaction;if(i&&i.type!=null&&He(i.type)&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(n=Object.assign({},n,{transaction:Object.assign({},i,{type:void 0})}))}}const r=this.getRpcRequest(n);return r!=null?await this.send(r.method,r.args):super._perform(n)}async _detectNetwork(){const n=this._getOption("staticNetwork");if(n)if(n===!0){if(T(this,Gi))return T(this,Gi)}else return n;return T(this,ei)?await T(this,ei):this.ready?(L(this,ei,(async()=>{try{const r=jn.from(He(await this.send("eth_chainId",[])));return L(this,ei,null),r}catch(r){throw L(this,ei,null),r}})()),await T(this,ei)):(L(this,ei,(async()=>{const r={id:Y0(this,zd)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let i;try{i=(await this._send(r))[0],L(this,ei,null)}catch(s){throw L(this,ei,null),this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:i}),"result"in i)return jn.from(He(i.result));throw this.getRpcError(r,i)})()),await T(this,ei))}_start(){T(this,bs)==null||T(this,bs).resolve==null||(T(this,bs).resolve(),L(this,bs,null),(async()=>{for(;T(this,Gi)==null&&!this.destroyed;)try{L(this,Gi,await this._detectNetwork())}catch(n){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",an("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await Bce(1e3)}Te(this,q0,jC).call(this)})())}async _waitUntilReady(){if(T(this,bs)!=null)return await T(this,bs).promise}_getSubscriber(n){return n.type==="pending"?new Rce(this):n.type==="event"?this._getOption("polling")?new pk(this,n.filter):new Ice(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new Gb("orphan"):super._getSubscriber(n)}get ready(){return T(this,bs)==null}getRpcTransaction(n){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(i=>{if(n[i]==null)return;let s=i;i==="gasLimit"&&(s="gas"),r[s]=hu(He(n[i],`tx.${i}`))}),["from","to","data"].forEach(i=>{n[i]!=null&&(r[i]=Be(n[i]))}),n.accessList&&(r.accessList=Ga(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(i=>i.toLowerCase())),r}getRpcRequest(n){switch(n.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Ff(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Ff(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[Ff(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Ff(n.address),"0x"+n.position.toString(16),n.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[n.signedTransaction]};case"getBlock":if("blockTag"in n)return{method:"eth_getBlockByNumber",args:[n.blockTag,!!n.includeTransactions]};if("blockHash"in n)return{method:"eth_getBlockByHash",args:[n.blockHash,!!n.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[n.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[n.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(n.transaction),n.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(n.transaction)]};case"getLogs":return n.filter&&n.filter.address!=null&&(Array.isArray(n.filter.address)?n.filter.address=n.filter.address.map(Ff):n.filter.address=Ff(n.filter.address)),{method:"eth_getLogs",args:[n.filter]}}return null}getRpcError(n,r){const{method:i}=n,{error:s}=r;if(i==="eth_estimateGas"&&s.message){const l=s.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return an("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:s}})}if(i==="eth_call"||i==="eth_estimateGas"){const l=vk(s),u=Nf.getBuiltinCallException(i==="eth_call"?"call":"estimateGas",n.params[0],l?l.data:null);return u.info={error:s,payload:n},u}const o=JSON.stringify(Uce(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return an("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[i]||"unknown",reason:"rejected",info:{payload:n,error:s}});if(i==="eth_sendRawTransaction"||i==="eth_sendTransaction"){const l=n.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return an("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return an("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:s}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return an("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:s}});if(o.match(/only replay-protected/i))return an("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:i,info:{transaction:l,info:{error:s}}})}let a=!!o.match(/the method .* does not exist/i);return a||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(a=!0),a?an("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:s,payload:n}}):an("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(an("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const i=Y0(this,zd)._++,s=new Promise((o,a)=>{T(this,Zo).push({resolve:o,reject:a,payload:{method:n,params:r,id:i,jsonrpc:"2.0"}})});return Te(this,q0,jC).call(this),s}async getSigner(n){n==null&&(n=0);const r=this.send("eth_accounts",[]);if(typeof n=="number"){const s=await r;if(n>=s.length)throw new Error("no such account");return new wk(this,s[n])}const{accounts:i}=await br({network:this.getNetwork(),accounts:r});n=jt(n);for(const s of i)if(jt(s)===n)return new wk(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new wk(this,r))}destroy(){T(this,so)&&(clearTimeout(T(this,so)),L(this,so,null));for(const{payload:n,reject:r}of T(this,Zo))r(an("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));L(this,Zo,[]),super.destroy()}}sc=new WeakMap,zd=new WeakMap,Zo=new WeakMap,so=new WeakMap,bs=new WeakMap,Gi=new WeakMap,ei=new WeakMap,q0=new WeakSet,jC=function(){if(T(this,so))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");L(this,so,setTimeout(()=>{L(this,so,null);const r=T(this,Zo);for(L(this,Zo,[]);r.length;){const i=[r.shift()];for(;r.length&&i.length!==T(this,sc).batchMaxCount;)if(i.push(r.shift()),JSON.stringify(i.map(o=>o.payload)).length>T(this,sc).batchMaxSize){r.unshift(i.pop());break}(async()=>{const s=i.length===1?i[0].payload:i.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const o=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:u}of i){if(this.destroyed){l(an("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const c=o.filter(f=>f.id===u.id)[0];if(c==null){const f=an("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",f),l(f);continue}if("error"in c){l(this.getRpcError(u,c));continue}a(c.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of i)a(o)}})()}},n))};class Fce extends E5{constructor(n,r){super(n,r);ae(this,vl);let i=this._getOption("pollingInterval");i==null&&(i=x5.pollingInterval),L(this,vl,i)}_getSubscriber(n){const r=super._getSubscriber(n);return A5(r)&&(r.pollingInterval=T(this,vl)),r}get pollingInterval(){return T(this,vl)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");L(this,vl,n),this._forEachSubscriber(r=>{A5(r)&&(r.pollingInterval=T(this,vl))})}}vl=new WeakMap;class Mo extends Fce{constructor(n,r,i){n==null&&(n="http://localhost:8545");super(r,i);ae(this,$d);typeof n=="string"?L(this,$d,new Rr(n)):L(this,$d,n.clone())}_getConnection(){return T(this,$d).clone()}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){const r=this._getConnection();r.body=JSON.stringify(n),r.setHeader("content-type","application/json");const i=await r.send();i.assertOk();let s=i.bodyJson;return Array.isArray(s)||(s=[s]),s}}$d=new WeakMap;function vk(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&Qt(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=vk(t[e]);if(n)return n}return null}if(typeof t=="string")try{return vk(JSON.parse(t))}catch{}return null}function Ak(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)Ak(t[n],e);if(typeof t=="string")try{return Ak(JSON.parse(t),e)}catch{}}}function Uce(t){const e=[];return Ak(t,e),e}const qb="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function jce(t){switch(t){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}ee(!1,"unsupported network","network",t)}class Qb extends Mo{constructor(n,r){n==null&&(n="mainnet");const i=jn.from(n);r==null&&(r=qb);const s={polling:!0,staticNetwork:i},o=Qb.getRequest(i,r);super(o,i,s);W(this,"apiKey");$e(this,{apiKey:r})}_getProvider(n){try{return new Qb(n,this.apiKey)}catch{}return super._getProvider(n)}static getRequest(n,r){r==null&&(r=qb);const i=new Rr(`https://${jce(n.name)}/${r}`);return i.allowGzip=!0,r===qb&&(i.retryFunc=async(s,o,a)=>(Bf("AnkrProvider"),!0)),i}getRpcError(n,r){return n.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(n,r)}isCommunityResource(){return this.apiKey===qb}}const Jb="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function Hce(t){switch(t){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}ee(!1,"unsupported network","network",t)}class Yb extends Mo{constructor(n,r){n==null&&(n="mainnet");const i=jn.from(n);r==null&&(r=Jb);const s=Yb.getRequest(i,r);super(s,i,{staticNetwork:i});W(this,"apiKey");$e(this,{apiKey:r})}_getProvider(n){try{return new Yb(n,this.apiKey)}catch{}return super._getProvider(n)}async _perform(n){if(n.method==="getTransactionResult"){const{trace:r,tx:i}=await br({trace:this.send("trace_transaction",[n.hash]),tx:this.getTransaction(n.hash)});if(r==null||i==null)return null;let s,o=!1;try{s=r[0].result.output,o=r[0].error==="Reverted"}catch{}if(s)return me(!o,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:s,reason:null,transaction:i,invocation:null,revert:null}),s;me(!1,"could not parse trace result","BAD_DATA",{value:r})}return await super._perform(n)}isCommunityResource(){return this.apiKey===Jb}static getRequest(n,r){r==null&&(r=Jb);const i=new Rr(`https://${Hce(n.name)}/v2/${r}`);return i.allowGzip=!0,r===Jb&&(i.retryFunc=async(s,o,a)=>(Bf("alchemy"),!0)),i}}function Xb(t){switch(t){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}ee(!1,"unsupported network","network",t)}function Vce(t){switch(t){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}ee(!1,"unsupported network","network",t)}class Zb extends Mo{constructor(n,r){n==null&&(n="mainnet");const i=jn.from(n);r==null&&(r=Xb(i.name));const s=Zb.getRequest(i,r);super(s,i,{staticNetwork:i});W(this,"apiKey");$e(this,{apiKey:r})}_getProvider(n){try{return new Zb(n,this.apiKey)}catch{}return super._getProvider(n)}isCommunityResource(){return this.apiKey===Xb(this._network.name)}static getRequest(n,r){r==null&&(r=Xb(n.name));const i=new Rr(`https://${Vce(n.name)}/${r}`);return i.allowGzip=!0,r===Xb(n.name)&&(i.retryFunc=async(s,o,a)=>(Bf("ChainstackProvider"),!0)),i}}class zce extends Mo{constructor(e){e==null&&(e="mainnet");const n=jn.from(e);ee(n.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",n,{staticNetwork:n})}}const k5=2e3;function $ce(t){return t&&typeof t.then=="function"}const Gce="org.ethers.plugins.provider.Etherscan",Wce=["enableCcipRead"];let Kce=1;class qce extends Wb{constructor(n,r){const i=r??null;super();W(this,"network");W(this,"apiKey");ae(this,Gd);const s=jn.from(n);L(this,Gd,s.getPlugin(Gce)),$e(this,{apiKey:i,network:s}),this.getBaseUrl()}getBaseUrl(){if(T(this,Gd))return T(this,Gd).baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}ee(!1,"unsupported network","network",this.network)}getUrl(n,r){const i=Object.keys(r).reduce((o,a)=>{const l=r[a];return l!=null&&(o+=`&${a}=${l}`),o},""),s=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${n}${i}${s}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(n,r){return r.module=n,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(n,r,i){const s=Kce++,o=i?this.getPostUrl():this.getUrl(n,r),a=i?this.getPostData(n,r):null;this.emit("debug",{action:"sendRequest",id:s,url:o,payload:a});const l=new Rr(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&Bf("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(vf(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return n==="proxy"?h&&h.status==0&&h.message=="NOTOK"&&p&&(this.emit("debug",{action:"receiveError",id:s,reason:"proxy-NOTOK",error:h}),d.throwThrottleError(h.result,k5)):p&&(this.emit("debug",{action:"receiveError",id:s,reason:"null result",error:h.result}),d.throwThrottleError(h.result,k5)),d},a&&(l.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),l.body=Object.keys(a).map(f=>`${f}=${a[f]}`).join("&"));const u=await l.send();try{u.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:s,error:f,reason:"assertOk"}),me(!1,"response error","SERVER_ERROR",{request:l,response:u})}u.hasBody()||(this.emit("debug",{action:"receiveError",id:s,error:"missing body",reason:"null body"}),me(!1,"missing response","SERVER_ERROR",{request:l,response:u}));const c=JSON.parse(vf(u.body));return n==="proxy"?(c.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:s,result:c,reason:"invalid JSON-RPC"}),me(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:u,info:{result:c}})),c.error&&(this.emit("debug",{action:"receiveError",id:s,result:c,reason:"JSON-RPC error"}),me(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:s,result:c}),c.result):c.status==0&&(c.message==="No records found"||c.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:s,result:c}),c.result):((c.status!=1||typeof c.message=="string"&&!c.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:s,result:c}),me(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:s,result:c}),c.result)}_getTransactionPostData(n){const r={};for(let i in n){if(Wce.indexOf(i)>=0||n[i]==null)continue;let s=n[i];if(!(i==="type"&&s===0)&&!(i==="blockTag"&&s==="latest")){if({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[i])s=hu(s);else if(i==="accessList")s="["+Ga(s).map(o=>`{address:"${o.address}",storageKeys:["${o.storageKeys.join('","')}"]}`).join(",")+"]";else if(i==="blobVersionedHashes"){if(s.length===0)continue;me(!1,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:n}})}else s=Be(s);r[i]=s}}return r}_checkError(n,r,i){let s="";if(Qn(r,"SERVER_ERROR")){try{s=r.info.result.error.message}catch{}if(!s)try{s=r.info.message}catch{}}if(n.method==="estimateGas"&&!s.match(/revert/i)&&s.match(/insufficient funds/i)&&me(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.transaction}),(n.method==="call"||n.method==="estimateGas")&&s.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=Nf.getBuiltinCallException(n.method,n.transaction,o);throw a.info={request:n,error:r},a}if(s&&n.method==="broadcastTransaction"){const o=Qp.from(n.signedTransaction);s.match(/replacement/i)&&s.match(/underpriced/i)&&me(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o}),s.match(/insufficient funds/)&&me(!1,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o}),s.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&me(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:o})}throw r}async _detectNetwork(){return this.network}async _perform(n){switch(n.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet")return"1000000000";if(this.network.name==="optimism")return"1000000";throw new Error("fallback onto the AbstractProvider default");case"getBalance":return this.fetch("account",{action:"balance",address:n.address,tag:n.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:n.address,tag:n.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:n.address,tag:n.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:n.address,position:n.position,tag:n.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:n.signedTransaction},!0).catch(r=>this._checkError(n,r,n.signedTransaction));case"getBlock":if("blockTag"in n)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:n.blockTag,boolean:n.includeTransactions?"true":"false"});me(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:n.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:n.hash});case"call":{if(n.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(i){return this._checkError(n,i,n.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(i){return this._checkError(n,i,n.transaction)}}}return super._perform(n)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(n){let r=this._getAddress(n);$ce(r)&&(r=await r);try{const i=await this.fetch("contract",{action:"getabi",address:r}),s=JSON.parse(i);return new If(r,s,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}Gd=new WeakMap;function Qce(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const Jce=Qce().WebSocket;class xk{constructor(e,n){ae(this,oo);ae(this,Q0);ae(this,Al);ae(this,oc);ae(this,xl);L(this,oo,e),L(this,Q0,JSON.stringify(n)),L(this,Al,null),L(this,oc,null),L(this,xl,null)}get filter(){return JSON.parse(T(this,Q0))}start(){L(this,Al,T(this,oo).send("eth_subscribe",this.filter).then(e=>(T(this,oo)._register(e,this),e)))}stop(){T(this,Al).then(e=>{T(this,oo).destroyed||T(this,oo).send("eth_unsubscribe",[e])}),L(this,Al,null)}pause(e){me(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),L(this,oc,!!e)}resume(){L(this,oc,null)}_handleMessage(e){if(T(this,Al)!=null&&T(this,oc)===null){let n=T(this,xl);n==null?n=this._emit(T(this,oo),e):n=n.then(async()=>{await this._emit(T(this,oo),e)}),L(this,xl,n.then(()=>{T(this,xl)===n&&L(this,xl,null)}))}}async _emit(e,n){throw new Error("sub-classes must implemente this; _emit")}}oo=new WeakMap,Q0=new WeakMap,Al=new WeakMap,oc=new WeakMap,xl=new WeakMap;class Yce extends xk{constructor(e){super(e,["newHeads"])}async _emit(e,n){e.emit("block",parseInt(n.number))}}class Xce extends xk{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,n){e.emit("pending",n)}}class Zce extends xk{constructor(n,r){super(n,["logs",r]);ae(this,J0);L(this,J0,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,J0))}async _emit(n,r){n.emit(this.logFilter,n._wrapLog(r,n._network))}}J0=new WeakMap;class efe extends E5{constructor(n,r){const i=Object.assign({},r??{});ee(i.batchMaxCount==null||i.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",r),i.batchMaxCount=1,i.staticNetwork==null&&(i.staticNetwork=!0);super(n,i);ae(this,ac);ae(this,Wd);ae(this,El);L(this,ac,new Map),L(this,Wd,new Map),L(this,El,new Map)}_getSubscriber(n){switch(n.type){case"close":return new Gb("close");case"block":return new Yce(this);case"pending":return new Xce(this);case"event":return new Zce(this,n.filter);case"orphan":if(n.filter.orphan==="drop-log")return new Gb("drop-log")}return super._getSubscriber(n)}_register(n,r){T(this,Wd).set(n,r);const i=T(this,El).get(n);if(i){for(const s of i)r._handleMessage(s);T(this,El).delete(n)}}async _send(n){ee(!Array.isArray(n),"WebSocket does not support batch send","payload",n);const r=new Promise((i,s)=>{T(this,ac).set(n.id,{payload:n,resolve:i,reject:s})});return await this._waitUntilReady(),await this._write(JSON.stringify(n)),[await r]}async _processMessage(n){const r=JSON.parse(n);if(r&&typeof r=="object"&&"id"in r){const i=T(this,ac).get(r.id);if(i==null){this.emit("error",an("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,ac).delete(r.id),i.resolve(r)}else if(r&&r.method==="eth_subscription"){const i=r.params.subscription,s=T(this,Wd).get(i);if(s)s._handleMessage(r.params.result);else{let o=T(this,El).get(i);o==null&&(o=[],T(this,El).set(i,o)),o.push(r.params.result)}}else{this.emit("error",an("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(n){throw new Error("sub-classes must override this")}}ac=new WeakMap,Wd=new WeakMap,El=new WeakMap;class S5 extends efe{constructor(n,r,i){super(r,i);ae(this,lc);ae(this,ws);typeof n=="string"?(L(this,lc,()=>new Jce(n)),L(this,ws,T(this,lc).call(this))):typeof n=="function"?(L(this,lc,n),L(this,ws,n())):(L(this,lc,null),L(this,ws,n)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(s){console.log("failed to start WebsocketProvider",s)}},this.websocket.onmessage=s=>{this._processMessage(s.data)}}get websocket(){if(T(this,ws)==null)throw new Error("websocket closed");return T(this,ws)}async _write(n){this.websocket.send(n)}async destroy(){T(this,ws)!=null&&(T(this,ws).close(),L(this,ws,null)),super.destroy()}}lc=new WeakMap,ws=new WeakMap;const n0="84842078b09946638c03157f83405213";function tfe(t){switch(t){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}ee(!1,"unsupported network","network",t)}class nfe extends S5{constructor(n,r){const i=new r0(n,r),s=i._getConnection();me(!s.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const o=s.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,i._network);W(this,"projectId");W(this,"projectSecret");$e(this,{projectId:i.projectId,projectSecret:i.projectSecret})}isCommunityResource(){return this.projectId===n0}}class r0 extends Mo{constructor(n,r,i){n==null&&(n="mainnet");const s=jn.from(n);r==null&&(r=n0),i==null&&(i=null);const o=r0.getRequest(s,r,i);super(o,s,{staticNetwork:s});W(this,"projectId");W(this,"projectSecret");$e(this,{projectId:r,projectSecret:i})}_getProvider(n){try{return new r0(n,this.projectId,this.projectSecret)}catch{}return super._getProvider(n)}isCommunityResource(){return this.projectId===n0}static getWebSocketProvider(n,r){return new nfe(n,r)}static getRequest(n,r,i){r==null&&(r=n0),i==null&&(i=null);const s=new Rr(`https://${tfe(n.name)}/v3/${r}`);return s.allowGzip=!0,i&&s.setCredentials("",i),r===n0&&(s.retryFunc=async(o,a,l)=>(Bf("InfuraProvider"),!0)),s}}const e1="919b412a057b5e9c9b6dce193c5a60242d6efadb";function rfe(t){switch(t){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}ee(!1,"unsupported network","network",t)}class t1 extends Mo{constructor(n,r){n==null&&(n="mainnet");const i=jn.from(n);r==null&&(r=e1);const s=t1.getRequest(i,r);super(s,i,{staticNetwork:i});W(this,"token");$e(this,{token:r})}_getProvider(n){try{return new t1(n,this.token)}catch{}return super._getProvider(n)}isCommunityResource(){return this.token===e1}static getRequest(n,r){r==null&&(r=e1);const i=new Rr(`https://${rfe(n.name)}/${r}`);return i.allowGzip=!0,r===e1&&(i.retryFunc=async(s,o,a)=>(Bf("QuickNodeProvider"),!0)),i}}const ife=BigInt("1"),sfe=BigInt("2");function ofe(t){for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}}function afe(t){return new Promise(e=>{setTimeout(e,t)})}function Ek(){return new Date().getTime()}function kk(t){return JSON.stringify(t,(e,n)=>typeof n=="bigint"?{type:"bigint",value:n.toString()}:n)}const C5={stallTimeout:400,priority:1,weight:1},D5={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function lfe(t,e){for(;(t.blockNumber<0||t.blockNumber<e)&&(t._updateNumber||(t._updateNumber=(async()=>{try{const n=await t.provider.getBlockNumber();n>t.blockNumber&&(t.blockNumber=n)}catch(n){t.blockNumber=-2,t._lastFatalError=n,t._lastFatalErrorTimestamp=Ek()}t._updateNumber=null})()),await t._updateNumber,t.outOfSync++,!t._lastFatalError););}function i0(t){if(t==null)return"null";if(Array.isArray(t))return"["+t.map(i0).join(",")+"]";if(typeof t=="object"&&typeof t.toJSON=="function")return i0(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":case"number":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{"+e.map(n=>`${JSON.stringify(n)}:${i0(t[n])}`).join(",")+"}"}}throw console.log("Could not serialize",t),new Error("Hmm...")}function Sk(t){if("error"in t){const n=t.error;return{tag:i0(n),value:n}}const e=t.result;return{tag:i0(e),value:e}}function n1(t,e){const n=new Map;for(const{value:i,tag:s,weight:o}of e){const a=n.get(s)||{value:i,weight:0};a.weight+=o,n.set(s,a)}let r=null;for(const i of n.values())i.weight>=t&&(!r||i.weight>r.weight)&&(r=i);if(r)return r.value}function Ck(t,e){let n=0;const r=new Map;let i=null;const s=[];for(const{value:a,tag:l,weight:u}of e)if(a instanceof Error){const c=r.get(l)||{value:a,weight:0};c.weight+=u,r.set(l,c),(i==null||c.weight>i.weight)&&(i=c)}else s.push(BigInt(a)),n+=u;if(n<t)return i&&i.weight>=t?i.value:void 0;s.sort((a,l)=>a<l?-1:l>a?1:0);const o=Math.floor(s.length/2);return s.length%2?s[o]:(s[o-1]+s[o]+ife)/sfe}function Dk(t,e){const n=n1(t,e);if(n!==void 0)return n;for(const r of e)if(r.value)return r.value}function ufe(t,e){if(t===1)return st(Ck(t,e),"%internal");const n=new Map,r=(o,a)=>{const l=n.get(o)||{result:o,weight:0};l.weight+=a,n.set(o,l)};for(const{weight:o,value:a}of e){const l=st(a);r(l-1,o),r(l,o),r(l+1,o)}let i=0,s;for(const{weight:o,result:a}of n.values())o>=t&&(o>i||s!=null&&o===i&&a>s)&&(i=o,s=a);return s}class cfe extends Wb{constructor(n,r,i){super(r,i);ae(this,ni);W(this,"quorum");W(this,"eventQuorum");W(this,"eventWorkers");ae(this,ti);ae(this,ea);ae(this,Kd);L(this,ti,n.map(s=>s instanceof Wb?Object.assign({provider:s},C5,D5):Object.assign({},C5,s,D5))),L(this,ea,-2),L(this,Kd,null),i&&i.quorum!=null?this.quorum=i.quorum:this.quorum=Math.ceil(T(this,ti).reduce((s,o)=>(s+=o.weight,s),0)/2),this.eventQuorum=1,this.eventWorkers=1,ee(this.quorum<=T(this,ti).reduce((s,o)=>s+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,ti).map(n=>{const r=Object.assign({},n);for(const i in r)i[0]==="_"&&delete r[i];return r})}async _detectNetwork(){return jn.from(He(await this._perform({method:"chainId"})))}async _translatePerform(n,r){switch(r.method){case"broadcastTransaction":return await n.broadcastTransaction(r.signedTransaction);case"call":return await n.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await n.getNetwork()).chainId;case"estimateGas":return await n.estimateGas(r.transaction);case"getBalance":return await n.getBalance(r.address,r.blockTag);case"getBlock":{const i="blockHash"in r?r.blockHash:r.blockTag;return await n.getBlock(i,r.includeTransactions)}case"getBlockNumber":return await n.getBlockNumber();case"getCode":return await n.getCode(r.address,r.blockTag);case"getGasPrice":return(await n.getFeeData()).gasPrice;case"getPriorityFee":return(await n.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await n.getLogs(r.filter);case"getStorage":return await n.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await n.getTransaction(r.hash);case"getTransactionCount":return await n.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await n.getTransactionReceipt(r.hash);case"getTransactionResult":return await n.getTransactionResult(r.hash)}}async _perform(n){if(n.method==="broadcastTransaction"){const o=T(this,ti).map(u=>null),a=T(this,ti).map(async({provider:u,weight:c},f)=>{try{const d=await u._perform(n);o[f]=Object.assign(Sk({result:d}),{weight:c})}catch(d){o[f]=Object.assign(Sk({error:d}),{weight:c})}});for(;;){const u=o.filter(d=>d!=null);for(const{value:d}of u)if(!(d instanceof Error))return d;const c=n1(this.quorum,o.filter(d=>d!=null));if(Qn(c,"INSUFFICIENT_FUNDS"))throw c;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=Dk(this.quorum,o);if(me(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:n,results:o.map(kk)}}),l instanceof Error)throw l;return l}await Te(this,ni,t7).call(this);const r=new Set;let i=0;for(;;){const o=Te(this,ni,HC).call(this,r,n);if(o==null||(i+=o.config.weight,i>=this.quorum))break}const s=await Te(this,ni,VC).call(this,r,n);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return s}async destroy(){for(const{provider:n}of T(this,ti))n.destroy();super.destroy()}}ti=new WeakMap,ea=new WeakMap,Kd=new WeakMap,ni=new WeakSet,e7=function(n){const r=Array.from(n).map(s=>s.config),i=T(this,ti).slice();ofe(i),i.sort((s,o)=>s.priority-o.priority);for(const s of i)if(!s._lastFatalError&&r.indexOf(s)===-1)return s;return null},HC=function(n,r){const i=Te(this,ni,e7).call(this,n);if(i==null)return null;const s={config:i,result:null,didBump:!1,perform:null,staller:null},o=Ek();return s.perform=(async()=>{try{i.requests++;const l=await this._translatePerform(i.provider,r);s.result={result:l}}catch(l){i.errorResponses++,s.result={error:l}}const a=Ek()-o;i._totalTime+=a,i.rollingDuration=.95*i.rollingDuration+.05*a,s.perform=null})(),s.staller=(async()=>{await afe(i.stallTimeout),s.staller=null})(),n.add(s),s},t7=async function(){let n=T(this,Kd);if(!n){const r=[];T(this,ti).forEach(i=>{r.push((async()=>{await lfe(i,0),i._lastFatalError||(i._network=await i.provider.getNetwork())})())}),L(this,Kd,n=(async()=>{await Promise.all(r);let i=null;for(const s of T(this,ti)){if(s._lastFatalError)continue;const o=s._network;i==null?i=o.chainId:o.chainId!==i&&me(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await n},n7=async function(n,r){const i=[];for(const s of n)if(s.result!=null){const{tag:o,value:a}=Sk(s.result);i.push({tag:o,value:a,weight:s.config.weight})}if(!(i.reduce((s,o)=>s+o.weight,0)<this.quorum)){switch(r.method){case"getBlockNumber":{T(this,ea)===-2&&L(this,ea,Math.ceil(st(Ck(this.quorum,T(this,ti).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:st(o.blockNumber).toString(),weight:o.weight}))))));const s=ufe(this.quorum,i);return s===void 0?void 0:(s>T(this,ea)&&L(this,ea,s),T(this,ea))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return Ck(this.quorum,i);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?Dk(this.quorum,i):n1(this.quorum,i);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return n1(this.quorum,i);case"broadcastTransaction":return Dk(this.quorum,i)}me(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${kk(r.method)})`})}},VC=async function(n,r){if(n.size===0)throw new Error("no runners?!");const i=[];let s=0;for(const a of n){if(a.perform&&i.push(a.perform),a.staller){i.push(a.staller);continue}a.didBump||(a.didBump=!0,s++)}const o=await Te(this,ni,n7).call(this,n,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<s;a++)Te(this,ni,HC).call(this,n,r);return me(i.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(n).map(a=>kk(a.result))}}),await Promise.race(i),await Te(this,ni,VC).call(this,n,r)};function ffe(t){return t&&typeof t.send=="function"&&typeof t.close=="function"}const dfe="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function hfe(t,e){e==null&&(e={});const n=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof t=="string"&&t.match(/^https?:/))return new Mo(t);if(typeof t=="string"&&t.match(/^wss?:/)||ffe(t))return new S5(t);let r=null;try{r=jn.from(t)}catch{}const i=[];if(n("publicPolygon")&&r&&(r.name==="matic"?i.push(new Mo("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&i.push(new Mo("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),n("alchemy"))try{i.push(new Yb(t,e.alchemy))}catch{}if(n("ankr")&&e.ankr!=null)try{i.push(new Qb(t,e.ankr))}catch{}if(n("chainstack"))try{i.push(new Zb(t,e.chainstack))}catch{}if(n("cloudflare"))try{i.push(new zce(t))}catch{}if(n("etherscan"))try{i.push(new qce(t,e.etherscan))}catch{}if(n("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),i.push(new r0(t,o,a))}catch{}if(n("quicknode"))try{let o=e.quicknode;i.push(new t1(t,o))}catch{}if(me(i.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"}),i.length===1)return i[0];let s=Math.floor(i.length/2);return s>2&&(s=2),r&&dfe.indexOf(r.name)!==-1&&(s=1),e&&e.quorum&&(s=e.quorum),new cfe(i,void 0,{quorum:s})}const pfe=async(t,e)=>{const n={name:t,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!cle(t))return n;try{const r=await mfe(t,e);r&&(n.name=r,n.isEns=!0)}catch(r){console.log(r)}return n},mfe=async(t,e)=>await gfe(e).lookupAddress(t),gfe=t=>hfe(t),yfe=(t,e,n)=>{if((t==null?void 0:t.length)>n){const r=t.substring(0,e),i=t.substring((t==null?void 0:t.length)-e);return`${r}...${i}`}return t};function bfe(t){var e;const{char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:o}=t,a=GV(n),l=new RegExp(`\\s${a}$`),u=s?"^":"",c=r?new RegExp(`${u}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${u}(?:^)?${a}[^\\s${a}]*`,"gm"),f=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!f)return null;const d=o.pos-f.length,h=Array.from(f.matchAll(c)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(p);if(i!==null&&!m)return null;const g=d+h.index;let y=g+h[0].length;return r&&l.test(f.slice(y-1,y+1))&&(h[0]+=" ",y+=1),g<o.pos&&y>=o.pos?{range:{from:g,to:y},query:h[0].slice(n.length),text:h[0]}:null}const wfe=new en("suggestion");function vfe({pluginKey:t=wfe,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:u=()=>[],render:c=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=bfe}){let h;const p=c==null?void 0:c(),m=new Ut({key:t,view(){return{update:async(g,y)=>{var v,w,b,E,x,O,S;const D=(v=this.key)===null||v===void 0?void 0:v.getState(y),I=(w=this.key)===null||w===void 0?void 0:w.getState(g.state),F=D.active&&I.active&&D.range.from!==I.range.from,Q=!D.active&&I.active,V=D.active&&!I.active,B=!Q&&!V&&D.query!==I.query,N=Q,H=B||F,K=V;if(!N&&!H&&!K)return;const J=K&&!N?D:I,X=g.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);h={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:ie=>l({editor:e,range:J.range,props:ie}),decorationNode:X,clientRect:X?()=>{var ie;const{decorationId:le}=(ie=this.key)===null||ie===void 0?void 0:ie.getState(e.state),Pe=g.dom.querySelector(`[data-decoration-id="${le}"]`);return(Pe==null?void 0:Pe.getBoundingClientRect())||null}:null},N&&((b=p==null?void 0:p.onBeforeStart)===null||b===void 0||b.call(p,h)),H&&((E=p==null?void 0:p.onBeforeUpdate)===null||E===void 0||E.call(p,h)),(H||N)&&(h.items=await u({editor:e,query:J.query})),K&&((x=p==null?void 0:p.onExit)===null||x===void 0||x.call(p,h)),H&&((O=p==null?void 0:p.onUpdate)===null||O===void 0||O.call(p,h)),N&&((S=p==null?void 0:p.onStart)===null||S===void 0||S.call(p,h))},destroy:()=>{var g;h&&((g=p==null?void 0:p.onExit)===null||g===void 0||g.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,v,w){const{isEditable:b}=e,{composing:E}=e.view,{selection:x}=g,{empty:O,from:S}=x,D={...y};if(D.composing=E,b&&(O||e.view.composing)){(S<y.range.from||S>y.range.to)&&!E&&!y.composing&&(D.active=!1);const I=d({char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:x.$from}),F=`id_${Math.floor(Math.random()*4294967295)}`;I&&f({editor:e,state:w,range:I.range,isActive:y.active})?(D.active=!0,D.decorationId=y.decorationId?y.decorationId:F,D.range=I.range,D.query=I.query,D.text=I.text):D.active=!1}else D.active=!1;return D.active||(D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null),D}},props:{handleKeyDown(g,y){var v;const{active:w,range:b}=m.getState(g.state);return w&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:g,event:y,range:b}))||!1},decorations(g){const{active:y,range:v,decorationId:w}=m.getState(g);return y?Wt.create(g.doc,[Un.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":w})]):null}}});return m}var Afe=typeof Sl=="object"&&Sl&&Sl.Object===Object&&Sl,xfe=typeof self=="object"&&self&&self.Object===Object&&self;Afe||xfe||Function("return this")();var Efe=typeof window<"u"?_.useLayoutEffect:_.useEffect,kfe=typeof window>"u";function Tk(t,{defaultValue:e=!1,initializeWithValue:n=!0}={}){const r=a=>kfe?e:window.matchMedia(a).matches,[i,s]=_.useState(()=>n?r(t):e);function o(){s(r(t))}return Efe(()=>{const a=window.matchMedia(t);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[t]),i}const Sfe=It.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[vfe({editor:this.editor,...this.options.suggestion})]}}),Cfe=({query:t,onError:e})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:k.jsx(RO,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:k.jsx(IO,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:k.jsx(Wm,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:k.jsx(Km,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:k.jsx(qm,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:k.jsx(Qm,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:k.jsx(Pc,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:k.jsx(iG,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:k.jsx(Jm,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:k.jsx(Ph,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:k.jsx(iA,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).insertTable({rows:3,cols:2,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:k.jsx(tG,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).run();const i=document.createElement("input");i.type="file",i.accept="image/*",i.onchange=async()=>{var s;if((s=i.files)!=null&&s.length){const o=i.files[0];if(o.size>zh){e&&typeof e=="function"&&e(WA.IMAGE_SIZE);return}const l=n.view.state.selection.from;lA(o,n.view,l)}},i.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:k.jsx(BO,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:k.jsx(LO,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:k.jsx(MO,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(2).focus(n.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:k.jsx(Y$,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(3).focus(n.state.selection.head-1).run()}}].filter(n=>{if(typeof t=="string"&&t.length>0){const r=t.toLowerCase();return n.title.toLowerCase().includes(r)||n.description.toLowerCase().includes(r)||n.searchTerms&&n.searchTerms.some(i=>i.includes(r))}return!0}),Dfe=(t,e)=>{const n=t.offsetHeight,r=e?e.offsetHeight:0,i=e.offsetTop,s=i+r;i<t.scrollTop?t.scrollTop-=t.scrollTop-i+5:s>n+t.scrollTop&&(t.scrollTop+=s-n-t.scrollTop+5)},Tfe=({items:t,command:e,editor:n})=>{const[r,i]=_.useState(0),[s,o]=_.useState(t),a=Tk("(max-width: 640px)"),l=_.useCallback(c=>{const f=s[c];f&&(f.title==="Continue writing"||e(f))},[e,n,s]);_.useEffect(()=>{if(a){const c=t.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(c)}else o(t)},[t,a]),_.useEffect(()=>{const c=["ArrowUp","ArrowDown","Enter"],f=d=>{if(c.includes(d.key))return d.preventDefault(),d.key==="ArrowUp"?(i((r+s.length-1)%s.length),!0):d.key==="ArrowDown"?(i((r+1)%s.length),!0):d.key==="Enter"?(l(r),!0):!1};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[s,r,i,l]),_.useEffect(()=>{i(0)},[s]);const u=_.useRef(null);return _.useLayoutEffect(()=>{const c=u==null?void 0:u.current,f=c==null?void 0:c.children[r];f&&c&&Dfe(c,f)},[r]),s.length>0?k.jsx("div",{id:"slash-command",ref:u,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:s.map((c,f)=>k.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${f===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>l(f),children:[k.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:c.icon}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium",children:c.title}),k.jsx("p",{className:"text-xs text-neutral-500",children:c.description})]})]},f))}):null},Ofe=()=>{let t=null,e=null;return{onStart:n=>{t=new TO(Tfe,{props:n,editor:n.editor}),e=zl("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:n=>{t==null||t.updateProps(n),e&&e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown:n=>{var r;return n.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=t==null?void 0:t.ref)==null?void 0:r.onKeyDown(n)},onExit:()=>{e==null||e[0].destroy(),t==null||t.destroy()}}},_fe=t=>{const e=({query:n})=>Cfe({query:n,onError:t});return Sfe.configure({suggestion:{items:e,render:Ofe}})};/*! *****************************************************************************
516
- Copyright (c) Microsoft Corporation.
517
-
518
- Permission to use, copy, modify, and/or distribute this software for any
519
- purpose with or without fee is hereby granted.
520
-
521
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
522
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
523
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
524
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
525
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
526
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
527
- PERFORMANCE OF THIS SOFTWARE.
528
- ***************************************************************************** */var Me=function(){return Me=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Me.apply(this,arguments)};function Ok(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Et(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _t(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function rn(t,e,n){if(arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var zt;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(zt||(zt={}));var Uf;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Uf||(Uf={}));var _k=zt.Start,Mk=zt.Stop,s0=zt.Raise,r1=zt.Send,T5=zt.Cancel,Mfe=zt.NullEvent,Nk=zt.Assign;zt.After,zt.DoneState;var O5=zt.Log,Nfe=zt.Init,Pk=zt.Invoke;zt.ErrorExecution;var _5=zt.ErrorPlatform,Pfe=zt.ErrorCustom,M5=zt.Update,Ife=zt.Choose,Rfe=zt.Pure,N5=".",P5={},Ik="xstate.guard",Lfe="",Sn=process.env.NODE_ENV==="production",i1;function Rk(t,e,n){n===void 0&&(n=N5);var r=o0(t,n),i=o0(e,n);return Mt(i)?Mt(r)?i===r:!1:Mt(r)?r in i:Object.keys(r).every(function(s){return s in i?Rk(r[s],i[s]):!1})}function I5(t){try{return Mt(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function Lk(t,e){try{return jf(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function Bfe(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function o0(t,e){if(Bfe(t))return t.value;if(jf(t))return s1(t);if(typeof t!="string")return t;var n=Lk(t,e);return s1(n)}function s1(t){if(t.length===1)return t[0];for(var e={},n=e,r=0;r<t.length-1;r++)r===t.length-2?n[t[r]]=t[r+1]:(n[t[r]]={},n=n[t[r]]);return e}function a0(t,e){for(var n={},r=Object.keys(t),i=0;i<r.length;i++){var s=r[i];n[s]=e(t[s],s,t,i)}return n}function R5(t,e,n){var r,i,s={};try{for(var o=Et(Object.keys(t)),a=o.next();!a.done;a=o.next()){var l=a.value,u=t[l];n(u)&&(s[l]=e(u,l,t))}}catch(c){r={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s}var Ffe=function(t){return function(e){var n,r,i=e;try{for(var s=Et(t),o=s.next();!o.done;o=s.next()){var a=o.value;i=i[a]}}catch(l){n={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}};function Ufe(t,e){return function(n){var r,i,s=n;try{for(var o=Et(t),a=o.next();!a.done;a=o.next()){var l=a.value;s=s[e][l]}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s}}function o1(t){if(!t)return[[]];if(Mt(t))return[[t]];var e=fn(Object.keys(t).map(function(n){var r=t[n];return typeof r!="string"&&(!r||!Object.keys(r).length)?[[n]]:o1(t[n]).map(function(i){return[n].concat(i)})}));return e}function fn(t){var e;return(e=[]).concat.apply(e,rn([],_t(t),!1))}function L5(t){return jf(t)?t:[t]}function ds(t){return t===void 0?[]:L5(t)}function a1(t,e,n){var r,i;if(Pt(t))return t(e,n.data);var s={};try{for(var o=Et(Object.keys(t)),a=o.next();!a.done;a=o.next()){var l=a.value,u=t[l];Pt(u)?s[l]=u(e,n.data):s[l]=u}}catch(c){r={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s}function jfe(t){return/^(done|error)\./.test(t)}function B5(t){return!!(t instanceof Promise||t!==null&&(Pt(t)||typeof t=="object")&&Pt(t.then))}function Hfe(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Vfe(t,e){var n,r,i=_t([[],[]],2),s=i[0],o=i[1];try{for(var a=Et(t),l=a.next();!l.done;l=a.next()){var u=l.value;e(u)?s.push(u):o.push(u)}}catch(c){n={error:c}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return[s,o]}function F5(t,e){return a0(t.states,function(n,r){if(n){var i=(Mt(e)?void 0:e[r])||(n?n.current:void 0);if(i)return{current:i,states:F5(n,i)}}})}function zfe(t,e){return{current:e,states:F5(t,e)}}function U5(t,e,n,r){Sn||sr(!!t,"Attempting to update undefined context");var i=t&&n.reduce(function(s,o){var a,l,u=o.assignment,c={state:r,action:o,_event:e},f={};if(Pt(u))f=u(s,e.data,c);else try{for(var d=Et(Object.keys(u)),h=d.next();!h.done;h=d.next()){var p=h.value,m=u[p];f[p]=Pt(m)?m(s,e.data,c):m}}catch(g){a={error:g}}finally{try{h&&!h.done&&(l=d.return)&&l.call(d)}finally{if(a)throw a.error}}return Object.assign({},s,f)},t);return i}var sr=function(){};Sn||(sr=function(t,e){var n=t instanceof Error?t:void 0;if(!(!n&&t)&&console!==void 0){var r=["Warning: ".concat(e)];n&&r.push(n),console.warn.apply(console,r)}});function jf(t){return Array.isArray(t)}function Pt(t){return typeof t=="function"}function Mt(t){return typeof t=="string"}function j5(t,e){if(t)return Mt(t)?{type:Ik,name:t,predicate:e?e[t]:void 0}:Pt(t)?{type:Ik,name:t.name,predicate:t}:t}function $fe(t){try{return"subscribe"in t&&Pt(t.subscribe)}catch{return!1}}var Ka=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();i1={},i1[Ka]=function(){return this},i1[Symbol.observable]=function(){return this};function Du(t){return!!t&&"__xstatenode"in t}function Gfe(t){return!!t&&typeof t.send=="function"}function l1(t,e){return Mt(t)||typeof t=="number"?Me({type:t},e):t}function or(t,e){if(!Mt(t)&&"$$type"in t&&t.$$type==="scxml")return t;var n=l1(t);return Me({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function Hf(t,e){var n=L5(e).map(function(r){return typeof r>"u"||typeof r=="string"||Du(r)?{target:r,event:t}:Me(Me({},r),{event:t})});return n}function Wfe(t){if(!(t===void 0||t===Lfe))return ds(t)}function Kfe(t,e,n){if(!Sn){var r=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(n,"', error was '").concat(t,"'.").concat(r));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(n,"'. ")+"Original error: '".concat(t,"'. ").concat(r," Current error is '").concat(e,"'.").concat(i))}}}function H5(t,e,n,r,i){var s=t.options.guards,o={state:i,cond:e,_event:r};if(e.type===Ik)return((s==null?void 0:s[e.name])||e.predicate)(n,r.data,o);var a=s==null?void 0:s[e.type];if(!a)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return a(n,r.data,o)}function V5(t){return typeof t=="string"?{type:t}:t}function u1(t,e,n){var r=function(){},i=typeof t=="object",s=i?t:null;return{next:((i?t.next:t)||r).bind(s),error:((i?t.error:e)||r).bind(s),complete:((i?t.complete:n)||r).bind(s)}}function c1(t,e){return"".concat(t,":invocation[").concat(e,"]")}function Bk(t){return(t.type===s0||t.type===r1&&t.to===Uf.Internal)&&typeof t.delay!="number"}var Vf=or({type:Nfe});function Fk(t,e){return e&&e[t]||void 0}function l0(t,e){var n;if(Mt(t)||typeof t=="number"){var r=Fk(t,e);Pt(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(Pt(t))n={type:t.name||t.toString(),exec:t};else{var r=Fk(t.type,e);if(Pt(r))n=Me(Me({},t),{exec:r});else if(r){var i=r.type||t.type;n=Me(Me(Me({},r),t),{type:i})}else n=t}return n}var qa=function(t,e){if(!t)return[];var n=jf(t)?t:[t];return n.map(function(r){return l0(r,e)})};function Uk(t){var e=l0(t);return Me(Me({id:Mt(t)?t:e.id},e),{type:e.type})}function qfe(t,e){return{type:s0,event:typeof t=="function"?t:l1(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function Qfe(t,e,n,r){var i={_event:n},s=or(Pt(t.event)?t.event(e,n.data,i):t.event),o;if(Mt(t.delay)){var a=r&&r[t.delay];o=Pt(a)?a(e,n.data,i):a}else o=Pt(t.delay)?t.delay(e,n.data,i):t.delay;return Me(Me({},t),{type:s0,_event:s,delay:o})}function Jfe(t,e){return{to:e?e.to:void 0,type:r1,event:Pt(t)?t:l1(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:Pt(t)?t.name:I5(t)}}function Yfe(t,e,n,r){var i={_event:n},s=or(Pt(t.event)?t.event(e,n.data,i):t.event),o;if(Mt(t.delay)){var a=r&&r[t.delay];o=Pt(a)?a(e,n.data,i):a}else o=Pt(t.delay)?t.delay(e,n.data,i):t.delay;var l=Pt(t.to)?t.to(e,n.data,i):t.to;return Me(Me({},t),{to:l,_event:s,event:s.data,delay:o})}var Xfe=function(t,e,n){return Me(Me({},t),{value:Mt(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},Zfe=function(t){return{type:T5,sendId:t}};function ede(t){var e=Uk(t);return{type:zt.Start,activity:e,exec:void 0}}function tde(t){var e=Pt(t)?t:Uk(t);return{type:zt.Stop,activity:e,exec:void 0}}function nde(t,e,n){var r=Pt(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,s={type:zt.Stop,activity:i};return s}var rde=function(t){return{type:Nk,assignment:t}};function ide(t,e){var n=e?"#".concat(e):"";return"".concat(zt.After,"(").concat(t,")").concat(n)}function f1(t,e){var n="".concat(zt.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function d1(t,e){var n="".concat(zt.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function u0(t,e){var n="".concat(zt.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}var sde=function(t){var e,n,r=[];try{for(var i=Et(t),s=i.next();!s.done;s=i.next())for(var o=s.value,a=0;a<o.actions.length;){if(o.actions[a].type===Nk){r.push(o.actions[a]),o.actions.splice(a,1);continue}a++}}catch(l){e={error:l}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function h1(t,e,n,r,i,s,o){o===void 0&&(o=!1);var a=o?[]:sde(i),l=a.length?U5(n,r,a,e):n,u=o?[n]:void 0,c=[];function f(p,m){var g;switch(m.type){case s0:{var y=Qfe(m,l,r,t.options.delays);return s&&typeof y.delay=="number"&&s(y,l,r),y}case r1:var v=Yfe(m,l,r,t.options.delays);if(!Sn){var w=m.delay;sr(!Mt(w)||typeof v.delay=="number","No delay reference for delay expression '".concat(w,"' was found on machine '").concat(t.id,"'"))}return s&&v.to!==Uf.Internal&&(p==="entry"?c.push(v):s(v,l,r)),v;case O5:{var b=Xfe(m,l,r);return s==null||s(b,l,r),b}case Ife:{var E=m,x=(g=E.conds.find(function(K){var J=j5(K.cond,t.options.guards);return!J||H5(t,J,l,r,s?void 0:e)}))===null||g===void 0?void 0:g.actions;if(!x)return[];var O=_t(h1(t,e,l,r,[{type:p,actions:qa(ds(x),t.options.actions)}],s,o),2),S=O[0],D=O[1];return l=D,u==null||u.push(l),S}case Rfe:{var x=m.get(l,r.data);if(!x)return[];var I=_t(h1(t,e,l,r,[{type:p,actions:qa(ds(x),t.options.actions)}],s,o),2),F=I[0],Q=I[1];return l=Q,u==null||u.push(l),F}case Mk:{var b=nde(m,l,r);return s==null||s(b,n,r),b}case Nk:{l=U5(l,r,[m],s?void 0:e),u==null||u.push(l);break}default:var V=l0(m,t.options.actions),B=V.exec;if(s)s(V,l,r);else if(B&&u){var N=u.length-1,H=Me(Me({},V),{exec:function(K){for(var J=[],X=1;X<arguments.length;X++)J[X-1]=arguments[X];B.apply(void 0,rn([u[N]],_t(J),!1))}});V=H}return V}}function d(p){var m,g,y=[];try{for(var v=Et(p.actions),w=v.next();!w.done;w=v.next()){var b=w.value,E=f(p.type,b);E&&(y=y.concat(E))}}catch(x){m={error:x}}finally{try{w&&!w.done&&(g=v.return)&&g.call(v)}finally{if(m)throw m.error}}return c.forEach(function(x){s(x,l,r)}),c.length=0,y}var h=fn(i.map(d));return[h,l]}var zf=function(t,e){var n=e(t);return n};function z5(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[Ka]=function(){return this},e}function ode(t,e,n,r){var i,s=V5(t.src),o=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],a=t.data?a1(t.data,n,r):void 0,l=o?$5(o,t.id,a):z5(t.id);return l.meta=t,l}function $5(t,e,n){var r=z5(e);if(r.deferred=!0,Du(t)){var i=r.state=zf(void 0,function(){return(n?t.withContext(n):t).initialState});r.getSnapshot=function(){return i}}return r}function ade(t){try{return typeof t.send=="function"}catch{return!1}}function lde(t){return ade(t)&&"id"in t}function ude(t){var e;return Me((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[Ka]=function(){return this},e),t)}var p1=function(t){return t.type==="atomic"||t.type==="final"};function G5(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function c0(t){return G5(t).filter(function(e){return e.type!=="history"})}function W5(t){var e=[t];return p1(t)?e:e.concat(fn(c0(t).map(W5)))}function f0(t,e){var n,r,i,s,o,a,l,u,c=new Set(t),f=jk(c),d=new Set(e);try{for(var h=Et(d),p=h.next();!p.done;p=h.next())for(var m=p.value,g=m.parent;g&&!d.has(g);)d.add(g),g=g.parent}catch(D){n={error:D}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var y=jk(d);try{for(var v=Et(d),w=v.next();!w.done;w=v.next()){var m=w.value;if(m.type==="compound"&&(!y.get(m)||!y.get(m).length))f.get(m)?f.get(m).forEach(function(I){return d.add(I)}):m.initialStateNodes.forEach(function(I){return d.add(I)});else if(m.type==="parallel")try{for(var b=(o=void 0,Et(c0(m))),E=b.next();!E.done;E=b.next()){var x=E.value;d.has(x)||(d.add(x),f.get(x)?f.get(x).forEach(function(I){return d.add(I)}):x.initialStateNodes.forEach(function(I){return d.add(I)}))}}catch(I){o={error:I}}finally{try{E&&!E.done&&(a=b.return)&&a.call(b)}finally{if(o)throw o.error}}}}catch(D){i={error:D}}finally{try{w&&!w.done&&(s=v.return)&&s.call(v)}finally{if(i)throw i.error}}try{for(var O=Et(d),S=O.next();!S.done;S=O.next())for(var m=S.value,g=m.parent;g&&!d.has(g);)d.add(g),g=g.parent}catch(D){l={error:D}}finally{try{S&&!S.done&&(u=O.return)&&u.call(O)}finally{if(l)throw l.error}}return d}function K5(t,e){var n=e.get(t);if(!n)return{};if(t.type==="compound"){var r=n[0];if(r){if(p1(r))return r.key}else return{}}var i={};return n.forEach(function(s){i[s.key]=K5(s,e)}),i}function jk(t){var e,n,r=new Map;try{for(var i=Et(t),s=i.next();!s.done;s=i.next()){var o=s.value;r.has(o)||r.set(o,[]),o.parent&&(r.has(o.parent)||r.set(o.parent,[]),r.get(o.parent).push(o))}}catch(a){e={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function cde(t,e){var n=f0([t],e);return K5(t,jk(n))}function d0(t,e){return Array.isArray(t)?t.some(function(n){return n===e}):t instanceof Set?t.has(e):!1}function fde(t){return rn([],_t(new Set(fn(rn([],_t(t.map(function(e){return e.ownEvents})),!1)))),!1)}function m1(t,e){return e.type==="compound"?c0(e).some(function(n){return n.type==="final"&&d0(t,n)}):e.type==="parallel"?c0(e).every(function(n){return m1(t,n)}):!1}function dde(t){return t===void 0&&(t=[]),t.reduce(function(e,n){return n.meta!==void 0&&(e[n.id]=n.meta),e},{})}function q5(t){return new Set(fn(t.map(function(e){return e.tags})))}function Q5(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(Mt(t)||Mt(e))return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(i){return Q5(t[i],e[i])})}function hde(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function pde(t,e){var n=t.exec,r=Me(Me({},t),{exec:n!==void 0?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return r}var Bi=function(){function t(e){var n=this,r;this.actions=[],this.activities=P5,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||P5,this.meta=dde(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(r=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&r!==void 0?r:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return fde(n.configuration)}})}return t.from=function(e,n){if(e instanceof t)return e.context!==n?new t({value:e.value,context:n,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var r=Vf;return new t({value:e,context:n,_event:r,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var r=Vf;return new t({value:e.value,context:n,_event:r,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,n)},t.prototype.toStrings=function(e,n){var r=this;if(e===void 0&&(e=this.value),n===void 0&&(n="."),Mt(e))return[e];var i=Object.keys(e);return i.concat.apply(i,rn([],_t(i.map(function(s){return r.toStrings(e[s],n).map(function(o){return s+n+o})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var n=e.tags;e.machine;var r=Ok(e,["configuration","transitions","tags","machine"]);return Me(Me({},r),{tags:Array.from(n)})},t.prototype.matches=function(e){return Rk(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var n;Sn&&sr(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var r=(n=this.machine)===null||n===void 0?void 0:n.getTransitionData(this,e);return!!(r!=null&&r.transitions.length)&&r.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}(),mde={deferEvents:!1},J5=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=Me(Me({},mde),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(n){throw this.clear(),n}finally{this.processingEvent=!1}},t}(),Hk=new Map,gde=0,h0={bookId:function(){return"x:".concat(gde++)},register:function(t,e){return Hk.set(t,e),t},get:function(t){return Hk.get(t)},free:function(t){Hk.delete(t)}};function Vk(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;Sn||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function yde(){var t=Vk();if(t&&"__xstate__"in t)return t.__xstate__}function bde(t){if(Vk()){var e=yde();e&&e.register(t)}}function wde(t,e){e===void 0&&(e={});var n=t.initialState,r=new Set,i=[],s=!1,o=function(){if(!s){for(s=!0;i.length>0;){var u=i.shift();n=t.transition(n,u,l),r.forEach(function(c){return c.next(n)})}s=!1}},a=ude({id:e.id,send:function(u){i.push(u),o()},getSnapshot:function(){return n},subscribe:function(u,c,f){var d=u1(u,c,f);return r.add(d),d.next(n),{unsubscribe:function(){r.delete(d)}}}}),l={parent:e.parent,self:a,id:e.id||"anonymous",observers:r};return n=t.start?t.start(l):n,a}var vde={sync:!1,autoForward:!1},wn;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(wn||(wn={}));var Ade=function(){function t(e,n){n===void 0&&(n=t.defaultOptions);var r=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=wn.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(c,f){if(jf(c))return r.batch(c),r.state;var d=or(l1(c,f));if(r.status===wn.Stopped)return Sn||sr(!1,'Event "'.concat(d.name,'" was sent to stopped service "').concat(r.machine.id,`". This service has already reached its final state, and will not transition.
529
- Event: `).concat(JSON.stringify(d.data))),r.state;if(r.status!==wn.Running&&!r.options.deferEvents)throw new Error('Event "'.concat(d.name,'" was sent to uninitialized service "').concat(r.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
530
- Event: `).concat(JSON.stringify(d.data)));return r.scheduler.schedule(function(){r.forward(d);var h=r._nextState(d);r.update(h,d)}),r._state},this.sendTo=function(c,f,d){var h=r.parent&&(f===Uf.Parent||r.parent.id===f),p=h?r.parent:Mt(f)?f===Uf.Internal?r:r.children.get(f)||h0.get(f):Gfe(f)?f:void 0;if(!p){if(!h)throw new Error("Unable to send event to child '".concat(f,"' from service '").concat(r.id,"'."));Sn||sr(!1,"Service '".concat(r.id,"' has no parent: unable to send event ").concat(c.type));return}if("machine"in p){if(r.status!==wn.Stopped||r.parent!==p||r.state.done){var m=Me(Me({},c),{name:c.name===Pfe?"".concat(u0(r.id)):c.name,origin:r.sessionId});!d&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([p,m]):p.send(m)}}else!d&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([p,c.data]):p.send(c.data)},this._exec=function(c,f,d,h){h===void 0&&(h=r.machine.options.actions);var p=c.exec||Fk(c.type,h),m=Pt(p)?p:p?p.exec:c.exec;if(m)try{return m(f,d.data,r.machine.config.predictableActionArguments?{action:c,_event:d}:{action:c,state:r.state,_event:d})}catch(B){throw r.parent&&r.parent.send({type:"xstate.error",data:B}),B}switch(c.type){case s0:{var g=c;r.defer(g);break}case r1:var y=c;if(typeof y.delay=="number"){r.defer(y);return}else y.to?r.sendTo(y._event,y.to,d===Vf):r.send(y._event);break;case T5:r.cancel(c.sendId);break;case _k:{if(r.status!==wn.Running)return;var v=c.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[v.id||v.type])break;if(v.type===zt.Invoke){var w=V5(v.src),b=r.machine.options.services?r.machine.options.services[w.type]:void 0,E=v.id,x=v.data;Sn||sr(!("forward"in v),"`forward` property is deprecated (found in invocation of '".concat(v.src,"' in in machine '").concat(r.machine.id,"'). ")+"Please use `autoForward` instead.");var O="autoForward"in v?v.autoForward:!!v.forward;if(!b){Sn||sr(!1,"No service found for invocation '".concat(v.src,"' in machine '").concat(r.machine.id,"'."));return}var S=x?a1(x,f,d):void 0;if(typeof b=="string")return;var D=Pt(b)?b(f,d.data,{data:S,src:w,meta:v.meta}):b;if(!D)return;var I=void 0;Du(D)&&(D=S?D.withContext(S):D,I={autoForward:O}),r.spawn(D,E,I)}else r.spawnActivity(v);break}case Mk:{r.stopChild(c.activity.id);break}case O5:var F=c,Q=F.label,V=F.value;Q?r.logger(Q,V):r.logger(V);break;default:Sn||sr(!1,"No implementation found for action type '".concat(c.type,"'"));break}};var i=Me(Me({},t.defaultOptions),n),s=i.clock,o=i.logger,a=i.parent,l=i.id,u=l!==void 0?l:e.id;this.id=u,this.logger=o,this.clock=s,this.parent=a,this.options=i,this.scheduler=new J5({deferEvents:this.options.deferEvents}),this.sessionId=h0.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:zf(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return Sn||sr(this.status!==wn.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,n){var r,i;try{for(var s=Et(e.actions),o=s.next();!o.done;o=s.next()){var a=o.value;this.exec(a,e,n)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},t.prototype.update=function(e,n){var r,i,s,o,a,l,u,c,f=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||n===Vf)&&this.options.execute)this.execute(this.state);else for(var d=void 0;d=this._outgoingQueue.shift();)d[0].send(d[1]);if(this.children.forEach(function(D){f.state.children[D.id]=D}),this.devTools&&this.devTools.send(n.data,e),e.event)try{for(var h=Et(this.eventListeners),p=h.next();!p.done;p=h.next()){var m=p.value;m(e.event)}}catch(D){r={error:D}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}try{for(var g=Et(this.listeners),y=g.next();!y.done;y=g.next()){var m=y.value;m(e,e.event)}}catch(D){s={error:D}}finally{try{y&&!y.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}try{for(var v=Et(this.contextListeners),w=v.next();!w.done;w=v.next()){var b=w.value;b(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(D){a={error:D}}finally{try{w&&!w.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}if(this.state.done){var E=e.configuration.find(function(D){return D.type==="final"&&D.parent===f.machine}),x=E&&E.doneData?a1(E.doneData,e.context,n):void 0;this._doneEvent=d1(this.id,x);try{for(var O=Et(this.doneListeners),S=O.next();!S.done;S=O.next()){var m=S.value;m(this._doneEvent)}}catch(D){u={error:D}}finally{try{S&&!S.done&&(c=O.return)&&c.call(O)}finally{if(u)throw u.error}}this._stop(),this._stopChildren(),h0.free(this.sessionId)}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===wn.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,n,r){var i=this,s=u1(e,n,r);this.listeners.add(s.next),this.status!==wn.NotStarted&&s.next(this.state);var o=function(){i.doneListeners.delete(o),i.stopListeners.delete(o),s.complete()};return this.status===wn.Stopped?s.complete():(this.onDone(o),this.onStop(o)),{unsubscribe:function(){i.listeners.delete(s.next),i.doneListeners.delete(o),i.stopListeners.delete(o)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.status===wn.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var n=this;if(this.status===wn.Running)return this;this.machine._init(),h0.register(this.sessionId,this),this.initialized=!0,this.status=wn.Running;var r=e===void 0?this.initialState:zf(this,function(){return hde(e)?n.machine.resolveState(e):n.machine.resolveState(Bi.from(e,n.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){n.update(r,Vf)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(e){Pt(e.stop)&&e.stop()}),this.children.clear()},t.prototype._stop=function(){var e,n,r,i,s,o,a,l,u,c;try{for(var f=Et(this.listeners),d=f.next();!d.done;d=f.next()){var h=d.value;this.listeners.delete(h)}}catch(O){e={error:O}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(e)throw e.error}}try{for(var p=Et(this.stopListeners),m=p.next();!m.done;m=p.next()){var h=m.value;h(),this.stopListeners.delete(h)}}catch(O){r={error:O}}finally{try{m&&!m.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}try{for(var g=Et(this.contextListeners),y=g.next();!y.done;y=g.next()){var h=y.value;this.contextListeners.delete(h)}}catch(O){s={error:O}}finally{try{y&&!y.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}try{for(var v=Et(this.doneListeners),w=v.next();!w.done;w=v.next()){var h=w.value;this.doneListeners.delete(h)}}catch(O){a={error:O}}finally{try{w&&!w.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}if(!this.initialized)return this;this.initialized=!1,this.status=wn.Stopped,this._initialState=void 0;try{for(var b=Et(Object.keys(this.delayedEventsMap)),E=b.next();!E.done;E=b.next()){var x=E.value;this.clock.clearTimeout(this.delayedEventsMap[x])}}catch(O){u={error:O}}finally{try{E&&!E.done&&(c=b.return)&&c.call(b)}finally{if(u)throw u.error}}this.scheduler.clear(),this.scheduler=new J5({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var e=this,n=this.scheduler;return this._stop(),n.schedule(function(){var r;if(!(!((r=e._state)===null||r===void 0)&&r.done)){var i=or({type:"xstate.stop"}),s=zf(e,function(){var o=fn(rn([],_t(e.state.configuration),!1).sort(function(f,d){return d.order-f.order}).map(function(f){return qa(f.onExit,e.machine.options.actions)})),a=_t(h1(e.machine,e.state,e.state.context,i,[{type:"exit",actions:o}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),l=a[0],u=a[1],c=new Bi({value:e.state.value,context:u,_event:i,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:l.filter(function(f){return!Bk(f)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return c.changed=!0,c});e.update(s,i),e._stopChildren(),h0.free(e.sessionId)}}),this},t.prototype.batch=function(e){var n=this;if(this.status===wn.NotStarted&&this.options.deferEvents)Sn||sr(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
531
- Event: `).concat(JSON.stringify(event)));else if(this.status!==wn.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(e.length){var r=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var i,s,o=n.state,a=!1,l=[],u=function(h){var p=or(h);n.forward(p),o=zf(n,function(){return n.machine.transition(o,p,void 0,r||void 0)}),l.push.apply(l,rn([],_t(n.machine.config.predictableActionArguments?o.actions:o.actions.map(function(m){return pde(m,o)})),!1)),a=a||!!o.changed};try{for(var c=Et(e),f=c.next();!f.done;f=c.next()){var d=f.value;u(d)}}catch(h){i={error:h}}finally{try{f&&!f.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}o.changed=a,o.actions=l,n.update(o,or(e[e.length-1]))})}},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype._nextState=function(e,n){var r=this;n===void 0&&(n=!!this.machine.config.predictableActionArguments&&this._exec);var i=or(e);if(i.name.indexOf(_5)===0&&!this.state.nextEvents.some(function(o){return o.indexOf(_5)===0}))throw i.data.data;var s=zf(this,function(){return r.machine.transition(r.state,i,void 0,n||void 0)});return s},t.prototype.nextState=function(e){return this._nextState(e,!1)},t.prototype.forward=function(e){var n,r;try{for(var i=Et(this.forwardTo),s=i.next();!s.done;s=i.next()){var o=s.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));a.send(e)}}catch(l){n={error:l}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.defer=function(e){var n=this,r=this.clock.setTimeout(function(){"to"in e&&e.to?n.sendTo(e._event,e.to,!0):n.send(e._event)},e.delay);e.id&&(this.delayedEventsMap[e.id]=r)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,n,r){r===void 0&&(r=this.machine.options.actions),this._exec(e,n.context,n._event,r)},t.prototype.removeChild=function(e){var n;this.children.delete(e),this.forwardTo.delete(e),(n=this.state)===null||n===void 0||delete n.children[e]},t.prototype.stopChild=function(e){var n=this.children.get(e);n&&(this.removeChild(e),Pt(n.stop)&&n.stop())},t.prototype.spawn=function(e,n,r){if(this.status!==wn.Running)return $5(e,n);if(B5(e))return this.spawnPromise(Promise.resolve(e),n);if(Pt(e))return this.spawnCallback(e,n);if(lde(e))return this.spawnActor(e,n);if($fe(e))return this.spawnObservable(e,n);if(Du(e))return this.spawnMachine(e,Me(Me({},r),{id:n}));if(Hfe(e))return this.spawnBehavior(e,n);throw new Error('Unable to spawn entity "'.concat(n,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,n){var r=this;n===void 0&&(n={});var i=new t(e,Me(Me({},this.options),{parent:this,id:n.id||e.id})),s=Me(Me({},vde),n);s.sync&&i.onTransition(function(a){r.send(M5,{state:a,id:i.id})});var o=i;return this.children.set(i.id,o),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(a){r.removeChild(i.id),r.send(or(a,{origin:i.id}))}).start(),o},t.prototype.spawnBehavior=function(e,n){var r=wde(e,{id:n,parent:this});return this.children.set(n,r),r},t.prototype.spawnPromise=function(e,n){var r,i=this,s=!1,o;e.then(function(l){s||(o=l,i.removeChild(n),i.send(or(d1(n,l),{origin:n})))},function(l){if(!s){i.removeChild(n);var u=u0(n,l);try{i.send(or(u,{origin:n}))}catch(c){Kfe(l,c,n),i.devTools&&i.devTools.send(u,i.state),i.machine.strict&&i.stop()}}});var a=(r={id:n,send:function(){},subscribe:function(l,u,c){var f=u1(l,u,c),d=!1;return e.then(function(h){d||(f.next(h),!d&&f.complete())},function(h){d||f.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:n}},getSnapshot:function(){return o}},r[Ka]=function(){return this},r);return this.children.set(n,a),a},t.prototype.spawnCallback=function(e,n){var r,i=this,s=!1,o=new Set,a=new Set,l,u=function(d){l=d,a.forEach(function(h){return h(d)}),!s&&i.send(or(d,{origin:n}))},c;try{c=e(u,function(d){o.add(d)})}catch(d){this.send(u0(n,d))}if(B5(c))return this.spawnPromise(c,n);var f=(r={id:n,send:function(d){return o.forEach(function(h){return h(d)})},subscribe:function(d){var h=u1(d);return a.add(h.next),{unsubscribe:function(){a.delete(h.next)}}},stop:function(){s=!0,Pt(c)&&c()},toJSON:function(){return{id:n}},getSnapshot:function(){return l}},r[Ka]=function(){return this},r);return this.children.set(n,f),f},t.prototype.spawnObservable=function(e,n){var r,i=this,s,o=e.subscribe(function(l){s=l,i.send(or(l,{origin:n}))},function(l){i.removeChild(n),i.send(or(u0(n,l),{origin:n}))},function(){i.removeChild(n),i.send(or(d1(n),{origin:n}))}),a=(r={id:n,send:function(){},subscribe:function(l,u,c){return e.subscribe(l,u,c)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:n}}},r[Ka]=function(){return this},r);return this.children.set(n,a),a},t.prototype.spawnActor=function(e,n){return this.children.set(n,e),e},t.prototype.spawnActivity=function(e){var n=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!n){Sn||sr(!1,"No implementation found for activity '".concat(e.type,"'"));return}var r=n(this.state.context,e);this.spawnEffect(e.id,r)},t.prototype.spawnEffect=function(e,n){var r;this.children.set(e,(r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:n||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},r[Ka]=function(){return this},r))},t.prototype.attachDev=function(){var e=Vk();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var n=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(Me(Me({name:this.id,autoPause:!0,stateSanitizer:function(r){return{value:r.value,context:r.context,actions:r.actions}}},n),{features:Me({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}bde(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[Ka]=function(){return this},t.prototype.getSnapshot=function(){return this.status===wn.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,n){return setTimeout(e,n)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=Y5,t}();function Y5(t,e){var n=new Ade(t,e);return n}function xde(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function g1(t){return Me(Me({type:Pk},t),{toJSON:function(){t.onDone,t.onError;var e=Ok(t,["onDone","onError"]);return Me(Me({},e),{type:Pk,src:xde(t.src)})}})}var $f="",zk="#",p0="*",Gf={},Wf=function(t){return t[0]===zk},Ede=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},kde=function(t,e,n){var r=n.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(Mt(s.target)||Du(s.target))}),i=e===$f?"the transient event":"event '".concat(e,"'");sr(!r,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Sde=function(){function t(e,n,r,i){r===void 0&&(r="context"in e?e.context:void 0);var s=this,o;this.config=e,this._context=r,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(Ede(),n),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:N5),this.id=this.config.id||rn([this.machine.key],_t(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(o=this.config.schema)!==null&&o!==void 0?o:{},this.description=this.config.description,Sn||sr(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?a0(this.config.states,function(u,c){var f,d=new t(u,{},void 0,{parent:s,key:c});return Object.assign(s.idMap,Me((f={},f[d.id]=d,f),d.idMap)),d}):Gf;var a=0;function l(u){var c,f;u.order=a++;try{for(var d=Et(G5(u)),h=d.next();!h.done;h=d.next()){var p=h.value;l(p)}}catch(m){c={error:m}}finally{try{h&&!h.done&&(f=d.return)&&f.call(d)}finally{if(c)throw c.error}}}l(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(u){var c=u.event;return c===$f}):$f in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=ds(this.config.entry||this.config.onEntry).map(function(u){return l0(u)}),this.onExit=ds(this.config.exit||this.config.onExit).map(function(u){return l0(u)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=ds(this.config.invoke).map(function(u,c){var f,d;if(Du(u)){var h=c1(s.id,c);return s.machine.options.services=Me((f={},f[h]=u,f),s.machine.options.services),g1({src:h,id:h})}else if(Mt(u.src)){var h=u.id||c1(s.id,c);return g1(Me(Me({},u),{id:h,src:u.src}))}else if(Du(u.src)||Pt(u.src)){var h=u.id||c1(s.id,c);return s.machine.options.services=Me((d={},d[h]=u.src,d),s.machine.options.services),g1(Me(Me({id:h},u),{src:h}))}else{var p=u.src;return g1(Me(Me({id:c1(s.id,c)},u),{src:p}))}}),this.activities=ds(this.config.activities).concat(this.invoke).map(function(u){return Uk(u)}),this.transition=this.transition.bind(this),this.tags=ds(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||W5(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,n){var r=this.options,i=r.actions,s=r.activities,o=r.guards,a=r.services,l=r.delays;return new t(this.config,{actions:Me(Me({},i),e.actions),activities:Me(Me({},s),e.activities),guards:Me(Me({},o),e.guards),services:Me(Me({},a),e.services),delays:Me(Me({},l),e.delays)},n??this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return Pt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:a0(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(n,r){return n[r.eventType]=n[r.eventType]||[],n[r.eventType].push(r),n},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var n=e===$f,r=this.transitions.filter(function(i){var s=i.eventType===e;return n?s:s||i.eventType===p0});return this.__cache.candidates[e]=r,r},t.prototype.getDelayedTransitions=function(){var e=this,n=this.config.after;if(!n)return[];var r=function(s,o){var a=Pt(s)?"".concat(e.id,":delay[").concat(o,"]"):s,l=ide(a,e.id);return e.onEntry.push(Jfe(l,{delay:s})),e.onExit.push(Zfe(l)),l},i=jf(n)?n.map(function(s,o){var a=r(s.delay,o);return Me(Me({},s),{event:a})}):fn(Object.keys(n).map(function(s,o){var a=n[s],l=Mt(a)?{target:a}:a,u=isNaN(+s)?s:+s,c=r(u,o);return ds(l).map(function(f){return Me(Me({},f),{event:c,delay:u})})}));return i.map(function(s){var o=s.delay;return Me(Me({},e.formatTransition(s)),{delay:o})})},t.prototype.getStateNodes=function(e){var n,r=this;if(!e)return[];var i=e instanceof Bi?e.value:o0(e,this.delimiter);if(Mt(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((n={},n[i]=s,n)):[this,this.states[i]]}var o=Object.keys(i),a=[this];return a.push.apply(a,rn([],_t(fn(o.map(function(l){return r.getStateNode(l).getStateNodes(i[l])}))),!1)),a},t.prototype.handles=function(e){var n=I5(e);return this.events.includes(n)},t.prototype.resolveState=function(e){var n=e instanceof Bi?e:Bi.create(e),r=Array.from(f0([],this.getStateNodes(n.value)));return new Bi(Me(Me({},n),{value:this.resolve(n.value),configuration:r,done:m1(r,this),tags:q5(r),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,n,r){var i=this.getStateNode(e),s=i.next(n,r);return!s||!s.transitions.length?this.next(n,r):s},t.prototype.transitionCompoundNode=function(e,n,r){var i=Object.keys(e),s=this.getStateNode(i[0]),o=s._transition(e[i[0]],n,r);return!o||!o.transitions.length?this.next(n,r):o},t.prototype.transitionParallelNode=function(e,n,r){var i,s,o={};try{for(var a=Et(Object.keys(e)),l=a.next();!l.done;l=a.next()){var u=l.value,c=e[u];if(c){var f=this.getStateNode(u),d=f._transition(c,n,r);d&&(o[u]=d)}}}catch(y){i={error:y}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}var h=Object.keys(o).map(function(y){return o[y]}),p=fn(h.map(function(y){return y.transitions})),m=h.some(function(y){return y.transitions.length>0});if(!m)return this.next(n,r);var g=fn(Object.keys(o).map(function(y){return o[y].configuration}));return{transitions:p,exitSet:fn(h.map(function(y){return y.exitSet})),configuration:g,source:n,actions:fn(Object.keys(o).map(function(y){return o[y].actions}))}},t.prototype._transition=function(e,n,r){return Mt(e)?this.transitionLeafNode(e,n,r):Object.keys(e).length===1?this.transitionCompoundNode(e,n,r):this.transitionParallelNode(e,n,r)},t.prototype.getTransitionData=function(e,n){return this._transition(e.value,e,or(n))},t.prototype.next=function(e,n){var r,i,s=this,o=n.name,a=[],l=[],u;try{for(var c=Et(this.getCandidates(o)),f=c.next();!f.done;f=c.next()){var d=f.value,h=d.cond,p=d.in,m=e.context,g=p?Mt(p)&&Wf(p)?e.matches(o0(this.getStateNodeById(p).path,this.delimiter)):Rk(o0(p,this.delimiter),Ffe(this.path.slice(0,-2))(e.value)):!0,y=!1;try{y=!h||H5(this.machine,h,m,n,e)}catch(b){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(o,"' in state node '").concat(this.id,`':
532
- `).concat(b.message))}if(y&&g){d.target!==void 0&&(l=d.target),a.push.apply(a,rn([],_t(d.actions),!1)),u=d;break}}}catch(b){r={error:b}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}if(u){if(!l.length)return{transitions:[u],exitSet:[],configuration:e.value?[this]:[],source:e,actions:a};var v=fn(l.map(function(b){return s.getRelativeStateNodes(b,e.historyValue)})),w=!!u.internal;return{transitions:[u],exitSet:w?[]:fn(l.map(function(b){return s.getPotentiallyReenteringNodes(b)})),configuration:v,source:e,actions:a}}},t.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var n=[],r=this,i=e;r&&r!==i;)n.push(r),r=r.parent;return r!==i?[]:(n.push(i),n)},t.prototype.getActions=function(e,n,r,i,s,o,a){var l,u,c,f,d=this,h=o?f0([],this.getStateNodes(o.value)):[],p=new Set;try{for(var m=Et(Array.from(e).sort(function(F,Q){return F.order-Q.order})),g=m.next();!g.done;g=m.next()){var y=g.value;(!d0(h,y)||d0(r.exitSet,y)||y.parent&&p.has(y.parent))&&p.add(y)}}catch(F){l={error:F}}finally{try{g&&!g.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}try{for(var v=Et(h),w=v.next();!w.done;w=v.next()){var y=w.value;(!d0(e,y)||d0(r.exitSet,y.parent))&&r.exitSet.push(y)}}catch(F){c={error:F}}finally{try{w&&!w.done&&(f=v.return)&&f.call(v)}finally{if(c)throw c.error}}r.exitSet.sort(function(F,Q){return Q.order-F.order});var b=Array.from(p).sort(function(F,Q){return F.order-Q.order}),E=new Set(r.exitSet),x=fn(b.map(function(F){var Q=[];if(F.type!=="final")return Q;var V=F.parent;if(!V.parent)return Q;Q.push(f1(F.id,F.doneData),f1(V.id,F.doneData?a1(F.doneData,i,s):void 0));var B=V.parent;return B.type==="parallel"&&c0(B).every(function(N){return m1(r.configuration,N)})&&Q.push(f1(B.id)),Q})),O=b.map(function(F){var Q=F.onEntry,V=F.activities.map(function(B){return ede(B)});return{type:"entry",actions:qa(a?rn(rn([],_t(Q),!1),_t(V),!1):rn(rn([],_t(V),!1),_t(Q),!1),d.machine.options.actions)}}).concat({type:"state_done",actions:x.map(function(F){return qfe(F)})}),S=Array.from(E).map(function(F){return{type:"exit",actions:qa(rn(rn([],_t(F.onExit),!1),_t(F.activities.map(function(Q){return tde(Q)})),!1),d.machine.options.actions)}}),D=S.concat({type:"transition",actions:qa(r.actions,this.machine.options.actions)}).concat(O);if(n){var I=qa(fn(rn([],_t(e),!1).sort(function(F,Q){return Q.order-F.order}).map(function(F){return F.onExit})),this.machine.options.actions).filter(function(F){return!Bk(F)});return D.concat({type:"stop",actions:I})}return D},t.prototype.transition=function(e,n,r,i){e===void 0&&(e=this.initialState);var s=or(n),o;if(e instanceof Bi)o=r===void 0?e:this.resolveState(Bi.from(e,r));else{var a=Mt(e)?this.resolve(s1(this.getResolvedPath(e))):this.resolve(e),l=r??this.machine.context;o=this.resolveState(Bi.from(a,l))}if(!Sn&&s.name===p0)throw new Error("An event cannot have the wildcard type ('".concat(p0,"')"));if(this.strict&&!this.events.includes(s.name)&&!jfe(s.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(s.name,"'"));var u=this._transition(o.value,o,s)||{transitions:[],configuration:[],exitSet:[],source:o,actions:[]},c=f0([],this.getStateNodes(o.value)),f=u.configuration.length?f0(c,u.configuration):c;return u.configuration=rn([],_t(f),!1),this.resolveTransition(u,o,o.context,i,s)},t.prototype.resolveRaisedTransition=function(e,n,r,i){var s,o=e.actions;return e=this.transition(e,n,void 0,i),e._event=r,e.event=r.data,(s=e.actions).unshift.apply(s,rn([],_t(o),!1)),e},t.prototype.resolveTransition=function(e,n,r,i,s){var o,a,l,u,c=this;s===void 0&&(s=Vf);var f=e.configuration,d=!n||e.transitions.length>0,h=d?e.configuration:n?n.configuration:[],p=m1(h,this),m=d?cde(this.machine,f):void 0,g=n?n.historyValue?n.historyValue:e.source?this.machine.historyValue(n.value):void 0:void 0,y=this.getActions(new Set(h),p,e,r,s,n,i),v=n?Me({},n.activities):{};try{for(var w=Et(y),b=w.next();!b.done;b=w.next()){var E=b.value;try{for(var x=(l=void 0,Et(E.actions)),O=x.next();!O.done;O=x.next()){var S=O.value;S.type===_k?v[S.activity.id||S.activity.type]=S:S.type===Mk&&(v[S.activity.id||S.activity.type]=!1)}}catch(Ie){l={error:Ie}}finally{try{O&&!O.done&&(u=x.return)&&u.call(x)}finally{if(l)throw l.error}}}}catch(Ie){o={error:Ie}}finally{try{b&&!b.done&&(a=w.return)&&a.call(w)}finally{if(o)throw o.error}}var D=_t(h1(this,n,r,s,y,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),I=D[0],F=D[1],Q=_t(Vfe(I,Bk),2),V=Q[0],B=Q[1],N=I.filter(function(Ie){var ke;return Ie.type===_k&&((ke=Ie.activity)===null||ke===void 0?void 0:ke.type)===Pk}),H=N.reduce(function(Ie,ke){return Ie[ke.activity.id]=ode(ke.activity,c.machine,F,s),Ie},n?Me({},n.children):{}),K=new Bi({value:m||n.value,context:F,_event:s,_sessionid:n?n._sessionid:null,historyValue:m?g?zfe(g,m):void 0:n?n.historyValue:void 0,history:!m||e.source?n:void 0,actions:m?B:[],activities:m?v:n?n.activities:{},events:[],configuration:h,transitions:e.transitions,children:H,done:p,tags:q5(h),machine:this}),J=r!==F;K.changed=s.name===M5||J;var X=K.history;X&&delete X.history;var ie=!p&&(this._transient||f.some(function(Ie){return Ie._transient}));if(!d&&(!ie||s.name===$f))return K;var le=K;if(!p)for(ie&&(le=this.resolveRaisedTransition(le,{type:Mfe},s,i));V.length;){var Pe=V.shift();le=this.resolveRaisedTransition(le,Pe._event,s,i)}var xe=le.changed||(X?!!le.actions.length||J||typeof X.value!=typeof le.value||!Q5(le.value,X.value):void 0);return le.changed=xe,le.history=X,le},t.prototype.getStateNode=function(e){if(Wf(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var n=this.states[e];if(!n)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return n},t.prototype.getStateNodeById=function(e){var n=Wf(e)?e.slice(zk.length):e;if(n===this.id)return this;var r=this.machine.idMap[n];if(!r)throw new Error("Child state node '#".concat(n,"' does not exist on machine '").concat(this.id,"'"));return r},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Wf(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var n=Lk(e,this.delimiter).slice(),r=this;n.length;){var i=n.shift();if(!i.length)break;r=r.getStateNode(i)}return r},t.prototype.resolve=function(e){var n,r=this;if(!e)return this.initialStateValue||Gf;switch(this.type){case"parallel":return a0(this.initialStateValue,function(s,o){return s?r.getStateNode(o).resolve(e[o]||s):Gf});case"compound":if(Mt(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(n={},n[e]=i.initialStateValue,n):e}return Object.keys(e).length?a0(e,function(s,o){return s?r.getStateNode(o).resolve(s):Gf}):this.initialStateValue||{};default:return e||Gf}},t.prototype.getResolvedPath=function(e){if(Wf(e)){var n=this.machine.idMap[e.slice(zk.length)];if(!n)throw new Error("Unable to find state node '".concat(e,"'"));return n.path}return Lk(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var n;if(this.type==="parallel")n=R5(this.states,function(r){return r.initialStateValue||Gf},function(r){return r.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));n=p1(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else n={};return this.__cache.initialStateValue=n,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,n){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,n??this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var n=this.config;Mt(n.target)?e=Wf(n.target)?s1(this.machine.getStateNodeById(n.target).path.slice(this.path.length-1)):n.target:e=n.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,n,r){return r===void 0&&(r=!0),r?e.type==="history"?e.resolveHistory(n):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(p1(this))return[this];if(this.type==="compound"&&!this.initial)return Sn||sr(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var n=o1(this.initialStateValue);return fn(n.map(function(r){return e.getFromRelativePath(r)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var n=_t(e),r=n[0],i=n.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var s=this.getStateNode(r);if(s.type==="history")return s.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:R5(this.states,function(n,r){if(!e)return n.historyValue();var i=Mt(e)?void 0:e[r];return n.historyValue(i||n.initialStateValue)},function(n){return!n.history})}},t.prototype.resolveHistory=function(e){var n=this;if(this.type!=="history")return[this];var r=this.parent;if(!e){var i=this.target;return i?fn(o1(i).map(function(o){return r.getFromRelativePath(o)})):r.initialStateNodes}var s=Ufe(r.path,"states")(e).current;return Mt(s)?[r.getStateNode(s)]:fn(o1(s).map(function(o){return n.history==="deep"?r.getFromRelativePath(o):[r.states[o[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,n=fn(Object.keys(this.states).map(function(r){return e.states[r].stateIds}));return[this.id].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,n,r,i;if(this.__cache.events)return this.__cache.events;var s=this.states,o=new Set(this.ownEvents);if(s)try{for(var a=Et(Object.keys(s)),l=a.next();!l.done;l=a.next()){var u=l.value,c=s[u];if(c.states)try{for(var f=(r=void 0,Et(c.events)),d=f.next();!d.done;d=f.next()){var h=d.value;o.add("".concat(h))}}catch(p){r={error:p}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}}catch(p){e={error:p}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(n){return!(!n.target&&!n.actions.length&&n.internal)}).map(function(n){return n.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var n=this;if(e!==void 0)return e.map(function(r){if(!Mt(r))return r;var i=r[0]===n.delimiter;if(i&&!n.parent)return n.getStateNodeByPath(r.slice(1));var s=i?n.key+r:r;if(n.parent)try{var o=n.parent.getStateNodeByPath(s);return o}catch(a){throw new Error("Invalid transition definition for state node '".concat(n.id,`':
533
- `).concat(a.message))}else return n.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var n=this,r=Wfe(e.target),i="internal"in e?e.internal:r?r.some(function(l){return Mt(l)&&l[0]===n.delimiter}):!0,s=this.machine.options.guards,o=this.resolveTarget(r),a=Me(Me({},e),{actions:qa(ds(e.actions)),cond:j5(e.cond,s),target:o,source:this,internal:i,eventType:e.event,toJSON:function(){return Me(Me({},a),{target:a.target?a.target.map(function(l){return"#".concat(l.id)}):void 0,source:"#".concat(n.id)})}});return a},t.prototype.formatTransitions=function(){var e,n,r=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var s=this.config.on,o=p0,a=s[o],l=a===void 0?[]:a,u=Ok(s,[typeof o=="symbol"?o:o+""]);i=fn(Object.keys(u).map(function(v){!Sn&&v===$f&&sr(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(r.id,'".'));var w=Hf(v,u[v]);return Sn||kde(r,v,w),w}).concat(Hf(p0,l)))}var c=this.config.always?Hf("",this.config.always):[],f=this.config.onDone?Hf(String(f1(this.id)),this.config.onDone):[];Sn||sr(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=fn(this.invoke.map(function(v){var w=[];return v.onDone&&w.push.apply(w,rn([],_t(Hf(String(d1(v.id)),v.onDone)),!1)),v.onError&&w.push.apply(w,rn([],_t(Hf(String(u0(v.id)),v.onError)),!1)),w})),h=this.after,p=fn(rn(rn(rn(rn([],_t(f),!1),_t(d),!1),_t(i),!1),_t(c),!1).map(function(v){return ds(v).map(function(w){return r.formatTransition(w)})}));try{for(var m=Et(h),g=m.next();!g.done;g=m.next()){var y=g.value;p.push(y)}}catch(v){e={error:v}}finally{try{g&&!g.done&&(n=m.return)&&n.call(m)}finally{if(e)throw e.error}}return p},t}(),X5=!1;function Cde(t,e){return!Sn&&!("predictableActionArguments"in t)&&!X5&&(X5=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new Sde(t,e)}var Qa=rde;(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
534
- PartySocket requires a global 'EventTarget' class to be available!
535
- You can polyfill this global by adding this to your code before any partysocket imports:
536
-
537
- \`\`\`
538
- import 'partysocket/event-target-polyfill';
539
- \`\`\`
540
- Please file an issue at https://github.com/partykit/partykit if you're still having trouble.
541
- `);var Z5=class extends Event{constructor(e,n){super("error",n);W(this,"message");W(this,"error");this.message=e.message,this.error=e}},eL=class extends Event{constructor(e=1e3,n="",r){super("close",r);W(this,"code");W(this,"reason");W(this,"wasClean",!0);this.code=e,this.reason=n}},$k={Event,ErrorEvent:Z5,CloseEvent:eL};function Dde(t,e){if(!t)throw new Error(e)}function Tde(t){return new t.constructor(t.type,t)}function Ode(t){return"data"in t?new MessageEvent(t.type,t):"code"in t||"reason"in t?new eL(t.code||1999,t.reason||"unknown reason",t):"error"in t?new Z5(t.error,t):new Event(t.type,t)}var _de=typeof process<"u"&&typeof((G9=process.versions)==null?void 0:G9.node)<"u"&&typeof document>"u",y1=_de?Ode:Tde,Tu={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},tL=!1,Mde=class cc extends EventTarget{constructor(n,r,i={}){super();W(this,"_ws");W(this,"_retryCount",-1);W(this,"_uptimeTimeout");W(this,"_connectTimeout");W(this,"_shouldReconnect",!0);W(this,"_connectLock",!1);W(this,"_binaryType","blob");W(this,"_closeCalled",!1);W(this,"_messageQueue",[]);W(this,"_debugLogger",console.log.bind(console));W(this,"_url");W(this,"_protocols");W(this,"_options");W(this,"onclose",null);W(this,"onerror",null);W(this,"onmessage",null);W(this,"onopen",null);W(this,"_handleOpen",n=>{this._debug("open event");const{minUptime:r=Tu.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),r),Dde(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(i=>{var s;return(s=this._ws)==null?void 0:s.send(i)}),this._messageQueue=[],this.onopen&&this.onopen(n),this.dispatchEvent(y1(n))});W(this,"_handleMessage",n=>{this._debug("message event"),this.onmessage&&this.onmessage(n),this.dispatchEvent(y1(n))});W(this,"_handleError",n=>{this._debug("error event",n.message),this._disconnect(void 0,n.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(n),this._debug("exec error listeners"),this.dispatchEvent(y1(n)),this._connect()});W(this,"_handleClose",n=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(n),this.dispatchEvent(y1(n))});this._url=n,this._protocols=r,this._options=i,this._options.startClosed&&(this._shouldReconnect=!1),this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return cc.CONNECTING}get OPEN(){return cc.OPEN}get CLOSING(){return cc.CLOSING}get CLOSED(){return cc.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(n){this._binaryType=n,this._ws&&(this._ws.binaryType=n)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((r,i)=>(typeof i=="string"?r+=i.length:i instanceof Blob?r+=i.size:r+=i.byteLength,r),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?cc.CLOSED:cc.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}close(n=1e3,r){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(n,r)}reconnect(n,r){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(n,r),this._connect())}send(n){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",n),this._ws.send(n);else{const{maxEnqueuedMessages:r=Tu.maxEnqueuedMessages}=this._options;this._messageQueue.length<r&&(this._debug("enqueue",n),this._messageQueue.push(n))}}_debug(...n){this._options.debug&&this._debugLogger("RWS>",...n)}_getNextDelay(){const{reconnectionDelayGrowFactor:n=Tu.reconnectionDelayGrowFactor,minReconnectionDelay:r=Tu.minReconnectionDelay,maxReconnectionDelay:i=Tu.maxReconnectionDelay}=this._options;let s=0;return this._retryCount>0&&(s=r*Math.pow(n,this._retryCount-1),s>i&&(s=i)),this._debug("next delay",s),s}_wait(){return new Promise(n=>{setTimeout(n,this._getNextDelay())})}_getNextProtocols(n){if(!n)return Promise.resolve(null);if(typeof n=="string"||Array.isArray(n))return Promise.resolve(n);if(typeof n=="function"){const r=n();if(!r)return Promise.resolve(null);if(typeof r=="string"||Array.isArray(r))return Promise.resolve(r);if(r.then)return r}throw Error("Invalid protocols")}_getNextUrl(n){if(typeof n=="string")return Promise.resolve(n);if(typeof n=="function"){const r=n();if(typeof r=="string")return Promise.resolve(r);if(r.then)return r}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:n=Tu.maxRetries,connectionTimeout:r=Tu.connectionTimeout}=this._options;if(this._retryCount>=n){this._debug("max retries reached",this._retryCount,">=",n);return}this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then(()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)])).then(([i,s])=>{if(this._closeCalled){this._connectLock=!1;return}!this._options.WebSocket&&typeof WebSocket>"u"&&!tL&&(console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket.
542
-
543
- For example, if you're using node.js, run \`npm install ws\`, and then in your code:
544
-
545
- import PartySocket from 'partysocket';
546
- import WS from 'ws';
547
-
548
- const partysocket = new PartySocket({
549
- host: "127.0.0.1:1999",
550
- room: "test-room",
551
- WebSocket: WS
552
- });
553
-
554
- `),tL=!0);const o=this._options.WebSocket||WebSocket;this._debug("connect",{url:i,protocols:s}),this._ws=s?new o(i,s):new o(i),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),r)}).catch(i=>{this._connectLock=!1,this._handleError(new $k.ErrorEvent(Error(i.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new $k.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(n=1e3,r){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(n,r),this._handleClose(new $k.CloseEvent(n,r,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};/*!
555
- * Reconnecting WebSocket
556
- * by Pedro Ladaria <pedro.ladaria@gmail.com>
557
- * https://github.com/pladaria/reconnecting-websocket
558
- * License MIT
559
- */function b1(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const n=new Uint8Array(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n}function nL(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t[n]!==e[n])return!1;return!0}function Nde(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(n[o]!==255)throw new TypeError(s+" is ambiguous");n[o]=i}var a=t.length,l=t.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function f(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var m=0,g=0,y=0,v=p.length;y!==v&&p[y]===0;)y++,m++;for(var w=(v-y)*c+1>>>0,b=new Uint8Array(w);y!==v;){for(var E=p[y],x=0,O=w-1;(E!==0||x<g)&&O!==-1;O--,x++)E+=256*b[O]>>>0,b[O]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=x,y++}for(var S=w-g;S!==w&&b[S]===0;)S++;for(var D=l.repeat(m);S<w;++S)D+=t.charAt(b[S]);return D}function d(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var m=0;if(p[m]!==" "){for(var g=0,y=0;p[m]===l;)g++,m++;for(var v=(p.length-m)*u+1>>>0,w=new Uint8Array(v);p[m];){var b=n[p.charCodeAt(m)];if(b===255)return;for(var E=0,x=v-1;(b!==0||E<y)&&x!==-1;x--,E++)b+=a*w[x]>>>0,w[x]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");y=E,m++}if(p[m]!==" "){for(var O=v-y;O!==v&&w[O]===0;)O++;for(var S=new Uint8Array(g+(v-O)),D=g;O!==v;)S[D++]=w[O++];return S}}}function h(p){var m=d(p);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:d,decode:h}}var Pde=Nde,Ide=Pde;const Rde=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Lde=t=>new TextEncoder().encode(t),Bde=t=>new TextDecoder().decode(t);class Fde{constructor(e,n,r){this.name=e,this.prefix=n,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ude{constructor(e,n,r){if(this.name=e,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return rL(this,e)}}class jde{constructor(e){this.decoders=e}or(e){return rL(this,e)}decode(e){const n=e[0],r=this.decoders[n];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const rL=(t,e)=>new jde({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Hde{constructor(e,n,r,i){this.name=e,this.prefix=n,this.baseEncode=r,this.baseDecode=i,this.encoder=new Fde(e,n,r),this.decoder=new Ude(e,n,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const w1=({name:t,prefix:e,encode:n,decode:r})=>new Hde(t,e,n,r),m0=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:i}=Ide(n,e);return w1({prefix:t,name:e,encode:r,decode:s=>Rde(i(s))})},Vde=(t,e,n,r)=>{const i={};for(let c=0;c<e.length;++c)i[e[c]]=c;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*n/8|0);let a=0,l=0,u=0;for(let c=0;c<s;++c){const f=i[t[c]];if(f===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<n|f,a+=n,a>=8&&(a-=8,o[u++]=255&l>>a)}if(a>=n||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return o},zde=(t,e,n)=>{const r=e[e.length-1]==="=",i=(1<<n)-1;let s="",o=0,a=0;for(let l=0;l<t.length;++l)for(a=a<<8|t[l],o+=8;o>n;)o-=n,s+=e[i&a>>o];if(o&&(s+=e[i&a<<n-o]),r)for(;s.length*n&7;)s+="=";return s},ar=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>w1({prefix:e,name:t,encode(i){return zde(i,r,n)},decode(i){return Vde(i,r,n,t)}}),$de=w1({prefix:"\0",name:"identity",encode:t=>Bde(t),decode:t=>Lde(t)}),Gde=Object.freeze(Object.defineProperty({__proto__:null,identity:$de},Symbol.toStringTag,{value:"Module"})),Wde=ar({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Kde=Object.freeze(Object.defineProperty({__proto__:null,base2:Wde},Symbol.toStringTag,{value:"Module"})),qde=ar({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Qde=Object.freeze(Object.defineProperty({__proto__:null,base8:qde},Symbol.toStringTag,{value:"Module"})),Jde=m0({prefix:"9",name:"base10",alphabet:"0123456789"}),Yde=Object.freeze(Object.defineProperty({__proto__:null,base10:Jde},Symbol.toStringTag,{value:"Module"})),Xde=ar({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Zde=ar({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),ehe=Object.freeze(Object.defineProperty({__proto__:null,base16:Xde,base16upper:Zde},Symbol.toStringTag,{value:"Module"})),the=ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nhe=ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rhe=ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ihe=ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),she=ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ohe=ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ahe=ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lhe=ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uhe=ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),che=Object.freeze(Object.defineProperty({__proto__:null,base32:the,base32hex:she,base32hexpad:ahe,base32hexpadupper:lhe,base32hexupper:ohe,base32pad:rhe,base32padupper:ihe,base32upper:nhe,base32z:uhe},Symbol.toStringTag,{value:"Module"})),fhe=m0({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),dhe=m0({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),hhe=Object.freeze(Object.defineProperty({__proto__:null,base36:fhe,base36upper:dhe},Symbol.toStringTag,{value:"Module"})),phe=m0({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mhe=m0({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ghe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:phe,base58flickr:mhe},Symbol.toStringTag,{value:"Module"})),yhe=ar({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bhe=ar({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),whe=ar({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vhe=ar({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Ahe=Object.freeze(Object.defineProperty({__proto__:null,base64:yhe,base64pad:bhe,base64url:whe,base64urlpad:vhe},Symbol.toStringTag,{value:"Module"})),iL=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),xhe=iL.reduce((t,e,n)=>(t[n]=e,t),[]),Ehe=iL.reduce((t,e,n)=>(t[e.codePointAt(0)]=n,t),[]);function khe(t){return t.reduce((e,n)=>(e+=xhe[n],e),"")}function She(t){const e=[];for(const n of t){const r=Ehe[n.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${n}`);e.push(r)}return new Uint8Array(e)}const Che=w1({prefix:"🚀",name:"base256emoji",encode:khe,decode:She}),Dhe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Che},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const sL={...Gde,...Kde,...Qde,...Yde,...ehe,...che,...hhe,...ghe,...Ahe,...Dhe};function oL(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}const aL=oL("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Gk=oL("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{t=t.substring(1);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),lL={utf8:aL,"utf-8":aL,hex:sL.base16,latin1:Gk,ascii:Gk,binary:Gk,...sL};function hs(t,e="utf8"){const n=lL[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return n.decoder.decode(`${n.prefix}${t}`)}function Ja(t,e="utf8"){const n=lL[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return n.encoder.encode(t).substring(1)}var g0={},uL={},v1={},A1={};Object.defineProperty(A1,"__esModule",{value:!0}),A1.BrowserRandomSource=void 0;const cL=65536;class The{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(e);for(let r=0;r<n.length;r+=cL)this._crypto.getRandomValues(n.subarray(r,r+Math.min(n.length-r,cL)));return n}}A1.BrowserRandomSource=The;function Ohe(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var x1={},Kf={};Object.defineProperty(Kf,"__esModule",{value:!0});function _he(t){for(var e=0;e<t.length;e++)t[e]=0;return t}Kf.wipe=_he;const Mhe=r7(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(x1,"__esModule",{value:!0}),x1.NodeRandomSource=void 0;const Nhe=Kf;class Phe{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Ohe<"u"){const e=Mhe;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(e);if(n.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let i=0;i<r.length;i++)r[i]=n[i];return(0,Nhe.wipe)(n),r}}x1.NodeRandomSource=Phe,Object.defineProperty(v1,"__esModule",{value:!0}),v1.SystemRandomSource=void 0;const Ihe=A1,Rhe=x1;class Lhe{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Ihe.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Rhe.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}v1.SystemRandomSource=Lhe;var ht={},fL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,l){var u=a>>>16&65535,c=a&65535,f=l>>>16&65535,d=l&65535;return c*d+(u*d+c*f<<16>>>0)|0}t.mul=Math.imul||e;function n(a,l){return a+l|0}t.add=n;function r(a,l){return a-l|0}t.sub=r;function i(a,l){return a<<l|a>>>32-l}t.rotl=i;function s(a,l){return a<<32-l|a>>>l}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(fL),Object.defineProperty(ht,"__esModule",{value:!0});var dL=fL;function Bhe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}ht.readInt16BE=Bhe;function Fhe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}ht.readUint16BE=Fhe;function Uhe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}ht.readInt16LE=Uhe;function jhe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}ht.readUint16LE=jhe;function hL(t,e,n){return e===void 0&&(e=new Uint8Array(2)),n===void 0&&(n=0),e[n+0]=t>>>8,e[n+1]=t>>>0,e}ht.writeUint16BE=hL,ht.writeInt16BE=hL;function pL(t,e,n){return e===void 0&&(e=new Uint8Array(2)),n===void 0&&(n=0),e[n+0]=t>>>0,e[n+1]=t>>>8,e}ht.writeUint16LE=pL,ht.writeInt16LE=pL;function Wk(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}ht.readInt32BE=Wk;function Kk(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}ht.readUint32BE=Kk;function qk(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}ht.readInt32LE=qk;function Qk(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}ht.readUint32LE=Qk;function E1(t,e,n){return e===void 0&&(e=new Uint8Array(4)),n===void 0&&(n=0),e[n+0]=t>>>24,e[n+1]=t>>>16,e[n+2]=t>>>8,e[n+3]=t>>>0,e}ht.writeUint32BE=E1,ht.writeInt32BE=E1;function k1(t,e,n){return e===void 0&&(e=new Uint8Array(4)),n===void 0&&(n=0),e[n+0]=t>>>0,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24,e}ht.writeUint32LE=k1,ht.writeInt32LE=k1;function Hhe(t,e){e===void 0&&(e=0);var n=Wk(t,e),r=Wk(t,e+4);return n*4294967296+r-(r>>31)*4294967296}ht.readInt64BE=Hhe;function Vhe(t,e){e===void 0&&(e=0);var n=Kk(t,e),r=Kk(t,e+4);return n*4294967296+r}ht.readUint64BE=Vhe;function zhe(t,e){e===void 0&&(e=0);var n=qk(t,e),r=qk(t,e+4);return r*4294967296+n-(n>>31)*4294967296}ht.readInt64LE=zhe;function $he(t,e){e===void 0&&(e=0);var n=Qk(t,e),r=Qk(t,e+4);return r*4294967296+n}ht.readUint64LE=$he;function mL(t,e,n){return e===void 0&&(e=new Uint8Array(8)),n===void 0&&(n=0),E1(t/4294967296>>>0,e,n),E1(t>>>0,e,n+4),e}ht.writeUint64BE=mL,ht.writeInt64BE=mL;function gL(t,e,n){return e===void 0&&(e=new Uint8Array(8)),n===void 0&&(n=0),k1(t>>>0,e,n),k1(t/4294967296>>>0,e,n+4),e}ht.writeUint64LE=gL,ht.writeInt64LE=gL;function Ghe(t,e,n){if(n===void 0&&(n=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,s=t/8+n-1;s>=n;s--)r+=e[s]*i,i*=256;return r}ht.readUintBE=Ghe;function Whe(t,e,n){if(n===void 0&&(n=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,s=n;s<n+t/8;s++)r+=e[s]*i,i*=256;return r}ht.readUintLE=Whe;function Khe(t,e,n,r){if(n===void 0&&(n=new Uint8Array(t/8)),r===void 0&&(r=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!dL.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=t/8+r-1;s>=r;s--)n[s]=e/i&255,i*=256;return n}ht.writeUintBE=Khe;function qhe(t,e,n,r){if(n===void 0&&(n=new Uint8Array(t/8)),r===void 0&&(r=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!dL.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=r;s<r+t/8;s++)n[s]=e/i&255,i*=256;return n}ht.writeUintLE=qhe;function Qhe(t,e){e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat32(e)}ht.readFloat32BE=Qhe;function Jhe(t,e){e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat32(e,!0)}ht.readFloat32LE=Jhe;function Yhe(t,e){e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat64(e)}ht.readFloat64BE=Yhe;function Xhe(t,e){e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat64(e,!0)}ht.readFloat64LE=Xhe;function Zhe(t,e,n){e===void 0&&(e=new Uint8Array(4)),n===void 0&&(n=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.setFloat32(n,t),e}ht.writeFloat32BE=Zhe;function epe(t,e,n){e===void 0&&(e=new Uint8Array(4)),n===void 0&&(n=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.setFloat32(n,t,!0),e}ht.writeFloat32LE=epe;function tpe(t,e,n){e===void 0&&(e=new Uint8Array(8)),n===void 0&&(n=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.setFloat64(n,t),e}ht.writeFloat64BE=tpe;function npe(t,e,n){e===void 0&&(e=new Uint8Array(8)),n===void 0&&(n=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.setFloat64(n,t,!0),e}ht.writeFloat64LE=npe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=v1,n=ht,r=Kf;t.defaultRandomSource=new e.SystemRandomSource;function i(u,c=t.defaultRandomSource){return c.randomBytes(u)}t.randomBytes=i;function s(u=t.defaultRandomSource){const c=i(4,u),f=(0,n.readUint32LE)(c);return(0,r.wipe)(c),f}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(u,c=o,f=t.defaultRandomSource){if(c.length<2)throw new Error("randomString charset is too short");if(c.length>256)throw new Error("randomString charset is too long");let d="";const h=c.length,p=256-256%h;for(;u>0;){const m=i(Math.ceil(u*256/p),f);for(let g=0;g<m.length&&u>0;g++){const y=m[g];y<p&&(d+=c.charAt(y%h),u--)}(0,r.wipe)(m)}return d}t.randomString=a;function l(u,c=o,f=t.defaultRandomSource){const d=Math.ceil(u/(Math.log(c.length)/Math.LN2));return a(d,c,f)}t.randomStringForEntropy=l}(uL);var yL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ht,n=Kf;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var r=function(){function a(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return a.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},a.prototype.update=function(l,u){if(u===void 0&&(u=l.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var c=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&u>0;)this._buffer[this._bufferLength++]=l[c++],u--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(c=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,l,c,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=l[c++],u--;return this},a.prototype.finish=function(l){if(!this._finished){var u=this._bytesHashed,c=this._bufferLength,f=u/536870912|0,d=u<<3,h=u%128<112?128:256;this._buffer[c]=128;for(var p=c+1;p<h-8;p++)this._buffer[p]=0;e.writeUint32BE(f,this._buffer,h-8),e.writeUint32BE(d,this._buffer,h-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,h),this._finished=!0}for(var p=0;p<this.digestLength/8;p++)e.writeUint32BE(this._stateHi[p],l,p*8),e.writeUint32BE(this._stateLo[p],l,p*8+4);return this},a.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},a.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(l){return this._stateHi.set(l.stateHi),this._stateLo.set(l.stateLo),this._bufferLength=l.bufferLength,l.buffer&&this._buffer.set(l.buffer),this._bytesHashed=l.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(l){n.wipe(l.stateHi),n.wipe(l.stateLo),l.buffer&&n.wipe(l.buffer),l.bufferLength=0,l.bytesHashed=0},a}();t.SHA512=r;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,l,u,c,f,d,h){for(var p=u[0],m=u[1],g=u[2],y=u[3],v=u[4],w=u[5],b=u[6],E=u[7],x=c[0],O=c[1],S=c[2],D=c[3],I=c[4],F=c[5],Q=c[6],V=c[7],B,N,H,K,J,X,ie,le;h>=128;){for(var Pe=0;Pe<16;Pe++){var xe=8*Pe+d;a[Pe]=e.readUint32BE(f,xe),l[Pe]=e.readUint32BE(f,xe+4)}for(var Pe=0;Pe<80;Pe++){var Ie=p,ke=m,$=g,ne=y,G=v,Z=w,A=b,P=E,ue=x,de=O,oe=S,we=D,De=I,pe=F,Ke=Q,qe=V;if(B=E,N=V,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=(v>>>14|I<<18)^(v>>>18|I<<14)^(I>>>9|v<<23),N=(I>>>14|v<<18)^(I>>>18|v<<14)^(v>>>9|I<<23),J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,B=v&w^~v&b,N=I&F^~I&Q,J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,B=i[Pe*2],N=i[Pe*2+1],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,B=a[Pe%16],N=l[Pe%16],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,H=ie&65535|le<<16,K=J&65535|X<<16,B=H,N=K,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=(p>>>28|x<<4)^(x>>>2|p<<30)^(x>>>7|p<<25),N=(x>>>28|p<<4)^(p>>>2|x<<30)^(p>>>7|x<<25),J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,B=p&m^p&g^m&g,N=x&O^x&S^O&S,J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,P=ie&65535|le<<16,qe=J&65535|X<<16,B=ne,N=we,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=H,N=K,J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,ne=ie&65535|le<<16,we=J&65535|X<<16,m=Ie,g=ke,y=$,v=ne,w=G,b=Z,E=A,p=P,O=ue,S=de,D=oe,I=we,F=De,Q=pe,V=Ke,x=qe,Pe%16===15)for(var xe=0;xe<16;xe++)B=a[xe],N=l[xe],J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=a[(xe+9)%16],N=l[(xe+9)%16],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,H=a[(xe+1)%16],K=l[(xe+1)%16],B=(H>>>1|K<<31)^(H>>>8|K<<24)^H>>>7,N=(K>>>1|H<<31)^(K>>>8|H<<24)^(K>>>7|H<<25),J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,H=a[(xe+14)%16],K=l[(xe+14)%16],B=(H>>>19|K<<13)^(K>>>29|H<<3)^H>>>6,N=(K>>>19|H<<13)^(H>>>29|K<<3)^(K>>>6|H<<26),J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,a[xe]=ie&65535|le<<16,l[xe]=J&65535|X<<16}B=p,N=x,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[0],N=c[0],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[0]=p=ie&65535|le<<16,c[0]=x=J&65535|X<<16,B=m,N=O,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[1],N=c[1],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[1]=m=ie&65535|le<<16,c[1]=O=J&65535|X<<16,B=g,N=S,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[2],N=c[2],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[2]=g=ie&65535|le<<16,c[2]=S=J&65535|X<<16,B=y,N=D,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[3],N=c[3],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[3]=y=ie&65535|le<<16,c[3]=D=J&65535|X<<16,B=v,N=I,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[4],N=c[4],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[4]=v=ie&65535|le<<16,c[4]=I=J&65535|X<<16,B=w,N=F,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[5],N=c[5],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[5]=w=ie&65535|le<<16,c[5]=F=J&65535|X<<16,B=b,N=Q,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[6],N=c[6],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[6]=b=ie&65535|le<<16,c[6]=Q=J&65535|X<<16,B=E,N=V,J=N&65535,X=N>>>16,ie=B&65535,le=B>>>16,B=u[7],N=c[7],J+=N&65535,X+=N>>>16,ie+=B&65535,le+=B>>>16,X+=J>>>16,ie+=X>>>16,le+=ie>>>16,u[7]=E=ie&65535|le<<16,c[7]=V=J&65535|X<<16,d+=128,h-=128}return d}function o(a){var l=new r;l.update(a);var u=l.digest();return l.clean(),u}t.hash=o})(yL),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=uL,n=yL,r=Kf;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ne){const G=new Float64Array(16);if(ne)for(let Z=0;Z<ne.length;Z++)G[Z]=ne[Z];return G}const s=new Uint8Array(32);s[0]=9;const o=i(),a=i([1]),l=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),c=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),d=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(ne,G){for(let Z=0;Z<16;Z++)ne[Z]=G[Z]|0}function p(ne){let G=1;for(let Z=0;Z<16;Z++){let A=ne[Z]+G+65535;G=Math.floor(A/65536),ne[Z]=A-G*65536}ne[0]+=G-1+37*(G-1)}function m(ne,G,Z){const A=~(Z-1);for(let P=0;P<16;P++){const ue=A&(ne[P]^G[P]);ne[P]^=ue,G[P]^=ue}}function g(ne,G){const Z=i(),A=i();for(let P=0;P<16;P++)A[P]=G[P];p(A),p(A),p(A);for(let P=0;P<2;P++){Z[0]=A[0]-65517;for(let de=1;de<15;de++)Z[de]=A[de]-65535-(Z[de-1]>>16&1),Z[de-1]&=65535;Z[15]=A[15]-32767-(Z[14]>>16&1);const ue=Z[15]>>16&1;Z[14]&=65535,m(A,Z,1-ue)}for(let P=0;P<16;P++)ne[2*P]=A[P]&255,ne[2*P+1]=A[P]>>8}function y(ne,G){let Z=0;for(let A=0;A<32;A++)Z|=ne[A]^G[A];return(1&Z-1>>>8)-1}function v(ne,G){const Z=new Uint8Array(32),A=new Uint8Array(32);return g(Z,ne),g(A,G),y(Z,A)}function w(ne){const G=new Uint8Array(32);return g(G,ne),G[0]&1}function b(ne,G){for(let Z=0;Z<16;Z++)ne[Z]=G[2*Z]+(G[2*Z+1]<<8);ne[15]&=32767}function E(ne,G,Z){for(let A=0;A<16;A++)ne[A]=G[A]+Z[A]}function x(ne,G,Z){for(let A=0;A<16;A++)ne[A]=G[A]-Z[A]}function O(ne,G,Z){let A,P,ue=0,de=0,oe=0,we=0,De=0,pe=0,Ke=0,qe=0,tt=0,lt=0,ft=0,Ze=0,Se=0,Ue=0,C=0,M=0,R=0,z=0,se=0,te=0,fe=0,he=0,U=0,re=0,ce=0,ye=0,ge=0,Le=0,Ve=0,pt=0,nt=0,et=Z[0],Lt=Z[1],Ct=Z[2],kt=Z[3],Jt=Z[4],Yt=Z[5],Xt=Z[6],Dn=Z[7],Tn=Z[8],On=Z[9],Bt=Z[10],hn=Z[11],_n=Z[12],Mn=Z[13],Nn=Z[14],j=Z[15];A=G[0],ue+=A*et,de+=A*Lt,oe+=A*Ct,we+=A*kt,De+=A*Jt,pe+=A*Yt,Ke+=A*Xt,qe+=A*Dn,tt+=A*Tn,lt+=A*On,ft+=A*Bt,Ze+=A*hn,Se+=A*_n,Ue+=A*Mn,C+=A*Nn,M+=A*j,A=G[1],de+=A*et,oe+=A*Lt,we+=A*Ct,De+=A*kt,pe+=A*Jt,Ke+=A*Yt,qe+=A*Xt,tt+=A*Dn,lt+=A*Tn,ft+=A*On,Ze+=A*Bt,Se+=A*hn,Ue+=A*_n,C+=A*Mn,M+=A*Nn,R+=A*j,A=G[2],oe+=A*et,we+=A*Lt,De+=A*Ct,pe+=A*kt,Ke+=A*Jt,qe+=A*Yt,tt+=A*Xt,lt+=A*Dn,ft+=A*Tn,Ze+=A*On,Se+=A*Bt,Ue+=A*hn,C+=A*_n,M+=A*Mn,R+=A*Nn,z+=A*j,A=G[3],we+=A*et,De+=A*Lt,pe+=A*Ct,Ke+=A*kt,qe+=A*Jt,tt+=A*Yt,lt+=A*Xt,ft+=A*Dn,Ze+=A*Tn,Se+=A*On,Ue+=A*Bt,C+=A*hn,M+=A*_n,R+=A*Mn,z+=A*Nn,se+=A*j,A=G[4],De+=A*et,pe+=A*Lt,Ke+=A*Ct,qe+=A*kt,tt+=A*Jt,lt+=A*Yt,ft+=A*Xt,Ze+=A*Dn,Se+=A*Tn,Ue+=A*On,C+=A*Bt,M+=A*hn,R+=A*_n,z+=A*Mn,se+=A*Nn,te+=A*j,A=G[5],pe+=A*et,Ke+=A*Lt,qe+=A*Ct,tt+=A*kt,lt+=A*Jt,ft+=A*Yt,Ze+=A*Xt,Se+=A*Dn,Ue+=A*Tn,C+=A*On,M+=A*Bt,R+=A*hn,z+=A*_n,se+=A*Mn,te+=A*Nn,fe+=A*j,A=G[6],Ke+=A*et,qe+=A*Lt,tt+=A*Ct,lt+=A*kt,ft+=A*Jt,Ze+=A*Yt,Se+=A*Xt,Ue+=A*Dn,C+=A*Tn,M+=A*On,R+=A*Bt,z+=A*hn,se+=A*_n,te+=A*Mn,fe+=A*Nn,he+=A*j,A=G[7],qe+=A*et,tt+=A*Lt,lt+=A*Ct,ft+=A*kt,Ze+=A*Jt,Se+=A*Yt,Ue+=A*Xt,C+=A*Dn,M+=A*Tn,R+=A*On,z+=A*Bt,se+=A*hn,te+=A*_n,fe+=A*Mn,he+=A*Nn,U+=A*j,A=G[8],tt+=A*et,lt+=A*Lt,ft+=A*Ct,Ze+=A*kt,Se+=A*Jt,Ue+=A*Yt,C+=A*Xt,M+=A*Dn,R+=A*Tn,z+=A*On,se+=A*Bt,te+=A*hn,fe+=A*_n,he+=A*Mn,U+=A*Nn,re+=A*j,A=G[9],lt+=A*et,ft+=A*Lt,Ze+=A*Ct,Se+=A*kt,Ue+=A*Jt,C+=A*Yt,M+=A*Xt,R+=A*Dn,z+=A*Tn,se+=A*On,te+=A*Bt,fe+=A*hn,he+=A*_n,U+=A*Mn,re+=A*Nn,ce+=A*j,A=G[10],ft+=A*et,Ze+=A*Lt,Se+=A*Ct,Ue+=A*kt,C+=A*Jt,M+=A*Yt,R+=A*Xt,z+=A*Dn,se+=A*Tn,te+=A*On,fe+=A*Bt,he+=A*hn,U+=A*_n,re+=A*Mn,ce+=A*Nn,ye+=A*j,A=G[11],Ze+=A*et,Se+=A*Lt,Ue+=A*Ct,C+=A*kt,M+=A*Jt,R+=A*Yt,z+=A*Xt,se+=A*Dn,te+=A*Tn,fe+=A*On,he+=A*Bt,U+=A*hn,re+=A*_n,ce+=A*Mn,ye+=A*Nn,ge+=A*j,A=G[12],Se+=A*et,Ue+=A*Lt,C+=A*Ct,M+=A*kt,R+=A*Jt,z+=A*Yt,se+=A*Xt,te+=A*Dn,fe+=A*Tn,he+=A*On,U+=A*Bt,re+=A*hn,ce+=A*_n,ye+=A*Mn,ge+=A*Nn,Le+=A*j,A=G[13],Ue+=A*et,C+=A*Lt,M+=A*Ct,R+=A*kt,z+=A*Jt,se+=A*Yt,te+=A*Xt,fe+=A*Dn,he+=A*Tn,U+=A*On,re+=A*Bt,ce+=A*hn,ye+=A*_n,ge+=A*Mn,Le+=A*Nn,Ve+=A*j,A=G[14],C+=A*et,M+=A*Lt,R+=A*Ct,z+=A*kt,se+=A*Jt,te+=A*Yt,fe+=A*Xt,he+=A*Dn,U+=A*Tn,re+=A*On,ce+=A*Bt,ye+=A*hn,ge+=A*_n,Le+=A*Mn,Ve+=A*Nn,pt+=A*j,A=G[15],M+=A*et,R+=A*Lt,z+=A*Ct,se+=A*kt,te+=A*Jt,fe+=A*Yt,he+=A*Xt,U+=A*Dn,re+=A*Tn,ce+=A*On,ye+=A*Bt,ge+=A*hn,Le+=A*_n,Ve+=A*Mn,pt+=A*Nn,nt+=A*j,ue+=38*R,de+=38*z,oe+=38*se,we+=38*te,De+=38*fe,pe+=38*he,Ke+=38*U,qe+=38*re,tt+=38*ce,lt+=38*ye,ft+=38*ge,Ze+=38*Le,Se+=38*Ve,Ue+=38*pt,C+=38*nt,P=1,A=ue+P+65535,P=Math.floor(A/65536),ue=A-P*65536,A=de+P+65535,P=Math.floor(A/65536),de=A-P*65536,A=oe+P+65535,P=Math.floor(A/65536),oe=A-P*65536,A=we+P+65535,P=Math.floor(A/65536),we=A-P*65536,A=De+P+65535,P=Math.floor(A/65536),De=A-P*65536,A=pe+P+65535,P=Math.floor(A/65536),pe=A-P*65536,A=Ke+P+65535,P=Math.floor(A/65536),Ke=A-P*65536,A=qe+P+65535,P=Math.floor(A/65536),qe=A-P*65536,A=tt+P+65535,P=Math.floor(A/65536),tt=A-P*65536,A=lt+P+65535,P=Math.floor(A/65536),lt=A-P*65536,A=ft+P+65535,P=Math.floor(A/65536),ft=A-P*65536,A=Ze+P+65535,P=Math.floor(A/65536),Ze=A-P*65536,A=Se+P+65535,P=Math.floor(A/65536),Se=A-P*65536,A=Ue+P+65535,P=Math.floor(A/65536),Ue=A-P*65536,A=C+P+65535,P=Math.floor(A/65536),C=A-P*65536,A=M+P+65535,P=Math.floor(A/65536),M=A-P*65536,ue+=P-1+37*(P-1),P=1,A=ue+P+65535,P=Math.floor(A/65536),ue=A-P*65536,A=de+P+65535,P=Math.floor(A/65536),de=A-P*65536,A=oe+P+65535,P=Math.floor(A/65536),oe=A-P*65536,A=we+P+65535,P=Math.floor(A/65536),we=A-P*65536,A=De+P+65535,P=Math.floor(A/65536),De=A-P*65536,A=pe+P+65535,P=Math.floor(A/65536),pe=A-P*65536,A=Ke+P+65535,P=Math.floor(A/65536),Ke=A-P*65536,A=qe+P+65535,P=Math.floor(A/65536),qe=A-P*65536,A=tt+P+65535,P=Math.floor(A/65536),tt=A-P*65536,A=lt+P+65535,P=Math.floor(A/65536),lt=A-P*65536,A=ft+P+65535,P=Math.floor(A/65536),ft=A-P*65536,A=Ze+P+65535,P=Math.floor(A/65536),Ze=A-P*65536,A=Se+P+65535,P=Math.floor(A/65536),Se=A-P*65536,A=Ue+P+65535,P=Math.floor(A/65536),Ue=A-P*65536,A=C+P+65535,P=Math.floor(A/65536),C=A-P*65536,A=M+P+65535,P=Math.floor(A/65536),M=A-P*65536,ue+=P-1+37*(P-1),ne[0]=ue,ne[1]=de,ne[2]=oe,ne[3]=we,ne[4]=De,ne[5]=pe,ne[6]=Ke,ne[7]=qe,ne[8]=tt,ne[9]=lt,ne[10]=ft,ne[11]=Ze,ne[12]=Se,ne[13]=Ue,ne[14]=C,ne[15]=M}function S(ne,G){O(ne,G,G)}function D(ne,G){const Z=i();let A;for(A=0;A<16;A++)Z[A]=G[A];for(A=253;A>=0;A--)S(Z,Z),A!==2&&A!==4&&O(Z,Z,G);for(A=0;A<16;A++)ne[A]=Z[A]}function I(ne,G){const Z=i();let A;for(A=0;A<16;A++)Z[A]=G[A];for(A=250;A>=0;A--)S(Z,Z),A!==1&&O(Z,Z,G);for(A=0;A<16;A++)ne[A]=Z[A]}function F(ne,G){const Z=i(),A=i(),P=i(),ue=i(),de=i(),oe=i(),we=i(),De=i(),pe=i();x(Z,ne[1],ne[0]),x(pe,G[1],G[0]),O(Z,Z,pe),E(A,ne[0],ne[1]),E(pe,G[0],G[1]),O(A,A,pe),O(P,ne[3],G[3]),O(P,P,u),O(ue,ne[2],G[2]),E(ue,ue,ue),x(de,A,Z),x(oe,ue,P),E(we,ue,P),E(De,A,Z),O(ne[0],de,oe),O(ne[1],De,we),O(ne[2],we,oe),O(ne[3],de,De)}function Q(ne,G,Z){for(let A=0;A<4;A++)m(ne[A],G[A],Z)}function V(ne,G){const Z=i(),A=i(),P=i();D(P,G[2]),O(Z,G[0],P),O(A,G[1],P),g(ne,A),ne[31]^=w(Z)<<7}function B(ne,G,Z){h(ne[0],o),h(ne[1],a),h(ne[2],a),h(ne[3],o);for(let A=255;A>=0;--A){const P=Z[A/8|0]>>(A&7)&1;Q(ne,G,P),F(G,ne),F(ne,ne),Q(ne,G,P)}}function N(ne,G){const Z=[i(),i(),i(),i()];h(Z[0],c),h(Z[1],f),h(Z[2],a),O(Z[3],c,f),B(ne,Z,G)}function H(ne){if(ne.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const G=(0,n.hash)(ne);G[0]&=248,G[31]&=127,G[31]|=64;const Z=new Uint8Array(32),A=[i(),i(),i(),i()];N(A,G),V(Z,A);const P=new Uint8Array(64);return P.set(ne),P.set(Z,32),{publicKey:Z,secretKey:P}}t.generateKeyPairFromSeed=H;function K(ne){const G=(0,e.randomBytes)(32,ne),Z=H(G);return(0,r.wipe)(G),Z}t.generateKeyPair=K;function J(ne){if(ne.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ne.subarray(32))}t.extractPublicKeyFromSecretKey=J;const X=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ie(ne,G){let Z,A,P,ue;for(A=63;A>=32;--A){for(Z=0,P=A-32,ue=A-12;P<ue;++P)G[P]+=Z-16*G[A]*X[P-(A-32)],Z=Math.floor((G[P]+128)/256),G[P]-=Z*256;G[P]+=Z,G[A]=0}for(Z=0,P=0;P<32;P++)G[P]+=Z-(G[31]>>4)*X[P],Z=G[P]>>8,G[P]&=255;for(P=0;P<32;P++)G[P]-=Z*X[P];for(A=0;A<32;A++)G[A+1]+=G[A]>>8,ne[A]=G[A]&255}function le(ne){const G=new Float64Array(64);for(let Z=0;Z<64;Z++)G[Z]=ne[Z];for(let Z=0;Z<64;Z++)ne[Z]=0;ie(ne,G)}function Pe(ne,G){const Z=new Float64Array(64),A=[i(),i(),i(),i()],P=(0,n.hash)(ne.subarray(0,32));P[0]&=248,P[31]&=127,P[31]|=64;const ue=new Uint8Array(64);ue.set(P.subarray(32),32);const de=new n.SHA512;de.update(ue.subarray(32)),de.update(G);const oe=de.digest();de.clean(),le(oe),N(A,oe),V(ue,A),de.reset(),de.update(ue.subarray(0,32)),de.update(ne.subarray(32)),de.update(G);const we=de.digest();le(we);for(let De=0;De<32;De++)Z[De]=oe[De];for(let De=0;De<32;De++)for(let pe=0;pe<32;pe++)Z[De+pe]+=we[De]*P[pe];return ie(ue.subarray(32),Z),ue}t.sign=Pe;function xe(ne,G){const Z=i(),A=i(),P=i(),ue=i(),de=i(),oe=i(),we=i();return h(ne[2],a),b(ne[1],G),S(P,ne[1]),O(ue,P,l),x(P,P,ne[2]),E(ue,ne[2],ue),S(de,ue),S(oe,de),O(we,oe,de),O(Z,we,P),O(Z,Z,ue),I(Z,Z),O(Z,Z,P),O(Z,Z,ue),O(Z,Z,ue),O(ne[0],Z,ue),S(A,ne[0]),O(A,A,ue),v(A,P)&&O(ne[0],ne[0],d),S(A,ne[0]),O(A,A,ue),v(A,P)?-1:(w(ne[0])===G[31]>>7&&x(ne[0],o,ne[0]),O(ne[3],ne[0],ne[1]),0)}function Ie(ne,G,Z){const A=new Uint8Array(32),P=[i(),i(),i(),i()],ue=[i(),i(),i(),i()];if(Z.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(xe(ue,ne))return!1;const de=new n.SHA512;de.update(Z.subarray(0,32)),de.update(ne),de.update(G);const oe=de.digest();return le(oe),B(P,ue,oe),N(ue,Z.subarray(32)),F(P,ue),V(A,P),!y(Z,A)}t.verify=Ie;function ke(ne){let G=[i(),i(),i(),i()];if(xe(G,ne))throw new Error("Ed25519: invalid public key");let Z=i(),A=i(),P=G[1];E(Z,a,P),x(A,a,P),D(A,A),O(Z,Z,A);let ue=new Uint8Array(32);return g(ue,Z),ue}t.convertPublicKeyToX25519=ke;function $(ne){const G=(0,n.hash)(ne.subarray(0,32));G[0]&=248,G[31]&=127,G[31]|=64;const Z=new Uint8Array(G.subarray(0,32));return(0,r.wipe)(G),Z}t.convertSecretKeyToX25519=$}(g0);const Jk=new Uint8Array([237,1]),bL=new Uint8Array([128,36]),wL=new Uint8Array([133,36]),vL=new Uint8Array([0,245,2]),Yk="did:key:z";function S1(t,e){if(!t.startsWith(Yk))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");const n=t.slice(Yk.length),r=hs(n,"base58btc");if(!ipe(r,e))throw new Error(`Expected prefix: ${e}`);return r.slice(e.length)}function rpe(t,e){const n=b1([e,t]),r=Ja(n,"base58btc");return Yk+r}const ipe=(t,e)=>nL(e,t.subarray(0,e.byteLength)),spe=t=>S1(t,Jk),ope=t=>rpe(t,Jk);var Xk=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};class y0{constructor(e,n,r){this.jwtAlg="EdDSA",this.secretKey=e,this.publicKey=n,this.exportable=r}static create(e){return Xk(this,void 0,void 0,function*(){const{exportable:n}=e||{},r=g0.generateKeyPair();return new y0(r.secretKey,r.publicKey,n??!1)})}static fromSecretKey(e,n){const{format:r="base64pad",exportable:i=!1}=n||{},s=hs(e,r),o=g0.extractPublicKeyFromSecretKey(s);return new y0(s,o,i)}did(){return ope(this.publicKey)}sign(e){return Xk(this,void 0,void 0,function*(){return g0.sign(this.secretKey,e)})}export(e="base64pad"){return Xk(this,void 0,void 0,function*(){if(!this.exportable)throw new Error("Key is not exportable");return Ja(this.secretKey,e)})}}const C1=(globalThis||window||self).crypto;var AL=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};const xL="RSASSA-PKCS1-v1_5",ape="SHA-256",lpe=128,upe=t=>AL(void 0,void 0,void 0,function*(){return yield C1.subtle.importKey("spki",t,{name:xL,hash:{name:ape}},!0,["verify"])}),EL=(t,e,n)=>AL(void 0,void 0,void 0,function*(){return yield C1.subtle.verify({name:xL,saltLength:lpe},yield upe(t),n,e)}),cpe=t=>{const e=S1(t,wL);return ppe(e)},fpe=t=>S1(t,vL),kL=new Uint8Array([48,13,6,9,42,134,72,134,247,13,1,1,1,5,0]),dpe=new Uint8Array([48]),hpe=new Uint8Array([3]),ppe=t=>{const e=b1([hpe,SL(t.length+1),new Uint8Array([0]),t]);return b1([dpe,SL(kL.length+e.length),kL,e])};function SL(t){if(t<0||!isFinite(t))throw new TypeError(`Expected non-negative number. Got ${t}`);if(t<=127)return new Uint8Array([t]);const e=[];for(;t!==0;)e.push(t&255),t=t>>>8;return e.reverse(),new Uint8Array([128|e.length&255,...e])}var CL={exports:{}};(function(t){var e=function(n){var r=1e7,i=7,s=9007199254740992,o=p(s),a="0123456789abcdefghijklmnopqrstuvwxyz",l=typeof BigInt=="function";function u(C,M,R,z){return typeof C>"u"?u[0]:typeof M<"u"?+M==10&&!R?Se(C):pe(C,M,R,z):Se(C)}function c(C,M){this.value=C,this.sign=M,this.isSmall=!1}c.prototype=Object.create(u.prototype);function f(C){this.value=C,this.sign=C<0,this.isSmall=!0}f.prototype=Object.create(u.prototype);function d(C){this.value=C}d.prototype=Object.create(u.prototype);function h(C){return-s<C&&C<s}function p(C){return C<1e7?[C]:C<1e14?[C%1e7,Math.floor(C/1e7)]:[C%1e7,Math.floor(C/1e7)%1e7,Math.floor(C/1e14)]}function m(C){g(C);var M=C.length;if(M<4&&ie(C,o)<0)switch(M){case 0:return 0;case 1:return C[0];case 2:return C[0]+C[1]*r;default:return C[0]+(C[1]+C[2]*r)*r}return C}function g(C){for(var M=C.length;C[--M]===0;);C.length=M+1}function y(C){for(var M=new Array(C),R=-1;++R<C;)M[R]=0;return M}function v(C){return C>0?Math.floor(C):Math.ceil(C)}function w(C,M){var R=C.length,z=M.length,se=new Array(R),te=0,fe=r,he,U;for(U=0;U<z;U++)he=C[U]+M[U]+te,te=he>=fe?1:0,se[U]=he-te*fe;for(;U<R;)he=C[U]+te,te=he===fe?1:0,se[U++]=he-te*fe;return te>0&&se.push(te),se}function b(C,M){return C.length>=M.length?w(C,M):w(M,C)}function E(C,M){var R=C.length,z=new Array(R),se=r,te,fe;for(fe=0;fe<R;fe++)te=C[fe]-se+M,M=Math.floor(te/se),z[fe]=te-M*se,M+=1;for(;M>0;)z[fe++]=M%se,M=Math.floor(M/se);return z}c.prototype.add=function(C){var M=Se(C);if(this.sign!==M.sign)return this.subtract(M.negate());var R=this.value,z=M.value;return M.isSmall?new c(E(R,Math.abs(z)),this.sign):new c(b(R,z),this.sign)},c.prototype.plus=c.prototype.add,f.prototype.add=function(C){var M=Se(C),R=this.value;if(R<0!==M.sign)return this.subtract(M.negate());var z=M.value;if(M.isSmall){if(h(R+z))return new f(R+z);z=p(Math.abs(z))}return new c(E(z,Math.abs(R)),R<0)},f.prototype.plus=f.prototype.add,d.prototype.add=function(C){return new d(this.value+Se(C).value)},d.prototype.plus=d.prototype.add;function x(C,M){var R=C.length,z=M.length,se=new Array(R),te=0,fe=r,he,U;for(he=0;he<z;he++)U=C[he]-te-M[he],U<0?(U+=fe,te=1):te=0,se[he]=U;for(he=z;he<R;he++){if(U=C[he]-te,U<0)U+=fe;else{se[he++]=U;break}se[he]=U}for(;he<R;he++)se[he]=C[he];return g(se),se}function O(C,M,R){var z;return ie(C,M)>=0?z=x(C,M):(z=x(M,C),R=!R),z=m(z),typeof z=="number"?(R&&(z=-z),new f(z)):new c(z,R)}function S(C,M,R){var z=C.length,se=new Array(z),te=-M,fe=r,he,U;for(he=0;he<z;he++)U=C[he]+te,te=Math.floor(U/fe),U%=fe,se[he]=U<0?U+fe:U;return se=m(se),typeof se=="number"?(R&&(se=-se),new f(se)):new c(se,R)}c.prototype.subtract=function(C){var M=Se(C);if(this.sign!==M.sign)return this.add(M.negate());var R=this.value,z=M.value;return M.isSmall?S(R,Math.abs(z),this.sign):O(R,z,this.sign)},c.prototype.minus=c.prototype.subtract,f.prototype.subtract=function(C){var M=Se(C),R=this.value;if(R<0!==M.sign)return this.add(M.negate());var z=M.value;return M.isSmall?new f(R-z):S(z,Math.abs(R),R>=0)},f.prototype.minus=f.prototype.subtract,d.prototype.subtract=function(C){return new d(this.value-Se(C).value)},d.prototype.minus=d.prototype.subtract,c.prototype.negate=function(){return new c(this.value,!this.sign)},f.prototype.negate=function(){var C=this.sign,M=new f(-this.value);return M.sign=!C,M},d.prototype.negate=function(){return new d(-this.value)},c.prototype.abs=function(){return new c(this.value,!1)},f.prototype.abs=function(){return new f(Math.abs(this.value))},d.prototype.abs=function(){return new d(this.value>=0?this.value:-this.value)};function D(C,M){var R=C.length,z=M.length,se=R+z,te=y(se),fe=r,he,U,re,ce,ye;for(re=0;re<R;++re){ce=C[re];for(var ge=0;ge<z;++ge)ye=M[ge],he=ce*ye+te[re+ge],U=Math.floor(he/fe),te[re+ge]=he-U*fe,te[re+ge+1]+=U}return g(te),te}function I(C,M){var R=C.length,z=new Array(R),se=r,te=0,fe,he;for(he=0;he<R;he++)fe=C[he]*M+te,te=Math.floor(fe/se),z[he]=fe-te*se;for(;te>0;)z[he++]=te%se,te=Math.floor(te/se);return z}function F(C,M){for(var R=[];M-- >0;)R.push(0);return R.concat(C)}function Q(C,M){var R=Math.max(C.length,M.length);if(R<=30)return D(C,M);R=Math.ceil(R/2);var z=C.slice(R),se=C.slice(0,R),te=M.slice(R),fe=M.slice(0,R),he=Q(se,fe),U=Q(z,te),re=Q(b(se,z),b(fe,te)),ce=b(b(he,F(x(x(re,he),U),R)),F(U,2*R));return g(ce),ce}function V(C,M){return-.012*C-.012*M+15e-6*C*M>0}c.prototype.multiply=function(C){var M=Se(C),R=this.value,z=M.value,se=this.sign!==M.sign,te;if(M.isSmall){if(z===0)return u[0];if(z===1)return this;if(z===-1)return this.negate();if(te=Math.abs(z),te<r)return new c(I(R,te),se);z=p(te)}return V(R.length,z.length)?new c(Q(R,z),se):new c(D(R,z),se)},c.prototype.times=c.prototype.multiply;function B(C,M,R){return C<r?new c(I(M,C),R):new c(D(M,p(C)),R)}f.prototype._multiplyBySmall=function(C){return h(C.value*this.value)?new f(C.value*this.value):B(Math.abs(C.value),p(Math.abs(this.value)),this.sign!==C.sign)},c.prototype._multiplyBySmall=function(C){return C.value===0?u[0]:C.value===1?this:C.value===-1?this.negate():B(Math.abs(C.value),this.value,this.sign!==C.sign)},f.prototype.multiply=function(C){return Se(C)._multiplyBySmall(this)},f.prototype.times=f.prototype.multiply,d.prototype.multiply=function(C){return new d(this.value*Se(C).value)},d.prototype.times=d.prototype.multiply;function N(C){var M=C.length,R=y(M+M),z=r,se,te,fe,he,U;for(fe=0;fe<M;fe++){he=C[fe],te=0-he*he;for(var re=fe;re<M;re++)U=C[re],se=2*(he*U)+R[fe+re]+te,te=Math.floor(se/z),R[fe+re]=se-te*z;R[fe+M]=te}return g(R),R}c.prototype.square=function(){return new c(N(this.value),!1)},f.prototype.square=function(){var C=this.value*this.value;return h(C)?new f(C):new c(N(p(Math.abs(this.value))),!1)},d.prototype.square=function(C){return new d(this.value*this.value)};function H(C,M){var R=C.length,z=M.length,se=r,te=y(M.length),fe=M[z-1],he=Math.ceil(se/(2*fe)),U=I(C,he),re=I(M,he),ce,ye,ge,Le,Ve,pt,nt;for(U.length<=R&&U.push(0),re.push(0),fe=re[z-1],ye=R-z;ye>=0;ye--){for(ce=se-1,U[ye+z]!==fe&&(ce=Math.floor((U[ye+z]*se+U[ye+z-1])/fe)),ge=0,Le=0,pt=re.length,Ve=0;Ve<pt;Ve++)ge+=ce*re[Ve],nt=Math.floor(ge/se),Le+=U[ye+Ve]-(ge-nt*se),ge=nt,Le<0?(U[ye+Ve]=Le+se,Le=-1):(U[ye+Ve]=Le,Le=0);for(;Le!==0;){for(ce-=1,ge=0,Ve=0;Ve<pt;Ve++)ge+=U[ye+Ve]-se+re[Ve],ge<0?(U[ye+Ve]=ge+se,ge=0):(U[ye+Ve]=ge,ge=1);Le+=ge}te[ye]=ce}return U=J(U,he)[0],[m(te),m(U)]}function K(C,M){for(var R=C.length,z=M.length,se=[],te=[],fe=r,he,U,re,ce,ye;R;){if(te.unshift(C[--R]),g(te),ie(te,M)<0){se.push(0);continue}U=te.length,re=te[U-1]*fe+te[U-2],ce=M[z-1]*fe+M[z-2],U>z&&(re=(re+1)*fe),he=Math.ceil(re/ce);do{if(ye=I(M,he),ie(ye,te)<=0)break;he--}while(he);se.push(he),te=x(te,ye)}return se.reverse(),[m(se),m(te)]}function J(C,M){var R=C.length,z=y(R),se=r,te,fe,he,U;for(he=0,te=R-1;te>=0;--te)U=he*se+C[te],fe=v(U/M),he=U-fe*M,z[te]=fe|0;return[z,he|0]}function X(C,M){var R,z=Se(M);if(l)return[new d(C.value/z.value),new d(C.value%z.value)];var se=C.value,te=z.value,fe;if(te===0)throw new Error("Cannot divide by zero");if(C.isSmall)return z.isSmall?[new f(v(se/te)),new f(se%te)]:[u[0],C];if(z.isSmall){if(te===1)return[C,u[0]];if(te==-1)return[C.negate(),u[0]];var he=Math.abs(te);if(he<r){R=J(se,he),fe=m(R[0]);var U=R[1];return C.sign&&(U=-U),typeof fe=="number"?(C.sign!==z.sign&&(fe=-fe),[new f(fe),new f(U)]):[new c(fe,C.sign!==z.sign),new f(U)]}te=p(he)}var re=ie(se,te);if(re===-1)return[u[0],C];if(re===0)return[u[C.sign===z.sign?1:-1],u[0]];se.length+te.length<=200?R=H(se,te):R=K(se,te),fe=R[0];var ce=C.sign!==z.sign,ye=R[1],ge=C.sign;return typeof fe=="number"?(ce&&(fe=-fe),fe=new f(fe)):fe=new c(fe,ce),typeof ye=="number"?(ge&&(ye=-ye),ye=new f(ye)):ye=new c(ye,ge),[fe,ye]}c.prototype.divmod=function(C){var M=X(this,C);return{quotient:M[0],remainder:M[1]}},d.prototype.divmod=f.prototype.divmod=c.prototype.divmod,c.prototype.divide=function(C){return X(this,C)[0]},d.prototype.over=d.prototype.divide=function(C){return new d(this.value/Se(C).value)},f.prototype.over=f.prototype.divide=c.prototype.over=c.prototype.divide,c.prototype.mod=function(C){return X(this,C)[1]},d.prototype.mod=d.prototype.remainder=function(C){return new d(this.value%Se(C).value)},f.prototype.remainder=f.prototype.mod=c.prototype.remainder=c.prototype.mod,c.prototype.pow=function(C){var M=Se(C),R=this.value,z=M.value,se,te,fe;if(z===0)return u[1];if(R===0)return u[0];if(R===1)return u[1];if(R===-1)return M.isEven()?u[1]:u[-1];if(M.sign)return u[0];if(!M.isSmall)throw new Error("The exponent "+M.toString()+" is too large.");if(this.isSmall&&h(se=Math.pow(R,z)))return new f(v(se));for(te=this,fe=u[1];z&!0&&(fe=fe.times(te),--z),z!==0;)z/=2,te=te.square();return fe},f.prototype.pow=c.prototype.pow,d.prototype.pow=function(C){var M=Se(C),R=this.value,z=M.value,se=BigInt(0),te=BigInt(1),fe=BigInt(2);if(z===se)return u[1];if(R===se)return u[0];if(R===te)return u[1];if(R===BigInt(-1))return M.isEven()?u[1]:u[-1];if(M.isNegative())return new d(se);for(var he=this,U=u[1];(z&te)===te&&(U=U.times(he),--z),z!==se;)z/=fe,he=he.square();return U},c.prototype.modPow=function(C,M){if(C=Se(C),M=Se(M),M.isZero())throw new Error("Cannot take modPow with modulus 0");var R=u[1],z=this.mod(M);for(C.isNegative()&&(C=C.multiply(u[-1]),z=z.modInv(M));C.isPositive();){if(z.isZero())return u[0];C.isOdd()&&(R=R.multiply(z).mod(M)),C=C.divide(2),z=z.square().mod(M)}return R},d.prototype.modPow=f.prototype.modPow=c.prototype.modPow;function ie(C,M){if(C.length!==M.length)return C.length>M.length?1:-1;for(var R=C.length-1;R>=0;R--)if(C[R]!==M[R])return C[R]>M[R]?1:-1;return 0}c.prototype.compareAbs=function(C){var M=Se(C),R=this.value,z=M.value;return M.isSmall?1:ie(R,z)},f.prototype.compareAbs=function(C){var M=Se(C),R=Math.abs(this.value),z=M.value;return M.isSmall?(z=Math.abs(z),R===z?0:R>z?1:-1):-1},d.prototype.compareAbs=function(C){var M=this.value,R=Se(C).value;return M=M>=0?M:-M,R=R>=0?R:-R,M===R?0:M>R?1:-1},c.prototype.compare=function(C){if(C===1/0)return-1;if(C===-1/0)return 1;var M=Se(C),R=this.value,z=M.value;return this.sign!==M.sign?M.sign?1:-1:M.isSmall?this.sign?-1:1:ie(R,z)*(this.sign?-1:1)},c.prototype.compareTo=c.prototype.compare,f.prototype.compare=function(C){if(C===1/0)return-1;if(C===-1/0)return 1;var M=Se(C),R=this.value,z=M.value;return M.isSmall?R==z?0:R>z?1:-1:R<0!==M.sign?R<0?-1:1:R<0?1:-1},f.prototype.compareTo=f.prototype.compare,d.prototype.compare=function(C){if(C===1/0)return-1;if(C===-1/0)return 1;var M=this.value,R=Se(C).value;return M===R?0:M>R?1:-1},d.prototype.compareTo=d.prototype.compare,c.prototype.equals=function(C){return this.compare(C)===0},d.prototype.eq=d.prototype.equals=f.prototype.eq=f.prototype.equals=c.prototype.eq=c.prototype.equals,c.prototype.notEquals=function(C){return this.compare(C)!==0},d.prototype.neq=d.prototype.notEquals=f.prototype.neq=f.prototype.notEquals=c.prototype.neq=c.prototype.notEquals,c.prototype.greater=function(C){return this.compare(C)>0},d.prototype.gt=d.prototype.greater=f.prototype.gt=f.prototype.greater=c.prototype.gt=c.prototype.greater,c.prototype.lesser=function(C){return this.compare(C)<0},d.prototype.lt=d.prototype.lesser=f.prototype.lt=f.prototype.lesser=c.prototype.lt=c.prototype.lesser,c.prototype.greaterOrEquals=function(C){return this.compare(C)>=0},d.prototype.geq=d.prototype.greaterOrEquals=f.prototype.geq=f.prototype.greaterOrEquals=c.prototype.geq=c.prototype.greaterOrEquals,c.prototype.lesserOrEquals=function(C){return this.compare(C)<=0},d.prototype.leq=d.prototype.lesserOrEquals=f.prototype.leq=f.prototype.lesserOrEquals=c.prototype.leq=c.prototype.lesserOrEquals,c.prototype.isEven=function(){return(this.value[0]&1)===0},f.prototype.isEven=function(){return(this.value&1)===0},d.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},c.prototype.isOdd=function(){return(this.value[0]&1)===1},f.prototype.isOdd=function(){return(this.value&1)===1},d.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},c.prototype.isPositive=function(){return!this.sign},f.prototype.isPositive=function(){return this.value>0},d.prototype.isPositive=f.prototype.isPositive,c.prototype.isNegative=function(){return this.sign},f.prototype.isNegative=function(){return this.value<0},d.prototype.isNegative=f.prototype.isNegative,c.prototype.isUnit=function(){return!1},f.prototype.isUnit=function(){return Math.abs(this.value)===1},d.prototype.isUnit=function(){return this.abs().value===BigInt(1)},c.prototype.isZero=function(){return!1},f.prototype.isZero=function(){return this.value===0},d.prototype.isZero=function(){return this.value===BigInt(0)},c.prototype.isDivisibleBy=function(C){var M=Se(C);return M.isZero()?!1:M.isUnit()?!0:M.compareAbs(2)===0?this.isEven():this.mod(M).isZero()},d.prototype.isDivisibleBy=f.prototype.isDivisibleBy=c.prototype.isDivisibleBy;function le(C){var M=C.abs();if(M.isUnit())return!1;if(M.equals(2)||M.equals(3)||M.equals(5))return!0;if(M.isEven()||M.isDivisibleBy(3)||M.isDivisibleBy(5))return!1;if(M.lesser(49))return!0}function Pe(C,M){for(var R=C.prev(),z=R,se=0,te,fe,he;z.isEven();)z=z.divide(2),se++;e:for(fe=0;fe<M.length;fe++)if(!C.lesser(M[fe])&&(he=e(M[fe]).modPow(z,C),!(he.isUnit()||he.equals(R)))){for(te=se-1;te!=0;te--){if(he=he.square().mod(C),he.isUnit())return!1;if(he.equals(R))continue e}return!1}return!0}c.prototype.isPrime=function(C){var M=le(this);if(M!==n)return M;var R=this.abs(),z=R.bitLength();if(z<=64)return Pe(R,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var se=Math.log(2)*z.toJSNumber(),te=Math.ceil(C===!0?2*Math.pow(se,2):se),fe=[],he=0;he<te;he++)fe.push(e(he+2));return Pe(R,fe)},d.prototype.isPrime=f.prototype.isPrime=c.prototype.isPrime,c.prototype.isProbablePrime=function(C,M){var R=le(this);if(R!==n)return R;for(var z=this.abs(),se=C===n?5:C,te=[],fe=0;fe<se;fe++)te.push(e.randBetween(2,z.minus(2),M));return Pe(z,te)},d.prototype.isProbablePrime=f.prototype.isProbablePrime=c.prototype.isProbablePrime,c.prototype.modInv=function(C){for(var M=e.zero,R=e.one,z=Se(C),se=this.abs(),te,fe,he;!se.isZero();)te=z.divide(se),fe=M,he=z,M=R,z=se,R=fe.subtract(te.multiply(R)),se=he.subtract(te.multiply(se));if(!z.isUnit())throw new Error(this.toString()+" and "+C.toString()+" are not co-prime");return M.compare(0)===-1&&(M=M.add(C)),this.isNegative()?M.negate():M},d.prototype.modInv=f.prototype.modInv=c.prototype.modInv,c.prototype.next=function(){var C=this.value;return this.sign?S(C,1,this.sign):new c(E(C,1),this.sign)},f.prototype.next=function(){var C=this.value;return C+1<s?new f(C+1):new c(o,!1)},d.prototype.next=function(){return new d(this.value+BigInt(1))},c.prototype.prev=function(){var C=this.value;return this.sign?new c(E(C,1),!0):S(C,1,this.sign)},f.prototype.prev=function(){var C=this.value;return C-1>-s?new f(C-1):new c(o,!0)},d.prototype.prev=function(){return new d(this.value-BigInt(1))};for(var xe=[1];2*xe[xe.length-1]<=r;)xe.push(2*xe[xe.length-1]);var Ie=xe.length,ke=xe[Ie-1];function $(C){return Math.abs(C)<=r}c.prototype.shiftLeft=function(C){var M=Se(C).toJSNumber();if(!$(M))throw new Error(String(M)+" is too large for shifting.");if(M<0)return this.shiftRight(-M);var R=this;if(R.isZero())return R;for(;M>=Ie;)R=R.multiply(ke),M-=Ie-1;return R.multiply(xe[M])},d.prototype.shiftLeft=f.prototype.shiftLeft=c.prototype.shiftLeft,c.prototype.shiftRight=function(C){var M,R=Se(C).toJSNumber();if(!$(R))throw new Error(String(R)+" is too large for shifting.");if(R<0)return this.shiftLeft(-R);for(var z=this;R>=Ie;){if(z.isZero()||z.isNegative()&&z.isUnit())return z;M=X(z,ke),z=M[1].isNegative()?M[0].prev():M[0],R-=Ie-1}return M=X(z,xe[R]),M[1].isNegative()?M[0].prev():M[0]},d.prototype.shiftRight=f.prototype.shiftRight=c.prototype.shiftRight;function ne(C,M,R){M=Se(M);for(var z=C.isNegative(),se=M.isNegative(),te=z?C.not():C,fe=se?M.not():M,he=0,U=0,re=null,ce=null,ye=[];!te.isZero()||!fe.isZero();)re=X(te,ke),he=re[1].toJSNumber(),z&&(he=ke-1-he),ce=X(fe,ke),U=ce[1].toJSNumber(),se&&(U=ke-1-U),te=re[0],fe=ce[0],ye.push(R(he,U));for(var ge=R(z?1:0,se?1:0)!==0?e(-1):e(0),Le=ye.length-1;Le>=0;Le-=1)ge=ge.multiply(ke).add(e(ye[Le]));return ge}c.prototype.not=function(){return this.negate().prev()},d.prototype.not=f.prototype.not=c.prototype.not,c.prototype.and=function(C){return ne(this,C,function(M,R){return M&R})},d.prototype.and=f.prototype.and=c.prototype.and,c.prototype.or=function(C){return ne(this,C,function(M,R){return M|R})},d.prototype.or=f.prototype.or=c.prototype.or,c.prototype.xor=function(C){return ne(this,C,function(M,R){return M^R})},d.prototype.xor=f.prototype.xor=c.prototype.xor;var G=1<<30,Z=(r&-r)*(r&-r)|G;function A(C){var M=C.value,R=typeof M=="number"?M|G:typeof M=="bigint"?M|BigInt(G):M[0]+M[1]*r|Z;return R&-R}function P(C,M){if(M.compareTo(C)<=0){var R=P(C,M.square(M)),z=R.p,se=R.e,te=z.multiply(M);return te.compareTo(C)<=0?{p:te,e:se*2+1}:{p:z,e:se*2}}return{p:e(1),e:0}}c.prototype.bitLength=function(){var C=this;return C.compareTo(e(0))<0&&(C=C.negate().subtract(e(1))),C.compareTo(e(0))===0?e(0):e(P(C,e(2)).e).add(e(1))},d.prototype.bitLength=f.prototype.bitLength=c.prototype.bitLength;function ue(C,M){return C=Se(C),M=Se(M),C.greater(M)?C:M}function de(C,M){return C=Se(C),M=Se(M),C.lesser(M)?C:M}function oe(C,M){if(C=Se(C).abs(),M=Se(M).abs(),C.equals(M))return C;if(C.isZero())return M;if(M.isZero())return C;for(var R=u[1],z,se;C.isEven()&&M.isEven();)z=de(A(C),A(M)),C=C.divide(z),M=M.divide(z),R=R.multiply(z);for(;C.isEven();)C=C.divide(A(C));do{for(;M.isEven();)M=M.divide(A(M));C.greater(M)&&(se=M,M=C,C=se),M=M.subtract(C)}while(!M.isZero());return R.isUnit()?C:C.multiply(R)}function we(C,M){return C=Se(C).abs(),M=Se(M).abs(),C.divide(oe(C,M)).multiply(M)}function De(C,M,R){C=Se(C),M=Se(M);var z=R||Math.random,se=de(C,M),te=ue(C,M),fe=te.subtract(se).add(1);if(fe.isSmall)return se.add(Math.floor(z()*fe));for(var he=tt(fe,r).value,U=[],re=!0,ce=0;ce<he.length;ce++){var ye=re?he[ce]+(ce+1<he.length?he[ce+1]/r:0):r,ge=v(z()*ye);U.push(ge),ge<he[ce]&&(re=!1)}return se.add(u.fromArray(U,r,!1))}var pe=function(C,M,R,z){R=R||a,C=String(C),z||(C=C.toLowerCase(),R=R.toLowerCase());var se=C.length,te,fe=Math.abs(M),he={};for(te=0;te<R.length;te++)he[R[te]]=te;for(te=0;te<se;te++){var U=C[te];if(U!=="-"&&U in he&&he[U]>=fe){if(U==="1"&&fe===1)continue;throw new Error(U+" is not a valid digit in base "+M+".")}}M=Se(M);var re=[],ce=C[0]==="-";for(te=ce?1:0;te<C.length;te++){var U=C[te];if(U in he)re.push(Se(he[U]));else if(U==="<"){var ye=te;do te++;while(C[te]!==">"&&te<C.length);re.push(Se(C.slice(ye+1,te)))}else throw new Error(U+" is not a valid character")}return Ke(re,M,ce)};function Ke(C,M,R){var z=u[0],se=u[1],te;for(te=C.length-1;te>=0;te--)z=z.add(C[te].times(se)),se=se.times(M);return R?z.negate():z}function qe(C,M){return M=M||a,C<M.length?M[C]:"<"+C+">"}function tt(C,M){if(M=e(M),M.isZero()){if(C.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(M.equals(-1)){if(C.isZero())return{value:[0],isNegative:!1};if(C.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-C.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var R=Array.apply(null,Array(C.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return R.unshift([1]),{value:[].concat.apply([],R),isNegative:!1}}var z=!1;if(C.isNegative()&&M.isPositive()&&(z=!0,C=C.abs()),M.isUnit())return C.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(C.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:z};for(var se=[],te=C,fe;te.isNegative()||te.compareAbs(M)>=0;){fe=te.divmod(M),te=fe.quotient;var he=fe.remainder;he.isNegative()&&(he=M.minus(he).abs(),te=te.next()),se.push(he.toJSNumber())}return se.push(te.toJSNumber()),{value:se.reverse(),isNegative:z}}function lt(C,M,R){var z=tt(C,M);return(z.isNegative?"-":"")+z.value.map(function(se){return qe(se,R)}).join("")}c.prototype.toArray=function(C){return tt(this,C)},f.prototype.toArray=function(C){return tt(this,C)},d.prototype.toArray=function(C){return tt(this,C)},c.prototype.toString=function(C,M){if(C===n&&(C=10),C!==10||M)return lt(this,C,M);for(var R=this.value,z=R.length,se=String(R[--z]),te="0000000",fe;--z>=0;)fe=String(R[z]),se+=te.slice(fe.length)+fe;var he=this.sign?"-":"";return he+se},f.prototype.toString=function(C,M){return C===n&&(C=10),C!=10||M?lt(this,C,M):String(this.value)},d.prototype.toString=f.prototype.toString,d.prototype.toJSON=c.prototype.toJSON=f.prototype.toJSON=function(){return this.toString()},c.prototype.valueOf=function(){return parseInt(this.toString(),10)},c.prototype.toJSNumber=c.prototype.valueOf,f.prototype.valueOf=function(){return this.value},f.prototype.toJSNumber=f.prototype.valueOf,d.prototype.valueOf=d.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function ft(C){if(h(+C)){var M=+C;if(M===v(M))return l?new d(BigInt(M)):new f(M);throw new Error("Invalid integer: "+C)}var R=C[0]==="-";R&&(C=C.slice(1));var z=C.split(/e/i);if(z.length>2)throw new Error("Invalid integer: "+z.join("e"));if(z.length===2){var se=z[1];if(se[0]==="+"&&(se=se.slice(1)),se=+se,se!==v(se)||!h(se))throw new Error("Invalid integer: "+se+" is not a valid exponent.");var te=z[0],fe=te.indexOf(".");if(fe>=0&&(se-=te.length-fe-1,te=te.slice(0,fe)+te.slice(fe+1)),se<0)throw new Error("Cannot include negative exponent part for integers");te+=new Array(se+1).join("0"),C=te}var he=/^([0-9][0-9]*)$/.test(C);if(!he)throw new Error("Invalid integer: "+C);if(l)return new d(BigInt(R?"-"+C:C));for(var U=[],re=C.length,ce=i,ye=re-ce;re>0;)U.push(+C.slice(ye,re)),ye-=ce,ye<0&&(ye=0),re-=ce;return g(U),new c(U,R)}function Ze(C){if(l)return new d(BigInt(C));if(h(C)){if(C!==v(C))throw new Error(C+" is not an integer.");return new f(C)}return ft(C.toString())}function Se(C){return typeof C=="number"?Ze(C):typeof C=="string"?ft(C):typeof C=="bigint"?new d(C):C}for(var Ue=0;Ue<1e3;Ue++)u[Ue]=Se(Ue),Ue>0&&(u[-Ue]=Se(-Ue));return u.one=u[1],u.zero=u[0],u.minusOne=u[-1],u.max=ue,u.min=de,u.gcd=oe,u.lcm=we,u.isInstance=function(C){return C instanceof c||C instanceof f||C instanceof d},u.randBetween=De,u.fromArray=function(C,M,R){return Ke(C.map(Se),Se(M||10),R)},u}();t.hasOwnProperty("exports")&&(t.exports=e)})(CL);var mpe=CL.exports;const D1=Jd(mpe);var DL=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};const TL="ECDSA",gpe="P-256",ype="SHA-256",bpe=t=>DL(void 0,void 0,void 0,function*(){return yield C1.subtle.importKey("raw",t,{name:TL,namedCurve:gpe},!0,["verify"])}),wpe=(t,e,n)=>DL(void 0,void 0,void 0,function*(){return yield C1.subtle.verify({name:TL,hash:{name:ype}},yield bpe(t),n,e)}),vpe=t=>{const e=S1(t,bL);return Ape(e)},Ape=t=>{if(t.length!==33)throw new Error("Expected 33 byte compress pubkey");if(t[0]!==2&&t[0]!==3)throw new Error("Expected first byte to be 0x02 or 0x03");const e=D1(2),n=e.pow(256).subtract(e.pow(224)).add(e.pow(192)).add(e.pow(96)).subtract(1),r=D1("41058363725152142129326129780047268409114441015993725554835256314039467401291"),i=n.add(1).divide(4),s=D1(t[0]-2),o=t.slice(1),a=D1(Ja(o,"base10")),l=a.pow(3).subtract(a.multiply(3)).add(r).modPow(i,n);let u;l.mod(2).equals(s)?u=l:u=n.subtract(l);const c=hs(u.toString(10),"base10"),f=32-c.length,d=new Uint8Array(32);return d.set(c,f),b1([[4],o,d])};var xpe=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};const Epe={prefix:Jk,jwtAlg:"EdDSA",verifySignature:(t,e,n)=>xpe(void 0,void 0,void 0,function*(){const r=spe(t);return g0.verify(r,e,n)})};var OL=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};const kpe={prefix:wL,jwtAlg:"RS256",verifySignature:(t,e,n)=>OL(void 0,void 0,void 0,function*(){const r=cpe(t);return EL(r,e,n)})},Spe={prefix:vL,jwtAlg:"RS256",verifySignature:(t,e,n)=>OL(void 0,void 0,void 0,function*(){const r=fpe(t);return EL(r,e,n)})};var Cpe=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};const Dpe={prefix:bL,jwtAlg:"ES256",verifySignature:(t,e,n)=>Cpe(void 0,void 0,void 0,function*(){const r=vpe(t);return wpe(r,e,n)})};var Tpe=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},Ope=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(u){s({value:u,done:a})},o)}};const _L="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",_pe=(t=6)=>{let e="";for(let n=0;n<t;n++)e+=_L[Math.floor(Math.random()*_L.length)];return e};function rt(t,e){return typeof t=="object"&&t!=null&&e in t}function lr(t){return typeof t=="object"&&t!=null}function Mpe(t){return typeof t=="object"&&t!=null&&Symbol.iterator in t}function Npe(t){return typeof t=="object"&&t!=null&&Symbol.asyncIterator in t}function Ppe(t){if(Mpe(t)){for(const e of t)return e;return}else{if(Npe(t))return Tpe(this,void 0,void 0,function*(){var e,n;try{for(var r=Ope(t),i;i=yield r.next(),!i.done;)return i.value}catch(s){e={error:s}}finally{try{i&&!i.done&&(n=r.return)&&(yield n.call(r))}finally{if(e)throw e.error}}});throw new TypeError(`Expected either Iterable or AsyncIterable, but got ${t}`)}}function Ipe(t){return lr(t)&&rt(t,"major")&&typeof t.major=="number"&&rt(t,"minor")&&typeof t.minor=="number"&&rt(t,"patch")&&typeof t.patch=="number"}const Rpe=/^0|[1-9]\d*/,Lpe=t=>e=>{const n=e.match(t);return n?n[0].length===e.length:!1};function Zk(t){var e,n,r;const i=t.match(/^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/);if(i===null)return null;const s=`${(e=i.groups)===null||e===void 0?void 0:e.major}.${(n=i.groups)===null||n===void 0?void 0:n.minor}.${(r=i.groups)===null||r===void 0?void 0:r.patch}`.split(".");if(s.length!==3||!s.every(Lpe(Rpe)))return null;const[o,a,l]=s.map(u=>parseInt(u,10));return!Number.isSafeInteger(o)||!Number.isSafeInteger(a)||!Number.isSafeInteger(l)||o<0||a<0||l<0?null:{major:o,minor:a,patch:l}}function Bpe(t){return`${t.major}.${t.minor}.${t.patch}`}const ML=1,NL=0,eS=-1;function tS(t,e){return t==null?e==null?NL:eS:e==null||t>e?ML:t<e?eS:NL}function Fpe(t,e){const n=typeof t=="string"?Zk(t):t,r=typeof e=="string"?Zk(e):e;return tS(n==null?void 0:n.major,r==null?void 0:r.major)||tS(n==null?void 0:n.minor,r==null?void 0:r.minor)||tS(n==null?void 0:n.patch,r==null?void 0:r.patch)}function nS(t,e){return Fpe(t,e)===eS}function Upe(t,e){return!nS(t,e)}const Fn="*",PL="/";function jpe(t){return t===Fn||lr(t)&&rt(t,"namespace")&&typeof t.namespace=="string"&&rt(t,"segments")&&Array.isArray(t.segments)&&t.segments.every(e=>typeof e=="string")}function Hpe(t){return t.join(PL)}function Vpe(t){switch(t){case Fn:return t;default:return Hpe([t.namespace,...t.segments])}}function zpe(t){switch(t){case Fn:return Fn;default:{const[e,...n]=t.split(PL);return{namespace:e,segments:n}}}}const rS=":";function $pe(t){return lr(t)&&rt(t,"scheme")&&typeof t.scheme=="string"&&rt(t,"hierPart")&&(t.hierPart===Fn||typeof t.hierPart=="string")}function Gpe(t){return{scheme:"my",hierPart:t}}function Wpe(t){return`${t.scheme}${rS}${t.hierPart}`}function Kpe(t){const[e,...n]=t.split(rS);return{scheme:e,hierPart:n.join(rS)}}function b0(t){return lr(t)&&rt(t,"with")&&$pe(t.with)&&rt(t,"can")&&jpe(t.can)}function IL(t){return lr(t)&&rt(t,"with")&&typeof t.with=="string"&&rt(t,"can")&&typeof t.can=="string"}function qpe(t){return{with:Gpe(t),can:Fn}}function Qpe(t){return{with:Wpe(t.with),can:Vpe(t.can)}}function Jpe(t){return{with:Kpe(t.with),can:zpe(t.can)}}function iS(t){return lr(t)&&rt(t,"jwtAlg")&&typeof t.jwtAlg=="string"&&rt(t,"sign")&&typeof t.sign=="function"}function Ype(t){return lr(t)&&rt(t,"alg")&&typeof t.alg=="string"&&rt(t,"typ")&&typeof t.typ=="string"&&rt(t,"ucv")&&Ipe(t.ucv)}function Xpe(t){return lr(t)&&rt(t,"iss")&&typeof t.iss=="string"&&rt(t,"aud")&&typeof t.aud=="string"&&rt(t,"exp")&&typeof t.exp=="number"&&(!rt(t,"nbf")||typeof t.nbf=="number")&&(!rt(t,"nnc")||typeof t.nnc=="string")&&rt(t,"att")&&Array.isArray(t.att)&&t.att.every(e=>b0(e)||IL(e))&&(!rt(t,"fct")||Array.isArray(t.fct)&&t.fct.every(lr))&&rt(t,"prf")&&Array.isArray(t.prf)&&t.prf.every(e=>typeof e=="string")}const Zpe={major:0,minor:3,patch:0};function e0e(t){return lr(t)&&rt(t,"alg")&&typeof t.alg=="string"&&rt(t,"typ")&&typeof t.typ=="string"&&rt(t,"uav")&&typeof t.uav=="string"}function t0e(t){return lr(t)&&rt(t,"iss")&&typeof t.iss=="string"&&rt(t,"aud")&&typeof t.aud=="string"&&(!rt(t,"nbf")||typeof t.nbf=="number")&&rt(t,"exp")&&typeof t.exp=="number"&&rt(t,"rsc")&&(typeof t.rsc=="string"||lr(t))&&rt(t,"ptc")&&typeof t.ptc=="string"&&(!rt(t,"prf")||typeof t.prf=="string")}function n0e(t,e){const n=(i,s)=>new Error(`Can't parse UCAN ${i}: ${s}`);if(!lr(t))throw n("header","Invalid format: Expected a record");let r="0.9.1";if(!rt(t,"ucv")||typeof t.ucv!="string"){if(!rt(t,"uav")||typeof t.uav!="string")throw n("header","Invalid format: Missing version indicator");if(t.uav!=="1.0.0")throw n("header",`Unsupported version 'uav: ${t.uav}'`);r="0.3.0"}else if(nS(t.ucv,"0.8.0"))throw n("header",`Unsupported version 'ucv: ${t.ucv}'`);if(Upe(r,"0.8.0")){if(typeof t.ucv!="string")throw n("header","Invalid format: Missing 'ucv' key or 'ucv' is not a string");if(t.ucv=Zk(t.ucv),t.ucv==null)throw n("header","Invalid format: 'ucv' string cannot be parsed into a semantic version");if(!Ype(t))throw n("header","Invalid format");if(!Xpe(e))throw n("payload","Invalid format");return{header:t,payload:e}}if(!e0e(t))throw n("header","Invalid version 0.3.0 format");if(!t0e(e))throw n("payload","Invalid version 0.3.0 format");return{header:{alg:t.alg,typ:t.typ,ucv:Zpe},payload:{iss:e.iss,aud:e.aud,nbf:e.nbf,exp:e.exp,att:(()=>{if(e.rsc===Fn||typeof e.rsc=="string")return[qpe(Fn)];const i=e.rsc;return Object.keys(i).map(s=>({with:{scheme:s,hierPart:i[s]},can:e.ptc===Fn?Fn:{namespace:s,segments:[e.ptc]}}))})(),prf:e.prf!=null?[e.prf]:[]}}}var RL=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},Ou=function(t){return this instanceof Ou?(this.v=t,this):new Ou(t)},r0e=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){s.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{l(r[d](h))}catch(p){f(s[0][3],p)}}function l(d){d.value instanceof Ou?Promise.resolve(d.value.v).then(u,c):f(s[0][2],d)}function u(d){a("next",d)}function c(d){a("throw",d)}function f(d,h){d(h),s.shift(),s.length&&a(s[0][0],s[0][1])}};const i0e="JWT",s0e={major:0,minor:8,patch:1},o0e=t=>e=>{const n=e.issuer,r=LL(Object.assign(Object.assign({},e),{issuer:n.did()}));return sS(t)(r,n)};function LL(t){const{issuer:e,audience:n,capabilities:r=[],lifetimeInSeconds:i=30,expiration:s,notBefore:o,facts:a,proofs:l=[],addNonce:u=!1}=t;if(!e.startsWith("did:"))throw new Error("The issuer must be a DID");if(!n.startsWith("did:"))throw new Error("The audience must be a DID");const c=Math.floor(Date.now()/1e3),f=s||c+i;return{aud:n,att:r,exp:f,fct:a,iss:e,nbf:o,nnc:u?_pe():void 0,prf:l}}const BL=t=>(e,n,r)=>RL(void 0,void 0,void 0,function*(){const i={alg:n,typ:i0e,ucv:s0e};if(!t.verifyIssuerAlg(e.iss,n))throw new Error("The issuer's key type must match the given key type.");const s=a0e(i),o=l0e(e),a=`${s}.${o}`,l=hs(a,"utf8"),u=yield r(l);return Object.freeze({header:i,payload:e,signedData:a,signature:Ja(u,"base64url")})}),sS=t=>(e,n)=>BL(t)(e,n.jwtAlg,r=>n.sign(r));function Qs(t){return`${t.signedData}.${t.signature}`}function a0e(t){const e=Object.assign(Object.assign({},t),{ucv:Bpe(t.ucv)});return Ja(hs(JSON.stringify(e),"utf8"),"base64url")}function l0e(t){const e=Object.assign(Object.assign({},t),{att:t.att.map(Qpe)});return Ja(hs(JSON.stringify(e),"utf8"),"base64url")}function u0e(t){const[e,n,r]=t.split(".");if(e==null||n==null||r==null)throw new Error(`Can't parse UCAN: ${t}: Expected JWT format: 3 dot-separated base64url-encoded values.`);let i,s;try{i=Ja(hs(e,"base64url"),"utf8")}catch{throw new Error(`Can't parse UCAN header: ${e}: Can't parse as base64url.`)}try{s=JSON.parse(i)}catch{throw new Error(`Can't parse UCAN header: ${e}: Can't parse encoded JSON inside.`)}let o,a;try{o=Ja(hs(n,"base64url"),"utf8")}catch{throw new Error(`Can't parse UCAN payload: ${n}: Can't parse as base64url.`)}try{a=JSON.parse(o)}catch{throw new Error(`Can't parse UCAN payload: ${n}: Can't parse encoded JSON inside.`)}const{header:l,payload:u}=n0e(s,a),c=u.att.reduce((f,d)=>IL(d)?[...f,Jpe(d)]:b0(d)?[...f,d]:f,[]);return{header:l,payload:Object.assign(Object.assign({},u),{att:c})}}const T1=t=>(e,n)=>RL(void 0,void 0,void 0,function*(){const{checkIssuer:r=!0,checkSignature:i=!0,checkIsExpired:s=!0,checkIsTooEarly:o=!0}=n??{},{header:a,payload:l}=u0e(e),[u,c,f]=e.split(".");if(r&&!t.verifyIssuerAlg(l.iss,a.alg))throw new Error(`Invalid UCAN: ${e}: Issuer key type does not match UCAN's \`alg\` property.`);if(i){const p=hs(f,"base64url"),m=hs(`${u}.${c}`,"utf8");if(!(yield t.verifySignature(l.iss,m,p)))throw new Error(`Invalid UCAN: ${e}: Signature invalid.`)}const d=`${u}.${c}`,h={header:a,payload:l,signedData:d,signature:f};if(s&&c0e(h))throw new Error(`Invalid UCAN: ${e}: Expired.`);if(o&&f0e(h))throw new Error(`Invalid UCAN: ${e}: Not active yet (too early).`);return h}),FL=t=>function(e,n){return r0e(this,arguments,function*(){const{checkAddressing:r=!0,checkTimeBoundsSubset:i=!0,checkVersionMonotonic:s=!0}=n||{};for(const o of e.payload.prf)try{const a=yield Ou(T1(t)(o,n));if(r&&e.payload.iss!==a.payload.aud)throw new Error(`Invalid Proof: Issuer ${e.payload.iss} doesn't match parent's audience ${a.payload.aud}`);if(i&&a.payload.nbf!=null&&e.payload.exp>a.payload.nbf)throw new Error(`Invalid Proof: 'Not before' (${a.payload.nbf}) is after parent's expiration (${e.payload.exp})`);if(i&&e.payload.nbf!=null&&e.payload.nbf>a.payload.exp)throw new Error(`Invalid Proof: Expiration (${a.payload.exp}) is before parent's 'not before' (${e.payload.nbf})`);if(s&&nS(e.header.ucv,a.header.ucv))throw new Error(`Invalid Proof: Version (${a.header.ucv}) is higher than parent's version (${e.header.ucv})`);yield yield Ou(a)}catch(a){a instanceof Error?yield yield Ou(a):yield yield Ou(new Error(`Error when trying to parse UCAN proof: ${a}`))}})};function c0e(t){return t.payload.exp<=Math.floor(Date.now()/1e3)}const f0e=t=>t.payload.nbf==null?!1:t.payload.nbf>Math.floor(Date.now()/1e3);var d0e=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},Ht=function(t){return this instanceof Ht?(this.v=t,this):new Ht(t)},No=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(u){s({value:u,done:a})},o)}},w0=function(t){var e,n;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=t[i]?function(o){return(n=!n)?{value:Ht(t[i](o)),done:i==="return"}:s?s(o):o}:s}},v0=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){s.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{l(r[d](h))}catch(p){f(s[0][3],p)}}function l(d){d.value instanceof Ht?Promise.resolve(d.value.v).then(u,c):f(s[0][2],d)}function u(d){a("next",d)}function c(d){a("throw",d)}function f(d,h){d(h),s.shift(),s.length&&a(s[0][0],s[0][1])}};const qf=t=>function(e,n,r=()=>d0e(this,void 0,void 0,function*(){return!1})){return v0(this,arguments,function*(){if(yield Ht(r(n)))return yield yield Ht(new Error(`UCAN Revoked: ${Qs(n)}`)),yield Ht(void 0);yield Ht(yield*w0(No(m0e(n)))),yield Ht(yield*w0(No(g0e(t,e,n,r))))})};function oS(t){return"capability"in t?t.chainStep==null?t.ucan.payload.iss:oS(t.chainStep):t.ownershipDID}const h0e={canDelegateResource(t,e){return t.scheme!==e.scheme?!1:t.hierPart===e.hierPart},canDelegateAbility(t,e){return t===Fn?!0:e===Fn||t.namespace!==e.namespace||t.segments.length!==e.segments.length?!1:t.segments.reduce((n,r,i)=>n&&e.segments[i]===r,!0)}};function O1(t,e,n){if("capability"in n)return v0e(t,n.capability,e);const r=n.scope;return r===Fn?!0:r.scheme==e.with.scheme&&t.canDelegateAbility(r.ability,e.can)}function p0e(t,e,n,r){if(e!==r.ownershipDID)return!1;const i=r.scope;return i===Fn?!0:n===Fn?!1:i.scheme===n.scheme&&t.canDelegateAbility(i.ability,n.ability)}function*m0e(t){for(const e of t.payload.att)switch(e.with.scheme.toLowerCase()){case"my":{const n=e.with.hierPart===Fn?Fn:{scheme:e.with.hierPart,ability:e.can};yield{ownershipDID:t.payload.iss,scope:n,ucan:t};break}case"as":case"prf":break;default:yield{capability:e,ucan:t}}}function g0e(t,e,n,r){return v0(this,arguments,function*(){var s,o;let a=0;try{for(var l=No(FL(t)(n)),u;u=yield Ht(l.next()),!u.done;){const f=u.value;if(f instanceof Error){yield yield Ht(f);continue}for(const d of n.payload.att)try{switch(d.with.scheme.toLowerCase()){case"my":continue;case"as":{yield Ht(yield*w0(No(y0e(t,e,d,n,f,r))));break}case"prf":{yield Ht(yield*w0(No(b0e(t,e,d,n,f,a,r))));break}default:yield Ht(yield*w0(No(w0e(t,e,d,n,f,r))))}}catch(h){yield yield Ht(c(h))}a++}}catch(f){s={error:f}}finally{try{u&&!u.done&&(o=l.return)&&(yield Ht(o.call(l)))}finally{if(s)throw s.error}}function c(f){return f instanceof Error?f:new Error(`Error during capability delegation checking: ${f}`)}})}function y0e(t,e,n,r,i,s){return v0(this,arguments,function*(){var a,l;const u=n.with.hierPart.split(":"),c=u[u.length-1],f=u.slice(0,-1).join(":"),d=c===Fn?Fn:{scheme:c,ability:n.can};try{for(var h=No(qf(t)(e,i,s)),p;p=yield Ht(h.next()),!p.done;){const m=p.value;if(m instanceof Error){yield yield Ht(m);continue}"ownershipDID"in m&&p0e(e,f,d,m)&&(yield yield Ht({ownershipDID:f,scope:d,ucan:r,chainStep:m}))}}catch(m){a={error:m}}finally{try{p&&!p.done&&(l=h.return)&&(yield Ht(l.call(h)))}finally{if(a)throw a.error}}})}function b0e(t,e,n,r,i,s,o){return v0(this,arguments,function*(){var l,u;if(n.with.hierPart!==Fn&&parseInt(n.with.hierPart,10)!==s)return yield Ht(void 0);try{for(var c=No(qf(t)(e,i,o)),f;f=yield Ht(c.next()),!f.done;){const d=f.value;if(d instanceof Error){yield yield Ht(d);continue}"capability"in d&&(yield yield Ht({capability:d.capability,ucan:r,chainStep:d}))}}catch(d){l={error:d}}finally{try{f&&!f.done&&(u=c.return)&&(yield Ht(u.call(c)))}finally{if(l)throw l.error}}})}function w0e(t,e,n,r,i,s){return v0(this,arguments,function*(){var a,l;try{for(var u=No(qf(t)(e,i,s)),c;c=yield Ht(u.next()),!c.done;){const f=c.value;if(f instanceof Error){yield yield Ht(f);continue}O1(e,n,f)&&(yield yield Ht({capability:n,ucan:r,chainStep:f}))}}catch(f){a={error:f}}finally{try{c&&!c.done&&(l=u.return)&&(yield Ht(l.call(u)))}finally{if(a)throw a.error}}})}function v0e(t,e,n){return t.canDelegateResource(e.with,n.with)&&t.canDelegateAbility(e.can,n.can)}var UL=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},A0e=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(u){s({value:u,done:a})},o)}};const x0e=t=>({ok:!0,value:t}),aS=t=>({ok:!1,error:t}),E0e=t=>(e,n)=>UL(void 0,void 0,void 0,function*(){var r,i,s,o,a;const{audience:l,requiredCapabilities:u}=n,c=(s=n.semantics)!==null&&s!==void 0?s:h0e,f=(o=n.isRevoked)!==null&&o!==void 0?o:()=>UL(void 0,void 0,void 0,function*(){return!1}),d=(a=n.checkFacts)!==null&&a!==void 0?a:()=>!0;if(typeof e!="string")throw new TypeError(`Expected an encoded UCAN string as first argument, but got ${e}`);if(typeof l!="string"||!l.startsWith("did:"))throw new TypeError(`Expected a DID string as second argument, but got ${l}`);if(typeof f!="function")throw new TypeError(`Expected a function returning a promise as third argument, but got ${f}`);if(!Array.isArray(u))throw new TypeError(`Expected an array as fourth argument, but got ${u}`);if(u.length<1)throw new TypeError("Expected a non-empty list of required capabilities as 4th argument.");if(u.some(m=>!b0(m.capability)||typeof m.rootIssuer!="string"||!m.rootIssuer.startsWith("did:")))throw new TypeError(`Expected an array of records of capabilities and rootIssuers as DID strings as 4th argument, but got ${u}`);if(typeof c.canDelegateResource!="function"||typeof c.canDelegateAbility!="function")throw new TypeError(`Expected a record with two functions 'canDelegateResource' and 'canDelegateAbility' as 5th argument, but got ${c}`);if(typeof d!="function")throw new TypeError(`Expected a function as 6th argument, but got ${d}`);try{const m=yield T1(t)(e);if(m.payload.aud!==l)return aS([new Error(`Invalid UCAN: Expected audience to be ${l}, but it's ${m.payload.aud}`)]);const g=[],y=new Set(u),v=[];try{e:for(var h=A0e(qf(t)(c,m,f)),p;p=yield h.next(),!p.done;){const w=p.value;if(w instanceof Error){g.push(w);continue}for(const b of y)O1(c,b.capability,w)&&oS(w)===b.rootIssuer&&(y.delete(b),v.push(Object.assign(Object.assign({},b),{proof:w})));if(y.size===0)break e}}catch(w){r={error:w}}finally{try{p&&!p.done&&(i=h.return)&&(yield i.call(h))}finally{if(r)throw r.error}}return y.size>0?aS(g):x0e(v)}catch(m){return aS([m instanceof Error?m:new Error(`Unknown error during UCAN verification: ${m}`)])}});var k0e=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};function jL(t){return lr(t)&&rt(t,"issuer")&&iS(t.issuer)&&rt(t,"audience")&&typeof t.audience=="string"&&rt(t,"expiration")&&typeof t.expiration=="number"}function S0e(t){return lr(t)&&rt(t,"issuer")&&iS(t.issuer)&&rt(t,"expiration")&&typeof t.expiration=="number"}const C0e=t=>class vs{constructor(n,r){this.state=n,this.defaultable=r}static create(){return new vs({},{capabilities:[],facts:[],proofs:[],addNonce:!1})}issuedBy(n){if(!iS(n))throw new TypeError(`Expected a Keypair, but got ${n}`);return new vs(Object.assign(Object.assign({},this.state),{issuer:n}),this.defaultable)}toAudience(n){if(typeof n!="string")throw new TypeError(`Expected audience DID as string, but got ${n}`);return new vs(Object.assign(Object.assign({},this.state),{audience:n}),this.defaultable)}withLifetimeInSeconds(n){if(typeof n!="number")throw new TypeError(`Expected seconds as number, but got ${n}`);if(!isFinite(n)||n<=0)throw new TypeError(`Expected seconds to be a positive number, but got ${n}`);return this.withExpiration(Math.floor(Date.now()/1e3)+n)}withExpiration(n){if(typeof n!="number"||!isFinite(n))throw new TypeError(`Expected expiration as number, but got ${n}`);if(this.defaultable.notBefore!=null&&n<this.defaultable.notBefore)throw new Error(`Can't set expiration to ${n} which is before 'notBefore': ${this.defaultable.notBefore}`);return new vs(Object.assign(Object.assign({},this.state),{expiration:n}),this.defaultable)}withNotBefore(n){if(typeof n!="number"||!isFinite(n))throw new TypeError(`Expected notBeforeTimestamp as number, but got ${n}`);if(rt(this.state,"expiration")&&typeof this.state.expiration=="number"&&this.state.expiration<n)throw new Error(`Can't set 'notBefore' to ${n} which is after expiration: ${this.state.expiration}`);return new vs(this.state,Object.assign(Object.assign({},this.defaultable),{notBefore:n}))}withFact(n,...r){if(!lr(n)||r.some(i=>!lr(i)))throw new TypeError(`Expected fact(s) to be a record, but got ${n}`);return new vs(this.state,Object.assign(Object.assign({},this.defaultable),{facts:[...this.defaultable.facts,n,...r]}))}withNonce(){return new vs(this.state,Object.assign(Object.assign({},this.defaultable),{addNonce:!0}))}claimCapability(n,...r){if(!b0(n))throw new TypeError(`Expected capability, but got ${JSON.stringify(n,null," ")}`);return new vs(this.state,Object.assign(Object.assign({},this.defaultable),{capabilities:[...this.defaultable.capabilities,n,...r]}))}delegateCapability(n,r,i){if(!b0(n))throw new TypeError(`Expected 'requiredCapability' as a second argument, but got ${n}`);if(!S0e(this.state))throw new Error("Can't delegate capabilities without having these paramenters set in the builder: issuer and expiration.");function s(o){return rt(o,"capability")||rt(o,"ownershipDID")}if(s(r)){if(i==null)throw new TypeError("Expected 'semantics' as third argument if a 'proof' DelegationChain was passed as second.");const o=r,a=o.ucan;if(!O1(i,n,o))throw new Error("Can't add capability to UCAN: Given proof doesn't give required rights to delegate.");return new vs(this.state,Object.assign(Object.assign({},this.defaultable),{capabilities:[...this.defaultable.capabilities,n],proofs:this.defaultable.proofs.find(l=>Qs(l)===Qs(a))==null?[...this.defaultable.proofs,a]:this.defaultable.proofs}))}else{const o=r,a=this.state.issuer.did(),l=Ppe(o.findWithCapability(a,n,a));if(l!=null){const u=l.ucan,c=Qs(u);return new vs(this.state,Object.assign(Object.assign({},this.defaultable),{capabilities:[...this.defaultable.capabilities,n],proofs:this.defaultable.proofs.find(f=>Qs(f)===c)==null?[...this.defaultable.proofs,u]:this.defaultable.proofs}))}else throw new Error("Couldn't add capability to UCAN. Couldn't find anything providing this capability in given store.")}}buildPayload(){if(!jL(this.state))throw new Error("Builder is missing one of the required properties before it can be built: issuer, audience and expiration.");return LL({issuer:this.state.issuer.did(),audience:this.state.audience,expiration:this.state.expiration,notBefore:this.defaultable.notBefore,addNonce:this.defaultable.addNonce,capabilities:this.defaultable.capabilities,facts:this.defaultable.facts,proofs:this.defaultable.proofs.map(n=>Qs(n))})}build(){return k0e(this,void 0,void 0,function*(){if(!jL(this.state))throw new Error("Builder is missing one of the required properties before it can be built: issuer, audience and expiration.");const n=this.buildPayload();return yield sS(t)(n,this.state.issuer)})}};var HL=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},VL=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(u){s({value:u,done:a})},o)}};const D0e=t=>class zC{constructor(n,r){this.index=r,this.knownSemantics=n}static empty(n){return new zC(n,{})}static fromTokens(n,r){var i,s,o,a;return HL(this,void 0,void 0,function*(){const l=zC.empty(n);try{for(i=VL(r);s=yield i.next(),!s.done;){const u=s.value,c=yield T1(t)(u);yield l.add(c)}}catch(u){o={error:u}}finally{try{s&&!s.done&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return l})}add(n){var r,i,s;return HL(this,void 0,void 0,function*(){const o=n.payload.aud,a=(s=this.index[o])!==null&&s!==void 0?s:[],l=Qs(n);if(a.find(d=>Qs(d.processedUcan)===l)!=null)return;const u=[];try{for(var c=VL(qf(t)(this.knownSemantics,n)),f;f=yield c.next(),!f.done;){const d=f.value;if(d instanceof Error){console.warn("Delegation chain error while storing UCAN:",d);continue}u.push(d)}}catch(d){r={error:d}}finally{try{f&&!f.done&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}a.find(d=>Qs(d.processedUcan)===l)==null&&(a.push({processedUcan:n,capabilities:u}),this.index[o]=a)})}getByAudience(n){var r;return((r=this.index[n])!==null&&r!==void 0?r:[]).map(i=>i.processedUcan)}findByAudience(n,r){var i,s,o;return(o=(s=(i=this.index[n])===null||i===void 0?void 0:i.find(a=>r(a.processedUcan)))===null||s===void 0?void 0:s.processedUcan)!==null&&o!==void 0?o:null}*findWithCapability(n,r,i){const s=this.index[n];if(s!=null)for(const o of s)for(const a of o.capabilities)O1(this.knownSemantics,r,a)&&oS(a)===i&&(yield a)}};var T0e=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};class O0e{constructor(e,n){this.keys=e,this.methods=n}verifyIssuerAlg(e,n){const r=WL(e);if(r==="key"){const i=GL(e);for(const s of this.keys)if(zL(i,s.prefix))return n===s.jwtAlg}else{const i=this.methods[r];if(i)return i.checkJwtAlg(e,n)}throw new Error(`DID method not supported by plugins: ${e}`)}verifySignature(e,n,r){return T0e(this,void 0,void 0,function*(){const i=WL(e);if(i==="key"){const s=GL(e);for(const o of this.keys)if(zL(s,o.prefix))return o.verifySignature(e,n,r)}else{const s=this.methods[i];if(s)return s.verifySignature(e,n,r)}throw new Error(`DID method not supported by plugins: ${e}`)})}}const zL=(t,e)=>nL(e,t.subarray(0,e.byteLength)),$L="did:key:z",GL=t=>{if(!t.startsWith($L))throw new Error(`Not a valid base58 formatted did:key: ${t}`);return hs(t.slice($L.length),"base58btc")},WL=t=>{const e=t.split(":");if(e[0]!=="did")throw new Error(`Not a DID: ${t}`);if(e[1].length<1)throw new Error(`No DID method included: ${t}`);return e[1]},_0e=t=>{const e=o0e(t),n=BL(t),r=sS(t),i=T1(t),s=FL(t),o=E0e(t),a=qf(t),l=C0e(t),u=D0e(t);return{build:e,sign:n,signWithKeypair:r,validate:i,validateProofs:s,verify:o,delegationChains:a,Builder:l,Store:u}},M0e=new O0e([Epe,Dpe,kpe,Spe],{}),N0e=_0e(M0e).build;for(var ur=[],lS=0;lS<256;++lS)ur.push((lS+256).toString(16).slice(1));function P0e(t,e=0){return(ur[t[e+0]]+ur[t[e+1]]+ur[t[e+2]]+ur[t[e+3]]+"-"+ur[t[e+4]]+ur[t[e+5]]+"-"+ur[t[e+6]]+ur[t[e+7]]+"-"+ur[t[e+8]]+ur[t[e+9]]+"-"+ur[t[e+10]]+ur[t[e+11]]+ur[t[e+12]]+ur[t[e+13]]+ur[t[e+14]]+ur[t[e+15]]).toLowerCase()}var _1,I0e=new Uint8Array(16);function R0e(){if(!_1&&(_1=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_1))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _1(I0e)}var uS,M1,cS=0,fS=0;function L0e(t,e,n){var r=0,i=new Array(16);t=t||{};var s=t.node,o=t.clockseq;if(t._v6||(s||(s=uS),o==null&&(o=M1)),s==null||o==null){var a=t.random||(t.rng||R0e)();s==null&&(s=[a[0],a[1],a[2],a[3],a[4],a[5]],!uS&&!t._v6&&(s[0]|=1,uS=s)),o==null&&(o=(a[6]<<8|a[7])&16383,M1===void 0&&!t._v6&&(M1=o))}var l=t.msecs!==void 0?t.msecs:Date.now(),u=t.nsecs!==void 0?t.nsecs:fS+1,c=l-cS+(u-fS)/1e4;if(c<0&&t.clockseq===void 0&&(o=o+1&16383),(c<0||l>cS)&&t.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");cS=l,fS=u,M1=o,l+=122192928e5;var f=((l&268435455)*1e4+u)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=f&255;var d=l/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=d&255,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=o>>>8|128,i[r++]=o&255;for(var h=0;h<6;++h)i[r+h]=s[h];return P0e(i)}const N1=typeof Buffer=="function";typeof TextDecoder=="function"&&new TextDecoder,typeof TextEncoder=="function"&&new TextEncoder;const A0=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),P1=(t=>{let e={};return t.forEach((n,r)=>e[n]=r),e})(A0),B0e=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,I1=String.fromCharCode.bind(String),KL=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),F0e=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),qL=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),U0e=typeof btoa=="function"?t=>btoa(t):N1?t=>Buffer.from(t,"binary").toString("base64"):t=>{let e,n,r,i,s="";const o=t.length%3;for(let a=0;a<t.length;){if((n=t.charCodeAt(a++))>255||(r=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=n<<16|r<<8|i,s+=A0[e>>18&63]+A0[e>>12&63]+A0[e>>6&63]+A0[e&63]}return o?s.slice(0,o-3)+"===".substring(o):s},QL=N1?t=>Buffer.from(t).toString("base64"):t=>{let n=[];for(let r=0,i=t.length;r<i;r+=4096)n.push(I1.apply(null,t.subarray(r,r+4096)));return U0e(n.join(""))},dS=(t,e=!1)=>e?F0e(QL(t)):QL(t),j0e=typeof atob=="function"?t=>atob(qL(t)):N1?t=>Buffer.from(t,"base64").toString("binary"):t=>{if(t=t.replace(/\s+/g,""),!B0e.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(t.length&3));let e,n="",r,i;for(let s=0;s<t.length;)e=P1[t.charAt(s++)]<<18|P1[t.charAt(s++)]<<12|(r=P1[t.charAt(s++)])<<6|(i=P1[t.charAt(s++)]),n+=r===64?I1(e>>16&255):i===64?I1(e>>16&255,e>>8&255):I1(e>>16&255,e>>8&255,e&255);return n},H0e=N1?t=>KL(Buffer.from(t,"base64")):t=>KL(j0e(t).split("").map(e=>e.charCodeAt(0))),JL=t=>H0e(V0e(t)),V0e=t=>qL(t.replace(/[-_]/g,e=>e=="-"?"+":"/"));var hS={exports:{}},pS={},R1={exports:{}},mS={};/**
560
- * @license React
561
- * use-sync-external-store-shim.production.min.js
562
- *
563
- * Copyright (c) Facebook, Inc. and its affiliates.
564
- *
565
- * This source code is licensed under the MIT license found in the
566
- * LICENSE file in the root directory of this source tree.
567
- */var YL;function z0e(){if(YL)return mS;YL=1;var t=_;function e(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,d){var h=d(),p=r({inst:{value:h,getSnapshot:d}}),m=p[0].inst,g=p[1];return s(function(){m.value=h,m.getSnapshot=d,l(m)&&g({inst:m})},[f,h,d]),i(function(){return l(m)&&g({inst:m}),f(function(){l(m)&&g({inst:m})})},[f]),o(h),h}function l(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function u(f,d){return d()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return mS.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:c,mS}var gS={};/**
568
- * @license React
569
- * use-sync-external-store-shim.development.js
570
- *
571
- * Copyright (c) Facebook, Inc. and its affiliates.
572
- *
573
- * This source code is licensed under the MIT license found in the
574
- * LICENSE file in the root directory of this source tree.
575
- */var XL;function $0e(){return XL||(XL=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=_,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(w){{for(var b=arguments.length,E=new Array(b>1?b-1:0),x=1;x<b;x++)E[x-1]=arguments[x];r("error",w,E)}}function r(w,b,E){{var x=e.ReactDebugCurrentFrame,O=x.getStackAddendum();O!==""&&(b+="%s",E=E.concat([O]));var S=E.map(function(D){return String(D)});S.unshift("Warning: "+b),Function.prototype.apply.call(console[w],console,S)}}function i(w,b){return w===b&&(w!==0||1/w===1/b)||w!==w&&b!==b}var s=typeof Object.is=="function"?Object.is:i,o=t.useState,a=t.useEffect,l=t.useLayoutEffect,u=t.useDebugValue,c=!1,f=!1;function d(w,b,E){c||t.startTransition!==void 0&&(c=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var x=b();if(!f){var O=b();s(x,O)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var S=o({inst:{value:x,getSnapshot:b}}),D=S[0].inst,I=S[1];return l(function(){D.value=x,D.getSnapshot=b,h(D)&&I({inst:D})},[w,x,b]),a(function(){h(D)&&I({inst:D});var F=function(){h(D)&&I({inst:D})};return w(F)},[w]),u(x),x}function h(w){var b=w.getSnapshot,E=w.value;try{var x=b();return!s(E,x)}catch{return!0}}function p(w,b,E){return b()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,y=g?p:d,v=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y;gS.useSyncExternalStore=v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),gS}var ZL;function eB(){return ZL||(ZL=1,process.env.NODE_ENV==="production"?R1.exports=z0e():R1.exports=$0e()),R1.exports}/**
576
- * @license React
577
- * use-sync-external-store-shim/with-selector.production.min.js
578
- *
579
- * Copyright (c) Facebook, Inc. and its affiliates.
580
- *
581
- * This source code is licensed under the MIT license found in the
582
- * LICENSE file in the root directory of this source tree.
583
- */var tB;function G0e(){if(tB)return pS;tB=1;var t=_,e=eB();function n(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return pS.useSyncExternalStoreWithSelector=function(u,c,f,d,h){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(x){if(!v){if(v=!0,w=x,x=d(x),h!==void 0&&m.hasValue){var O=m.value;if(h(O,x))return b=O}return b=x}if(O=b,r(w,x))return O;var S=d(x);return h!==void 0&&h(O,S)?O:(w=x,b=S)}var v=!1,w,b,E=f===void 0?null:f;return[function(){return y(c())},E===null?void 0:function(){return y(E())}]},[c,f,d,h]);var g=i(u,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},pS}var yS={};/**
584
- * @license React
585
- * use-sync-external-store-shim/with-selector.development.js
586
- *
587
- * Copyright (c) Facebook, Inc. and its affiliates.
588
- *
589
- * This source code is licensed under the MIT license found in the
590
- * LICENSE file in the root directory of this source tree.
591
- */var nB;function W0e(){return nB||(nB=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=_,e=eB();function n(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;function u(c,f,d,h,p){var m=s(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var y=a(function(){var E=!1,x,O,S=function(Q){if(!E){E=!0,x=Q;var V=h(Q);if(p!==void 0&&g.hasValue){var B=g.value;if(p(B,V))return O=B,B}return O=V,V}var N=x,H=O;if(r(N,Q))return H;var K=h(Q);return p!==void 0&&p(H,K)?H:(x=Q,O=K,K)},D=d===void 0?null:d,I=function(){return S(f())},F=D===null?void 0:function(){return S(D())};return[I,F]},[f,d,h,p]),v=y[0],w=y[1],b=i(c,v,w);return o(function(){g.hasValue=!0,g.value=b},[b]),l(b),b}yS.useSyncExternalStoreWithSelector=u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),yS}process.env.NODE_ENV==="production"?hS.exports=G0e():hS.exports=W0e();var K0e=hS.exports,q0e=_.useLayoutEffect;function rB(t){var e=Y.useRef();return e.current||(e.current={v:t()}),e.current.v}var L1=function(){return L1=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},L1.apply(this,arguments)},Q0e=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},J0e=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s};function Y0e(t,e){var n=rB(function(){return typeof t=="function"?t():t});if(process.env.NODE_ENV!=="production"&&typeof t!="function"){var r=J0e(_.useState(n),1),i=r[0];t!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var s=e.context,o=e.guards,a=e.actions,l=e.activities,u=e.services,c=e.delays;e.state;var f=Q0e(e,["context","guards","actions","activities","services","delays","state"]),d=rB(function(){var h={context:s,guards:o,actions:a,activities:l,services:u,delays:c},p=n.withConfig(h,function(){return L1(L1({},n.context),s)});return Y5(p,f)});return q0e(function(){Object.assign(d.machine.options.actions,a),Object.assign(d.machine.options.guards,o),Object.assign(d.machine.options.activities,l),Object.assign(d.machine.options.services,u),Object.assign(d.machine.options.delays,c)},[a,o,l,u,c]),d}function X0e(t,e,n){if(t.status===wn.NotStarted)return!0;var r=n.changed===void 0&&(Object.keys(n.children).length>0||typeof e.changed=="boolean");return!(n.changed||r)}var Z0e=function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s};function eme(t){return t}function tme(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=Z0e(e,1),i=r[0],s=i===void 0?{}:i,o=Y0e(t,s),a=_.useCallback(function(){return o.status===wn.NotStarted?s.state?Bi.create(s.state):o.machine.initialState:o.getSnapshot()},[o]),l=_.useCallback(function(f,d){return X0e(o,f,d)},[o]),u=_.useCallback(function(f){var d=o.subscribe(f).unsubscribe;return d},[o]),c=K0e.useSyncExternalStoreWithSelector(u,a,a,eme,l);return _.useEffect(function(){var f=s.state;return o.start(f?Bi.create(f):void 0),function(){o.stop(),o.status=wn.NotStarted}},[]),[c,o.send,o]}var iB=async t=>{const e={kty:"oct",k:t,alg:"A128GCM",ext:!0};return await window.crypto.subtle.importKey("jwk",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])},nme=t=>{const e=new Uint8Array(t);let n="";for(let r=0;r<e.byteLength;r++)n+=String.fromCharCode(e[r]);return btoa(n)},sB=async(t,e,n)=>{const r=await iB(e),i=new TextEncoder().encode(n),s=new TextEncoder().encode(t),o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},r,s);return{iv:i,encryptedData:nme(o)}},rme=t=>{const e=atob(t),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);return r.buffer},oB=async(t,e,n)=>{const r=rme(t),i=await iB(e),s=new TextEncoder().encode(n),o=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:s},i,r);return new TextDecoder().decode(o)},ime=class{constructor(t,e){this._onMessageHandler=null,this._onConnection=null,this._onDisconnection=null,this._isManuallyDisconnected=!1,this._sequenceCallbackMap={},this._webSocketStatus=0,this._webSocket=null,this.isWebSocketReady=!1,this._websocketServiceDid="",this.isAuthenticated=!1,this.roomId="",this.clientUcanKeyPair=null,this.clientUsername="",this.isAuthenticating=!1,this.roomMembers=[],this.key="",this._onError=null,this.roomKey="",this.disconnect=()=>{this._webSocketStatus=3,this._webSocket&&(this._webSocket.onopen=null,this._webSocket.removeEventListener("message",this._processMessage),this._webSocket.close(1e3,"auth failed"),this._webSocketStatus=4)},this.handleHandShake=async n=>{if(this._websocketServiceDid=n.server_did,this._webSocketStatus!==1||!this.roomId)throw new Error("cannot establish handshake. websocket is either not connected or roomId is not defined");const r=await y0.create();this.clientUcanKeyPair=await y0.create();const i=await N0e({audience:this._websocketServiceDid,issuer:r,capabilities:[{with:{scheme:"fileverse",hierPart:`//solo.fileverse.io/doc/${this.roomId}`},can:{namespace:"crud",segments:["EDIT"]}}]}),s=Qs(i),o={cmd:"/auth",args:{username:this.clientUsername||"default-username",token:s}};this.isAuthenticating=!0;const a=await this._sendNetworkRequest(o,!0,!1);return this.isAuthenticating=!1,a},this._websocketUrl=t||"ws://localhost:5000",this._processMessage=this._processMessage.bind(this),this.roomKey=e}async _decryptMessage(t){var n,r;if(!this.roomKey)throw new Error("Cannot decrypt request without a room key");const e=JSON.parse(t);return(r=(n=e==null?void 0:e.event)==null?void 0:n.data)!=null&&r.data&&(e.event.data.data.position?e.event.data.data.position=await oB(e==null?void 0:e.event.data.data.position,this.roomKey,this.roomId):e.event.data.data=await oB(e==null?void 0:e.event.data.data,this.roomKey,this.roomId)),e}_getSequenceIdCallback(t){return this._sequenceCallbackMap[t]}_removeSequenceIdFromMap(t){delete this._sequenceCallbackMap[t]}_registerSequenceCallback(t,e,n){this._sequenceCallbackMap[t]={payload:n,callback:e}}async _encryptRequest(t){if(!this.roomKey)throw new Error("Cannot encrypt request without a room key");if(!t.args.data)return JSON.stringify(t);if(t.args.data.position){const e=(await sB(t.args.data.position,this.roomKey,this.roomId)).encryptedData;t.args.data.position=e}else t.args.data=(await sB(t.args.data,this.roomKey,this.roomId)).encryptedData;return JSON.stringify(t)}async _sendNetworkRequest(t,e=!0,n=!0){var o;const r=L0e(),i={...t,seq_id:r},s=n?await this._encryptRequest(i):JSON.stringify(i);if(this._isManuallyDisconnected||this._webSocketStatus!==1||!this._webSocket)throw(o=this._onError)==null||o.call(this,"Cannot send request, websocket is not connected"),new Error("Cannot send request, websocket is not connected");return new Promise(a=>{if(!this._webSocket){a(null);return}this._webSocket.send(s),e?this._registerSequenceCallback(r,a,i):a(null)})}async _fetchRoomMembers(){if(!this.roomId)throw new Error(`Cannot fetch members of room id: ${this.roomId}`);const t={cmd:"/documents/peers/list",args:{document_id:this.roomId}},e=await this._sendNetworkRequest(t);if(!e||!e.status)throw new Error("failed to make fetch members");this.roomMembers=e.data.peers}async sendUpdate({update:t}){const e={cmd:"/documents/update",args:{document_id:this.roomId,data:dS(t),update_snapshot_ref:null}};return await this._sendNetworkRequest(e)}async broadcastAwareness(t){const e={cmd:"/documents/awareness",args:{document_id:this.roomId,data:{position:dS(t)}}};return await this._sendNetworkRequest(e)}async sendTrackUpdate({update:t}){const e={cmd:"/documents/track",args:{document_id:this.roomId,data:dS(t)}};return await this._sendNetworkRequest(e)}async _processMessage(t){var n,r;if(this._isManuallyDisconnected)return;let e;if(t.data==="PONG"&&(e=t.data),e||(e=JSON.parse(t.data)),!e)throw new Error("Failed to get message data");if(e=await this._decryptMessage(t.data),e.seq_id){const i=this._getSequenceIdCallback(e.seq_id);if(i&&typeof i.callback=="function"){this._removeSequenceIdFromMap(e.seq_id),delete e.seq_id,i.callback(e);return}}if(e.is_handshake_response){if(e.server_did){const i=await this.handleHandShake(e);if(!i||!i.is_handshake_response){this.disconnect();return}this.isAuthenticated=!0,(n=this._onConnection)==null||n.call(this)}return}e.event&&e.type==="ROOM_UPDATE"&&e.event_type==="ROOM_MEMBERSHIP_CHANGE"&&await this._fetchRoomMembers(),(r=this._onMessageHandler)==null||r.call(this,e)}_clearSequenceCallbackMap(){this._sequenceCallbackMap={}}connectSocket(){if(this._webSocketStatus===1||this._webSocketStatus===2)return;this._webSocketStatus=2,this._isManuallyDisconnected=!1;const t={maxReconnectionDelay:1e4,minReconnectionDelay:1500,reconnectionDelayGrowFactor:1.3,connectionTimeout:6e3,maxRetries:0};return new Promise((e,n)=>{this._webSocket=new Mde(this._websocketUrl,[],t),this._webSocket.addEventListener("message",this._processMessage),this._webSocket.onopen=()=>{this.isWebSocketReady=!1,this._webSocketStatus=1,this._clearSequenceCallbackMap(),e()},this._webSocket.onclose=r=>{var i;this._webSocketStatus=0,this.isWebSocketReady=!1,(i=this._onDisconnection)==null||i.call(this,r)},this._webSocket.onerror=r=>{var i;console.info("SocketAPI: socket error",r),this._webSocketStatus=0,this.isWebSocketReady=!1,(i=this._onError)==null||i.call(this,"Failed to connect to Socket")}})}async init(t){this._onConnection=t.onConnect,this._onDisconnection=t.onDisconnect,this._onMessageHandler=t.onMessage,this._onError=t.onError,this.roomId=t.roomId,this.clientUsername=t.username,await this.connectSocket()}},sme=(t,e,n)=>({added:r,updated:i,removed:s})=>{const o=r.concat(i).concat(s),a=jc();Gr(a,jJ(t,o)),n&&e&&e.broadcastAwareness(Ti(a))},ome=Cde({id:"fileverse-sync-machine",schema:{context:{},events:{}},predictableActionArguments:!0,initial:"disconnected",context:{socketClient:null,roomId:"",username:"",ydoc:new ka,roomMembers:[],isConnected:!1,awareness:null,_awarenessUpdateHandler:null,onError:null,roomKey:null},on:{SEND_UPDATE:"updating",UPDATE_COMMIT:{actions:"updateCommitRecord"},ROOM_MEMBERSHIP_CHANGE:{actions:"updateRoomMembers",target:"send_initial_update"},MESSAGE_RECEIVED:{actions:"processMessage"},CONTENT_UPDATE:{actions:"applyUpdate"},SEND_INIT_UPDATE:"send_initial_update",DISCONNECT:"disconnecting",AWARENESS_UPDATE:{actions:"applyAwarenessState"},INIT_AWARENESS:{actions:"handleAwareness"},RESET_STATE:{actions:"handleReset",target:"disconnected"}},states:{disconnected:{entry:["setConnectState"],on:{CONNECT:{target:"connecting",actions:["initSync"]}}},connecting:{invoke:{id:"connectSocket",src:"connectSocket",onError:"disconnected"}},send_initial_update:{invoke:{id:"broadcastLocalLatestCommit",src:"broadcastLocalLatestCommit",onDone:"connected"}},updating:{invoke:{id:"sendUpdates",src:"sendUpdates",onDone:[{target:"connected",cond:"isUserConnected"},{target:"disconnected"}]}},connected:{entry:["setConnectState"],on:{DISCONNECT:"disconnecting"}},disconnecting:{invoke:{id:"disconnectSocket",src:"disconnectSocket",onDone:"disconnected"}}}},{actions:{handleReset:Qa(()=>({roomMembers:[],isConnected:!1,awareness:null,_awarenessUpdateHandler:null,socketClient:null})),handleAwareness:Qa(t=>{const e=new FJ(t.ydoc),n=sme(e,t.socketClient,t.isConnected);return e.on("update",n),{awareness:e,_awarenessUpdateHandler:n}}),applyAwarenessState:Qa((t,e)=>(t.awareness&&HJ(t.awareness,Wr(xa(JL(e.data.event.data.data.position))),t.socketClient),{})),setConnectState:Qa(t=>{var n;const e=((n=t.socketClient)==null?void 0:n._webSocketStatus)===1;return{isConnected:e,roomMembers:e?t.roomMembers:[]}}),initSync:Qa((t,e)=>{if(!e.data.username)throw new Error("username is not provided");return{socketClient:new ime(e.data.url,t.roomKey),username:e.data.username}}),processMessage:Qa((t,e)=>(e.type==="MESSAGE_RECEIVED"&&console.log("Message received:",e.data),{})),updateRoomMembers:Qa((t,e)=>{var n;if(e.data.event_type!=="ROOM_MEMBERSHIP_CHANGE")throw new Error(`expected ROOM_MEMBERSHIP_CHANGE, but got: ${e.data.event_type}`);return{roomMembers:((n=t.socketClient)==null?void 0:n.roomMembers)??[]}}),applyUpdate:Qa((t,e)=>{if(e.data.event_type!=="CONTENT_UPDATE")throw new Error(`expected CONTENT_UPDATE, but got: ${e.data.event_type}`);if(!t.ydoc)throw new Error("Ydoc is not available");return Dg(t.ydoc,JL(e.data.event.data.data),"self"),{}})},services:{broadcastLocalLatestCommit:t=>async e=>{e({type:"SEND_UPDATE",data:{update:cM(t.ydoc),commit:!0}})},connectSocket:t=>async e=>{if(!t.socketClient)throw new Error("websocket has not been initialised");await t.socketClient.init({roomId:t.roomId,username:t.username,onConnect:()=>e({type:"SEND_INIT_UPDATE",data:null}),onDisconnect:()=>e({type:"DISCONNECTED",data:null}),onMessage:n=>{if(!(n!=null&&n.event_type))throw new Error("message is not an event");e({type:n.event_type,data:n})},onError:n=>{var r;e({type:"RESET_STATE",data:n}),(r=t.onError)==null||r.call(t,n)}})},disconnectSocket:t=>async()=>{const{socketClient:e,awareness:n,_awarenessUpdateHandler:r}=t;e&&(e.disconnect(),n==null||n.off("update",r))},sendUpdates:(t,e)=>async()=>{const{socketClient:n,isConnected:r}=t;n&&e.type==="SEND_UPDATE"&&r&&await n.sendUpdate({update:e.data.update})}},guards:{isUserConnected:t=>t.isConnected}}),ame=ome,lme=t=>{const[e,n]=_.useState(!1),[r]=_.useState(new ka),[i,s]=tme(ame,{context:{...t,ydoc:r}}),{awareness:o}=i.context,a=_.useCallback((c,f)=>{s({type:"CONNECT",data:{url:"wss://dev-sync.fileverse.io/",roomId:f,username:c}})},[s]),l=_.useCallback(()=>{s({type:"DISCONNECT",data:{}})},[s]);_.useEffect(()=>{if(r){const c=(f,d)=>{d!=="self"&&s({type:"SEND_UPDATE",data:{update:cM(r)}})};return r.on("updateV2",c),()=>{r.off("updateV2",c)}}},[r,s]);const u=_.useMemo(()=>[i,s],[i,s]);return _.useEffect(()=>{n(i.context.isConnected)},[i.context.isConnected]),_.useEffect(()=>{r&&!o&&i.context.isConnected&&s({type:"INIT_AWARENESS",data:null})},[r,o,i.context.isConnected,s]),{machine:u,connect:a,disconnect:l,isConnected:e,ydoc:r}},ume=lme;const aB=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),lB=()=>null,cme=It.create({name:"collaborationCursor",addOptions(){return{provider:null,user:{name:null,color:null},render:t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},selectionRender:oN,onUpdate:lB}},onCreate(){this.options.onUpdate!==lB&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCursor.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor')},addStorage(){return{users:[]}},addCommands(){return{updateUser:t=>()=>(this.options.user=t,this.options.provider.awareness.setLocalStateField("user",this.options.user),!0),user:t=>({editor:e})=>(console.warn('[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor'),e.commands.updateUser(t))}},addProseMirrorPlugins(){return[lY((this.options.provider.context.awareness.setLocalStateField("user",this.options.user),this.storage.users=aB(this.options.provider.context.awareness.states),this.options.provider.context.awareness.on("update",()=>{this.storage.users=aB(this.options.provider.context.awareness.states)}),this.options.provider.context.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),uB=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],fme=({isPreviewMode:t,initialContent:e,enableCollaboration:n,collaborationId:r,walletAddress:i,username:s,onChange:o,onCollaboratorChange:a,onCommentInteraction:l,onTextSelection:u,ensResolutionUrl:c,onError:f,setCharacterCount:d,setWordCount:h,collaborationkey:p})=>{var B,N;const[m,g]=_.useState([...yoe,_fe(f)]),y=_.useRef(!1),v=(H,K,J)=>{let X=!1;return H.doc.nodesBetween(K,J,ie=>{ie.marks&&ie.marks.some(le=>le.type.name==="highlight"&&le.attrs.color==="yellow")&&(X=!0)}),X},w=(H,K)=>{var X;const J=K.target;if(J&&J.nodeName==="MARK"&&J.dataset.color&&((X=J==null?void 0:J.dataset)==null?void 0:X.color)==="yellow"){const ie=J.textContent,le=H.posAtCoords({left:K.clientX,top:K.clientY});if(le){const{state:Pe}=H;let xe=le.pos,Ie=le.pos;if(Pe.doc.nodesBetween(xe,Ie,(ke,$)=>{ke.marks&&ke.marks.length&&ke.marks.forEach(ne=>{ne.type.name==="highlight"&&(xe=$,Ie=$+ke.nodeSize)})}),xe!==Ie){const ke={text:ie,from:xe,to:Ie,isHighlightedYellow:v(Pe,xe,Ie)};l==null||l(ke)}}}},b=(H,K,J)=>{w(H,J)},{machine:E,connect:x,ydoc:O}=ume({roomId:r,roomKey:p}),S=E[0].context,D=j$({extensions:m,editorProps:{...mq,handleDOMEvents:{mouseover:w,keydown:(H,K)=>{if(["ArrowUp","ArrowDown","Enter"].includes(K.key)&&document.querySelector("#slash-command"))return!0}},handleClick:b},autofocus:"start",onTransaction:({editor:H,transaction:K})=>{H!=null&&H.isEmpty||K.docChanged&&(o==null||o(H.getJSON()))},shouldRerenderOnTransaction:!0,immediatelyRender:!1},[m]),I=_.useRef(()=>{}),F=(H,K=!1)=>{if(!n||!r)throw new Error("docId or username is not provided");x(H,r)},Q=_.useRef(null);_.useEffect(()=>{D==null||D.setEditable(!t)},[t,D]),_.useEffect(()=>{e&&D&&!y.current&&(queueMicrotask(()=>{D.commands.setContent(e)}),y.current=!0),setTimeout(()=>{y.current=!1})},[e,D]),_.useEffect(()=>{if(!D)return;const H=()=>{const{state:K}=D,{from:J,to:X}=K.selection,ie=K.doc.textBetween(J,X," ");u==null||u({text:ie,from:J,to:X,isHighlightedYellow:v(K,J,X)})};return D.on("selectionUpdate",H),()=>{D.off("selectionUpdate",H)}},[D]),_.useEffect(()=>{S!=null&&S.awareness&&S.isConnected&&g([...m.filter(H=>H.name!=="history"),pY.configure({document:O}),cme.configure({provider:E[0],user:{name:s&&s.length>20?yfe(s,7,15):s,color:uB[Math.floor(Math.random()*uB.length)],isEns:!1},render:xoe})])},[S==null?void 0:S.awareness,S.isConnected]);const V=async()=>{let H=s,K=!1;if(i&&c){const{name:J,isEns:X}=await pfe(i,c);H=J,K=X}if(!H)throw new Error("Cannot start collaboration without a username");F(H,K)};return _.useEffect(()=>{n?V():I.current()},[n]),_.useEffect(()=>{var H,K;a==null||a((K=(H=D==null?void 0:D.storage)==null?void 0:H.collaborationCursor)==null?void 0:K.users)},[(N=(B=D==null?void 0:D.storage)==null?void 0:B.collaborationCursor)==null?void 0:N.users]),_.useEffect(()=>{d&&d(D==null?void 0:D.storage.characterCount.characters()),h&&h(D==null?void 0:D.storage.characterCount.words())},[D==null?void 0:D.storage.characterCount.characters(),D==null?void 0:D.storage.characterCount.words()]),{editor:D,ref:Q,connect:F,ydoc:O}},dme=({title:t,content:e,contentClassName:n,open:r,onOpenChange:i,primaryAction:s,secondaryAction:o})=>{const a=_.useCallback(l=>{l.key==="Enter"&&(s!=null&&s.onClick)&&!s.isLoading&&s.onClick()},[s]);return _.useEffect(()=>(r&&document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}),[a,r,s]),k.jsx(pK,{open:r,onOpenChange:i,children:k.jsxs(t_,{className:"max-w-md sm:w-full w-[90%] z-20",children:[k.jsx(n_,{className:"px-4 pt-0 border-b-[1px]",children:k.jsx(i_,{className:"text-left text-base",children:t})}),k.jsx("div",{className:Ne("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",n),children:e&&e}),k.jsxs(r_,{className:"px-5 pb-5 justify-end sm:",children:[o&&k.jsx(yK,{asChild:!0,children:k.jsx(ba,{disabled:o==null?void 0:o.isLoading,isLoading:o==null?void 0:o.isLoading,className:o==null?void 0:o.className,variant:(o==null?void 0:o.variant)||"ghost",onClick:o==null?void 0:o.onClick,children:o==null?void 0:o.label})}),s&&k.jsx(ba,{disabled:s==null?void 0:s.isLoading,isLoading:s==null?void 0:s.isLoading,className:s==null?void 0:s.className,variant:(s==null?void 0:s.variant)||"primary",onClick:s==null?void 0:s.onClick,children:s==null?void 0:s.label})]})]})})},hme=({editor:t,onError:e,isKeyboardVisible:n})=>{const{toolVisibilty:r,setToolVisibility:i,bottomToolbar:s}=KA({editor:t,onError:e}),o=Tk("(max-width: 1023px)"),[a,l]=_.useState(""),[u,c]=_.useState(""),[f,d]=_.useState(!0),[h,p]=_.useState(!0),m=_.useRef(null),g=()=>{if(a===null){p(!1),i(Ge.NONE);return}if(u===""&&a===""){i(Ge.NONE),d(!0),p(!0);return}if(a===""){t.chain().focus().extendMarkRange("link").unsetLink().run(),i(Ge.NONE);return}let w=a;!a.startsWith("http://")||!a.startsWith("https://")?w="https://"+a:w=a;try{w.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&p(!0)}catch{console.error("Invalid URL"),p(!1)}const{from:b,to:E}=t.state.selection;t.state.doc.textBetween(b,E)?t.chain().focus().extendMarkRange("link").setLink({href:w}).run():t.chain().focus().command(({tr:O,dispatch:S})=>{const{from:D,to:I}=t.state.selection,F=u,Q={href:w};return O.insertText(F,D,I),O.addMark(D,F.length+D,t.schema.marks.link.create(Q)),S&&S(O),!0}).run(),p(!0),d(!0),c(""),l(""),i(Ge.NONE)},y=w=>{const{from:b,to:E}=w.state.selection;return w.state.doc.textBetween(b,E)},v=w=>w.getAttributes("link").href;return _.useEffect(()=>{let w=0;const b=()=>{w=Date.now()},E=()=>{var S,D,I;if(Date.now()-w>500){const{selection:F}=t.state,Q=F.from!==F.to,V=((S=t.state.doc.nodeAt(F.from))==null?void 0:S.type.name)==="resizableMedia",B=((D=t.state.doc.nodeAt(F.from))==null?void 0:D.type.name)==="iframe";Q&&!V&&!B&&((I=m.current)==null||I.click())}},x=()=>{var D;if(!o)return;const{selection:O}=t.state;O.from!==O.to&&((D=m.current)==null||D.click())};return o?(document.addEventListener("touchstart",b),document.addEventListener("touchend",E)):document.addEventListener("mouseup",x),()=>{o?(document.removeEventListener("touchstart",b),document.removeEventListener("touchend",E)):document.removeEventListener("mouseup",x)}},[t,o]),_.useEffect(()=>{if(!t)return;const w=b=>{b.key==="k"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),r!==Ge.LINK_POPUP?i(Ge.LINK_POPUP):i(Ge.NONE))};return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[t,r]),_.useEffect(()=>{n&&i(Ge.NONE)},[n,i]),k.jsxs(q6,{children:[k.jsx("div",{className:"flex w-full justify-between sm:justify-evenly select-none",children:s.map(w=>{if(w)return k.jsx("div",{className:"flex items-center",children:w.title==="Text formating"?k.jsx(Q6,{asChild:!0,children:k.jsx("button",{ref:m,onClick:()=>w.onClick(),children:w.icon})}):w.title==="Text color"?k.jsx(Q6,{asChild:!0,children:k.jsx("button",{onClick:()=>w.onClick(),children:w.icon})}):k.jsx("button",{className:Ne("flex items-center rounded px-2 py-1 transition",{"text-black":w.isActive,"text-[#A1AAB1]":!w.isActive}),onClick:()=>w.onClick(),disabled:!w.isActive,children:w.icon})},w.title)})}),r===Ge.TEXT_FORMATING&&k.jsx(iq,{editor:t,setToolVisibility:i}),k.jsx(dme,{open:r===Ge.LINK_POPUP,onOpenChange:()=>i(Ge.NONE),title:"Link",content:k.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[k.jsx(mg,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:y(t),onChange:w=>{w.preventDefault(),c(w.target.value)},isValid:f,message:f?"":"Invalid text"}),k.jsx(mg,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:v(t),onChange:w=>{w.preventDefault(),l(w.target.value)},isValid:h,message:h?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>g(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>i(Ge.NONE),className:"w-auto min-w-[80px]"}})]})},bS=_.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),B1=_.createContext({}),F1=_.createContext(null),wS=typeof document<"u",vS=wS?_.useLayoutEffect:_.useEffect,cB=_.createContext({strict:!1}),AS=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),fB="data-"+AS("framerAppearId"),pme={skipAnimations:!1,useManualTiming:!1};class dB{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const n=this.order.indexOf(e);n!==-1&&(this.order.splice(n,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function mme(t){let e=new dB,n=new dB,r=0,i=!1,s=!1;const o=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const f=c&&i,d=f?e:n;return u&&o.add(l),d.add(l)&&f&&i&&(r=e.order.length),l},cancel:l=>{n.remove(l),o.delete(l)},process:l=>{if(i){s=!0;return}if(i=!0,[e,n]=[n,e],n.clear(),r=e.order.length,r)for(let u=0;u<r;u++){const c=e.order[u];o.has(c)&&(a.schedule(c),t()),c(l)}i=!1,s&&(s=!1,a.process(l))}};return a}const U1=["read","resolveKeyframes","update","preRender","render","postRender"],gme=40;function hB(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=U1.reduce((f,d)=>(f[d]=mme(()=>n=!0),f),{}),o=f=>{s[f].process(i)},a=()=>{const f=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(f-i.timestamp,gme),1),i.timestamp=f,i.isProcessing=!0,U1.forEach(o),i.isProcessing=!1,n&&e&&(r=!1,t(a))},l=()=>{n=!0,r=!0,i.isProcessing||t(a)};return{schedule:U1.reduce((f,d)=>{const h=s[d];return f[d]=(p,m=!1,g=!1)=>(n||l(),h.schedule(p,m,g)),f},{}),cancel:f=>U1.forEach(d=>s[d].cancel(f)),state:i,steps:s}}const{schedule:xS,cancel:tve}=hB(queueMicrotask,!1);function Qf(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const pB=_.createContext({});let mB=!1;function yme(t,e,n,r,i){const{visualElement:s}=_.useContext(B1),o=_.useContext(cB),a=_.useContext(F1),l=_.useContext(bS).reducedMotion,u=_.useRef();r=r||o.renderer,!u.current&&r&&(u.current=r(t,{visualState:e,parent:s,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const c=u.current,f=_.useContext(pB);c&&!c.projection&&i&&(c.type==="html"||c.type==="svg")&&wme(u.current,n,i,f),_.useInsertionEffect(()=>{c&&c.update(n,a)});const d=_.useRef(!!(n[fB]&&!window.HandoffComplete));return vS(()=>{c&&(c.updateFeatures(),xS.render(c.render),d.current&&c.animationState&&c.animationState.animateChanges())}),_.useEffect(()=>{c&&(!d.current&&c.animationState&&c.animationState.animateChanges(),d.current&&(d.current=!1,mB||(mB=!0,queueMicrotask(bme))))}),c}function bme(){window.HandoffComplete=!0}function wme(t,e,n,r){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:gB(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Qf(a),visualElement:t,scheduleRender:()=>t.scheduleRender(),animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function gB(t){if(t)return t.options.allowProjection!==!1?t.projection:gB(t.parent)}function vme(t,e,n){return _.useCallback(r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Qf(n)&&(n.current=r))},[e])}function x0(t){return typeof t=="string"||Array.isArray(t)}function j1(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const ES=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],kS=["initial",...ES];function H1(t){return j1(t.animate)||kS.some(e=>x0(t[e]))}function yB(t){return!!(H1(t)||t.variants)}function Ame(t,e){if(H1(t)){const{initial:n,animate:r}=t;return{initial:n===!1||x0(n)?n:void 0,animate:x0(r)?r:void 0}}return t.inherit!==!1?e:{}}function xme(t){const{initial:e,animate:n}=Ame(t,_.useContext(B1));return _.useMemo(()=>({initial:e,animate:n}),[bB(e),bB(n)])}function bB(t){return Array.isArray(t)?t.join(" "):t}const wB={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Jf={};for(const t in wB)Jf[t]={isEnabled:e=>wB[t].some(n=>!!e[n])};function Eme(t){for(const e in t)Jf[e]={...Jf[e],...t[e]}}const SS=_.createContext({}),kme=Symbol.for("motionComponentSymbol"),cr=t=>t;let Yf=cr,Po=cr;process.env.NODE_ENV!=="production"&&(Yf=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Po=(t,e)=>{if(!t)throw new Error(e)});function Sme({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:i}){t&&Eme(t);function s(a,l){let u;const c={..._.useContext(bS),...a,layoutId:Cme(a)},{isStatic:f}=c,d=xme(a),h=r(a,f);if(!f&&wS){Dme(c,t);const p=Tme(c);u=p.MeasureLayout,d.visualElement=yme(i,h,c,e,p.ProjectionNode)}return k.jsxs(B1.Provider,{value:d,children:[u&&d.visualElement?k.jsx(u,{visualElement:d.visualElement,...c}):null,n(i,a,vme(h,d.visualElement,l),h,f,d.visualElement)]})}const o=_.forwardRef(s);return o[kme]=i,o}function Cme({layoutId:t}){const e=_.useContext(SS).id;return e&&t!==void 0?e+"-"+t:t}function Dme(t,e){const n=_.useContext(cB).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Yf(!1,r):Po(!1,r)}}function Tme(t){const{drag:e,layout:n}=Jf;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Ome(t){function e(r,i={}){return Sme(t(r,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(r,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const _me=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function CS(t){return typeof t!="string"||t.includes("-")?!1:!!(_me.indexOf(t)>-1||/[A-Z]/u.test(t))}const V1={};function Mme(t){Object.assign(V1,t)}const E0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],_u=new Set(E0);function vB(t,{layout:e,layoutId:n}){return _u.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!V1[t]||t==="opacity")}const vr=t=>!!(t&&t.getVelocity),Nme={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Pme=E0.length;function Ime(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},r,i){let s="";for(let o=0;o<Pme;o++){const a=E0[o];if(t[a]!==void 0){const l=Nme[a]||a;s+=`${l}(${t[a]}) `}}return e&&!t.z&&(s+="translateZ(0)"),s=s.trim(),i?s=i(t,r?"":s):n&&r&&(s="none"),s}const AB=t=>e=>typeof e=="string"&&e.startsWith(t),xB=AB("--"),Rme=AB("var(--"),DS=t=>Rme(t)?Lme.test(t.split("/*")[0].trim()):!1,Lme=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Bme=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Ya=(t,e,n)=>n>e?e:n<t?t:n,Xf={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},k0={...Xf,transform:t=>Ya(0,1,t)},z1={...Xf,default:1},S0=t=>Math.round(t*1e5)/1e5,TS=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Fme=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Ume=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function C0(t){return typeof t=="string"}const D0=t=>({test:e=>C0(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Xa=D0("deg"),Js=D0("%"),Je=D0("px"),jme=D0("vh"),Hme=D0("vw"),EB={...Js,parse:t=>Js.parse(t)/100,transform:t=>Js.transform(t*100)},kB={...Xf,transform:Math.round},SB={borderWidth:Je,borderTopWidth:Je,borderRightWidth:Je,borderBottomWidth:Je,borderLeftWidth:Je,borderRadius:Je,radius:Je,borderTopLeftRadius:Je,borderTopRightRadius:Je,borderBottomRightRadius:Je,borderBottomLeftRadius:Je,width:Je,maxWidth:Je,height:Je,maxHeight:Je,size:Je,top:Je,right:Je,bottom:Je,left:Je,padding:Je,paddingTop:Je,paddingRight:Je,paddingBottom:Je,paddingLeft:Je,margin:Je,marginTop:Je,marginRight:Je,marginBottom:Je,marginLeft:Je,rotate:Xa,rotateX:Xa,rotateY:Xa,rotateZ:Xa,scale:z1,scaleX:z1,scaleY:z1,scaleZ:z1,skew:Xa,skewX:Xa,skewY:Xa,distance:Je,translateX:Je,translateY:Je,translateZ:Je,x:Je,y:Je,z:Je,perspective:Je,transformPerspective:Je,opacity:k0,originX:EB,originY:EB,originZ:Je,zIndex:kB,backgroundPositionX:Je,backgroundPositionY:Je,fillOpacity:k0,strokeOpacity:k0,numOctaves:kB};function OS(t,e,n,r){const{style:i,vars:s,transform:o,transformOrigin:a}=t;let l=!1,u=!1,c=!0;for(const f in e){const d=e[f];if(xB(f)){s[f]=d;continue}const h=SB[f],p=Bme(d,h);if(_u.has(f)){if(l=!0,o[f]=p,!c)continue;d!==(h.default||0)&&(c=!1)}else f.startsWith("origin")?(u=!0,a[f]=p):i[f]=p}if(e.transform||(l||r?i.transform=Ime(t.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;i.transformOrigin=`${f} ${d} ${h}`}}const _S=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function CB(t,e,n){for(const r in e)!vr(e[r])&&!vB(r,n)&&(t[r]=e[r])}function Vme({transformTemplate:t},e,n){return _.useMemo(()=>{const r=_S();return OS(r,e,{enableHardwareAcceleration:!n},t),Object.assign({},r.vars,r.style)},[e])}function zme(t,e,n){const r=t.style||{},i={};return CB(i,r,t),Object.assign(i,Vme(t,e,n)),i}function $me(t,e,n){const r={},i=zme(t,e,n);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=i,r}const Gme=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function $1(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Gme.has(t)}let DB=t=>!$1(t);function Wme(t){t&&(DB=e=>e.startsWith("on")?!$1(e):t(e))}try{Wme(require("@emotion/is-prop-valid").default)}catch{}function Kme(t,e,n){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||(DB(i)||n===!0&&$1(i)||!e&&!$1(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}function TB(t,e,n){return typeof t=="string"?t:Je.transform(e+n*t)}function qme(t,e,n){const r=TB(e,t.x,t.width),i=TB(n,t.y,t.height);return`${r} ${i}`}const Qme={offset:"stroke-dashoffset",array:"stroke-dasharray"},Jme={offset:"strokeDashoffset",array:"strokeDasharray"};function Yme(t,e,n=1,r=0,i=!0){t.pathLength=1;const s=i?Qme:Jme;t[s.offset]=Je.transform(-r);const o=Je.transform(e),a=Je.transform(n);t[s.array]=`${o} ${a}`}function MS(t,{attrX:e,attrY:n,attrScale:r,originX:i,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},c,f,d){if(OS(t,u,c,d),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p,dimensions:m}=t;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||s!==void 0||p.transform)&&(p.transformOrigin=qme(m,i!==void 0?i:.5,s!==void 0?s:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&Yme(h,o,a,l,!1)}const OB=()=>({..._S(),attrs:{}}),NS=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xme(t,e,n,r){const i=_.useMemo(()=>{const s=OB();return MS(s,e,{enableHardwareAcceleration:!1},NS(r),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};CB(s,t.style,t),i.style={...s,...i.style}}return i}function Zme(t=!1){return(n,r,i,{latestValues:s},o)=>{const l=(CS(n)?Xme:$me)(r,s,o,n),u=Kme(r,typeof n=="string",t),c=n!==_.Fragment?{...u,...l,ref:i}:{},{children:f}=r,d=_.useMemo(()=>vr(f)?f.get():f,[f]);return _.createElement(n,{...c,children:d})}}function _B(t,{style:e,vars:n},r,i){Object.assign(t.style,e,i&&i.getProjectionStyles(r));for(const s in n)t.style.setProperty(s,n[s])}const MB=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function NB(t,e,n,r){_B(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(MB.has(i)?i:AS(i),e.attrs[i])}function PS(t,e,n){var r;const{style:i}=t,s={};for(const o in i)(vr(i[o])||e.style&&vr(e.style[o])||vB(o,t)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function PB(t,e,n){const r=PS(t,e,n);for(const i in t)if(vr(t[i])||vr(e[i])){const s=E0.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=t[i]}return r}function IB(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function IS(t,e,n,r){if(typeof e=="function"){const[i,s]=IB(r);e=e(n!==void 0?n:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=IB(r);e=e(n!==void 0?n:t.custom,i,s)}return e}function RB(t){const e=_.useRef(null);return e.current===null&&(e.current=t()),e.current}const RS=t=>Array.isArray(t),ege=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),tge=t=>RS(t)?t[t.length-1]||0:t;function G1(t){const e=vr(t)?t.get():t;return ege(e)?e.toValue():e}function nge({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,i,s){const o={latestValues:rge(r,i,s,t),renderState:e()};return n&&(o.mount=a=>n(r,a,o)),o}const LB=t=>(e,n)=>{const r=_.useContext(B1),i=_.useContext(F1),s=()=>nge(t,e,r,i);return n?s():RB(s)};function rge(t,e,n,r){const i={},s=r(t,{});for(const d in s)i[d]=G1(s[d]);let{initial:o,animate:a}=t;const l=H1(t),u=yB(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const f=c?a:o;return f&&typeof f!="boolean"&&!j1(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=IS(t,h);if(!p)return;const{transitionEnd:m,transition:g,...y}=p;for(const v in y){let w=y[v];if(Array.isArray(w)){const b=c?w.length-1:0;w=w[b]}w!==null&&(i[v]=w)}for(const v in m)i[v]=m[v]}),i}const{schedule:Rt,cancel:Io,state:fr,steps:LS}=hB(typeof requestAnimationFrame<"u"?requestAnimationFrame:cr,!0),ige={useVisualState:LB({scrapeMotionValuesFromProps:PB,createRenderState:OB,onMount:(t,e,{renderState:n,latestValues:r})=>{Rt.read(()=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Rt.render(()=>{MS(n,r,{enableHardwareAcceleration:!1},NS(e.tagName),t.transformTemplate),NB(e,n)})}})},sge={useVisualState:LB({scrapeMotionValuesFromProps:PS,createRenderState:_S})};function oge(t,{forwardMotionProps:e=!1},n,r){return{...CS(t)?ige:sge,preloadedFeatures:n,useRender:Zme(e),createVisualElement:r,Component:t}}function Ro(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const BB=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function W1(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const age=t=>e=>BB(e)&&t(e,W1(e));function Lo(t,e,n,r){return Ro(t,e,age(n),r)}const lge=(t,e)=>n=>e(t(n)),Bo=(...t)=>t.reduce(lge);function FB(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const UB=FB("dragHorizontal"),jB=FB("dragVertical");function HB(t){let e=!1;if(t==="y")e=jB();else if(t==="x")e=UB();else{const n=UB(),r=jB();n&&r?e=()=>{n(),r()}:(n&&n(),r&&r())}return e}function VB(){const t=HB(!0);return t?(t(),!1):!0}class Za{constructor(e){this.isMounted=!1,this.node=e}update(){}}function zB(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||VB())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const l=a[r];l&&Rt.postRender(()=>l(s,o))};return Lo(t.current,n,i,{passive:!t.getProps()[r]})}class uge extends Za{mount(){this.unmount=Bo(zB(this.node,!0),zB(this.node,!1))}unmount(){}}class cge extends Za{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Bo(Ro(this.node.current,"focus",()=>this.onFocus()),Ro(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const $B=(t,e)=>e?t===e?!0:$B(t,e.parentElement):!1;function BS(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,W1(n))}class fge extends Za{constructor(){super(...arguments),this.removeStartListeners=cr,this.removeEndListeners=cr,this.removeAccessibleListeners=cr,this.startPointerPress=(e,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),s=Lo(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c,globalTapTarget:f}=this.node.getProps(),d=!f&&!$B(this.node.current,a.target)?c:u;d&&Rt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Lo(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Bo(s,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||BS("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&Rt.postRender(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Ro(this.node.current,"keyup",o),BS("down",(a,l)=>{this.startPress(a,l)})},n=Ro(this.node.current,"keydown",e),r=()=>{this.isPressing&&BS("cancel",(s,o)=>this.cancelPress(s,o))},i=Ro(this.node.current,"blur",r);this.removeAccessibleListeners=Bo(n,i)}}startPress(e,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Rt.postRender(()=>r(e,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!VB()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Rt.postRender(()=>r(e,n))}mount(){const e=this.node.getProps(),n=Lo(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Ro(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Bo(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const FS=new WeakMap,US=new WeakMap,dge=t=>{const e=FS.get(t.target);e&&e(t)},hge=t=>{t.forEach(dge)};function pge({root:t,...e}){const n=t||document;US.has(n)||US.set(n,{});const r=US.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(hge,{root:t,...e})),r[i]}function mge(t,e,n){const r=pge(e);return FS.set(t,n),r.observe(t),()=>{FS.delete(t),r.unobserve(t)}}const gge={some:0,all:1};class yge extends Za{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:gge[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),d=u?c:f;d&&d(l)};return mge(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(bge(e,n))&&this.startObserver()}unmount(){}}function bge({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const wge={inView:{Feature:yge},tap:{Feature:fge},focus:{Feature:cge},hover:{Feature:uge}};function GB(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function K1(t,e,n){const r=t.getProps();return IS(r,e,n!==void 0?n:r.custom,t)}const Fo=t=>t*1e3,Uo=t=>t/1e3,vge={type:"spring",stiffness:500,damping:25,restSpeed:10},Age=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),xge={type:"keyframes",duration:.8},Ege={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},kge=(t,{keyframes:e})=>e.length>2?xge:_u.has(t)?t.startsWith("scale")?Age(e[1]):vge:Ege;function Sge({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}function jS(t,e){return t[e]||t.default||t}const Cge=t=>t!==null;function q1(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(Cge),s=e&&n!=="loop"&&e%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}let Q1;function Dge(){Q1=void 0}const el={now:()=>(Q1===void 0&&el.set(fr.isProcessing||pme.useManualTiming?fr.timestamp:performance.now()),Q1),set:t=>{Q1=t,queueMicrotask(Dge)}},WB=t=>/^0[^.\s]+$/u.test(t);function Tge(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||WB(t):!0}const KB=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Oge=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _ge(t){const e=Oge.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${n??r}`,i]}const Mge=4;function qB(t,e,n=1){Po(n<=Mge,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,i]=_ge(t);if(!r)return;const s=window.getComputedStyle(e).getPropertyValue(r);if(s){const o=s.trim();return KB(o)?parseFloat(o):o}return DS(i)?qB(i,e,n+1):i}const Nge=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),QB=t=>t===Xf||t===Je,JB=(t,e)=>parseFloat(t.split(", ")[e]),YB=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return JB(i[1],e);{const s=r.match(/^matrix\((.+)\)$/u);return s?JB(s[1],t):0}},Pge=new Set(["x","y","z"]),Ige=E0.filter(t=>!Pge.has(t));function Rge(t){const e=[];return Ige.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Zf={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:YB(4,13),y:YB(5,14)};Zf.translateX=Zf.x,Zf.translateY=Zf.y;const XB=t=>e=>e.test(t),ZB=[Xf,Je,Js,Xa,Hme,jme,{test:t=>t==="auto",parse:t=>t}],eF=t=>ZB.find(XB(t)),Mu=new Set;let HS=!1,VS=!1;function tF(){if(VS){const t=Array.from(Mu).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const i=Rge(r);i.length&&(n.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,o])=>{var a;(a=r.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}VS=!1,HS=!1,Mu.forEach(t=>t.complete()),Mu.clear()}function nF(){Mu.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(VS=!0)})}function Lge(){nF(),tF()}class zS{constructor(e,n,r,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Mu.add(this),HS||(HS=!0,Rt.read(nF),Rt.resolveKeyframes(tF))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:i}=this;for(let s=0;s<e.length;s++)if(e[s]===null)if(s===0){const o=i==null?void 0:i.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const l=r.readValue(n,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),i&&o===void 0&&i.set(e[0])}else e[s]=e[s-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Mu.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Mu.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const $S=(t,e)=>n=>!!(C0(n)&&Ume.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),rF=(t,e,n)=>r=>{if(!C0(r))return r;const[i,s,o,a]=r.match(TS);return{[t]:parseFloat(i),[e]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Bge=t=>Ya(0,255,t),GS={...Xf,transform:t=>Math.round(Bge(t))},Nu={test:$S("rgb","red"),parse:rF("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+GS.transform(t)+", "+GS.transform(e)+", "+GS.transform(n)+", "+S0(k0.transform(r))+")"};function Fge(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const WS={test:$S("#"),parse:Fge,transform:Nu.transform},ed={test:$S("hsl","hue"),parse:rF("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Js.transform(S0(e))+", "+Js.transform(S0(n))+", "+S0(k0.transform(r))+")"},Ar={test:t=>Nu.test(t)||WS.test(t)||ed.test(t),parse:t=>Nu.test(t)?Nu.parse(t):ed.test(t)?ed.parse(t):WS.parse(t),transform:t=>C0(t)?t:t.hasOwnProperty("red")?Nu.transform(t):ed.transform(t)};function Uge(t){var e,n;return isNaN(t)&&C0(t)&&(((e=t.match(TS))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Fme))===null||n===void 0?void 0:n.length)||0)>0}const iF="number",sF="color",jge="var",Hge="var(",oF="${}",Vge=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function T0(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(Vge,l=>(Ar.test(l)?(r.color.push(s),i.push(sF),n.push(Ar.parse(l))):l.startsWith(Hge)?(r.var.push(s),i.push(jge),n.push(l)):(r.number.push(s),i.push(iF),n.push(parseFloat(l))),++s,oF)).split(oF);return{values:n,split:a,indexes:r,types:i}}function aF(t){return T0(t).values}function lF(t){const{split:e,types:n}=T0(t),r=e.length;return i=>{let s="";for(let o=0;o<r;o++)if(s+=e[o],i[o]!==void 0){const a=n[o];a===iF?s+=S0(i[o]):a===sF?s+=Ar.transform(i[o]):s+=i[o]}return s}}const zge=t=>typeof t=="number"?0:t;function $ge(t){const e=aF(t);return lF(t)(e.map(zge))}const tl={test:Uge,parse:aF,createTransformer:lF,getAnimatableNone:$ge},Gge=new Set(["brightness","contrast","saturate","opacity"]);function Wge(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(TS)||[];if(!r)return t;const i=n.replace(r,"");let s=Gge.has(e)?1:0;return r!==n&&(s*=100),e+"("+s+i+")"}const Kge=/\b([a-z-]*)\(.*?\)/gu,KS={...tl,getAnimatableNone:t=>{const e=t.match(Kge);return e?e.map(Wge).join(" "):t}},qge={...SB,color:Ar,backgroundColor:Ar,outlineColor:Ar,fill:Ar,stroke:Ar,borderColor:Ar,borderTopColor:Ar,borderRightColor:Ar,borderBottomColor:Ar,borderLeftColor:Ar,filter:KS,WebkitFilter:KS},qS=t=>qge[t];function uF(t,e){let n=qS(t);return n!==KS&&(n=tl),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Qge=new Set(["auto","none","0"]);function Jge(t,e,n){let r=0,i;for(;r<t.length&&!i;){const s=t[r];typeof s=="string"&&!Qge.has(s)&&T0(s).values.length&&(i=t[r]),r++}if(i&&n)for(const s of e)t[s]=uF(n,i)}class cF extends zS{constructor(e,n,r,i){super(e,n,r,i,i==null?void 0:i.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let u=e[l];if(typeof u=="string"&&(u=u.trim(),DS(u))){const c=qB(u,n.current);c!==void 0&&(e[l]=c),l===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Nge.has(r)||e.length!==2)return;const[i,s]=e,o=eF(i),a=eF(s);if(o!==a)if(QB(o)&&QB(a))for(let l=0;l<e.length;l++){const u=e[l];typeof u=="string"&&(e[l]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let i=0;i<e.length;i++)Tge(e[i])&&r.push(i);r.length&&Jge(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Zf[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(r,i).jump(i,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:i}=this;if(!n.current)return;const s=n.getValue(r);s&&s.jump(this.measuredOrigin,!1);const o=i.length-1,a=i[o];i[o]=Zf[r](n.measureViewportBox(),window.getComputedStyle(n.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,u])=>{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function fF(t){let e;return()=>(e===void 0&&(e=t()),e)}const dF=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(tl.test(t)||t==="0")&&!t.startsWith("url("));function Yge(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Xge(t,e,n,r){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const s=t[t.length-1],o=dF(i,e),a=dF(s,e);return Yf(o===a,`You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`),!o||!a?!1:Yge(t)||n==="spring"&&r}class hF{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Lge(),this._resolved}onKeyframesResolved(e,n){this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!Xge(e,r,i,s))if(o)this.options.duration=0;else{l==null||l(q1(e,this.options,n)),a==null||a(),this.resolveFinishedPromise();return}const c=this.initPlayback(e,n);c!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function pF(t,e){return e?t*(1e3/e):0}const Zge=5;function mF(t,e,n){const r=Math.max(e-Zge,0);return pF(n-t(r),e-r)}const QS=.001,eye=.01,gF=10,tye=.05,nye=1;function rye({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let i,s;Yf(t<=Fo(gF),"Spring duration must be 10 seconds or less");let o=1-e;o=Ya(tye,nye,o),t=Ya(eye,gF,Uo(t)),o<1?(i=u=>{const c=u*o,f=c*t,d=c-n,h=JS(u,o),p=Math.exp(-f);return QS-d/h*p},s=u=>{const f=u*o*t,d=f*n+n,h=Math.pow(o,2)*Math.pow(u,2)*t,p=Math.exp(-f),m=JS(Math.pow(u,2),o);return(-i(u)+QS>0?-1:1)*((d-h)*p)/m}):(i=u=>{const c=Math.exp(-u*t),f=(u-n)*t+1;return-QS+c*f},s=u=>{const c=Math.exp(-u*t),f=(n-u)*(t*t);return c*f});const a=5/t,l=sye(i,s,a);if(t=Fo(t),isNaN(l))return{stiffness:100,damping:10,duration:t};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const iye=12;function sye(t,e,n){let r=n;for(let i=1;i<iye;i++)r=r-t(r)/e(r);return r}function JS(t,e){return t*Math.sqrt(1-e*e)}const oye=["duration","bounce"],aye=["stiffness","damping","mass"];function yF(t,e){return e.some(n=>t[n]!==void 0)}function lye(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!yF(t,aye)&&yF(t,oye)){const n=rye(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}function bF({keyframes:t,restDelta:e,restSpeed:n,...r}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:l,mass:u,duration:c,velocity:f,isResolvedFromDuration:d}=lye({...r,velocity:-Uo(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*u)),m=s-i,g=Uo(Math.sqrt(a/u)),y=Math.abs(m)<5;n||(n=y?.01:2),e||(e=y?.005:.5);let v;if(p<1){const w=JS(g,p);v=b=>{const E=Math.exp(-p*g*b);return s-E*((h+p*g*m)/w*Math.sin(w*b)+m*Math.cos(w*b))}}else if(p===1)v=w=>s-Math.exp(-g*w)*(m+(h+g*m)*w);else{const w=g*Math.sqrt(p*p-1);v=b=>{const E=Math.exp(-p*g*b),x=Math.min(w*b,300);return s-E*((h+p*g*m)*Math.sinh(x)+w*m*Math.cosh(x))/w}}return{calculatedDuration:d&&c||null,next:w=>{const b=v(w);if(d)o.done=w>=c;else{let E=h;w!==0&&(p<1?E=mF(v,w,b):E=0);const x=Math.abs(E)<=n,O=Math.abs(s-b)<=e;o.done=x&&O}return o.value=o.done?s:b,o}}}function wF({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=t[0],d={done:!1,value:f},h=S=>a!==void 0&&S<a||l!==void 0&&S>l,p=S=>a===void 0?l:l===void 0||Math.abs(a-S)<Math.abs(l-S)?a:l;let m=n*e;const g=f+m,y=o===void 0?g:o(g);y!==g&&(m=y-f);const v=S=>-m*Math.exp(-S/r),w=S=>y+v(S),b=S=>{const D=v(S),I=w(S);d.done=Math.abs(D)<=u,d.value=d.done?y:I};let E,x;const O=S=>{h(d.value)&&(E=S,x=bF({keyframes:[d.value,p(d.value)],velocity:mF(w,S,d.value),damping:i,stiffness:s,restDelta:u,restSpeed:c}))};return O(0),{calculatedDuration:null,next:S=>{let D=!1;return!x&&E===void 0&&(D=!0,b(S),O(S)),E!==void 0&&S>=E?x.next(S-E):(!D&&b(S),d)}}}const vF=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,uye=1e-7,cye=12;function fye(t,e,n,r,i){let s,o,a=0;do o=e+(n-e)/2,s=vF(o,r,i)-t,s>0?n=o:e=o;while(Math.abs(s)>uye&&++a<cye);return o}function O0(t,e,n,r){if(t===e&&n===r)return cr;const i=s=>fye(s,0,1,t,n);return s=>s===0||s===1?s:vF(i(s),e,r)}const dye=O0(.42,0,1,1),hye=O0(0,0,.58,1),AF=O0(.42,0,.58,1),pye=t=>Array.isArray(t)&&typeof t[0]!="number",xF=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,EF=t=>e=>1-t(1-e),YS=t=>1-Math.sin(Math.acos(t)),kF=EF(YS),mye=xF(YS),SF=O0(.33,1.53,.69,.99),XS=EF(SF),gye=xF(XS),CF={linear:cr,easeIn:dye,easeInOut:AF,easeOut:hye,circIn:YS,circInOut:mye,circOut:kF,backIn:XS,backInOut:gye,backOut:SF,anticipate:t=>(t*=2)<1?.5*XS(t):.5*(2-Math.pow(2,-10*(t-1)))},DF=t=>{if(Array.isArray(t)){Po(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,i]=t;return O0(e,n,r,i)}else if(typeof t=="string")return Po(CF[t]!==void 0,`Invalid easing type '${t}'`),CF[t];return t},_0=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},dn=(t,e,n)=>t+(e-t)*n;function ZS(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function yye({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let i=0,s=0,o=0;if(!e)i=s=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;i=ZS(l,a,t+1/3),s=ZS(l,a,t),o=ZS(l,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}function J1(t,e){return n=>n>0?e:t}const eC=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},bye=[WS,Nu,ed],wye=t=>bye.find(e=>e.test(t));function TF(t){const e=wye(t);if(Yf(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let n=e.parse(t);return e===ed&&(n=yye(n)),n}const OF=(t,e)=>{const n=TF(t),r=TF(e);if(!n||!r)return J1(t,e);const i={...n};return s=>(i.red=eC(n.red,r.red,s),i.green=eC(n.green,r.green,s),i.blue=eC(n.blue,r.blue,s),i.alpha=dn(n.alpha,r.alpha,s),Nu.transform(i))},tC=new Set(["none","hidden"]);function vye(t,e){return tC.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Aye(t,e){return n=>dn(t,e,n)}function nC(t){return typeof t=="number"?Aye:typeof t=="string"?DS(t)?J1:Ar.test(t)?OF:kye:Array.isArray(t)?_F:typeof t=="object"?Ar.test(t)?OF:xye:J1}function _F(t,e){const n=[...t],r=n.length,i=t.map((s,o)=>nC(s)(s,e[o]));return s=>{for(let o=0;o<r;o++)n[o]=i[o](s);return n}}function xye(t,e){const n={...t,...e},r={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(r[i]=nC(t[i])(t[i],e[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function Eye(t,e){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],a=t.indexes[o][i[o]],l=(n=t.values[a])!==null&&n!==void 0?n:0;r[s]=l,i[o]++}return r}const kye=(t,e)=>{const n=tl.createTransformer(e),r=T0(t),i=T0(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?tC.has(t)&&!i.values.length||tC.has(e)&&!r.values.length?vye(t,e):Bo(_F(Eye(r,i),i.values),n):(Yf(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),J1(t,e))};function MF(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?dn(t,e,n):nC(t)(t,e)}function Sye(t,e,n){const r=[],i=n||MF,s=t.length-1;for(let o=0;o<s;o++){let a=i(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||cr:e;a=Bo(l,a)}r.push(a)}return r}function Cye(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const s=t.length;if(Po(s===e.length,"Both input and output ranges must be the same length"),s===1)return()=>e[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=Sye(e,r,i),a=o.length,l=u=>{let c=0;if(a>1)for(;c<t.length-2&&!(u<t[c+1]);c++);const f=_0(t[c],t[c+1],u);return o[c](f)};return n?u=>l(Ya(t[0],t[s-1],u)):l}function Dye(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=_0(0,e,r);t.push(dn(n,1,i))}}function Tye(t){const e=[0];return Dye(e,t.length-1),e}function Oye(t,e){return t.map(n=>n*e)}function _ye(t,e){return t.map(()=>e||AF).splice(0,t.length-1)}function Y1({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=pye(r)?r.map(DF):DF(r),s={done:!1,value:e[0]},o=Oye(n&&n.length===e.length?n:Tye(e),t),a=Cye(o,e,{ease:Array.isArray(i)?i:_ye(e,i)});return{calculatedDuration:t,next:l=>(s.value=a(l),s.done=l>=t,s)}}const NF=2e4;function Mye(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<NF;)e+=n,r=t.next(e);return e>=NF?1/0:e}const Nye=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Rt.update(e,!0),stop:()=>Io(e),now:()=>fr.isProcessing?fr.timestamp:el.now()}},Pye={decay:wF,inertia:wF,tween:Y1,keyframes:Y1,spring:bF},Iye=t=>t/100;class rC extends hF{constructor({KeyframeResolver:e=zS,...n}){super(n),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:a}=this.options;a&&a()};const{name:r,motionValue:i,keyframes:s}=this.options,o=(a,l)=>this.onKeyframesResolved(a,l);r&&i&&i.owner?this.resolver=i.owner.resolveKeyframes(s,o,r,i):this.resolver=new e(s,o,r,i),this.resolver.scheduleResolve()}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Pye[n]||Y1;let l,u;a!==Y1&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Po(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),l=Bo(Iye,MF(e[0],e[1])),e=[0,100]);const c=a({...this.options,keyframes:e});s==="mirror"&&(u=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Mye(c));const{calculatedDuration:f}=c,d=f+i,h=d*(r+1)-i;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:f}=r;if(this.startTime===null)return s.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const y=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>c;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let w=this.currentTime,b=s;if(h){const S=Math.min(this.currentTime,c)/f;let D=Math.floor(S),I=S%1;!I&&S>=1&&(I=1),I===1&&D--,D=Math.min(D,h+1),!!(D%2)&&(p==="reverse"?(I=1-I,m&&(I-=m/f)):p==="mirror"&&(b=o)),w=Ya(0,1,I)*f}const E=v?{done:!1,value:l[0]}:b.next(w);a&&(E.value=a(E.value));let{done:x}=E;!v&&u!==null&&(x=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&x);return O&&i!==void 0&&(E.value=q1(l,this.options,i)),g&&g(E.value),O&&this.finish(),E}get duration(){const{resolved:e}=this;return e?Uo(e.calculatedDuration):0}get time(){return Uo(this.currentTime)}set time(e){e=Fo(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Uo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Nye,onPlay:n}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=r),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const PF=t=>Array.isArray(t)&&typeof t[0]=="number";function IF(t){return!!(!t||typeof t=="string"&&t in iC||PF(t)||Array.isArray(t)&&t.every(IF))}const M0=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,iC={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:M0([0,.65,.55,1]),circOut:M0([.55,0,1,.45]),backIn:M0([.31,.01,.66,-.59]),backOut:M0([.33,1.53,.69,.99])};function Rye(t){return RF(t)||iC.easeOut}function RF(t){if(t)return PF(t)?M0(t):Array.isArray(t)?t.map(Rye):iC[t]}function Lye(t,e,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a,times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=RF(a);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}const Bye=fF(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Fye=new Set(["opacity","clipPath","filter","transform"]),X1=10,Uye=2e4;function jye(t){return t.type==="spring"||t.name==="backgroundColor"||!IF(t.ease)}function Hye(t,e){const n=new rC({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const i=[];let s=0;for(;!r.done&&s<Uye;)r=n.sample(s),i.push(r.value),s+=X1;return{times:void 0,keyframes:i,duration:s-X1,ease:"linear"}}class LF extends hF{constructor(e){super(e);const{name:n,motionValue:r,keyframes:i}=this.options;this.resolver=new cF(i,(s,o)=>this.onKeyframesResolved(s,o),n,r),this.resolver.scheduleResolve()}initPlayback(e,n){var r;let{duration:i=300,times:s,ease:o,type:a,motionValue:l,name:u}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(jye(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=Hye(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),i=m.duration,s=m.times,o=m.ease,a="keyframes"}const c=Lye(l.owner.current,u,e,{...this.options,duration:i,times:s,ease:o});return c.startTime=el.now(),this.pendingTimeline?(c.timeline=this.pendingTimeline,this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:f}=this.options;l.set(q1(e,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return Uo(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return Uo(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Fo(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return cr;const{animation:r}=n;r.timeline=e,r.onfinish=null}return cr}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:i,type:s,ease:o,times:a}=e;if(!(n.playState==="idle"||n.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:u,onComplete:c,...f}=this.options,d=new rC({...f,keyframes:r,duration:i,type:s,ease:o,times:a,isGenerator:!0}),h=Fo(this.time);l.setWithVelocity(d.sample(h-X1).value,d.sample(h).value,X1)}this.cancel()}}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return Bye()&&r&&Fye.has(r)&&n&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}function Vye(t,e){let n;const r=()=>{const{currentTime:i}=e,o=(i===null?0:i.value)/100;n!==o&&t(o),n=o};return Rt.update(r,!0),()=>Io(r)}const zye=fF(()=>window.ScrollTimeline!==void 0);class $ye{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,n){return Promise.all(this.animations).then(e).catch(n)}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e){const n=this.animations.map(r=>{if(zye()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),Vye(i=>{r.time=r.duration*i},e)});return()=>{n.forEach((r,i)=>{r&&r(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const sC=(t,e,n,r={},i,s)=>o=>{const a=jS(r,t)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Fo(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};Sge(a)||(c={...c,...kge(t,c)}),c.duration&&(c.duration=Fo(c.duration)),c.repeatDelay&&(c.repeatDelay=Fo(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(f=!0)),f&&!s&&e.get()!==void 0){const d=q1(c.keyframes,a);if(d!==void 0)return Rt.update(()=>{c.onUpdate(d),c.onComplete()}),new $ye([])}return!s&&LF.supports(c)?new LF(c):new rC(c)};function Z1(t){return!!(vr(t)&&t.add)}function oC(t,e){t.indexOf(e)===-1&&t.push(e)}function aC(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class lC{constructor(){this.subscriptions=[]}add(e){return oC(this.subscriptions,e),()=>aC(this.subscriptions,e)}notify(e,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,r);else for(let s=0;s<i;s++){const o=this.subscriptions[s];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const BF=new Set;function uC(t,e,n){t||BF.has(e)||(console.warn(e),BF.add(e))}const FF=30,Gye=t=>!isNaN(parseFloat(t));class Wye{constructor(e,n={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=el.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=el.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Gye(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&uC(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new lC);const r=this.events[e].add(n);return e==="change"?()=>{r(),Rt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=el.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>FF)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,FF);return pF(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function N0(t,e){return new Wye(t,e)}function Kye(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,N0(n))}function qye(t,e){const n=K1(t,e);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const o in s){const a=tge(s[o]);Kye(t,o,a)}}function UF(t){return t.getProps()[fB]}function Qye({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function jF(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;const u=t.getValue("willChange");r&&(o=r);const c=[],f=i&&t.animationState&&t.animationState.getState()[i];for(const d in l){const h=t.getValue(d,(s=t.latestValues[d])!==null&&s!==void 0?s:null),p=l[d];if(p===void 0||f&&Qye(f,d))continue;const m={delay:n,elapsed:0,...jS(o||{},d)};let g=!1;if(window.HandoffAppearAnimations){const v=UF(t);if(v){const w=window.HandoffAppearAnimations(v,d,h,Rt);w!==null&&(m.elapsed=w,g=!0)}}h.start(sC(d,h,p,t.shouldReduceMotion&&_u.has(d)?{type:!1}:m,t,g));const y=h.animation;y&&(Z1(u)&&(u.add(d),y.then(()=>u.remove(d))),c.push(y))}return a&&Promise.all(c).then(()=>{Rt.update(()=>{a&&qye(t,a)})}),c}function cC(t,e,n={}){var r;const i=K1(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const o=i?()=>Promise.all(jF(t,i,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:d}=s;return Jye(t,e,c+u,f,d,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,c]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function Jye(t,e,n=0,r=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(t.variantChildren).sort(Yye).forEach((u,c)=>{u.notify("AnimationStart",e),o.push(cC(u,e,{...s,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function Yye(t,e){return t.sortNodePosition(e)}function Xye(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(s=>cC(t,s,n));r=Promise.all(i)}else if(typeof e=="string")r=cC(t,e,n);else{const i=typeof e=="function"?K1(t,e,n.custom):e;r=Promise.all(jF(t,i,n))}return r.then(()=>{Rt.postRender(()=>{t.notify("AnimationComplete",e)})})}const Zye=[...ES].reverse(),ebe=ES.length;function tbe(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Xye(t,n,r)))}function nbe(t){let e=tbe(t),n=HF(),r=!0;const i=l=>(u,c)=>{var f;const d=K1(t,c,l==="exit"?(f=t.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;u={...u,...m,...p}}return u};function s(l){e=l(t)}function o(l){const u=t.getProps(),c=t.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let g=0;g<ebe;g++){const y=Zye[g],v=n[y],w=u[y]!==void 0?u[y]:c[y],b=x0(w),E=y===l?v.isActive:null;E===!1&&(p=g);let x=w===c[y]&&w!==u[y]&&b;if(x&&r&&t.manuallyAnimateOnMount&&(x=!1),v.protectedKeys={...h},!v.isActive&&E===null||!w&&!v.prevProp||j1(w)||typeof w=="boolean")continue;let S=rbe(v.prevProp,w)||y===l&&v.isActive&&!x&&b||g>p&&b,D=!1;const I=Array.isArray(w)?w:[w];let F=I.reduce(i(y),{});E===!1&&(F={});const{prevResolvedValues:Q={}}=v,V={...Q,...F},B=N=>{S=!0,d.has(N)&&(D=!0,d.delete(N)),v.needsAnimating[N]=!0;const H=t.getValue(N);H&&(H.liveStyle=!1)};for(const N in V){const H=F[N],K=Q[N];if(h.hasOwnProperty(N))continue;let J=!1;RS(H)&&RS(K)?J=!GB(H,K):J=H!==K,J?H!=null?B(N):d.add(N):H!==void 0&&d.has(N)?B(N):v.protectedKeys[N]=!0}v.prevProp=w,v.prevResolvedValues=F,v.isActive&&(h={...h,...F}),r&&t.blockInitialAnimation&&(S=!1),S&&(!x||D)&&f.push(...I.map(N=>({animation:N,options:{type:y}})))}if(d.size){const g={};d.forEach(y=>{const v=t.getBaseTarget(y),w=t.getValue(y);w&&(w.liveStyle=!0),g[y]=v??null}),f.push({animation:g})}let m=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,u){var c;if(n[l].isActive===u)return Promise.resolve();(c=t.variantChildren)===null||c===void 0||c.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,u)}),n[l].isActive=u;const f=o(l);for(const d in n)n[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>n,reset:()=>{n=HF(),r=!0}}}function rbe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!GB(e,t):!1}function Pu(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function HF(){return{animate:Pu(!0),whileInView:Pu(),whileHover:Pu(),whileTap:Pu(),whileDrag:Pu(),whileFocus:Pu(),exit:Pu()}}class ibe extends Za{constructor(e){super(e),e.animationState||(e.animationState=nbe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();j1(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let sbe=0;class obe extends Za{constructor(){super(...arguments),this.id=sbe++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const abe={animation:{Feature:ibe},exit:{Feature:obe}},VF=(t,e)=>Math.abs(t-e);function lbe(t,e){const n=VF(t.x,e.x),r=VF(t.y,e.y);return Math.sqrt(n**2+r**2)}class zF{constructor(e,n,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=dC(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=lbe(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=fr;this.history.push({...p,timestamp:m});const{onStart:g,onMove:y}=this.handlers;d||(g&&g(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=fC(d,this.transformPagePoint),Rt.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=dC(f.type==="pointercancel"?this.lastMoveEventInfo:fC(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,g),p&&p(f,g)},!BB(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const o=W1(e),a=fC(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=fr;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(e,dC(a,this.history)),this.removeListeners=Bo(Lo(this.contextWindow,"pointermove",this.handlePointerMove),Lo(this.contextWindow,"pointerup",this.handlePointerUp),Lo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Io(this.updatePoint)}}function fC(t,e){return e?{point:e(t.point)}:t}function $F(t,e){return{x:t.x-e.x,y:t.y-e.y}}function dC({point:t},e){return{point:t,delta:$F(t,GF(e)),offset:$F(t,ube(e)),velocity:cbe(e,.1)}}function ube(t){return t[0]}function GF(t){return t[t.length-1]}function cbe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=GF(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>Fo(e)));)n--;if(!r)return{x:0,y:0};const s=Uo(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function gi(t){return t.max-t.min}function hC(t,e=0,n=.01){return Math.abs(t-e)<=n}function WF(t,e,n,r=.5){t.origin=r,t.originPoint=dn(e.min,e.max,t.origin),t.scale=gi(n)/gi(e),(hC(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=dn(n.min,n.max,t.origin)-t.originPoint,(hC(t.translate)||isNaN(t.translate))&&(t.translate=0)}function P0(t,e,n,r){WF(t.x,e.x,n.x,r?r.originX:void 0),WF(t.y,e.y,n.y,r?r.originY:void 0)}function KF(t,e,n){t.min=n.min+e.min,t.max=t.min+gi(e)}function fbe(t,e,n){KF(t.x,e.x,n.x),KF(t.y,e.y,n.y)}function qF(t,e,n){t.min=e.min-n.min,t.max=t.min+gi(e)}function I0(t,e,n){qF(t.x,e.x,n.x),qF(t.y,e.y,n.y)}function dbe(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?dn(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?dn(n,t,r.max):Math.min(t,n)),t}function QF(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function hbe(t,{top:e,left:n,bottom:r,right:i}){return{x:QF(t.x,n,i),y:QF(t.y,e,r)}}function JF(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function pbe(t,e){return{x:JF(t.x,e.x),y:JF(t.y,e.y)}}function mbe(t,e){let n=.5;const r=gi(t),i=gi(e);return i>r?n=_0(e.min,e.max-r,t.min):r>i&&(n=_0(t.min,t.max-i,e.min)),Ya(0,1,n)}function gbe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const pC=.35;function ybe(t=pC){return t===!1?t=0:t===!0&&(t=pC),{x:YF(t,"left","right"),y:YF(t,"top","bottom")}}function YF(t,e,n){return{min:XF(t,e),max:XF(t,n)}}function XF(t,e){return typeof t=="number"?t:t[e]||0}const ZF=()=>({translate:0,scale:1,origin:0,originPoint:0}),td=()=>({x:ZF(),y:ZF()}),e9=()=>({min:0,max:0}),Cn=()=>({x:e9(),y:e9()});function Fi(t){return[t("x"),t("y")]}function t9({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function bbe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function wbe(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function mC(t){return t===void 0||t===1}function gC({scale:t,scaleX:e,scaleY:n}){return!mC(t)||!mC(e)||!mC(n)}function Iu(t){return gC(t)||n9(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function n9(t){return r9(t.x)||r9(t.y)}function r9(t){return t&&t!=="0%"}function ew(t,e,n){const r=t-n,i=e*r;return n+i}function i9(t,e,n,r,i){return i!==void 0&&(t=ew(t,i,r)),ew(t,n,r)+e}function yC(t,e=0,n=1,r,i){t.min=i9(t.min,e,n,r,i),t.max=i9(t.max,e,n,r,i)}function s9(t,{x:e,y:n}){yC(t.x,e.translate,e.scale,e.originPoint),yC(t.y,n.translate,n.scale,n.originPoint)}function vbe(t,e,n,r=!1){const i=n.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;a<i;a++){s=n[a],o=s.projectionDelta;const l=s.instance;l&&l.style&&l.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&nd(t,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,s9(t,o)),r&&Iu(s.latestValues)&&nd(t,s.latestValues))}e.x=o9(e.x),e.y=o9(e.y)}function o9(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function nl(t,e){t.min=t.min+e,t.max=t.max+e}function a9(t,e,[n,r,i]){const s=e[i]!==void 0?e[i]:.5,o=dn(t.min,t.max,s);yC(t,e[n],e[r],o,e.scale)}const Abe=["x","scaleX","originX"],xbe=["y","scaleY","originY"];function nd(t,e){a9(t.x,e,Abe),a9(t.y,e,xbe)}function l9(t,e){return t9(wbe(t.getBoundingClientRect(),e))}function Ebe(t,e,n){const r=l9(t,n),{scroll:i}=e;return i&&(nl(r.x,i.offset.x),nl(r.y,i.offset.y)),r}const u9=({current:t})=>t?t.ownerDocument.defaultView:null,kbe=new WeakMap;class Sbe{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Cn(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=c=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(W1(c,"page").point)},s=(c,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=HB(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Fi(g=>{let y=this.getAxisMotionValue(g).get()||0;if(Js.test(y)){const{projection:v}=this.visualElement;if(v&&v.layout){const w=v.layout.layoutBox[g];w&&(y=gi(w)*(parseFloat(y)/100))}}this.originPoint[g]=y}),p&&Rt.postRender(()=>p(c,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(c,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:g}=f;if(h&&this.currentDirection===null){this.currentDirection=Cbe(g),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,g),this.updateAxis("y",f.point,g),this.visualElement.render(),m&&m(c,f)},a=(c,f)=>this.stop(c,f),l=()=>Fi(c=>{var f;return this.getAnimationState(c)==="paused"&&((f=this.getAxisMotionValue(c).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new zF(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:u9(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Rt.postRender(()=>s(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:i}=this.getProps();if(!r||!tw(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=dbe(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;n&&Qf(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=hbe(i.layoutBox,n):this.constraints=!1,this.elastic=ybe(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Fi(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=gbe(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Qf(e))return!1;const r=e.current;Po(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=Ebe(r,i.root,this.visualElement.getTransformPagePoint());let o=pbe(i.layout.layoutBox,s);if(n){const a=n(bbe(o));this.hasMutatedConstraints=!!a,a&&(o=t9(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Fi(c=>{if(!tw(c,n,this.currentDirection))return;let f=l&&l[c]||{};o&&(f={min:0,max:0});const d=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?e[c]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return r.start(sC(e,r,0,n,this.visualElement))}stopAnimation(){Fi(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Fi(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Fi(n=>{const{drag:r}=this.getProps();if(!tw(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];s.set(e[n]-dn(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Qf(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Fi(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();i[o]=mbe({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Fi(o=>{if(!tw(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(dn(l,u,i[o]))})}addListeners(){if(!this.visualElement.current)return;kbe.set(this.visualElement,this);const e=this.visualElement.current,n=Lo(e,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Qf(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Rt.read(r);const o=Ro(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Fi(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=l[c].translate,f.set(f.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=pC,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function tw(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Cbe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Dbe extends Za{constructor(e){super(e),this.removeGroupControls=cr,this.removeListeners=cr,this.controls=new Sbe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||cr}unmount(){this.removeGroupControls(),this.removeListeners()}}const c9=t=>(e,n)=>{t&&Rt.postRender(()=>t(e,n))};class Tbe extends Za{constructor(){super(...arguments),this.removePointerDownListener=cr}onPointerDown(e){this.session=new zF(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:u9(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:c9(e),onStart:c9(n),onMove:r,onEnd:(s,o)=>{delete this.session,i&&Rt.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Lo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Obe(){const t=_.useContext(F1);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:r}=t,i=_.useId();return _.useEffect(()=>r(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}const nw={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function f9(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const R0={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Je.test(t))t=parseFloat(t);else return t;const n=f9(t,e.target.x),r=f9(t,e.target.y);return`${n}% ${r}%`}},_be={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=tl.parse(t);if(i.length>5)return r;const s=tl.createTransformer(t),o=typeof i[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;i[0+o]/=a,i[1+o]/=l;const u=dn(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=u),typeof i[3+o]=="number"&&(i[3+o]/=u),s(i)}};class Mbe extends _.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=e;Mme(Nbe),s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),nw.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,o=r.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Rt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),xS.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function d9(t){const[e,n]=Obe(),r=_.useContext(SS);return k.jsx(Mbe,{...t,layoutGroup:r,switchLayoutGroup:_.useContext(pB),isPresent:e,safeToRemove:n})}const Nbe={borderRadius:{...R0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:R0,borderTopRightRadius:R0,borderBottomLeftRadius:R0,borderBottomRightRadius:R0,boxShadow:_be},h9=["TopLeft","TopRight","BottomLeft","BottomRight"],Pbe=h9.length,p9=t=>typeof t=="string"?parseFloat(t):t,m9=t=>typeof t=="number"||Je.test(t);function Ibe(t,e,n,r,i,s){i?(t.opacity=dn(0,n.opacity!==void 0?n.opacity:1,Rbe(r)),t.opacityExit=dn(e.opacity!==void 0?e.opacity:1,0,Lbe(r))):s&&(t.opacity=dn(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<Pbe;o++){const a=`border${h9[o]}Radius`;let l=g9(e,a),u=g9(n,a);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||m9(l)===m9(u)?(t[a]=Math.max(dn(p9(l),p9(u),r),0),(Js.test(u)||Js.test(l))&&(t[a]+="%")):t[a]=u}(e.rotate||n.rotate)&&(t.rotate=dn(e.rotate||0,n.rotate||0,r))}function g9(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Rbe=y9(0,.5,kF),Lbe=y9(.5,.95,cr);function y9(t,e,n){return r=>r<t?0:r>e?1:n(_0(t,e,r))}function b9(t,e){t.min=e.min,t.max=e.max}function Ui(t,e){b9(t.x,e.x),b9(t.y,e.y)}function w9(t,e,n,r,i){return t-=e,t=ew(t,1/n,r),i!==void 0&&(t=ew(t,1/i,r)),t}function Bbe(t,e=0,n=1,r=.5,i,s=t,o=t){if(Js.test(e)&&(e=parseFloat(e),e=dn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=dn(s.min,s.max,r);t===s&&(a-=e),t.min=w9(t.min,e,n,a,i),t.max=w9(t.max,e,n,a,i)}function v9(t,e,[n,r,i],s,o){Bbe(t,e[n],e[r],e[i],e.scale,s,o)}const Fbe=["x","scaleX","originX"],Ube=["y","scaleY","originY"];function A9(t,e,n,r){v9(t.x,e,Fbe,n?n.x:void 0,r?r.x:void 0),v9(t.y,e,Ube,n?n.y:void 0,r?r.y:void 0)}function x9(t){return t.translate===0&&t.scale===1}function E9(t){return x9(t.x)&&x9(t.y)}function jbe(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function k9(t,e){return Math.round(t.x.min)===Math.round(e.x.min)&&Math.round(t.x.max)===Math.round(e.x.max)&&Math.round(t.y.min)===Math.round(e.y.min)&&Math.round(t.y.max)===Math.round(e.y.max)}function S9(t){return gi(t.x)/gi(t.y)}class Hbe{constructor(){this.members=[]}add(e){oC(this.members,e),e.scheduleRender()}remove(e){if(aC(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){r=s;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function C9(t,e,n){let r="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:d,skewX:h,skewY:p}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const Vbe=(t,e)=>t.depth-e.depth;class zbe{constructor(){this.children=[],this.isDirty=!1}add(e){oC(this.children,e),this.isDirty=!0}remove(e){aC(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Vbe),this.isDirty=!1,this.children.forEach(e)}}function $be(t,e){const n=el.now(),r=({timestamp:i})=>{const s=i-n;s>=e&&(Io(r),t(s-e))};return Rt.read(r,!0),()=>Io(r)}function Gbe(t){window.MotionDebug&&window.MotionDebug.record(t)}function Wbe(t){return t instanceof SVGElement&&t.tagName!=="svg"}function Kbe(t,e,n){const r=vr(t)?t:N0(t);return r.start(sC("",r,e,n)),r.animation}const bC=["","X","Y","Z"],qbe={visibility:"hidden"},D9=1e3;let Qbe=0;const Ru={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function wC(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function T9(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return!1;const{visualElement:e}=t.options;return e?UF(e)?!0:t.parent&&!t.parent.hasCheckedOptimisedAppear?T9(t.parent):!1:!1}function O9({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=Qbe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ru.totalNodes=Ru.resolvedTargetDeltas=Ru.recalculatedProjection=0,this.nodes.forEach(Xbe),this.nodes.forEach(r1e),this.nodes.forEach(i1e),this.nodes.forEach(Zbe),Gbe(Ru)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new zbe)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new lC),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,a=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=Wbe(o),this.instance=o;const{layoutId:l,layout:u,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(u||l)&&(this.isLayoutDirty=!0),t){let f;const d=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=$be(d,250),nw.hasAnimatedSinceResize&&(nw.hasAnimatedSinceResize=!1,this.nodes.forEach(M9))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||u1e,{onLayoutAnimationStart:g,onLayoutAnimationComplete:y}=c.getProps(),v=!this.targetLayout||!k9(this.targetLayout,p)||h,w=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,w);const b={...jS(m,"layout"),onPlay:g,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else d||M9(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Io(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(s1e),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.HandoffCancelAllAnimations&&T9(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const f=this.path[c];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(_9);return}this.isUpdating||this.nodes.forEach(t1e),this.isUpdating=!1,this.nodes.forEach(n1e),this.nodes.forEach(Jbe),this.nodes.forEach(Ybe),this.clearAllSnapshots();const a=el.now();fr.delta=Ya(0,1e3/60,a-fr.timestamp),fr.timestamp=a,fr.isProcessing=!0,LS.update.process(fr),LS.preRender.process(fr),LS.render.process(fr),fr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,xS.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(e1e),this.sharedNodes.forEach(o1e)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Rt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Rt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Cn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&(this.scroll={animationId:this.root.animationId,phase:o,isRoot:r(this.instance),offset:n(this.instance)})}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!E9(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,c=u!==this.prevTransformTemplateValue;o&&(a||Iu(this.latestValues)||c)&&(i(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),c1e(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return Cn();const a=o.measureViewportBox(),{scroll:l}=this.root;return l&&(nl(a.x,l.offset.x),nl(a.y,l.offset.y)),a}removeElementScroll(o){const a=Cn();Ui(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l],{scroll:c,options:f}=u;if(u!==this.root&&c&&f.layoutScroll){if(c.isRoot){Ui(a,o);const{scroll:d}=this.root;d&&(nl(a.x,-d.offset.x),nl(a.y,-d.offset.y))}nl(a.x,c.offset.x),nl(a.y,c.offset.y)}}return a}applyTransform(o,a=!1){const l=Cn();Ui(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];!a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&nd(l,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),Iu(c.latestValues)&&nd(l,c.latestValues)}return Iu(this.latestValues)&&nd(l,this.latestValues),l}removeTransform(o){const a=Cn();Ui(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!Iu(u.latestValues))continue;gC(u.latestValues)&&u.updateSnapshot();const c=Cn(),f=u.measurePageBox();Ui(c,f),A9(a,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,c)}return Iu(this.latestValues)&&A9(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==fr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:f,layoutId:d}=this.options;if(!(!this.layout||!(f||d))){if(this.resolvedRelativeTargetAt=fr.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Cn(),this.relativeTargetOrigin=Cn(),I0(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),Ui(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Cn(),this.targetWithTransforms=Cn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),fbe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ui(this.target,this.layout.layoutBox),s9(this.target,this.targetDelta)):Ui(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Cn(),this.relativeTargetOrigin=Cn(),I0(this.relativeTargetOrigin,this.target,h.target),Ui(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Ru.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||gC(this.parent.latestValues)||n9(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===fr.timestamp&&(u=!1),u)return;const{layout:c,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||f))return;Ui(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;vbe(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Cn());const{target:p}=a;if(!p){this.projectionTransform&&(this.projectionDelta=td(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=td(),this.projectionDeltaWithTransform=td());const m=this.projectionTransform;P0(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=C9(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Ru.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(o,a=!1){const l=this.snapshot,u=l?l.latestValues:{},c={...this.latestValues},f=td();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=Cn(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,m=h!==p,g=this.getStack(),y=!g||g.members.length<=1,v=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(l1e));this.animationProgress=0;let w;this.mixTargetDelta=b=>{const E=b/1e3;N9(f.x,o.x,E),N9(f.y,o.y,E),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(I0(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),a1e(this.relativeTarget,this.relativeTargetOrigin,d,E),w&&jbe(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Cn()),Ui(w,this.relativeTarget)),m&&(this.animationValues=c,Ibe(c,u,this.latestValues,E,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Io(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Rt.update(()=>{nw.hasAnimatedSinceResize=!0,this.currentAnimation=Kbe(0,D9,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(D9),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&B9(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Cn();const f=gi(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=gi(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}Ui(a,l),nd(a,c),P0(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Hbe),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&wC("z",o,u,this.animationValues);for(let c=0;c<bC.length;c++)wC(`rotate${bC[c]}`,o,u,this.animationValues),wC(`skew${bC[c]}`,o,u,this.animationValues);o.render();for(const c in u)o.setStaticValue(c,u[c]),this.animationValues&&(this.animationValues[c]=u[c]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return qbe;const u={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=G1(o==null?void 0:o.pointerEvents)||"",u.transform=c?c(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=G1(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Iu(this.latestValues)&&(m.transform=c?c({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=C9(this.projectionDeltaWithTransform,this.treeScale,d),c&&(u.transform=c(d,u.transform));const{x:h,y:p}=this.projectionDelta;u.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?u.opacity=f===this?(l=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:u.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in V1){if(d[m]===void 0)continue;const{correct:g,applyTo:y}=V1[m],v=u.transform==="none"?d[m]:g(d[m],f);if(y){const w=y.length;for(let b=0;b<w;b++)u[y[b]]=v}else u[m]=v}return this.options.layoutId&&(u.pointerEvents=f===this?G1(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(_9),this.root.sharedNodes.clear()}}}function Jbe(t){t.updateLayout()}function Ybe(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=t.layout,{animationType:s}=t.options,o=n.source!==t.layout.source;s==="size"?Fi(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=gi(d);d.min=r[f].min,d.max=d.min+h}):B9(s,n.layoutBox,r)&&Fi(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=gi(r[f]);d.max=d.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+h)});const a=td();P0(a,r,n.layoutBox);const l=td();o?P0(l,t.applyTransform(i,!0),n.measuredBox):P0(l,r,n.layoutBox);const u=!E9(a);let c=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=Cn();I0(p,n.layoutBox,d.layoutBox);const m=Cn();I0(m,r,h.layoutBox),k9(p,m)||(c=!0),f.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function Xbe(t){Ru.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Zbe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function e1e(t){t.clearSnapshot()}function _9(t){t.clearMeasurements()}function t1e(t){t.isLayoutDirty=!1}function n1e(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function M9(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function r1e(t){t.resolveTargetDelta()}function i1e(t){t.calcProjection()}function s1e(t){t.resetSkewAndRotation()}function o1e(t){t.removeLeadSnapshot()}function N9(t,e,n){t.translate=dn(e.translate,0,n),t.scale=dn(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function P9(t,e,n,r){t.min=dn(e.min,n.min,r),t.max=dn(e.max,n.max,r)}function a1e(t,e,n,r){P9(t.x,e.x,n.x,r),P9(t.y,e.y,n.y,r)}function l1e(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const u1e={duration:.45,ease:[.4,0,.1,1]},I9=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),R9=I9("applewebkit/")&&!I9("chrome/")?Math.round:cr;function L9(t){t.min=R9(t.min),t.max=R9(t.max)}function c1e(t){L9(t.x),L9(t.y)}function B9(t,e,n){return t==="position"||t==="preserve-aspect"&&!hC(S9(e),S9(n),.2)}const f1e=O9({attachResizeListener:(t,e)=>Ro(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),vC={current:void 0},F9=O9({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!vC.current){const t=new f1e({});t.mount(window),t.setOptions({layoutScroll:!0}),vC.current=t}return vC.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),d1e={pan:{Feature:Tbe},drag:{Feature:Dbe,ProjectionNode:F9,MeasureLayout:d9}},AC={current:null},U9={current:!1};function h1e(){if(U9.current=!0,!!wS)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>AC.current=t.matches;t.addListener(e),e()}else AC.current=!1}function p1e(t,e,n){const{willChange:r}=e;for(const i in e){const s=e[i],o=n[i];if(vr(s))t.addValue(i,s),Z1(r)&&r.add(i),process.env.NODE_ENV==="development"&&uC(s.version==="11.2.12",`Attempting to mix Framer Motion versions ${s.version} with 11.2.12 may not work as expected.`);else if(vr(o))t.addValue(i,N0(s,{owner:t})),Z1(r)&&r.remove(i);else if(o!==s)if(t.hasValue(i)){const a=t.getValue(i);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=t.getStaticValue(i);t.addValue(i,N0(a!==void 0?a:s,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const j9=new WeakMap,m1e=[...ZB,Ar,tl],g1e=t=>m1e.find(XB(t)),H9=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],y1e=kS.length;class b1e{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.resolveKeyframes=(d,h,p,m)=>new this.KeyframeResolver(d,h,p,m,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=zS,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Rt.render(this.render,!1,!0);const{latestValues:l,renderState:u}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=H1(n),this.isVariantNode=yB(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&vr(h)&&(h.set(l[d],!1),Z1(c)&&c.add(d))}}mount(e){this.current=e,j9.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),U9.current||h1e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:AC.current,process.env.NODE_ENV!=="production"&&uC(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){j9.delete(this.current),this.projection&&this.projection.unmount(),Io(this.notifyUpdate),Io(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){const r=_u.has(e),i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Rt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),s(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Jf){const n=Jf[e];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Cn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<H9.length;r++){const i=H9[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const s="on"+i,o=e[s];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=p1e(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const r=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(r.initial=this.props.initial),r}const n={};for(let r=0;r<y1e;r++){const i=kS[r],s=this.props[i];(x0(s)||s===!1)&&(n[i]=s)}return n}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=N0(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(KB(i)||WB(i))?i=parseFloat(i):!g1e(i)&&tl.test(n)&&(i=uF(e,n)),this.setBaseTarget(e,vr(i)?i.get():i)),vr(i)?i.get():i}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const o=IS(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(i=o[e])}if(r&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!vr(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new lC),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class V9 extends b1e{constructor(){super(...arguments),this.KeyframeResolver=cF}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}}function w1e(t){return window.getComputedStyle(t)}class v1e extends V9{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,n){if(_u.has(n)){const r=qS(n);return r&&r.default||0}else{const r=w1e(e),i=(xB(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return l9(e,n)}build(e,n,r,i){OS(e,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return PS(e,n,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;vr(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,r,i){_B(e,n,r,i)}}class A1e extends V9{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(_u.has(n)){const r=qS(n);return r&&r.default||0}return n=MB.has(n)?n:AS(n),e.getAttribute(n)}measureInstanceViewportBox(){return Cn()}scrapeMotionValuesFromProps(e,n,r){return PB(e,n,r)}build(e,n,r,i){MS(e,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,r,i){NB(e,n,r,i)}mount(e){this.isSVGTag=NS(e.tagName),super.mount(e)}}const x1e=(t,e)=>CS(t)?new A1e(e,{enableHardwareAcceleration:!1}):new v1e(e,{allowProjection:t!==_.Fragment,enableHardwareAcceleration:!0}),E1e={...abe,...wge,...d1e,...{layout:{ProjectionNode:F9,MeasureLayout:d9}}},k1e=Ome((t,e)=>oge(t,e,E1e,x1e));function z9(){const t=_.useRef(!1);return vS(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function S1e(){const t=z9(),[e,n]=_.useState(0),r=_.useCallback(()=>{t.current&&n(e+1)},[e]);return[_.useCallback(()=>Rt.postRender(r),[r]),e]}class C1e extends Y.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function D1e({children:t,isPresent:e}){const n=_.useId(),r=_.useRef(null),i=_.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=_.useContext(bS);return _.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:u}=i.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return s&&(c.nonce=s),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`
592
- [data-motion-pop-id="${n}"] {
593
- position: absolute !important;
594
- width: ${o}px !important;
595
- height: ${a}px !important;
596
- top: ${l}px !important;
597
- left: ${u}px !important;
598
- }
599
- `),()=>{document.head.removeChild(c)}},[e]),k.jsx(C1e,{isPresent:e,childRef:r,sizeRef:i,children:Y.cloneElement(t,{ref:r})})}const xC=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=RB(T1e),l=_.useId(),u=_.useMemo(()=>({id:l,initial:e,isPresent:n,custom:i,onExitComplete:c=>{a.set(c,!0);for(const f of a.values())if(!f)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),s?[Math.random()]:[n]);return _.useMemo(()=>{a.forEach((c,f)=>a.set(f,!1))},[n]),Y.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),o==="popLayout"&&(t=k.jsx(D1e,{isPresent:n,children:t})),k.jsx(F1.Provider,{value:u,children:t})};function T1e(){return new Map}function O1e(t){return _.useEffect(()=>()=>t(),[])}const Lu=t=>t.key||"";function _1e(t,e){t.forEach(n=>{const r=Lu(n);e.set(r,n)})}function M1e(t){const e=[];return _.Children.forEach(t,n=>{_.isValidElement(n)&&e.push(n)}),e}const N1e=({children:t,custom:e,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Po(!i,"Replace exitBeforeEnter with mode='wait'");const a=_.useContext(SS).forceRender||S1e()[0],l=z9(),u=M1e(t);let c=u;const f=_.useRef(new Map).current,d=_.useRef(c),h=_.useRef(new Map).current,p=_.useRef(!0);if(vS(()=>{p.current=!1,_1e(u,h),d.current=c}),O1e(()=>{p.current=!0,h.clear(),f.clear()}),p.current)return k.jsx(k.Fragment,{children:c.map(v=>k.jsx(xC,{isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:s,mode:o,children:v},Lu(v)))});c=[...c];const m=d.current.map(Lu),g=u.map(Lu),y=m.length;for(let v=0;v<y;v++){const w=m[v];g.indexOf(w)===-1&&!f.has(w)&&f.set(w,void 0)}return o==="wait"&&f.size&&(c=[]),f.forEach((v,w)=>{if(g.indexOf(w)!==-1)return;const b=h.get(w);if(!b)return;const E=m.indexOf(w);let x=v;if(!x){const O=()=>{f.delete(w);const S=Array.from(h.keys()).filter(D=>!g.includes(D));if(S.forEach(D=>h.delete(D)),d.current=u.filter(D=>{const I=Lu(D);return I===w||S.includes(I)}),!f.size){if(l.current===!1)return;a(),r&&r()}};x=k.jsx(xC,{isPresent:!1,onExitComplete:O,custom:e,presenceAffectsLayout:s,mode:o,children:b},Lu(b)),f.set(w,x)}c.splice(E,0,x)}),c=c.map(v=>{const w=v.key;return f.has(w)?v:k.jsx(xC,{isPresent:!0,presenceAffectsLayout:s,mode:o,children:v},Lu(v))}),process.env.NODE_ENV!=="production"&&o==="wait"&&c.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`),k.jsx(k.Fragment,{children:f.size?c:c.map(v=>_.cloneElement(v))})};var rw={exports:{}};/*!
600
- * Platform.js v1.3.6
601
- * Copyright 2014-2020 Benjamin Tan
602
- * Copyright 2011-2013 John-David Dalton
603
- * Available under MIT license
604
- */rw.exports,function(t,e){(function(){var n={function:!0,object:!0},r=n[typeof window]&&window||this,i=e,s=t&&!t.nodeType&&t,o=i&&s&&typeof Sl=="object"&&Sl;o&&(o.global===o||o.window===o||o.self===o)&&(r=o);var a=Math.pow(2,53)-1,l=/\bOpera/,u=Object.prototype,c=u.hasOwnProperty,f=u.toString;function d(S){return S=String(S),S.charAt(0).toUpperCase()+S.slice(1)}function h(S,D,I){var F={"10.0":"10","6.4":"10 Technical Preview","6.3":"8.1","6.2":"8","6.1":"Server 2008 R2 / 7","6.0":"Server 2008 / Vista","5.2":"Server 2003 / XP 64-bit","5.1":"XP","5.01":"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return D&&I&&/^Win/i.test(S)&&!/^Windows Phone /i.test(S)&&(F=F[/[\d.]+$/.exec(S)])&&(S="Windows "+F),S=String(S),D&&I&&(S=S.replace(RegExp(D,"i"),I)),S=m(S.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0]),S}function p(S,D){var I=-1,F=S?S.length:0;if(typeof F=="number"&&F>-1&&F<=a)for(;++I<F;)D(S[I],I,S);else g(S,D)}function m(S){return S=E(S),/^(?:webOS|i(?:OS|P))/.test(S)?S:d(S)}function g(S,D){for(var I in S)c.call(S,I)&&D(S[I],I,S)}function y(S){return S==null?d(S):f.call(S).slice(8,-1)}function v(S,D){var I=S!=null?typeof S[D]:"number";return!/^(?:boolean|number|string|undefined)$/.test(I)&&(I=="object"?!!S[D]:!0)}function w(S){return String(S).replace(/([ -])(?!$)/g,"$1?")}function b(S,D){var I=null;return p(S,function(F,Q){I=D(I,F,Q,S)}),I}function E(S){return String(S).replace(/^ +| +$/g,"")}function x(S){var D=r,I=S&&typeof S=="object"&&y(S)!="String";I&&(D=S,S=null);var F=D.navigator||{},Q=F.userAgent||"";S||(S=Q);var V=I?!!F.likeChrome:/\bChrome\b/.test(S)&&!/internal|\n/i.test(f.toString()),B="Object",N=I?B:"ScriptBridgingProxyObject",H=I?B:"Environment",K=I&&D.java?"JavaPackage":y(D.java),J=I?B:"RuntimeObject",X=/\bJava/.test(K)&&D.java,ie=X&&y(D.environment)==H,le=X?"a":"α",Pe=X?"b":"β",xe=D.document||{},Ie=D.operamini||D.opera,ke=l.test(ke=I&&Ie?Ie["[[Class]]"]:y(Ie))?ke:Ie=null,$,ne=S,G=[],Z=null,A=S==Q,P=A&&Ie&&typeof Ie.version=="function"&&Ie.version(),ue,de=Ke([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),oe=tt(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),we=ft([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),De=qe({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),pe=lt(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function Ke(C){return b(C,function(M,R){return M||RegExp("\\b"+(R.pattern||w(R))+"\\b","i").exec(S)&&(R.label||R)})}function qe(C){return b(C,function(M,R,z){return M||(R[we]||R[/^[a-z]+(?: +[a-z]+\b)*/i.exec(we)]||RegExp("\\b"+w(z)+"(?:\\b|\\w*\\d)","i").exec(S))&&z})}function tt(C){return b(C,function(M,R){return M||RegExp("\\b"+(R.pattern||w(R))+"\\b","i").exec(S)&&(R.label||R)})}function lt(C){return b(C,function(M,R){var z=R.pattern||w(R);return!M&&(M=RegExp("\\b"+z+"(?:/[\\d.]+|[ \\w.]*)","i").exec(S))&&(M=h(M,z,R.label||R)),M})}function ft(C){return b(C,function(M,R){var z=R.pattern||w(R);return!M&&(M=RegExp("\\b"+z+" *\\d+[.\\w_]*","i").exec(S)||RegExp("\\b"+z+" *\\w+-[\\w]*","i").exec(S)||RegExp("\\b"+z+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(S))&&((M=String(R.label&&!RegExp(z,"i").test(R.label)?R.label:M).split("/"))[1]&&!/[\d.]+/.test(M[0])&&(M[0]+=" "+M[1]),R=R.label||R,M=m(M[0].replace(RegExp(z,"i"),R).replace(RegExp("; *(?:"+R+"[_-])?","i")," ").replace(RegExp("("+R+")[-_.]?(\\w)","i"),"$1 $2"))),M})}function Ze(C){return b(C,function(M,R){return M||(RegExp(R+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(S)||0)[1]||null})}function Se(){return this.description||""}if(de&&(de=[de]),/\bAndroid\b/.test(pe)&&!we&&($=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(S))&&(we=E($[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),De&&!we?we=ft([De]):De&&we&&(we=we.replace(RegExp("^("+w(De)+")[-_.\\s]","i"),De+" ").replace(RegExp("^("+w(De)+")[-_.]?(\\w)","i"),De+" $2")),($=/\bGoogle TV\b/.exec(we))&&(we=$[0]),/\bSimulator\b/i.test(S)&&(we=(we?we+" ":"")+"Simulator"),oe=="Opera Mini"&&/\bOPiOS\b/.test(S)&&G.push("running in Turbo/Uncompressed mode"),oe=="IE"&&/\blike iPhone OS\b/.test(S)?($=x(S.replace(/like iPhone OS/,"")),De=$.manufacturer,we=$.product):/^iP/.test(we)?(oe||(oe="Safari"),pe="iOS"+(($=/ OS ([\d_]+)/i.exec(S))?" "+$[1].replace(/_/g,"."):"")):oe=="Konqueror"&&/^Linux\b/i.test(pe)?pe="Kubuntu":De&&De!="Google"&&(/Chrome/.test(oe)&&!/\bMobile Safari\b/i.test(S)||/\bVita\b/.test(we))||/\bAndroid\b/.test(pe)&&/^Chrome/.test(oe)&&/\bVersion\//i.test(S)?(oe="Android Browser",pe=/\bAndroid\b/.test(pe)?pe:"Android"):oe=="Silk"?(/\bMobi/i.test(S)||(pe="Android",G.unshift("desktop mode")),/Accelerated *= *true/i.test(S)&&G.unshift("accelerated")):oe=="UC Browser"&&/\bUCWEB\b/.test(S)?G.push("speed mode"):oe=="PaleMoon"&&($=/\bFirefox\/([\d.]+)\b/.exec(S))?G.push("identifying as Firefox "+$[1]):oe=="Firefox"&&($=/\b(Mobile|Tablet|TV)\b/i.exec(S))?(pe||(pe="Firefox OS"),we||(we=$[1])):!oe||($=!/\bMinefield\b/i.test(S)&&/\b(?:Firefox|Safari)\b/.exec(oe))?(oe&&!we&&/[\/,]|^[^(]+?\)/.test(S.slice(S.indexOf($+"/")+8))&&(oe=null),($=we||De||pe)&&(we||De||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(pe))&&(oe=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(pe)?pe:$)+" Browser")):oe=="Electron"&&($=(/\bChrome\/([\d.]+)\b/.exec(S)||0)[1])&&G.push("Chromium "+$),P||(P=Ze(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",w(oe),"(?:Firefox|Minefield|NetFront)"])),($=de=="iCab"&&parseFloat(P)>3&&"WebKit"||/\bOpera\b/.test(oe)&&(/\bOPR\b/.test(S)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(S)&&!/^(?:Trident|EdgeHTML)$/.test(de)&&"WebKit"||!de&&/\bMSIE\b/i.test(S)&&(pe=="Mac OS"?"Tasman":"Trident")||de=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(oe)&&"NetFront")&&(de=[$]),oe=="IE"&&($=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(S)||0)[1])?(oe+=" Mobile",pe="Windows Phone "+(/\+$/.test($)?$:$+".x"),G.unshift("desktop mode")):/\bWPDesktop\b/i.test(S)?(oe="IE Mobile",pe="Windows Phone 8.x",G.unshift("desktop mode"),P||(P=(/\brv:([\d.]+)/.exec(S)||0)[1])):oe!="IE"&&de=="Trident"&&($=/\brv:([\d.]+)/.exec(S))&&(oe&&G.push("identifying as "+oe+(P?" "+P:"")),oe="IE",P=$[1]),A){if(v(D,"global"))if(X&&($=X.lang.System,ne=$.getProperty("os.arch"),pe=pe||$.getProperty("os.name")+" "+$.getProperty("os.version")),ie){try{P=D.require("ringo/engine").version.join("."),oe="RingoJS"}catch{($=D.system)&&$.global.system==D.system&&(oe="Narwhal",pe||(pe=$[0].os||null))}oe||(oe="Rhino")}else typeof D.process=="object"&&!D.process.browser&&($=D.process)&&(typeof $.versions=="object"&&(typeof $.versions.electron=="string"?(G.push("Node "+$.versions.node),oe="Electron",P=$.versions.electron):typeof $.versions.nw=="string"&&(G.push("Chromium "+P,"Node "+$.versions.node),oe="NW.js",P=$.versions.nw)),oe||(oe="Node.js",ne=$.arch,pe=$.platform,P=/[\d.]+/.exec($.version),P=P?P[0]:null));else y($=D.runtime)==N?(oe="Adobe AIR",pe=$.flash.system.Capabilities.os):y($=D.phantom)==J?(oe="PhantomJS",P=($=$.version||null)&&$.major+"."+$.minor+"."+$.patch):typeof xe.documentMode=="number"&&($=/\bTrident\/(\d+)/i.exec(S))?(P=[P,xe.documentMode],($=+$[1]+4)!=P[1]&&(G.push("IE "+P[1]+" mode"),de&&(de[1]=""),P[1]=$),P=oe=="IE"?String(P[1].toFixed(1)):P[0]):typeof xe.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(oe)&&(G.push("masking as "+oe+" "+P),oe="IE",P="11.0",de=["Trident"],pe="Windows");pe=pe&&m(pe)}if(P&&($=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(P)||/(?:alpha|beta)(?: ?\d)?/i.exec(S+";"+(A&&F.appMinorVersion))||/\bMinefield\b/i.test(S)&&"a")&&(Z=/b/i.test($)?"beta":"alpha",P=P.replace(RegExp($+"\\+?$"),"")+(Z=="beta"?Pe:le)+(/\d+\+?/.exec($)||"")),oe=="Fennec"||oe=="Firefox"&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(pe))oe="Firefox Mobile";else if(oe=="Maxthon"&&P)P=P.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(we))we=="Xbox 360"&&(pe=null),we=="Xbox 360"&&/\bIEMobile\b/.test(S)&&G.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(oe)||oe&&!we&&!/Browser|Mobi/.test(oe))&&(pe=="Windows CE"||/Mobi/i.test(S)))oe+=" Mobile";else if(oe=="IE"&&A)try{D.external===null&&G.unshift("platform preview")}catch{G.unshift("embedded")}else(/\bBlackBerry\b/.test(we)||/\bBB10\b/.test(S))&&($=(RegExp(we.replace(/ +/g," *")+"/([.\\d]+)","i").exec(S)||0)[1]||P)?($=[$,/BB10/.test(S)],pe=($[1]?(we=null,De="BlackBerry"):"Device Software")+" "+$[0],P=null):this!=g&&we!="Wii"&&(A&&Ie||/Opera/.test(oe)&&/\b(?:MSIE|Firefox)\b/i.test(S)||oe=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(pe)||oe=="IE"&&(pe&&!/^Win/.test(pe)&&P>5.5||/\bWindows XP\b/.test(pe)&&P>8||P==8&&!/\bTrident\b/.test(S)))&&!l.test($=x.call(g,S.replace(l,"")+";"))&&$.name&&($="ing as "+$.name+(($=$.version)?" "+$:""),l.test(oe)?(/\bIE\b/.test($)&&pe=="Mac OS"&&(pe=null),$="identify"+$):($="mask"+$,ke?oe=m(ke.replace(/([a-z])([A-Z])/g,"$1 $2")):oe="Opera",/\bIE\b/.test($)&&(pe=null),A||(P=null)),de=["Presto"],G.push($));($=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(S)||0)[1])&&($=[parseFloat($.replace(/\.(\d)$/,".0$1")),$],oe=="Safari"&&$[1].slice(-1)=="+"?(oe="WebKit Nightly",Z="alpha",P=$[1].slice(0,-1)):(P==$[1]||P==($[2]=(/\bSafari\/([\d.]+\+?)/i.exec(S)||0)[1]))&&(P=null),$[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(S)||0)[1],$[0]==537.36&&$[2]==537.36&&parseFloat($[1])>=28&&de=="WebKit"&&(de=["Blink"]),!A||!V&&!$[1]?(de&&(de[1]="like Safari"),$=($=$[0],$<400?1:$<500?2:$<526?3:$<533?4:$<534?"4+":$<535?5:$<537?6:$<538?7:$<601?8:$<602?9:$<604?10:$<606?11:$<608?12:"12")):(de&&(de[1]="like Chrome"),$=$[1]||($=$[0],$<530?1:$<532?2:$<532.05?3:$<533?4:$<534.03?5:$<534.07?6:$<534.1?7:$<534.13?8:$<534.16?9:$<534.24?10:$<534.3?11:$<535.01?12:$<535.02?"13+":$<535.07?15:$<535.11?16:$<535.19?17:$<536.05?18:$<536.1?19:$<537.01?20:$<537.11?"21+":$<537.13?23:$<537.18?24:$<537.24?25:$<537.36?26:de!="Blink"?"27":"28")),de&&(de[1]+=" "+($+=typeof $=="number"?".x":/[.+]/.test($)?"":"+")),oe=="Safari"&&(!P||parseInt(P)>45)?P=$:oe=="Chrome"&&/\bHeadlessChrome/i.test(S)&&G.unshift("headless")),oe=="Opera"&&($=/\bzbov|zvav$/.exec(pe))?(oe+=" ",G.unshift("desktop mode"),$=="zvav"?(oe+="Mini",P=null):oe+="Mobile",pe=pe.replace(RegExp(" *"+$+"$"),"")):oe=="Safari"&&/\bChrome\b/.exec(de&&de[1])?(G.unshift("desktop mode"),oe="Chrome Mobile",P=null,/\bOS X\b/.test(pe)?(De="Apple",pe="iOS 4.3+"):pe=null):/\bSRWare Iron\b/.test(oe)&&!P&&(P=Ze("Chrome")),P&&P.indexOf($=/[\d.]+$/.exec(pe))==0&&S.indexOf("/"+$+"-")>-1&&(pe=E(pe.replace($,""))),pe&&pe.indexOf(oe)!=-1&&!RegExp(oe+" OS").test(pe)&&(pe=pe.replace(RegExp(" *"+w(oe)+" *"),"")),de&&!/\b(?:Avant|Nook)\b/.test(oe)&&(/Browser|Lunascape|Maxthon/.test(oe)||oe!="Safari"&&/^iOS/.test(pe)&&/\bSafari\b/.test(de[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(oe)&&de[1])&&($=de[de.length-1])&&G.push($),G.length&&(G=["("+G.join("; ")+")"]),De&&we&&we.indexOf(De)<0&&G.push("on "+De),we&&G.push((/^on /.test(G[G.length-1])?"":"on ")+we),pe&&($=/ ([\d.+]+)$/.exec(pe),ue=$&&pe.charAt(pe.length-$[0].length-1)=="/",pe={architecture:32,family:$&&!ue?pe.replace($[0],""):pe,version:$?$[1]:null,toString:function(){var C=this.version;return this.family+(C&&!ue?" "+C:"")+(this.architecture==64?" 64-bit":"")}}),($=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(ne))&&!/\bi686\b/i.test(ne)?(pe&&(pe.architecture=64,pe.family=pe.family.replace(RegExp(" *"+$),"")),oe&&(/\bWOW64\b/i.test(S)||A&&/\w(?:86|32)$/.test(F.cpuClass||F.platform)&&!/\bWin64; x64\b/i.test(S))&&G.unshift("32-bit")):pe&&/^OS X/.test(pe.family)&&oe=="Chrome"&&parseFloat(P)>=39&&(pe.architecture=64),S||(S=null);var Ue={};return Ue.description=S,Ue.layout=de&&de[0],Ue.manufacturer=De,Ue.name=oe,Ue.prerelease=Z,Ue.product=we,Ue.ua=S,Ue.version=oe&&P,Ue.os=pe||{architecture:null,family:null,version:null,toString:function(){return"null"}},Ue.parse=x,Ue.toString=Se,Ue.version&&G.unshift(P),Ue.name&&G.unshift(oe),pe&&oe&&!(pe==String(pe).split(" ")[0]&&(pe==oe.split(" ")[0]||we))&&G.push(we?"("+pe+")":"on "+pe),G.length&&(Ue.description=G.join(" ")),Ue}var O=x();i&&s?g(O,function(S,D){i[D]=S}):r.platform=O}).call(Sl)}(rw,rw.exports);var P1e=rw.exports;const I1e=Jd(P1e),EC=()=>{var t;return(t=I1e.os)==null?void 0:t.family},R1e=_.forwardRef(({isPreviewMode:t=!1,initialContent:e,enableCollaboration:n,collaborationId:r,username:i,renderToolRightSection:s,renderToolLeftSection:o,walletAddress:a,onChange:l,onCollaboratorChange:u,onTextSelection:c,onCommentInteraction:f,handleCommentButtonClick:d,showCommentButton:h,ensResolutionUrl:p,disableBottomToolbar:m,onError:g,setCharacterCount:y,setWordCount:v,collaborationkey:w},b)=>{const[E,x]=_.useState(!1),[O,S]=_.useState(!1),D=_.useRef(null),I=_.useRef(null),F=Tk("(max-width: 640px)"),Q=EC()==="iOS"||EC()==="Android"||EC()==="Windows Phone"||F,{editor:V,ref:B,ydoc:N}=fme({isPreviewMode:t,initialContent:e,enableCollaboration:n,collaborationId:r,walletAddress:a,username:i,onChange:l,onCollaboratorChange:u,onCommentInteraction:f,onTextSelection:c,ensResolutionUrl:p,onError:g,setCharacterCount:y,setWordCount:v,collaborationkey:w});return _.useImperativeHandle(b,()=>({getEditor:()=>V,getYdoc:()=>N}),[V,N]),_.useEffect(()=>{if(!V)return;const H=X=>{const{key:ie}=X;return ie.length===1},K=X=>{H(X)&&Q&&(D.current&&clearTimeout(D.current),S(!0),D.current=setTimeout(()=>{S(!1)},500))},J=V.view.dom;return J.addEventListener("keydown",K),()=>{J.removeEventListener("keydown",K),D.current&&clearTimeout(D.current)}},[V,Q]),_.useEffect(()=>{if(V&&Q){const{selection:H}=V.state,K=Nm(H),J=()=>{x(!0)},X=()=>{x(!1)};return!K&&V.on("focus",J),K&&V.on("blur",X),()=>{V.off("focus",J),V.off("blur",X)}}},[Q,V]),_.useEffect(()=>{if(!V)return;const H=J=>{J.key==="Enter"&&V.commands.scrollIntoView()},K=V.view.dom;return K.addEventListener("keydown",H),()=>{K.removeEventListener("keydown",H)}},[V]),_.useEffect(()=>{if(!Q||!V)return;const H=()=>{B.current&&B.current.scrollIntoView()},K=V.view.dom;return K.addEventListener("resize",H),()=>{K.removeEventListener("resize",H)}},[V,B,Q]),V?k.jsxs("div",{"data-cy":"single-webpage",className:"bg-[#f8f9fa] h-full w-full",children:[k.jsx("div",{id:"toolbar",className:"flex items-center w-full h-16 sticky left-0 top-0 z-10 px-4 bg-[#f8f9fa]",children:k.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[k.jsx("div",{className:"grow",children:o==null?void 0:o({editor:V.getJSON()})}),!t&&k.jsx("div",{className:"grow relative hidden xl:block",children:k.jsx(pq,{onError:g,editor:V})}),s==null?void 0:s({editor:V.getJSON()})]})}),k.jsxs("div",{className:"p-4 sm:px-[88px] sm:py-[78px] bg-white w-full sm:w-[70%] max-w-[856px] mx-auto",style:{height:Q&&!t?"calc(100vh - 8rem)":"100vh"},children:[k.jsxs("div",{ref:B,className:"w-full h-full overflow-y-scroll overflow-x-hidden no-scrollbar",children:[!t&&k.jsxs("div",{children:[k.jsx(sq,{editor:V}),k.jsx(dq,{editor:V,appendTo:B})]}),k.jsx(hq,{isPreviewMode:t,children:k.jsx(M$,{editor:V,id:"editor",className:"w-full h-full py-4"})})]}),h&&!Q&&k.jsx(ba,{ref:I,onClick:()=>{d==null||d(V)},variant:"ghost",className:Ne("absolute w-12 h-12 bg-white rounded-full shadow-xl top-[70px] right-[-23px]"),children:k.jsx(rG,{})})]}),!t&&k.jsx(N1e,{children:!O&&!m&&k.jsx(k1e.div,{initial:{y:50,opacity:0},animate:{y:0,opacity:1},exit:{y:50,opacity:0},transition:{duration:.2},className:Ne("flex xl:hidden items-center w-full h-16 fixed left-0 bottom-0 z-10 px-4 bg-[#f8f9fa] transition-all duration-300 ease-in-out",E&&"hidden"),children:k.jsx(hme,{onError:g,editor:V,isKeyboardVisible:E})})})]}):k.jsxs("div",{className:"w-screen h-screen flex flex-col gap-4 justify-center items-center",children:[k.jsx(M_,{}),k.jsx("p",{children:"Loading Editor..."})]})});At.DdocEditor=R1e,Object.defineProperty(At,Symbol.toStringTag,{value:"Module"})});