@prismicio/editor-fields 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/EditorConfig.d.ts +23 -15
  2. package/dist/fields/EmbedField/EmbedField.d.ts +0 -4
  3. package/dist/fields/EmbedField/EmbedFooter.d.ts +8 -0
  4. package/dist/fields/GeoPointField/GeoPointField.d.ts +13 -0
  5. package/dist/fields/GeoPointField/geoPointFieldUtils.d.ts +6 -0
  6. package/dist/fields/GeoPointField/index.d.ts +1 -0
  7. package/dist/fields/ImageField/CropperDialog/CropperDialog.d.ts +0 -1
  8. package/dist/fields/ImageField/EmptyCardContent.d.ts +8 -0
  9. package/dist/fields/ImageField/ImageAltControl.d.ts +8 -0
  10. package/dist/fields/ImageField/ImageFieldCard.d.ts +16 -0
  11. package/dist/fields/ImageField/MediaPicker/MediaLibrary/mediaLibraryData.d.ts +8 -8
  12. package/dist/fields/ImageField/MediaPicker/externalImage.d.ts +2 -1
  13. package/dist/fields/LinkField/Documents/DocumentsModal.d.ts +2 -0
  14. package/dist/fields/LinkField/Documents/documentsData.d.ts +20 -20
  15. package/dist/fields/LinkField/Documents/filterData.d.ts +2 -0
  16. package/dist/fields/LinkField/LinkFieldActions.d.ts +2 -0
  17. package/dist/fields/LinkField/useLinkField.d.ts +8 -5
  18. package/dist/fields/RichTextField/BubbleMenu/BubbleMenu.d.ts +7 -0
  19. package/dist/fields/RichTextField/BubbleMenu/ExtraItems.d.ts +8 -0
  20. package/dist/fields/RichTextField/BubbleMenu/LinkItems.d.ts +6 -0
  21. package/dist/fields/RichTextField/BubbleMenu/MarkItems.d.ts +8 -0
  22. package/dist/fields/RichTextField/BubbleMenu/NodeItems.d.ts +8 -0
  23. package/dist/fields/RichTextField/BubbleMenu/index.d.ts +1 -0
  24. package/dist/fields/RichTextField/RichTextField.d.ts +1 -2
  25. package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +4 -4
  26. package/dist/fields/RichTextField/extensions/Bold/Bold.d.ts +3 -0
  27. package/dist/fields/RichTextField/extensions/BulletList/BulletList.d.ts +3 -0
  28. package/dist/fields/RichTextField/extensions/CodeBlock/CodeBlock.d.ts +3 -0
  29. package/dist/fields/RichTextField/extensions/Heading/Heading.d.ts +21 -0
  30. package/dist/fields/RichTextField/extensions/Image/ImageExtension.d.ts +10 -0
  31. package/dist/fields/RichTextField/extensions/Image/ImageView.d.ts +13 -0
  32. package/dist/fields/RichTextField/extensions/Italic/Italic.d.ts +3 -0
  33. package/dist/fields/RichTextField/extensions/Link/Link.d.ts +44 -0
  34. package/dist/fields/RichTextField/extensions/Link.d.ts +1 -43
  35. package/dist/fields/RichTextField/extensions/OrderedList/OrderedList.d.ts +3 -0
  36. package/dist/fields/RichTextField/extensions/Paragraph/Paragraph.d.ts +3 -0
  37. package/dist/fields/RichTextField/extensions/extensions.d.ts +16 -0
  38. package/dist/fields/RichTextField/extensions/index.d.ts +1 -14
  39. package/dist/fields/RichTextField/models/EditorExtension.d.ts +3 -1
  40. package/dist/fields/RichTextField/models/MenuItems.d.ts +5 -4
  41. package/dist/fields/RichTextField/models/RichTextConfig.d.ts +22 -6
  42. package/dist/fields/RichTextField/useEditor.d.ts +4 -0
  43. package/dist/fields/utils.d.ts +3 -2
  44. package/dist/index.d.ts +1 -1
  45. package/dist/index.es.js +19195 -18048
  46. package/dist/index.umd.js +32 -32
  47. package/dist/zones/RepeatableZoneEditor.d.ts +3 -4
  48. package/package.json +5 -6
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(bn,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react"),require("@prismicio/editor-ui"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@prismicio/editor-ui","react-dom"],N):(bn=typeof globalThis<"u"?globalThis:bn||self,N(bn.EditorFields={},bn.React,bn.EditorUi,bn.ReactDOM))})(this,function(bn,N,T,R_){"use strict";var zAe=Object.defineProperty;var KAe=(bn,N,T)=>N in bn?zAe(bn,N,{enumerable:!0,configurable:!0,writable:!0,value:T}):bn[N]=T;var Wc=(bn,N,T)=>(KAe(bn,typeof N!="symbol"?N+"":N,T),T);function yM(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const _e=yM(N),zH=yM(R_);var de=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){if(this instanceof r){var i=[null];i.push.apply(i,arguments);var o=Function.bind.apply(t,i);return new o}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var y={},KH={get exports(){return y},set exports(e){y=e}},dd={};/**
1
+ (function(bn,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("react"),require("@prismicio/editor-ui"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@prismicio/editor-ui","react-dom"],F):(bn=typeof globalThis<"u"?globalThis:bn||self,F(bn.EditorFields={},bn.React,bn.EditorUi,bn.ReactDOM))})(this,function(bn,F,T,M_){"use strict";var nFe=Object.defineProperty;var rFe=(bn,F,T)=>F in bn?nFe(bn,F,{enumerable:!0,configurable:!0,writable:!0,value:T}):bn[F]=T;var qa=(bn,F,T)=>(rFe(bn,typeof F!="symbol"?F+"":F,T),T);function gM(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Ce=gM(F),Y5=gM(M_);var de=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){if(this instanceof r){var i=[null];i.push.apply(i,arguments);var o=Function.bind.apply(t,i);return new o}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var y={},J5={get exports(){return y},set exports(e){y=e}},ld={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var bM;function VH(){if(bM)return dd;bM=1;var e=N,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(u,s,c){var l,f={},d=null,p=null;c!==void 0&&(d=""+c),s.key!==void 0&&(d=""+s.key),s.ref!==void 0&&(p=s.ref);for(l in s)r.call(s,l)&&!o.hasOwnProperty(l)&&(f[l]=s[l]);if(u&&u.defaultProps)for(l in s=u.defaultProps,s)f[l]===void 0&&(f[l]=s[l]);return{$$typeof:t,type:u,key:d,ref:p,props:f,_owner:i.current}}return dd.Fragment=n,dd.jsx=a,dd.jsxs=a,dd}var pd={};/**
9
+ */var yM;function Z5(){if(yM)return ld;yM=1;var e=F,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(u,s,c){var l,f={},d=null,p=null;c!==void 0&&(d=""+c),s.key!==void 0&&(d=""+s.key),s.ref!==void 0&&(p=s.ref);for(l in s)r.call(s,l)&&!o.hasOwnProperty(l)&&(f[l]=s[l]);if(u&&u.defaultProps)for(l in s=u.defaultProps,s)f[l]===void 0&&(f[l]=s[l]);return{$$typeof:t,type:u,key:d,ref:p,props:f,_owner:i.current}}return ld.Fragment=n,ld.jsx=a,ld.jsxs=a,ld}var fd={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,31 +14,31 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var _M;function HH(){return _M||(_M=1,process.env.NODE_ENV!=="production"&&function(){var e=N,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function g(E){if(E===null||typeof E!="object")return null;var z=h&&E[h]||E[m];return typeof z=="function"?z:null}var _=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(E){{for(var z=arguments.length,te=new Array(z>1?z-1:0),Se=1;Se<z;Se++)te[Se-1]=arguments[Se];C("error",E,te)}}function C(E,z,te){{var Se=_.ReactDebugCurrentFrame,Je=Se.getStackAddendum();Je!==""&&(z+="%s",te=te.concat([Je]));var it=te.map(function(qe){return String(qe)});it.unshift("Warning: "+z),Function.prototype.apply.call(console[E],console,it)}}var b=!1,w=!1,O=!1,M=!1,x=!1,U;U=Symbol.for("react.module.reference");function B(E){return!!(typeof E=="string"||typeof E=="function"||E===r||E===o||x||E===i||E===c||E===l||M||E===p||b||w||O||typeof E=="object"&&E!==null&&(E.$$typeof===d||E.$$typeof===f||E.$$typeof===a||E.$$typeof===u||E.$$typeof===s||E.$$typeof===U||E.getModuleId!==void 0))}function P(E,z,te){var Se=E.displayName;if(Se)return Se;var Je=z.displayName||z.name||"";return Je!==""?te+"("+Je+")":te}function Z(E){return E.displayName||"Context"}function ee(E){if(E==null)return null;if(typeof E.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof E=="function")return E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case r:return"Fragment";case n:return"Portal";case o:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case l:return"SuspenseList"}if(typeof E=="object")switch(E.$$typeof){case u:var z=E;return Z(z)+".Consumer";case a:var te=E;return Z(te._context)+".Provider";case s:return P(E,E.render,"ForwardRef");case f:var Se=E.displayName||null;return Se!==null?Se:ee(E.type)||"Memo";case d:{var Je=E,it=Je._payload,qe=Je._init;try{return ee(qe(it))}catch{return null}}}return null}var J=Object.assign,ge=0,Ie,k,A,I,$,R,L;function X(){}X.__reactDisabledLog=!0;function ne(){{if(ge===0){Ie=console.log,k=console.info,A=console.warn,I=console.error,$=console.group,R=console.groupCollapsed,L=console.groupEnd;var E={configurable:!0,enumerable:!0,value:X,writable:!0};Object.defineProperties(console,{info:E,log:E,warn:E,error:E,group:E,groupCollapsed:E,groupEnd:E})}ge++}}function Re(){{if(ge--,ge===0){var E={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},E,{value:Ie}),info:J({},E,{value:k}),warn:J({},E,{value:A}),error:J({},E,{value:I}),group:J({},E,{value:$}),groupCollapsed:J({},E,{value:R}),groupEnd:J({},E,{value:L})})}ge<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=_.ReactCurrentDispatcher,Ae;function ze(E,z,te){{if(Ae===void 0)try{throw Error()}catch(Je){var Se=Je.stack.trim().match(/\n( *(at )?)/);Ae=Se&&Se[1]||""}return`
18
- `+Ae+E}}var He=!1,ut;{var Ut=typeof WeakMap=="function"?WeakMap:Map;ut=new Ut}function en(E,z){if(!E||He)return"";{var te=ut.get(E);if(te!==void 0)return te}var Se;He=!0;var Je=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var it;it=se.current,se.current=null,ne();try{if(z){var qe=function(){throw Error()};if(Object.defineProperty(qe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(qe,[])}catch(Ua){Se=Ua}Reflect.construct(E,[],qe)}else{try{qe.call()}catch(Ua){Se=Ua}E.call(qe.prototype)}}else{try{throw Error()}catch(Ua){Se=Ua}E()}}catch(Ua){if(Ua&&Se&&typeof Ua.stack=="string"){for(var We=Ua.stack.split(`
19
- `),Yn=Se.stack.split(`
20
- `),At=We.length-1,jt=Yn.length-1;At>=1&&jt>=0&&We[At]!==Yn[jt];)jt--;for(;At>=1&&jt>=0;At--,jt--)if(We[At]!==Yn[jt]){if(At!==1||jt!==1)do if(At--,jt--,jt<0||We[At]!==Yn[jt]){var ui=`
21
- `+We[At].replace(" at new "," at ");return E.displayName&&ui.includes("<anonymous>")&&(ui=ui.replace("<anonymous>",E.displayName)),typeof E=="function"&&ut.set(E,ui),ui}while(At>=1&&jt>=0);break}}}finally{He=!1,se.current=it,Re(),Error.prepareStackTrace=Je}var fd=E?E.displayName||E.name:"",BH=fd?ze(fd):"";return typeof E=="function"&&ut.set(E,BH),BH}function yn(E,z,te){return en(E,!1)}function mr(E){var z=E.prototype;return!!(z&&z.isReactComponent)}function Bi(E,z,te){if(E==null)return"";if(typeof E=="function")return en(E,mr(E));if(typeof E=="string")return ze(E);switch(E){case c:return ze("Suspense");case l:return ze("SuspenseList")}if(typeof E=="object")switch(E.$$typeof){case s:return yn(E.render);case f:return Bi(E.type,z,te);case d:{var Se=E,Je=Se._payload,it=Se._init;try{return Bi(it(Je),z,te)}catch{}}}return""}var ii=Object.prototype.hasOwnProperty,Ro={},Wa=_.ReactDebugCurrentFrame;function Ui(E){if(E){var z=E._owner,te=Bi(E.type,E._source,z?z.type:null);Wa.setExtraStackFrame(te)}else Wa.setExtraStackFrame(null)}function vr(E,z,te,Se,Je){{var it=Function.call.bind(ii);for(var qe in E)if(it(E,qe)){var We=void 0;try{if(typeof E[qe]!="function"){var Yn=Error((Se||"React class")+": "+te+" type `"+qe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof E[qe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Yn.name="Invariant Violation",Yn}We=E[qe](z,qe,Se,te,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(At){We=At}We&&!(We instanceof Error)&&(Ui(Je),S("%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).",Se||"React class",te,qe,typeof We),Ui(null)),We instanceof Error&&!(We.message in Ro)&&(Ro[We.message]=!0,Ui(Je),S("Failed %s type: %s",te,We.message),Ui(null))}}}var oi=Array.isArray;function qi(E){return oi(E)}function zi(E){{var z=typeof Symbol=="function"&&Symbol.toStringTag,te=z&&E[Symbol.toStringTag]||E.constructor.name||"Object";return te}}function ja(E){try{return La(E),!1}catch{return!0}}function La(E){return""+E}function Da(E){if(ja(E))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",zi(E)),La(E)}var ai=_.ReactCurrentOwner,Ju={key:!0,ref:!0,__self:!0,__source:!0},ad,W,F;F={};function D(E){if(ii.call(E,"ref")){var z=Object.getOwnPropertyDescriptor(E,"ref").get;if(z&&z.isReactWarning)return!1}return E.ref!==void 0}function Fe(E){if(ii.call(E,"key")){var z=Object.getOwnPropertyDescriptor(E,"key").get;if(z&&z.isReactWarning)return!1}return E.key!==void 0}function j(E,z){if(typeof E.ref=="string"&&ai.current&&z&&ai.current.stateNode!==z){var te=ee(ai.current.type);F[te]||(S('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',ee(ai.current.type),E.ref),F[te]=!0)}}function ie(E,z){{var te=function(){ad||(ad=!0,S("%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)",z))};te.isReactWarning=!0,Object.defineProperty(E,"key",{get:te,configurable:!0})}}function me(E,z){{var te=function(){W||(W=!0,S("%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)",z))};te.isReactWarning=!0,Object.defineProperty(E,"ref",{get:te,configurable:!0})}}var he=function(E,z,te,Se,Je,it,qe){var We={$$typeof:t,type:E,key:z,ref:te,props:qe,_owner:it};return We._store={},Object.defineProperty(We._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(We,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Se}),Object.defineProperty(We,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Je}),Object.freeze&&(Object.freeze(We.props),Object.freeze(We)),We};function Ce(E,z,te,Se,Je){{var it,qe={},We=null,Yn=null;te!==void 0&&(Da(te),We=""+te),Fe(z)&&(Da(z.key),We=""+z.key),D(z)&&(Yn=z.ref,j(z,Je));for(it in z)ii.call(z,it)&&!Ju.hasOwnProperty(it)&&(qe[it]=z[it]);if(E&&E.defaultProps){var At=E.defaultProps;for(it in At)qe[it]===void 0&&(qe[it]=At[it])}if(We||Yn){var jt=typeof E=="function"?E.displayName||E.name||"Unknown":E;We&&ie(qe,jt),Yn&&me(qe,jt)}return he(E,We,Yn,Je,Se,ai.current,qe)}}var st=_.ReactCurrentOwner,Gn=_.ReactDebugCurrentFrame;function Wr(E){if(E){var z=E._owner,te=Bi(E.type,E._source,z?z.type:null);Gn.setExtraStackFrame(te)}else Gn.setExtraStackFrame(null)}var ud;ud=!1;function Ki(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function sd(){{if(st.current){var E=ee(st.current.type);if(E)return`
17
+ */var bM;function X5(){return bM||(bM=1,process.env.NODE_ENV!=="production"&&function(){var e=F,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function g(E){if(E===null||typeof E!="object")return null;var z=h&&E[h]||E[m];return typeof z=="function"?z:null}var _=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(E){{for(var z=arguments.length,te=new Array(z>1?z-1:0),$e=1;$e<z;$e++)te[$e-1]=arguments[$e];C("error",E,te)}}function C(E,z,te){{var $e=_.ReactDebugCurrentFrame,Je=$e.getStackAddendum();Je!==""&&(z+="%s",te=te.concat([Je]));var it=te.map(function(qe){return String(qe)});it.unshift("Warning: "+z),Function.prototype.apply.call(console[E],console,it)}}var b=!1,w=!1,O=!1,M=!1,x=!1,U;U=Symbol.for("react.module.reference");function B(E){return!!(typeof E=="string"||typeof E=="function"||E===r||E===o||x||E===i||E===c||E===l||M||E===p||b||w||O||typeof E=="object"&&E!==null&&(E.$$typeof===d||E.$$typeof===f||E.$$typeof===a||E.$$typeof===u||E.$$typeof===s||E.$$typeof===U||E.getModuleId!==void 0))}function P(E,z,te){var $e=E.displayName;if($e)return $e;var Je=z.displayName||z.name||"";return Je!==""?te+"("+Je+")":te}function Z(E){return E.displayName||"Context"}function ee(E){if(E==null)return null;if(typeof E.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof E=="function")return E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case r:return"Fragment";case n:return"Portal";case o:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case l:return"SuspenseList"}if(typeof E=="object")switch(E.$$typeof){case u:var z=E;return Z(z)+".Consumer";case a:var te=E;return Z(te._context)+".Provider";case s:return P(E,E.render,"ForwardRef");case f:var $e=E.displayName||null;return $e!==null?$e:ee(E.type)||"Memo";case d:{var Je=E,it=Je._payload,qe=Je._init;try{return ee(qe(it))}catch{return null}}}return null}var J=Object.assign,ge=0,Te,k,A,I,$,R,L;function X(){}X.__reactDisabledLog=!0;function ne(){{if(ge===0){Te=console.log,k=console.info,A=console.warn,I=console.error,$=console.group,R=console.groupCollapsed,L=console.groupEnd;var E={configurable:!0,enumerable:!0,value:X,writable:!0};Object.defineProperties(console,{info:E,log:E,warn:E,error:E,group:E,groupCollapsed:E,groupEnd:E})}ge++}}function ke(){{if(ge--,ge===0){var E={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},E,{value:Te}),info:J({},E,{value:k}),warn:J({},E,{value:A}),error:J({},E,{value:I}),group:J({},E,{value:$}),groupCollapsed:J({},E,{value:R}),groupEnd:J({},E,{value:L})})}ge<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=_.ReactCurrentDispatcher,Fe;function ze(E,z,te){{if(Fe===void 0)try{throw Error()}catch(Je){var $e=Je.stack.trim().match(/\n( *(at )?)/);Fe=$e&&$e[1]||""}return`
18
+ `+Fe+E}}var He=!1,ut;{var Ut=typeof WeakMap=="function"?WeakMap:Map;ut=new Ut}function en(E,z){if(!E||He)return"";{var te=ut.get(E);if(te!==void 0)return te}var $e;He=!0;var Je=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var it;it=se.current,se.current=null,ne();try{if(z){var qe=function(){throw Error()};if(Object.defineProperty(qe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(qe,[])}catch(Ua){$e=Ua}Reflect.construct(E,[],qe)}else{try{qe.call()}catch(Ua){$e=Ua}E.call(qe.prototype)}}else{try{throw Error()}catch(Ua){$e=Ua}E()}}catch(Ua){if(Ua&&$e&&typeof Ua.stack=="string"){for(var We=Ua.stack.split(`
19
+ `),Jn=$e.stack.split(`
20
+ `),At=We.length-1,jt=Jn.length-1;At>=1&&jt>=0&&We[At]!==Jn[jt];)jt--;for(;At>=1&&jt>=0;At--,jt--)if(We[At]!==Jn[jt]){if(At!==1||jt!==1)do if(At--,jt--,jt<0||We[At]!==Jn[jt]){var ai=`
21
+ `+We[At].replace(" at new "," at ");return E.displayName&&ai.includes("<anonymous>")&&(ai=ai.replace("<anonymous>",E.displayName)),typeof E=="function"&&ut.set(E,ai),ai}while(At>=1&&jt>=0);break}}}finally{He=!1,se.current=it,ke(),Error.prepareStackTrace=Je}var cd=E?E.displayName||E.name:"",V5=cd?ze(cd):"";return typeof E=="function"&&ut.set(E,V5),V5}function yn(E,z,te){return en(E,!1)}function mr(E){var z=E.prototype;return!!(z&&z.isReactComponent)}function Ui(E,z,te){if(E==null)return"";if(typeof E=="function")return en(E,mr(E));if(typeof E=="string")return ze(E);switch(E){case c:return ze("Suspense");case l:return ze("SuspenseList")}if(typeof E=="object")switch(E.$$typeof){case s:return yn(E.render);case f:return Ui(E.type,z,te);case d:{var $e=E,Je=$e._payload,it=$e._init;try{return Ui(it(Je),z,te)}catch{}}}return""}var ri=Object.prototype.hasOwnProperty,Mo={},Wa=_.ReactDebugCurrentFrame;function qi(E){if(E){var z=E._owner,te=Ui(E.type,E._source,z?z.type:null);Wa.setExtraStackFrame(te)}else Wa.setExtraStackFrame(null)}function vr(E,z,te,$e,Je){{var it=Function.call.bind(ri);for(var qe in E)if(it(E,qe)){var We=void 0;try{if(typeof E[qe]!="function"){var Jn=Error(($e||"React class")+": "+te+" type `"+qe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof E[qe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Jn.name="Invariant Violation",Jn}We=E[qe](z,qe,$e,te,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(At){We=At}We&&!(We instanceof Error)&&(qi(Je),S("%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).",$e||"React class",te,qe,typeof We),qi(null)),We instanceof Error&&!(We.message in Mo)&&(Mo[We.message]=!0,qi(Je),S("Failed %s type: %s",te,We.message),qi(null))}}}var ii=Array.isArray;function zi(E){return ii(E)}function Ki(E){{var z=typeof Symbol=="function"&&Symbol.toStringTag,te=z&&E[Symbol.toStringTag]||E.constructor.name||"Object";return te}}function ja(E){try{return La(E),!1}catch{return!0}}function La(E){return""+E}function Da(E){if(ja(E))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ki(E)),La(E)}var oi=_.ReactCurrentOwner,Ju={key:!0,ref:!0,__self:!0,__source:!0},id,W,N;N={};function D(E){if(ri.call(E,"ref")){var z=Object.getOwnPropertyDescriptor(E,"ref").get;if(z&&z.isReactWarning)return!1}return E.ref!==void 0}function Ne(E){if(ri.call(E,"key")){var z=Object.getOwnPropertyDescriptor(E,"key").get;if(z&&z.isReactWarning)return!1}return E.key!==void 0}function j(E,z){if(typeof E.ref=="string"&&oi.current&&z&&oi.current.stateNode!==z){var te=ee(oi.current.type);N[te]||(S('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',ee(oi.current.type),E.ref),N[te]=!0)}}function ie(E,z){{var te=function(){id||(id=!0,S("%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)",z))};te.isReactWarning=!0,Object.defineProperty(E,"key",{get:te,configurable:!0})}}function me(E,z){{var te=function(){W||(W=!0,S("%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)",z))};te.isReactWarning=!0,Object.defineProperty(E,"ref",{get:te,configurable:!0})}}var he=function(E,z,te,$e,Je,it,qe){var We={$$typeof:t,type:E,key:z,ref:te,props:qe,_owner:it};return We._store={},Object.defineProperty(We._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(We,"_self",{configurable:!1,enumerable:!1,writable:!1,value:$e}),Object.defineProperty(We,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Je}),Object.freeze&&(Object.freeze(We.props),Object.freeze(We)),We};function Ie(E,z,te,$e,Je){{var it,qe={},We=null,Jn=null;te!==void 0&&(Da(te),We=""+te),Ne(z)&&(Da(z.key),We=""+z.key),D(z)&&(Jn=z.ref,j(z,Je));for(it in z)ri.call(z,it)&&!Ju.hasOwnProperty(it)&&(qe[it]=z[it]);if(E&&E.defaultProps){var At=E.defaultProps;for(it in At)qe[it]===void 0&&(qe[it]=At[it])}if(We||Jn){var jt=typeof E=="function"?E.displayName||E.name||"Unknown":E;We&&ie(qe,jt),Jn&&me(qe,jt)}return he(E,We,Jn,Je,$e,oi.current,qe)}}var st=_.ReactCurrentOwner,Yn=_.ReactDebugCurrentFrame;function Wr(E){if(E){var z=E._owner,te=Ui(E.type,E._source,z?z.type:null);Yn.setExtraStackFrame(te)}else Yn.setExtraStackFrame(null)}var od;od=!1;function Vi(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function ad(){{if(st.current){var E=ee(st.current.type);if(E)return`
22
22
 
23
- Check the render method of \``+E+"`."}return""}}function cd(E){{if(E!==void 0){var z=E.fileName.replace(/^.*[\\\/]/,""),te=E.lineNumber;return`
23
+ Check the render method of \``+E+"`."}return""}}function ud(E){{if(E!==void 0){var z=E.fileName.replace(/^.*[\\\/]/,""),te=E.lineNumber;return`
24
24
 
25
- Check your code at `+z+":"+te+"."}return""}}var Ba={};function hM(E){{var z=sd();if(!z){var te=typeof E=="string"?E:E.displayName||E.name;te&&(z=`
25
+ Check your code at `+z+":"+te+"."}return""}}var Ba={};function pM(E){{var z=ad();if(!z){var te=typeof E=="string"?E:E.displayName||E.name;te&&(z=`
26
26
 
27
- Check the top-level render call using <`+te+">.")}return z}}function ld(E,z){{if(!E._store||E._store.validated||E.key!=null)return;E._store.validated=!0;var te=hM(z);if(Ba[te])return;Ba[te]=!0;var Se="";E&&E._owner&&E._owner!==st.current&&(Se=" It was passed a child from "+ee(E._owner.type)+"."),Wr(E),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',te,Se),Wr(null)}}function Pc(E,z){{if(typeof E!="object")return;if(qi(E))for(var te=0;te<E.length;te++){var Se=E[te];Ki(Se)&&ld(Se,z)}else if(Ki(E))E._store&&(E._store.validated=!0);else if(E){var Je=g(E);if(typeof Je=="function"&&Je!==E.entries)for(var it=Je.call(E),qe;!(qe=it.next()).done;)Ki(qe.value)&&ld(qe.value,z)}}}function jAe(E){{var z=E.type;if(z==null||typeof z=="string")return;var te;if(typeof z=="function")te=z.propTypes;else if(typeof z=="object"&&(z.$$typeof===s||z.$$typeof===f))te=z.propTypes;else return;if(te){var Se=ee(z);vr(te,E.props,"prop",Se,E)}else if(z.PropTypes!==void 0&&!ud){ud=!0;var Je=ee(z);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Je||"Unknown")}typeof z.getDefaultProps=="function"&&!z.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function LAe(E){{for(var z=Object.keys(E.props),te=0;te<z.length;te++){var Se=z[te];if(Se!=="children"&&Se!=="key"){Wr(E),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Se),Wr(null);break}}E.ref!==null&&(Wr(E),S("Invalid attribute `ref` supplied to `React.Fragment`."),Wr(null))}}function DH(E,z,te,Se,Je,it){{var qe=B(E);if(!qe){var We="";(E===void 0||typeof E=="object"&&E!==null&&Object.keys(E).length===0)&&(We+=" 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 Yn=cd(Je);Yn?We+=Yn:We+=sd();var At;E===null?At="null":qi(E)?At="array":E!==void 0&&E.$$typeof===t?(At="<"+(ee(E.type)||"Unknown")+" />",We=" Did you accidentally export a JSX literal instead of a component?"):At=typeof E,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",At,We)}var jt=Ce(E,z,te,Je,it);if(jt==null)return jt;if(qe){var ui=z.children;if(ui!==void 0)if(Se)if(qi(ui)){for(var fd=0;fd<ui.length;fd++)Pc(ui[fd],E);Object.freeze&&Object.freeze(ui)}else S("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 Pc(ui,E)}return E===r?LAe(jt):jAe(jt),jt}}function DAe(E,z,te){return DH(E,z,te,!0)}function BAe(E,z,te){return DH(E,z,te,!1)}var UAe=BAe,qAe=DAe;pd.Fragment=r,pd.jsx=UAe,pd.jsxs=qAe}()),pd}(function(e){process.env.NODE_ENV==="production"?e.exports=VH():e.exports=HH()})(KH);var $M=function(e){return function(){return{meet:function(t,n){return function(r){return e.meet(t(r),n(r))}},join:function(t,n){return function(r){return e.join(t(r),n(r))}},zero:function(){return e.zero},one:function(){return e.one},implies:function(t,n){return function(r){return e.implies(t(r),n(r))}},not:function(t){return function(n){return e.not(t(n))}}}}},k_=function(e){return function(){return{concat:function(t,n){return function(r){return e.concat(t(r),n(r))}}}}},SM=function(e){var t=k_(e);return function(){return{concat:t().concat,empty:function(){return e.empty}}}},A_=function(e){return{add:function(t,n){return function(r){return e.add(t(r),n(r))}},zero:function(){return e.zero},mul:function(t,n){return function(r){return e.mul(t(r),n(r))}},one:function(){return e.one}}},TM=function(e){var t=A_(e);return{add:t.add,mul:t.mul,one:t.one,zero:t.zero,sub:function(n,r){return function(i){return e.sub(n(i),r(i))}}}},GH=function(e){return function(t){return t(e)}};function q(e){return e}var Lc=q;function Jn(e){return function(){return e}}var F_=Jn(!0),IM=Jn(!1),CM=Jn(null),N_=Jn(void 0),YH=N_;function JH(e){return function(t,n){return e(n,t)}}function H(e,t,n,r,i,o,a,u,s){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(t(e.apply(this,arguments)))))))))}}}function OM(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}function ZH(e){return e+1}function XH(e){return e-1}function wM(e){throw new Error("Called `absurd` function which should be uncallable")}function QH(e){return function(t){return e.apply(void 0,t)}}function e6(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(t)}}function v(e,t,n,r,i,o,a,u,s){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return o(i(r(n(t(e)))));case 7:return a(o(i(r(n(t(e))))));case 8:return u(a(o(i(r(n(t(e)))))));case 9:return s(u(a(o(i(r(n(t(e))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var t6=wM,Zn=function(e,t){return t};function n6(e){return function(t){return!e(t)}}var r6=function(){return{concat:function(e,t){return H(e,t)},empty:q}};const EM=Object.freeze(Object.defineProperty({__proto__:null,SK:Zn,absurd:wM,apply:GH,constFalse:IM,constNull:CM,constTrue:F_,constUndefined:N_,constVoid:YH,constant:Jn,decrement:XH,flip:JH,flow:H,getBooleanAlgebra:$M,getEndomorphismMonoid:r6,getMonoid:SM,getRing:TM,getSemigroup:k_,getSemiring:A_,hole:t6,identity:q,increment:ZH,not:n6,pipe:v,tuple:OM,tupled:QH,unsafeCoerce:Lc,untupled:e6},Symbol.toStringTag,{value:"Module"}));var jr=function(e){return{equals:function(t,n){return t===n||e(t,n)}}},xM=function(e){return jr(function(t,n){for(var r in e)if(!e[r].equals(t[r],n[r]))return!1;return!0})},MM=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return jr(function(n,r){return e.every(function(i,o){return i.equals(n[o],r[o])})})},i6=function(e,t){return v(e,RM(t))},RM=function(e){return function(t){return jr(function(n,r){return t.equals(e(n),e(r))})}},kM="Eq",Dc={equals:function(e,t){return e===t}},o6={equals:function(){return!0}},AM=function(){return{concat:function(e,t){return jr(function(n,r){return e.equals(n,r)&&t.equals(n,r)})}}},a6=function(){return{concat:AM().concat,empty:o6}},FM={URI:kM,contramap:i6},u6=MM,s6=xM,c6=Dc.equals,l6=FM,f6=Dc,d6=Dc,p6=Dc,h6={equals:function(e,t){return e.valueOf()===t.valueOf()}};const m6=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:FM,URI:kM,contramap:RM,eq:l6,eqBoolean:f6,eqDate:h6,eqNumber:p6,eqStrict:Dc,eqString:d6,fromEquals:jr,getMonoid:a6,getSemigroup:AM,getStructEq:s6,getTupleEq:u6,strictEqual:c6,struct:xM,tuple:MM},Symbol.toStringTag,{value:"Module"}));function Bc(e,t){return function(n){return function(r){return e.map(r,function(i){return t.map(i,n)})}}}function Ue(e){return function(t){return function(n){return e.map(n,function(r){return r(t)})}}}function Ct(e){return function(t){return function(n){return e.map(n,function(r){var i;return i={},i[t]=r,i})}}}function Uc(e,t){var n=Bc(e,t);return{map:function(r,i){return v(r,n(i))}}}const v6=Object.freeze(Object.defineProperty({__proto__:null,bindTo:Ct,flap:Ue,getFunctorComposition:Uc,map:Bc},Symbol.toStringTag,{value:"Module"}));var g6=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},Ft=function(e){return e._tag==="None"},gt=function(e){return e._tag==="Some"},ye={_tag:"None"},fe=function(e){return{_tag:"Some",value:e}},qt=function(e){return e._tag==="Left"},P_=function(e){return e._tag==="Right"},ko=function(e){return{_tag:"Left",left:e}},qa=function(e){return{_tag:"Right",right:e}},hd=function(e){return[e]},mt=function(e){return e.length>0},gr=function(e){return e[0]},qc=function(e){return e.slice(1)},tn=[],zt={},ct=Object.prototype.hasOwnProperty,_m=function(e){return g6([e[0]],e.slice(1),!0)},Ee=function(e,t){return{left:e,right:t}},y6=function(e,t){return v(e,NM(t))},b6=function(e,t){return v(e,PM(t))},_6=function(e,t,n){return v(e,WM(t,n))},NM=function(e){return function(t){return Ee($m(t),e(Sm(t)))}},PM=function(e){return function(t){return Ee(e($m(t)),Sm(t))}},WM=function(e,t){return function(n){return Ee(e($m(n)),t(Sm(n)))}},W_="Separated",$6={URI:W_,mapLeft:b6,bimap:_6},jM={URI:W_,map:y6},S6=Ue(jM),$m=function(e){return e.left},Sm=function(e){return e.right};const T6=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:$6,Functor:jM,URI:W_,bimap:WM,flap:S6,left:$m,map:NM,mapLeft:PM,right:Sm,separated:Ee},Symbol.toStringTag,{value:"Module"}));function Ao(e,t){return function(n){return function(r){return e.ap(e.map(r,function(i){return function(o){return t.ap(i,o)}}),n)}}}function Ot(e){return function(t){return function(n){return e.ap(e.map(n,function(r){return function(){return r}}),t)}}}function wt(e){return function(t){return function(n){return e.ap(e.map(n,function(){return function(r){return r}}),t)}}}function Et(e){return function(t,n){return function(r){return e.ap(e.map(r,function(i){return function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))}}),n)}}}function Kt(e){return function(t){return{concat:function(n,r){return e.ap(e.map(n,function(i){return function(o){return t.concat(i,o)}}),r)}}}}function j_(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,t===0?e.apply(null,i):j_(e,t-1,i)}}var L_={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function I6(e){return ct.call(L_,e)||(L_[e]=j_(OM,e-1,[])),L_[e]}function C6(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=I6(r),o=e.map(t[0],i),a=1;a<r;a++)o=e.ap(o,t[a]);return o}}function O6(e){var t=e.length;switch(t){case 1:return function(n){var r;return r={},r[e[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[e[0]]=n,i[e[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[e[0]]=n,o[e[1]]=r,o[e[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[e[0]]=n,a[e[1]]=r,a[e[2]]=i,a[e[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[e[0]]=n,u[e[1]]=r,u[e[2]]=i,u[e[3]]=o,u[e[4]]=a,u}}}}};default:return j_(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i},t-1,[])}}function w6(e){return function(t){for(var n=Object.keys(t),r=n.length,i=O6(n),o=e.map(t[n[0]],i),a=1;a<r;a++)o=e.ap(o,t[n[a]]);return o}}const E6=Object.freeze(Object.defineProperty({__proto__:null,ap:Ao,apFirst:Ot,apS:Et,apSecond:wt,getApplySemigroup:Kt,sequenceS:w6,sequenceT:C6},Symbol.toStringTag,{value:"Module"}));function lt(e){return function(t){return function(n){return e.chain(n,function(r){return e.map(t(r),function(){return r})})}}}function xt(e){return function(t,n){return function(r){return e.chain(r,function(i){return e.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))})})}}}const x6=Object.freeze(Object.defineProperty({__proto__:null,bind:xt,chainFirst:lt},Symbol.toStringTag,{value:"Module"}));var LM=function(e){return function(t,n){return t===n||e(t,n)===0}},Zu=function(e){return{equals:LM(e),compare:function(t,n){return t===n?0:e(t,n)}}},DM=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Zu(function(n,r){for(var i=0;i<e.length-1;i++){var o=e[i].compare(n[i],r[i]);if(o!==0)return o}return e[i].compare(n[i],r[i])})},D_=function(e){return Zu(function(t,n){return e.compare(n,t)})},M6=function(e,t){return v(e,Tm(t))},Tm=function(e){return function(t){return Zu(function(n,r){return t.compare(e(n),e(r))})}},BM="Ord",UM=function(){return{concat:function(e,t){return Zu(function(n,r){var i=e.compare(n,r);return i!==0?i:t.compare(n,r)})}}},B_=function(){return{concat:UM().concat,empty:Zu(function(){return 0})}},qM={URI:BM,contramap:M6},R6={equals:F_,compare:Jn(0)},k6=function(e){return function(t){return function(n){return n===t||e.compare(n,t)===0}}},zM=function(e){return function(t,n){return e.compare(t,n)===-1}},KM=function(e){return function(t,n){return e.compare(t,n)===1}},A6=function(e){return function(t,n){return e.compare(t,n)!==1}},F6=function(e){return function(t,n){return e.compare(t,n)!==-1}},Im=function(e){return function(t,n){return t===n||e.compare(t,n)<1?t:n}},Cm=function(e){return function(t,n){return t===n||e.compare(t,n)>-1?t:n}},VM=function(e){var t=Im(e),n=Cm(e);return function(r,i){return function(o){return n(t(o,i),r)}}},N6=function(e){var t=zM(e),n=KM(e);return function(r,i){return function(o){return!(t(o,r)||n(o,i))}}},P6=DM,W6=D_,j6=qM;function L6(e,t){return e<t?-1:e>t?1:0}var U_={equals:Dc.equals,compare:L6},D6=U_,B6=U_,Om=U_,U6=v(Om,Tm(function(e){return e.valueOf()}));const q6=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:qM,URI:BM,between:N6,clamp:VM,contramap:Tm,equals:k6,equalsDefault:LM,fromCompare:Zu,geq:F6,getDualOrd:W6,getMonoid:B_,getSemigroup:UM,getTupleOrd:P6,gt:KM,leq:A6,lt:zM,max:Cm,min:Im,ord:j6,ordBoolean:D6,ordDate:U6,ordNumber:Om,ordString:B6,reverse:D_,trivial:R6,tuple:DM},Symbol.toStringTag,{value:"Module"}));var HM=function(e){return{concat:function(t,n){return e.concat(n,t)}}},z6=function(e){return function(t){return{concat:function(n,r){return e(n)?t.concat(n,r):r}}}},K6=function(e){return function(t){return{concat:function(n,r){return e(r)?t.concat(n,r):n}}}},V6=function(e){return function(t){return{concat:function(n,r){return t.concat(e(n),e(r))}}}},GM=function(e){return function(t){return function(n){return n.reduce(function(r,i){return e.concat(r,i)},t)}}};const H6=Object.freeze(Object.defineProperty({__proto__:null,concatAll:GM,endo:V6,filterFirst:z6,filterSecond:K6,reverse:HM},Symbol.toStringTag,{value:"Module"}));var wm=function(e){return{concat:Im(e)}},Em=function(e){return{concat:Cm(e)}},q_=function(e){return{concat:function(){return e}}},z_=HM,K_=function(e){return{concat:function(t,n){var r={};for(var i in e)ct.call(e,i)&&(r[i]=e[i].concat(t[i],n[i]));return r}}},V_=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{concat:function(n,r){return e.map(function(i,o){return i.concat(n[o],r[o])})}}},YM=function(e){return function(t){return{concat:function(n,r){return t.concat(n,t.concat(e,r))}}}},H_=function(){return{concat:q}},xm=function(){return{concat:function(e,t){return t}}},G_=GM,JM=q_(void 0),G6=function(){return{concat:function(e,t){return Object.assign({},e,t)}}},Y6=xm,J6=H_,Z6=V_,X6=K_,Q6=z_,e9=Em,t9=wm,n9=YM;function r9(e){var t=G_(e);return function(n,r){return r===void 0?t(n):t(n)(r)}}var ZM={concat:function(e,t){return e&&t}},XM={concat:function(e,t){return e||t}},i9=k_,QM={concat:function(e,t){return e+t}},eR={concat:function(e,t){return e+t}},tR={concat:function(e,t){return e*t}};const nR=Object.freeze(Object.defineProperty({__proto__:null,concatAll:G_,constant:q_,first:H_,fold:r9,getDualSemigroup:Q6,getFirstSemigroup:J6,getFunctionSemigroup:i9,getIntercalateSemigroup:n9,getJoinSemigroup:e9,getLastSemigroup:Y6,getMeetSemigroup:t9,getObjectSemigroup:G6,getStructSemigroup:X6,getTupleSemigroup:Z6,intercalate:YM,last:xm,max:Em,min:wm,reverse:z_,semigroupAll:ZM,semigroupAny:XM,semigroupProduct:tR,semigroupString:QM,semigroupSum:eR,semigroupVoid:JM,struct:K_,tuple:V_},Symbol.toStringTag,{value:"Module"}));var md=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},vd=tn,Vi=mt,Mm=function(e,t){return e<0||e>=t.length},Y_=function(e){return function(t){return md([e],t,!0)}},zc=Y_,J_=function(e){return function(t){return md(md([],t,!0),[e],!1)}},Rm=J_,km=function(e,t,n){if(Vi(n)){var r=_m(n);return r.splice(e,0,t),r}return[t]},Z_=function(e,t,n){if(n[e]===t)return n;var r=_m(n);return r[e]=t,r},X_=function(e){return function(t){if(t.length===1)return t;for(var n=[kn(t)],r=ci(t),i=function(s){n.every(function(c){return!e.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},rR=function(e){if(Vi(e)){var t=B_();return t0(e.reduce(t.concat,t.empty))}return q},Q_=function(e){var t=X_(e);return function(n){return function(r){return t(v(r,yd(n)))}}},e0=function(e){return function(t){var n=t.length,r=Math.round(e)%n;if(Mm(Math.abs(r),t)||r===0)return t;if(r<0){var i=Nm(-r)(t),o=i[0],a=i[1];return v(a,yd(o))}else return e0(r-n)(t)}},gd=function(e){return Vi(e)?fe(e):ye},Am=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},o9=function(e){return Am(function(){return e})},iR=function(e,t){return e<=t?Am(function(n){return e+n})(t-e+1):[e]},oR=function(e){return[kn(e),ci(e)]},aR=function(e){return[Kc(e),Ka(e)]},a9=function(e){return gd(e.slice())};function uR(e){return function(t){return t.concat(e)}}function yd(e,t){return t?e.concat(t):function(n){return n.concat(e)}}var u9=function(e){return e.length===1?e:md([Ka(e)],e.slice(0,-1).reverse(),!0)};function sR(e){return function(t){var n=t.length;if(n===0)return vd;for(var r=[],i=t[0],o=[i],a=1;a<n;a++){var u=t[a];e.equals(u,i)?o.push(u):(r.push(o),i=u,o=[i])}return r.push(o),r}}var s9=function(e){return function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=e(o);ct.call(n,a)?n[a].push(o):n[a]=[o]}return n}},t0=function(e){return function(t){return t.length===1?t:t.slice().sort(e.compare)}},c9=function(e,t){return cR(e,function(){return t})},cR=function(e,t){return function(n){return Mm(e,n)?ye:fe(Z_(e,t(n[e]),n))}},lR=function(e,t,n){for(var r=[n(e[0],t[0])],i=Math.min(e.length,t.length),o=1;o<i;o++)r[o]=n(e[o],t[o]);return r};function fR(e,t){return t===void 0?function(n){return fR(n,e)}:lR(e,t,function(n,r){return[n,r]})}var l9=function(e){for(var t=[e[0][0]],n=[e[0][1]],r=1;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},Fm=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},n0=function(e){return function(t){var n=ci(t);return Vi(n)?v(n,Fm(e),zc(kn(t))):t}},dR=function(e){return function(t){for(var n=_m(e(0,kn(t))),r=1;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},r0=function(e){return function(t){for(var n=e(t),r=n[0],i=n[1],o=[r],a=i;Vi(a);){var u=e(a),s=u[0],c=u[1];o.push(s),a=c}return o}},Nm=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[t,vd]:[v(t.slice(1,n),zc(kn(t))),t.slice(n)]}},pR=function(e){return r0(Nm(e))},si=function(e,t){return v(e,f0(t))},i0=function(e,t){return v(e,d0(t))},bd=function(e,t){return v(e,bR(t))},o0=function(e,t){return v(e,Pm(t))},hR=function(e,t){return v(e,l0(t))},_d=function(e,t,n){return v(e,p0(t,n))},$d=function(e){var t=h0(e);return function(n,r){return v(n,t(r))}},Sd=function(e,t,n){return v(e,m0(t,n))},a0=function(e){var t=_R(e);return function(n,r){return v(n,t(r))}},mR=function(e,t){return v(e,yR(t))},u0=function(e,t,n){return v(e,Wm(t,n))},s0=function(e){var t=v0(e);return function(n,r){return v(n,t(r))}},c0=function(e,t,n){return v(e,jm(t,n))},vR=function(e){var t=Dm(e);return function(n,r){return v(n,t(r))}},za=hd,gR=function(e){return function(t){return v(t,uR(e()))}},yR=gR,bR=function(e){return Pm(function(t){return v(e,f0(t))})},Pm=function(e){return dR(function(t,n){return e(n)})},l0=function(e){return function(t){for(var n=ci(t),r=[e(t)];Vi(n);)r.push(e(n)),n=ci(n);return r}},f9=l0(q),d9=Pm(q),f0=function(e){return d0(function(t,n){return e(n)})},d0=function(e){return function(t){for(var n=[e(0,kn(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},p0=function(e,t){return Wm(e,function(n,r,i){return t(r,i)})},h0=function(e){return function(t){return function(n){return n.slice(1).reduce(function(r,i){return e.concat(r,t(i))},t(n[0]))}}},m0=function(e,t){return jm(e,function(n,r,i){return t(r,i)})},Wm=function(e,t){return function(n){return n.reduce(function(r,i,o){return t(o,r,i)},e)}},v0=function(e){return function(t){return function(n){return n.slice(1).reduce(function(r,i,o){return e.concat(r,t(o+1,i))},t(0,n[0]))}}},jm=function(e,t){return function(n){return n.reduceRight(function(r,i,o){return t(o,i,r)},e)}},_R=function(e){var t=Dm(e);return function(n){return t(function(r,i){return n(i)})}},Lm=function(e){return Dm(e)(Zn)},Dm=function(e){return function(t){return function(n){for(var r=e.map(t(0,kn(n)),za),i=1;i<n.length;i++)r=e.ap(e.map(r,function(o){return function(a){return v(o,Rm(a))}}),t(i,n[i]));return r}}},Bm=gr,Rn="ReadonlyNonEmptyArray",$R=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},p9=function(){return{concat:yd}},SR=function(e){return jr(function(t,n){return t.length===n.length&&t.every(function(r,i){return e.equals(r,n[i])})})},h9=function(e){var t=Q_(e);return{concat:function(n,r){return t(r)(n)}}},g0={URI:Rn,map:si},m9=Ue(g0),v9={URI:Rn,of:za},g9={URI:Rn,map:si,mapWithIndex:i0},Um={URI:Rn,map:si,ap:bd},y9=Ot(Um),b9=wt(Um),_9={URI:Rn,map:si,ap:bd,of:za},y0={URI:Rn,map:si,ap:bd,chain:o0},$9=lt(y0),S9={URI:Rn,map:si,ap:bd,of:za,chain:o0},T9={URI:Rn,reduce:_d,foldMap:$d,reduceRight:Sd},I9={URI:Rn,reduce:_d,foldMap:$d,reduceRight:Sd,reduceWithIndex:u0,foldMapWithIndex:s0,reduceRightWithIndex:c0},C9={URI:Rn,map:si,reduce:_d,foldMap:$d,reduceRight:Sd,traverse:a0,sequence:Lm},O9={URI:Rn,map:si,mapWithIndex:i0,reduce:_d,foldMap:$d,reduceRight:Sd,traverse:a0,sequence:Lm,reduceWithIndex:u0,foldMapWithIndex:s0,reduceRightWithIndex:c0,traverseWithIndex:vR},w9={URI:Rn,map:si,alt:mR},E9={URI:Rn,map:si,extend:hR,extract:Bm},x9=za(zt),M9=Ct(g0),R9=xt(y0),k9=Et(Um),kn=Bm,ci=qc,Ka=function(e){return e[e.length-1]},Kc=function(e){return e.slice(0,-1)},TR=function(e){var t=wm(e);return function(n){return n.reduce(t.concat)}},IR=function(e){var t=Em(e);return function(n){return n.reduce(t.concat)}},qm=function(e){return function(t){return t.reduce(e.concat)}},A9=function(e){return function(t){return e(kn(t),ci(t))}},F9=function(e){return function(t){return e(Kc(t),Ka(t))}},CR=function(e){return function(t){return md([e(kn(t))],ci(t),!0)}},N9=function(e){return CR(function(){return e})},OR=function(e){return function(t){return v(Kc(t),Rm(e(Ka(t))))}},P9=function(e){return OR(function(){return e})},b0=function(e){var t=qm(e);return function(n){return H(n0(n),t)}};function W9(e){var t=t0(e),n=sR(e);return function(r){return Vi(r)?n(t(r)):vd}}function j9(e){return wR(function(t,n){return e(n)})}var wR=function(e){return function(t){return gd(t.filter(function(n,r){return e(r,n)}))}},L9=oR,D9=aR;function ER(e,t){return t===void 0?zc(e):v(t,zc(e))}var xR=function(e,t){return v(e,yd([t]))},B9=function(e,t){return function(n){return e<0||e>n.length?ye:fe(km(e,t,n))}},U9=Fm,q9=qm,z9={URI:Rn,of:za,map:si,mapWithIndex:i0,ap:bd,chain:o0,extend:hR,extract:Bm,reduce:_d,foldMap:$d,reduceRight:Sd,traverse:a0,sequence:Lm,reduceWithIndex:u0,foldMapWithIndex:s0,reduceRightWithIndex:c0,traverseWithIndex:vR,alt:mR};const K9=Object.freeze(Object.defineProperty({__proto__:null,Alt:w9,Applicative:_9,Apply:Um,Chain:y0,Comonad:E9,Do:x9,Foldable:T9,FoldableWithIndex:I9,Functor:g0,FunctorWithIndex:g9,Monad:S9,Pointed:v9,Traversable:C9,TraversableWithIndex:O9,URI:Rn,alt:yR,altW:gR,ap:bR,apFirst:y9,apS:k9,apSecond:b9,append:Rm,appendW:J_,bind:R9,bindTo:M9,chain:Pm,chainFirst:$9,chainWithIndex:dR,chop:r0,chunksOf:pR,concat:yd,concatAll:qm,concatW:uR,cons:ER,duplicate:f9,empty:vd,extend:l0,extract:Bm,filter:j9,filterWithIndex:wR,flap:m9,flatten:d9,fold:q9,foldMap:h0,foldMapWithIndex:v0,fromArray:a9,fromReadonlyArray:gd,getEq:SR,getSemigroup:p9,getShow:$R,getUnionSemigroup:h9,group:sR,groupBy:s9,groupSort:W9,head:kn,init:Kc,insertAt:B9,intercalate:b0,intersperse:n0,isNonEmpty:Vi,isOutOfBound:Mm,last:Ka,makeBy:Am,map:f0,mapWithIndex:d0,matchLeft:A9,matchRight:F9,max:IR,min:TR,modifyAt:cR,modifyHead:CR,modifyLast:OR,of:za,prepend:zc,prependAll:Fm,prependToAll:U9,prependW:Y_,range:iR,readonlyNonEmptyArray:z9,reduce:p0,reduceRight:m0,reduceRightWithIndex:jm,reduceWithIndex:Wm,replicate:o9,reverse:u9,rotate:e0,sequence:Lm,snoc:xR,sort:t0,sortBy:rR,splitAt:Nm,tail:ci,traverse:_R,traverseWithIndex:Dm,unappend:aR,uncons:L9,union:Q_,uniq:X_,unprepend:oR,unsafeInsertAt:km,unsafeUpdateAt:Z_,unsnoc:D9,unzip:l9,updateAt:c9,updateHead:N9,updateLast:P9,zip:fR,zipWith:lR},Symbol.toStringTag,{value:"Module"}));var MR={equals:function(e,t){return e===t}},RR={concat:function(e,t){return e+t}},kR="",V9={concat:RR.concat,empty:kR},V={equals:MR.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},H9={show:function(e){return JSON.stringify(e)}},G9=function(e){return typeof e=="string"},Y9=function(e){return e.toUpperCase()},J9=function(e){return e.toLowerCase()},Z9=function(e,t){return function(n){return n.replace(e,t)}},X9=function(e){return e.trim()},Q9=function(e){return e.trimLeft()},eG=function(e){return e.trimRight()},tG=function(e,t){return function(n){return n.slice(e,t)}},nG=function(e){return e.length===0},rG=function(e){return e.length},iG=function(e){return function(t){var n=t.split(e);return Vi(n)?n:[t]}},oG=function(e,t){return function(n){return n.includes(e,t)}},aG=function(e,t){return function(n){return n.startsWith(e,t)}},uG=function(e,t){return function(n){return n.endsWith(e,t)}};const sG=Object.freeze(Object.defineProperty({__proto__:null,Eq:MR,Monoid:V9,Ord:V,Semigroup:RR,Show:H9,empty:kR,endsWith:uG,includes:oG,isEmpty:nG,isString:G9,replace:Z9,size:rG,slice:tG,split:iG,startsWith:aG,toLowerCase:J9,toUpperCase:Y9,trim:X9,trimLeft:Q9,trimRight:eG},Symbol.toStringTag,{value:"Module"}));function li(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.separate)}}}function fi(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.compact)}}}function _0(e){return function(t){var n=e.wither(t);return function(r){return function(i){return n(i,function(o){return t.map(r(o),function(a){return a?fe(o):ye})})}}}}const cG=Object.freeze(Object.defineProperty({__proto__:null,filterE:_0,wiltDefault:li,witherDefault:fi},Symbol.toStringTag,{value:"Module"}));var lG=function(e){return Object.assign({},e)},fG=function(e){return Object.assign({},e)},AR=function(e){return Object.keys(e).length},di=function(e){for(var t in e)if(ct.call(e,t))return!1;return!0},Vc=function(e){return function(t){return Object.keys(t).sort(e.compare)}},dG=Vc(V);function zm(e){if(typeof e=="function")return zm(V)(e);var t=Vc(e);return function(n){return function(r){for(var i=[],o=0,a=t(r);o<a.length;o++){var u=a[o];i.push(n(u,r[u]))}return i}}}var $0=zm(V)(function(e,t){return[e,t]});function pG(e){return function(t){var n=$0(t),r=n.length;return e.unfold(0,function(i){return i<r?fe([n[i],i+1]):ye})}}var S0=function(e,t){return function(n){if(ct.call(n,e)&&n[e]===t)return n;var r=Object.assign({},n);return r[e]=t,r}},Fo=function(e,t){return ct.call(t,e)};function Km(e){return function(t){if(!ct.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}var hG=function(e,t){return function(n){if(!Fo(e,n))return ye;if(n[e]===t)return fe(n);var r=Object.assign({},n);return r[e]=t,fe(r)}},mG=function(e,t){return function(n){if(!Fo(e,n))return ye;var r=t(n[e]);if(r===n[e])return fe(n);var i=Object.assign({},n);return i[e]=r,fe(i)}};function vG(e){var t=Km(e);return function(n){var r=Xu(e,n);return Ft(r)?ye:fe([r.value,t(n)])}}function Vm(e){return function(t,n){if(n===void 0){var r=Vm(e);return function(o){return r(o,t)}}for(var i in t)if(!ct.call(n,i)||!e.equals(t[i],n[i]))return!1;return!0}}function Xu(e,t){return t===void 0?function(n){return Xu(e,n)}:ct.call(t,e)?fe(t[e]):ye}var Td={};function Hm(e){return function(t){var n={};for(var r in t)ct.call(t,r)&&(n[r]=e(r,t[r]));return n}}function T0(e){return Hm(function(t,n){return e(n)})}function Hc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return Hc(V).apply(void 0,e);var n=Vc(e[0]);return function(r,i){return function(o){for(var a=r,u=n(o),s=u.length,c=0;c<s;c++){var l=u[c];a=i(l,a,o[l])}return a}}}function Gc(e){if("compare"in e){var t=Vc(e);return function(n){return function(r){return function(i){for(var o=n.empty,a=t(i),u=a.length,s=0;s<u;s++){var c=a[s];o=n.concat(o,r(c,i[c]))}return o}}}}return Gc(V)(e)}function Yc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return Yc(V).apply(void 0,e);var n=Vc(e[0]);return function(r,i){return function(o){for(var a=r,u=n(o),s=u.length,c=s-1;c>=0;c--){var l=u[c];a=i(l,o[l],a)}return a}}}var FR=function(e,t){var n;return n={},n[e]=t,n};function NR(e){var t=Cd(V)(e);return function(n){return function(r){return t(r,n)}}}function Gm(e){var t=Hi(V)(e);return function(n){return function(r){return t(r,n)}}}function Jc(e){return Id(V)(e)}var gG=function(e){var t=Gm(e);return function(n){return function(r){return e.map(v(r,t(n)),No)}}},yG=function(e){var t=Gm(e);return function(n){return function(r){return e.map(v(r,t(n)),Po)}}};function Ym(e){return function(t){var n={},r={};for(var i in t)if(ct.call(t,i)){var o=e(i,t[i]);switch(o._tag){case"Left":n[i]=o.left;break;case"Right":r[i]=o.right;break}}return Ee(n,r)}}function Jm(e){return function(t){var n={},r={};for(var i in t)if(ct.call(t,i)){var o=t[i];e(i,o)?r[i]=o:n[i]=o}return Ee(n,r)}}function Zm(e){return function(t){var n={};for(var r in t)if(ct.call(t,r)){var i=e(r,t[r]);gt(i)&&(n[r]=i.value)}return n}}function Xm(e){return function(t){var n={},r=!1;for(var i in t)if(ct.call(t,i)){var o=t[i];e(i,o)?n[i]=o:r=!0}return r?n:t}}function PR(e,t){var n=I0(e,t);return function(r){return n(r,q)}}function I0(e,t){return function(n,r){return t.reduce(n,{},function(i,o){var a=r(o),u=a[0],s=a[1];return i[u]=ct.call(i,u)?e.concat(i[u],s):s,i})}}var bG=$0,_G=function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];t[i[0]]=i[1]}return t};function WR(e){return function(t){for(var n in t)if(!e(t[n]))return!1;return!0}}function jR(e){return function(t){for(var n in t)if(e(t[n]))return!0;return!1}}function C0(e){return function(t,n){if(n===void 0){var r=C0(e);return function(o){return r(t,o)}}for(var i in n)if(e.equals(n[i],t))return!0;return!1}}var O0=function(e){return function(t){return function(n){if(di(n))return t;if(di(t))return n;var r={};for(var i in n)Fo(i,t)?r[i]=e.concat(n[i],t[i]):r[i]=n[i];for(var i in t)Fo(i,r)||(r[i]=t[i]);return r}}},w0=function(e){return function(t){return function(n){if(di(n)||di(t))return Td;var r={};for(var i in n)Fo(i,t)&&(r[i]=e.concat(n[i],t[i]));return r}}},E0=function(e){return function(t){if(di(t))return e;if(di(e))return t;var n={};for(var r in t)Fo(r,e)||(n[r]=t[r]);for(var r in e)Fo(r,t)||(n[r]=e[r]);return n}},yr=function(e,t){return v(e,T0(t))},Qu=function(e,t){return v(e,Hm(t))},br=function(e){var t=Od(e);return function(n,r,i){return v(n,t(r,i))}},_r=function(e){return function(t){var n=wd(e)(t);return function(r,i){return v(r,n(i))}}},$r=function(e){var t=Ed(e);return function(n,r,i){return v(n,t(r,i))}},es=function(e,t){return v(e,x0(t))},ts=function(e,t){return v(e,M0(t))},ns=function(e,t){return v(e,R0(t))},rs=function(e,t){return v(e,k0(t))},is=function(e){var t=Hc(e);return function(n,r,i){return v(n,t(r,i))}},as=function(e){var t=Gc(e);return function(n){var r=t(n);return function(i,o){return v(i,r(o))}}},us=function(e){var t=Yc(e);return function(n,r,i){return v(n,t(r,i))}},Qm=function(e,t){return v(e,Ym(t))},ev=function(e,t){return v(e,Jm(t))},tv=function(e,t){return v(e,Zm(t))},nv=function(e,t){return v(e,Xm(t))},Hi=function(e){var t=Cd(e);return function(n){var r=t(n);return function(i,o){return r(i,H(Zn,o))}}},Id=function(e){var t=Hi(e);return function(n){var r=t(n);return function(i){return r(i,q)}}},Cd=function(e){return function(t){var n=Vc(e);return function(r,i){var o=n(r);if(o.length===0)return t.of(Td);for(var a=t.of({}),u=function(f){a=t.ap(t.map(a,function(d){return function(p){var h;return Object.assign({},d,(h={},h[f]=p,h))}}),i(f,r[f]))},s=0,c=o;s<c.length;s++){var l=c[s];u(l)}return a}}},x0=function(e){return Xm(function(t,n){return e(n)})},M0=function(e){return Zm(function(t,n){return e(n)})},R0=function(e){return Jm(function(t,n){return e(n)})},k0=function(e){return Ym(function(t,n){return e(n)})};function Od(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===1){var n=Hc(e[0]);return function(r,i){return n(r,function(o,a,u){return i(a,u)})}}return Od(V).apply(void 0,e)}function wd(e){if("compare"in e){var t=Gc(e);return function(n){var r=t(n);return function(i){return r(function(o,a){return i(a)})}}}return wd(V)(e)}function Ed(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===1){var n=Yc(e[0]);return function(r,i){return n(r,function(o,a,u){return i(a,u)})}}return Ed(V).apply(void 0,e)}var No=function(e){var t={};for(var n in e)if(ct.call(e,n)){var r=e[n];gt(r)&&(t[n]=r.value)}return t},Po=function(e){var t={},n={};for(var r in e)if(ct.call(e,r)){var i=e[r];qt(i)?t[r]=i.left:n[r]=i.right}return Ee(t,n)},nn="ReadonlyRecord";function rv(e){return"compare"in e?function(t){return{show:function(n){var r=zm(e)(function(i,o){return"".concat(JSON.stringify(i),": ").concat(t.show(o))})(n).join(", ");return r===""?"{}":"{ ".concat(r," }")}}}:rv(V)(e)}function LR(e){var t=Vm(e);return jr(function(n,r){return t(n)(r)&&t(r)(n)})}function DR(e){return{concat:function(t,n){if(di(t))return n;if(di(n))return t;var r=Object.assign({},t);for(var i in n)ct.call(n,i)&&(r[i]=ct.call(t,i)?e.concat(t[i],n[i]):n[i]);return r},empty:Td}}var BR={URI:nn,map:yr},$G=Ue(BR),SG={URI:nn,map:yr,mapWithIndex:Qu},TG=function(e){return{URI:nn,reduce:br(e),foldMap:_r(e),reduceRight:$r(e)}},IG=function(e){return{URI:nn,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),reduceWithIndex:is(e),foldMapWithIndex:as(e),reduceRightWithIndex:us(e)}},xd={URI:nn,compact:No,separate:Po},CG={URI:nn,map:yr,compact:No,separate:Po,filter:es,filterMap:ts,partition:ns,partitionMap:rs},OG={URI:nn,map:yr,mapWithIndex:Qu,compact:No,separate:Po,filter:es,filterMap:ts,partition:ns,partitionMap:rs,filterMapWithIndex:tv,filterWithIndex:nv,partitionMapWithIndex:Qm,partitionWithIndex:ev},UR=function(e){return{URI:nn,map:yr,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),traverse:Hi(e),sequence:Id(e)}},wG=function(e){return{URI:nn,map:yr,mapWithIndex:Qu,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),reduceWithIndex:is(e),foldMapWithIndex:as(e),reduceRightWithIndex:us(e),traverse:Hi(e),sequence:Id(e),traverseWithIndex:Cd(e)}},EG=function(e){var t=UR(e);return{URI:nn,map:yr,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),traverse:t.traverse,sequence:t.sequence,compact:No,separate:Po,filter:es,filterMap:ts,partition:ns,partitionMap:rs,wither:fi(t,xd),wilt:li(t,xd)}},qR=function(e){var t=O0(e);return{concat:function(n,r){return t(r)(n)}}},xG=function(e){return{concat:qR(e).concat,empty:Td}},MG=function(e){var t=w0(e);return{concat:function(n,r){return t(r)(n)}}},RG=function(){return{concat:function(e,t){return E0(t)(e)}}},kG={URI:nn,reduce:br(V),foldMap:_r(V),reduceRight:$r(V)},AG={URI:nn,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),reduceWithIndex:is(V),foldMapWithIndex:as(V),reduceRightWithIndex:us(V)},A0={URI:nn,map:yr,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),traverse:Hi(V),sequence:Jc},FG={URI:nn,map:yr,mapWithIndex:Qu,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),reduceWithIndex:is(V),foldMapWithIndex:as(V),reduceRightWithIndex:us(V),traverse:Hi(V),sequence:Jc,traverseWithIndex:Cd(V)},zR=fi(A0,xd),KR=li(A0,xd),NG={URI:nn,map:yr,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),traverse:Hi(V),sequence:Jc,compact:No,separate:Po,filter:es,filterMap:ts,partition:ns,partitionMap:rs,wither:zR,wilt:KR},F0=S0;function VR(e,t){return ct.call(t===void 0?this:t,e)}var PG={URI:nn,map:yr,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),traverse:Hi(V),sequence:Jc,compact:No,separate:Po,filter:es,filterMap:ts,partition:ns,partitionMap:rs,mapWithIndex:Qu,reduceWithIndex:is(V),foldMapWithIndex:as(V),reduceRightWithIndex:us(V),filterMapWithIndex:tv,filterWithIndex:nv,partitionMapWithIndex:Qm,partitionWithIndex:ev,traverseWithIndex:Cd(V),wither:zR,wilt:KR};const WG=Object.freeze(Object.defineProperty({__proto__:null,Compactable:xd,Filterable:CG,FilterableWithIndex:OG,Foldable:kG,FoldableWithIndex:AG,Functor:BR,FunctorWithIndex:SG,Traversable:A0,TraversableWithIndex:FG,URI:nn,Witherable:NG,_filter:es,_filterMap:ts,_filterMapWithIndex:tv,_filterWithIndex:nv,_foldMap:_r,_foldMapWithIndex:as,_map:yr,_mapWithIndex:Qu,_partition:ns,_partitionMap:rs,_partitionMapWithIndex:Qm,_partitionWithIndex:ev,_reduce:br,_reduceRight:$r,_reduceRightWithIndex:us,_reduceWithIndex:is,_sequence:Id,_traverse:Hi,collect:zm,compact:No,deleteAt:Km,difference:E0,elem:C0,empty:Td,every:WR,filter:x0,filterMap:M0,filterMapWithIndex:Zm,filterWithIndex:Xm,flap:$G,foldMap:wd,foldMapWithIndex:Gc,fromEntries:_G,fromFoldable:PR,fromFoldableMap:I0,fromRecord:lG,getDifferenceMagma:RG,getEq:LR,getFoldable:TG,getFoldableWithIndex:IG,getIntersectionSemigroup:MG,getMonoid:DR,getShow:rv,getTraversable:UR,getTraversableWithIndex:wG,getUnionMonoid:xG,getUnionSemigroup:qR,getWitherable:EG,has:Fo,hasOwnProperty:VR,insertAt:F0,intersection:w0,isEmpty:di,isSubrecord:Vm,keys:dG,lookup:Xu,map:T0,mapWithIndex:Hm,modifyAt:mG,partition:R0,partitionMap:k0,partitionMapWithIndex:Ym,partitionWithIndex:Jm,pop:vG,readonlyRecord:PG,reduce:Od,reduceRight:Ed,reduceRightWithIndex:Yc,reduceWithIndex:Hc,separate:Po,sequence:Jc,singleton:FR,size:AR,some:jR,toEntries:bG,toReadonlyArray:$0,toRecord:fG,toUnfoldable:pG,traverse:Gm,traverseWithIndex:NR,union:O0,updateAt:hG,upsertAt:S0,wilt:yG,wither:gG},Symbol.toStringTag,{value:"Module"})),N0=N.createContext(void 0);function Gi(){const e=N.useContext(N0);if(!e)throw new Error("Missing EditorConfigContext.Provider");return e}var Qe={},G={},jG={get exports(){return G},set exports(e){G=e}};(function(e){var t,n,r,i,o,a,u,s,c,l,f,d,p,h,m,g,_,S,C,b,w,O,M,x,U,B,P,Z,ee;(function(J){var ge=typeof de=="object"?de:typeof self=="object"?self:typeof this=="object"?this:{};J(Ie(ge,Ie(e.exports)));function Ie(k,A){return k!==ge&&(typeof Object.create=="function"?Object.defineProperty(k,"__esModule",{value:!0}):k.__esModule=!0),function(I,$){return k[I]=A?A(I,$):$}}})(function(J){var ge=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,A){k.__proto__=A}||function(k,A){for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&(k[I]=A[I])};t=function(k,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");ge(k,A);function I(){this.constructor=k}k.prototype=A===null?Object.create(A):(I.prototype=A.prototype,new I)},n=Object.assign||function(k){for(var A,I=1,$=arguments.length;I<$;I++){A=arguments[I];for(var R in A)Object.prototype.hasOwnProperty.call(A,R)&&(k[R]=A[R])}return k},r=function(k,A){var I={};for(var $ in k)Object.prototype.hasOwnProperty.call(k,$)&&A.indexOf($)<0&&(I[$]=k[$]);if(k!=null&&typeof Object.getOwnPropertySymbols=="function")for(var R=0,$=Object.getOwnPropertySymbols(k);R<$.length;R++)A.indexOf($[R])<0&&Object.prototype.propertyIsEnumerable.call(k,$[R])&&(I[$[R]]=k[$[R]]);return I},i=function(k,A,I,$){var R=arguments.length,L=R<3?A:$===null?$=Object.getOwnPropertyDescriptor(A,I):$,X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(k,A,I,$);else for(var ne=k.length-1;ne>=0;ne--)(X=k[ne])&&(L=(R<3?X(L):R>3?X(A,I,L):X(A,I))||L);return R>3&&L&&Object.defineProperty(A,I,L),L},o=function(k,A){return function(I,$){A(I,$,k)}},a=function(k,A,I,$,R,L){function X(mr){if(mr!==void 0&&typeof mr!="function")throw new TypeError("Function expected");return mr}for(var ne=$.kind,Re=ne==="getter"?"get":ne==="setter"?"set":"value",se=!A&&k?$.static?k:k.prototype:null,Ae=A||(se?Object.getOwnPropertyDescriptor(se,$.name):{}),ze,He=!1,ut=I.length-1;ut>=0;ut--){var Ut={};for(var en in $)Ut[en]=en==="access"?{}:$[en];for(var en in $.access)Ut.access[en]=$.access[en];Ut.addInitializer=function(mr){if(He)throw new TypeError("Cannot add initializers after decoration has completed");L.push(X(mr||null))};var yn=(0,I[ut])(ne==="accessor"?{get:Ae.get,set:Ae.set}:Ae[Re],Ut);if(ne==="accessor"){if(yn===void 0)continue;if(yn===null||typeof yn!="object")throw new TypeError("Object expected");(ze=X(yn.get))&&(Ae.get=ze),(ze=X(yn.set))&&(Ae.set=ze),(ze=X(yn.init))&&R.push(ze)}else(ze=X(yn))&&(ne==="field"?R.push(ze):Ae[Re]=ze)}se&&Object.defineProperty(se,$.name,Ae),He=!0},u=function(k,A,I){for(var $=arguments.length>2,R=0;R<A.length;R++)I=$?A[R].call(k,I):A[R].call(k);return $?I:void 0},s=function(k){return typeof k=="symbol"?k:"".concat(k)},c=function(k,A,I){return typeof A=="symbol"&&(A=A.description?"[".concat(A.description,"]"):""),Object.defineProperty(k,"name",{configurable:!0,value:I?"".concat(I," ",A):A})},l=function(k,A){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(k,A)},f=function(k,A,I,$){function R(L){return L instanceof I?L:new I(function(X){X(L)})}return new(I||(I=Promise))(function(L,X){function ne(Ae){try{se($.next(Ae))}catch(ze){X(ze)}}function Re(Ae){try{se($.throw(Ae))}catch(ze){X(ze)}}function se(Ae){Ae.done?L(Ae.value):R(Ae.value).then(ne,Re)}se(($=$.apply(k,A||[])).next())})},d=function(k,A){var I={label:0,sent:function(){if(L[0]&1)throw L[1];return L[1]},trys:[],ops:[]},$,R,L,X;return X={next:ne(0),throw:ne(1),return:ne(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function ne(se){return function(Ae){return Re([se,Ae])}}function Re(se){if($)throw new TypeError("Generator is already executing.");for(;X&&(X=0,se[0]&&(I=0)),I;)try{if($=1,R&&(L=se[0]&2?R.return:se[0]?R.throw||((L=R.return)&&L.call(R),0):R.next)&&!(L=L.call(R,se[1])).done)return L;switch(R=0,L&&(se=[se[0]&2,L.value]),se[0]){case 0:case 1:L=se;break;case 4:return I.label++,{value:se[1],done:!1};case 5:I.label++,R=se[1],se=[0];continue;case 7:se=I.ops.pop(),I.trys.pop();continue;default:if(L=I.trys,!(L=L.length>0&&L[L.length-1])&&(se[0]===6||se[0]===2)){I=0;continue}if(se[0]===3&&(!L||se[1]>L[0]&&se[1]<L[3])){I.label=se[1];break}if(se[0]===6&&I.label<L[1]){I.label=L[1],L=se;break}if(L&&I.label<L[2]){I.label=L[2],I.ops.push(se);break}L[2]&&I.ops.pop(),I.trys.pop();continue}se=A.call(k,I)}catch(Ae){se=[6,Ae],R=0}finally{$=L=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}},p=function(k,A){for(var I in k)I!=="default"&&!Object.prototype.hasOwnProperty.call(A,I)&&ee(A,k,I)},ee=Object.create?function(k,A,I,$){$===void 0&&($=I);var R=Object.getOwnPropertyDescriptor(A,I);(!R||("get"in R?!A.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:function(){return A[I]}}),Object.defineProperty(k,$,R)}:function(k,A,I,$){$===void 0&&($=I),k[$]=A[I]},h=function(k){var A=typeof Symbol=="function"&&Symbol.iterator,I=A&&k[A],$=0;if(I)return I.call(k);if(k&&typeof k.length=="number")return{next:function(){return k&&$>=k.length&&(k=void 0),{value:k&&k[$++],done:!k}}};throw new TypeError(A?"Object is not iterable.":"Symbol.iterator is not defined.")},m=function(k,A){var I=typeof Symbol=="function"&&k[Symbol.iterator];if(!I)return k;var $=I.call(k),R,L=[],X;try{for(;(A===void 0||A-- >0)&&!(R=$.next()).done;)L.push(R.value)}catch(ne){X={error:ne}}finally{try{R&&!R.done&&(I=$.return)&&I.call($)}finally{if(X)throw X.error}}return L},g=function(){for(var k=[],A=0;A<arguments.length;A++)k=k.concat(m(arguments[A]));return k},_=function(){for(var k=0,A=0,I=arguments.length;A<I;A++)k+=arguments[A].length;for(var $=Array(k),R=0,A=0;A<I;A++)for(var L=arguments[A],X=0,ne=L.length;X<ne;X++,R++)$[R]=L[X];return $},S=function(k,A,I){if(I||arguments.length===2)for(var $=0,R=A.length,L;$<R;$++)(L||!($ in A))&&(L||(L=Array.prototype.slice.call(A,0,$)),L[$]=A[$]);return k.concat(L||Array.prototype.slice.call(A))},C=function(k){return this instanceof C?(this.v=k,this):new C(k)},b=function(k,A,I){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var $=I.apply(k,A||[]),R,L=[];return R={},X("next"),X("throw"),X("return"),R[Symbol.asyncIterator]=function(){return this},R;function X(He){$[He]&&(R[He]=function(ut){return new Promise(function(Ut,en){L.push([He,ut,Ut,en])>1||ne(He,ut)})})}function ne(He,ut){try{Re($[He](ut))}catch(Ut){ze(L[0][3],Ut)}}function Re(He){He.value instanceof C?Promise.resolve(He.value.v).then(se,Ae):ze(L[0][2],He)}function se(He){ne("next",He)}function Ae(He){ne("throw",He)}function ze(He,ut){He(ut),L.shift(),L.length&&ne(L[0][0],L[0][1])}},w=function(k){var A,I;return A={},$("next"),$("throw",function(R){throw R}),$("return"),A[Symbol.iterator]=function(){return this},A;function $(R,L){A[R]=k[R]?function(X){return(I=!I)?{value:C(k[R](X)),done:!1}:L?L(X):X}:L}},O=function(k){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var A=k[Symbol.asyncIterator],I;return A?A.call(k):(k=typeof h=="function"?h(k):k[Symbol.iterator](),I={},$("next"),$("throw"),$("return"),I[Symbol.asyncIterator]=function(){return this},I);function $(L){I[L]=k[L]&&function(X){return new Promise(function(ne,Re){X=k[L](X),R(ne,Re,X.done,X.value)})}}function R(L,X,ne,Re){Promise.resolve(Re).then(function(se){L({value:se,done:ne})},X)}},M=function(k,A){return Object.defineProperty?Object.defineProperty(k,"raw",{value:A}):k.raw=A,k};var Ie=Object.create?function(k,A){Object.defineProperty(k,"default",{enumerable:!0,value:A})}:function(k,A){k.default=A};x=function(k){if(k&&k.__esModule)return k;var A={};if(k!=null)for(var I in k)I!=="default"&&Object.prototype.hasOwnProperty.call(k,I)&&ee(A,k,I);return Ie(A,k),A},U=function(k){return k&&k.__esModule?k:{default:k}},B=function(k,A,I,$){if(I==="a"&&!$)throw new TypeError("Private accessor was defined without a getter");if(typeof A=="function"?k!==A||!$:!A.has(k))throw new TypeError("Cannot read private member from an object whose class did not declare it");return I==="m"?$:I==="a"?$.call(k):$?$.value:A.get(k)},P=function(k,A,I,$,R){if($==="m")throw new TypeError("Private method is not writable");if($==="a"&&!R)throw new TypeError("Private accessor was defined without a setter");if(typeof A=="function"?k!==A||!R:!A.has(k))throw new TypeError("Cannot write private member to an object whose class did not declare it");return $==="a"?R.call(k,I):R?R.value=I:A.set(k,I),I},Z=function(k,A){if(A===null||typeof A!="object"&&typeof A!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof k=="function"?A===k:k.has(A)},J("__extends",t),J("__assign",n),J("__rest",r),J("__decorate",i),J("__param",o),J("__esDecorate",a),J("__runInitializers",u),J("__propKey",s),J("__setFunctionName",c),J("__metadata",l),J("__awaiter",f),J("__generator",d),J("__exportStar",p),J("__createBinding",ee),J("__values",h),J("__read",m),J("__spread",g),J("__spreadArrays",_),J("__spreadArray",S),J("__await",C),J("__asyncGenerator",b),J("__asyncDelegator",w),J("__asyncValues",O),J("__makeTemplateObject",M),J("__importStar",x),J("__importDefault",U),J("__classPrivateFieldGet",B),J("__classPrivateFieldSet",P),J("__classPrivateFieldIn",Z)})})(jG);var Zc={};function HR(e){return function(t){return function(n){return n.reduce(function(r,i){return e.alt(r,function(){return i})},t)}}}const LG=Object.freeze(Object.defineProperty({__proto__:null,altAll:HR},Symbol.toStringTag,{value:"Module"}));function DG(e){return HR(e)(e.zero())}const BG=Object.freeze(Object.defineProperty({__proto__:null,altAll:DG},Symbol.toStringTag,{value:"Module"}));function Lr(e){var t=Kt(e);return function(n){return{concat:t(n).concat,empty:e.of(n.empty)}}}function GR(e,t){var n=Uc(e,t).map,r=Ao(e,t);return{map:n,of:function(i){return e.of(t.of(i))},ap:function(i,o){return v(i,r(o))}}}const UG=Object.freeze(Object.defineProperty({__proto__:null,getApplicativeComposition:GR,getApplicativeMonoid:Lr},Symbol.toStringTag,{value:"Module"}));function Yi(e){return function(t){return function(n){return e.fromEither(Ft(n)?ko(t()):qa(n.value))}}}function Va(e){return function(t,n){return function(r){return e.fromEither(t(r)?qa(r):ko(n(r)))}}}function Ji(e){var t=Yi(e);return function(n){var r=t(n);return function(i){return H(i,r)}}}function ss(e,t){var n=Ji(e);return function(r){var i=n(r);return function(o){return function(a){return t.chain(a,i(o))}}}}function Sr(e){return function(t){return H(t,e.fromEither)}}function Wo(e,t){var n=Sr(e);return function(r){return function(i){return t.chain(i,n(r))}}}function jo(e,t){return H(Sr(e),lt(t))}function cs(e,t){return function(n,r){return function(i){return t.chain(i,function(o){return e.fromEither(n(o)?qa(o):ko(r(o)))})}}}const qG=Object.freeze(Object.defineProperty({__proto__:null,chainEitherK:Wo,chainFirstEitherK:jo,chainOptionK:ss,filterOrElse:cs,fromEitherK:Sr,fromOption:Yi,fromOptionK:Ji,fromPredicate:Va},Symbol.toStringTag,{value:"Module"}));var Md=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},Lo=function(e){return e.length>0},iv=function(e,t){return e<0||e>=t.length},P0=function(e){return function(t){return Md([e],t,!0)}},Xc=P0,W0=function(e){return function(t){return Md(Md([],t,!0),[e],!1)}},Rd=W0,j0=function(e,t,n){if(Lo(n)){var r=kd(n);return r.splice(e,0,t),r}return[t]},L0=function(e,t,n){var r=kd(n);return r[e]=t,r},D0=function(e){return function(t){if(t.length===1)return Qc(t);for(var n=[Dr(t)],r=hi(t),i=function(s){n.every(function(c){return!e.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},YR=function(e){if(Lo(e)){var t=B_();return z0(e.reduce(t.concat,t.empty))}return Qc},B0=function(e){var t=D0(e);return function(n){return function(r){return t(v(r,av(n)))}}},U0=function(e){return function(t){var n=t.length,r=Math.round(e)%n;if(iv(Math.abs(r),t)||r===0)return Qc(t);if(r<0){var i=sv(-r)(t),o=i[0],a=i[1];return v(a,av(o))}else return U0(r-n)(t)}},kd=_m,q0=function(e){return Lo(e)?fe(e):ye},ov=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},zG=function(e){return ov(function(){return e})},JR=function(e,t){return e<=t?ov(function(n){return e+n})(t-e+1):[e]},ZR=function(e){return[Dr(e),hi(e)]},XR=function(e){return[tl(e),el(e)]};function QR(e){return function(t){return t.concat(e)}}function av(e,t){return t?e.concat(t):function(n){return n.concat(e)}}var KG=function(e){return Md([el(e)],e.slice(0,-1).reverse(),!0)};function ek(e){return function(t){var n=t.length;if(n===0)return[];for(var r=[],i=t[0],o=[i],a=1;a<n;a++){var u=t[a];e.equals(u,i)?o.push(u):(r.push(o),i=u,o=[i])}return r.push(o),r}}var VG=function(e){return function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=e(o);ct.call(n,a)?n[a].push(o):n[a]=[o]}return n}},z0=function(e){return function(t){return t.slice().sort(e.compare)}},HG=function(e,t){return function(n){return e<0||e>n.length?ye:fe(j0(e,t,n))}},GG=function(e,t){return tk(e,function(){return t})},tk=function(e,t){return function(n){return iv(e,n)?ye:fe(L0(e,t(n[e]),n))}},Qc=kd,Ha=function(e){return[e]},nk=function(e,t,n){for(var r=[n(e[0],t[0])],i=Math.min(e.length,t.length),o=1;o<i;o++)r[o]=n(e[o],t[o]);return r};function rk(e,t){return t===void 0?function(n){return rk(n,e)}:nk(e,t,function(n,r){return[n,r]})}var YG=function(e){for(var t=[e[0][0]],n=[e[0][1]],r=1;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},uv=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},ik=function(e){return function(t){var n=hi(t);return Lo(n)?v(n,uv(e),Xc(Dr(t))):Qc(t)}},ok=v0,ak=h0,uk=function(e){return function(t){for(var n=kd(e(0,Dr(t))),r=1;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},K0=function(e){return function(t){for(var n=e(t),r=n[0],i=n[1],o=[r],a=i;Lo(a);){var u=e(a),s=u[0],c=u[1];o.push(s),a=c}return o}},sv=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[Qc(t),[]]:[v(t.slice(1,n),Xc(Dr(t))),t.slice(n)]}},sk=function(e){return K0(sv(e))},pi=function(e,t){return v(e,Q0(t))},V0=function(e,t){return v(e,e$(t))},Ad=function(e,t){return v(e,hk(t))},H0=function(e,t){return v(e,cv(t))},ck=function(e,t){return v(e,X0(t))},Fd=function(e,t,n){return v(e,mk(t,n))},Nd=function(e){var t=ak(e);return function(n,r){return v(n,t(r))}},Pd=function(e,t,n){return v(e,gk(t,n))},G0=function(e){var t=bk(e);return function(n,r){return v(n,t(r))}},lk=function(e,t){return v(e,pk(t))},Y0=function(e,t,n){return v(e,vk(t,n))},J0=function(e){var t=ok(e);return function(n,r){return v(n,t(r))}},Z0=function(e,t,n){return v(e,yk(t,n))},fk=function(e){var t=fv(e);return function(n,r){return v(n,t(r))}},dk=function(e){return function(t){return v(t,QR(e()))}},pk=dk,hk=function(e){return cv(function(t){return v(e,Q0(t))})},cv=function(e){return uk(function(t,n){return e(n)})},X0=function(e){return function(t){for(var n=hi(t),r=[e(t)];Lo(n);)r.push(e(n)),n=hi(n);return r}},JG=X0(q),ZG=cv(q),Q0=function(e){return e$(function(t,n){return e(n)})},e$=function(e){return function(t){for(var n=[e(0,Dr(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},mk=p0,vk=Wm,gk=m0,yk=jm,bk=function(e){var t=fv(e);return function(n){return t(function(r,i){return n(i)})}},lv=function(e){return fv(e)(function(t,n){return n})},fv=function(e){return function(t){return function(n){for(var r=e.map(t(0,Dr(n)),Ha),i=1;i<n.length;i++)r=e.ap(e.map(r,function(o){return function(a){return v(o,Rd(a))}}),t(i,n[i]));return r}}},t$=kn,An="NonEmptyArray",XG=$R,QG=function(){return{concat:av}},eY=SR,tY=function(e){var t=B0(e);return{concat:function(n,r){return t(r)(n)}}},n$={URI:An,map:pi},nY=Ue(n$),rY={URI:An,of:Ha},iY={URI:An,map:pi,mapWithIndex:V0},dv={URI:An,map:pi,ap:Ad},oY=Ot(dv),aY=wt(dv),uY={URI:An,map:pi,ap:Ad,of:Ha},r$={URI:An,map:pi,ap:Ad,chain:H0},sY=lt(r$),cY={URI:An,map:pi,ap:Ad,of:Ha,chain:H0},lY={URI:An,reduce:Fd,foldMap:Nd,reduceRight:Pd},fY={URI:An,reduce:Fd,foldMap:Nd,reduceRight:Pd,reduceWithIndex:Y0,foldMapWithIndex:J0,reduceRightWithIndex:Z0},dY={URI:An,map:pi,reduce:Fd,foldMap:Nd,reduceRight:Pd,traverse:G0,sequence:lv},pY={URI:An,map:pi,mapWithIndex:V0,reduce:Fd,foldMap:Nd,reduceRight:Pd,traverse:G0,sequence:lv,reduceWithIndex:Y0,foldMapWithIndex:J0,reduceRightWithIndex:Z0,traverseWithIndex:fk},hY={URI:An,map:pi,alt:lk},mY={URI:An,map:pi,extend:ck,extract:t$},vY=Ha(zt),gY=Ct(n$),yY=xt(r$),bY=Et(dv),Dr=kn,hi=function(e){return e.slice(1)},el=Ka,tl=function(e){return e.slice(0,-1)},_Y=TR,$Y=IR,SY=function(e){return function(t){return t.reduce(e.concat)}},TY=function(e){return function(t){return e(Dr(t),hi(t))}},IY=function(e){return function(t){return e(tl(t),el(t))}},_k=function(e){return function(t){return Md([e(Dr(t))],hi(t),!0)}},CY=function(e){return _k(function(){return e})},$k=function(e){return function(t){return v(tl(t),Rd(e(el(t))))}},OY=function(e){return $k(function(){return e})},wY=b0;function EY(e){var t=z0(e),n=ek(e);return function(r){return Lo(r)?n(t(r)):[]}}function xY(e){return Sk(function(t,n){return e(n)})}var Sk=function(e){return function(t){return q0(t.filter(function(n,r){return e(r,n)}))}},MY=ZR,RY=XR;function Tk(e,t){return t===void 0?Xc(e):v(t,Xc(e))}var Ik=function(e,t){return v(e,Rd(t))},kY=uv,AY=qm,FY={URI:An,of:Ha,map:pi,mapWithIndex:V0,ap:Ad,chain:H0,extend:ck,extract:t$,reduce:Fd,foldMap:Nd,reduceRight:Pd,traverse:G0,sequence:lv,reduceWithIndex:Y0,foldMapWithIndex:J0,reduceRightWithIndex:Z0,traverseWithIndex:fk,alt:lk};const NY=Object.freeze(Object.defineProperty({__proto__:null,Alt:hY,Applicative:uY,Apply:dv,Chain:r$,Comonad:mY,Do:vY,Foldable:lY,FoldableWithIndex:fY,Functor:n$,FunctorWithIndex:iY,Monad:cY,Pointed:rY,Traversable:dY,TraversableWithIndex:pY,URI:An,alt:pk,altW:dk,ap:hk,apFirst:oY,apS:bY,apSecond:aY,append:Rd,appendW:W0,bind:yY,bindTo:gY,chain:cv,chainFirst:sY,chainWithIndex:uk,chop:K0,chunksOf:sk,concat:av,concatAll:SY,concatW:QR,cons:Tk,copy:Qc,duplicate:JG,extend:X0,extract:t$,filter:xY,filterWithIndex:Sk,flap:nY,flatten:ZG,fold:AY,foldMap:ak,foldMapWithIndex:ok,fromArray:q0,fromReadonlyNonEmptyArray:kd,getEq:eY,getSemigroup:QG,getShow:XG,getUnionSemigroup:tY,group:ek,groupBy:VG,groupSort:EY,head:Dr,init:tl,insertAt:HG,intercalate:wY,intersperse:ik,isNonEmpty:Lo,isOutOfBound:iv,last:el,makeBy:ov,map:Q0,mapWithIndex:e$,matchLeft:TY,matchRight:IY,max:$Y,min:_Y,modifyAt:tk,modifyHead:_k,modifyLast:$k,nonEmptyArray:FY,of:Ha,prepend:Xc,prependAll:uv,prependToAll:kY,prependW:P0,range:JR,reduce:mk,reduceRight:gk,reduceRightWithIndex:yk,reduceWithIndex:vk,replicate:zG,reverse:KG,rotate:U0,sequence:lv,snoc:Ik,sort:z0,sortBy:YR,splitAt:sv,tail:hi,traverse:bk,traverseWithIndex:fv,unappend:XR,uncons:MY,union:B0,uniq:D0,unprepend:ZR,unsafeInsertAt:j0,unsafeUpdateAt:L0,unsnoc:RY,unzip:YG,updateAt:GG,updateHead:CY,updateLast:OY,zip:rk,zipWith:nk},Symbol.toStringTag,{value:"Module"}));var PY=function(e){return typeof e=="number"},i$={equals:function(e,t){return e===t}},pv={equals:i$.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},WY={equals:i$.equals,compare:pv.compare,top:1/0,bottom:-1/0},jY={show:function(e){return JSON.stringify(e)}},Ck={concat:function(e,t){return e-t}},o$={concat:function(e,t){return e+t}},a$={concat:function(e,t){return e*t}},LY={concat:o$.concat,empty:0},DY={concat:a$.concat,empty:1},BY={add:o$.concat,zero:0,mul:a$.concat,one:1,sub:Ck.concat,degree:function(e){return 1},div:function(e,t){return e/t},mod:function(e,t){return e%t}};const UY=Object.freeze(Object.defineProperty({__proto__:null,Bounded:WY,Eq:i$,Field:BY,MagmaSub:Ck,MonoidProduct:DY,MonoidSum:LY,Ord:pv,SemigroupProduct:a$,SemigroupSum:o$,Show:jY,isNumber:PY},Symbol.toStringTag,{value:"Module"}));function nl(e,t){return function(n){return n?t.of(void 0):e.zero()}}const qY=Object.freeze(Object.defineProperty({__proto__:null,guard:nl},Symbol.toStringTag,{value:"Module"}));var zY=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},Zi=function(e){return e.length===0},Mt=Vi,KY=zc,VY=Y_,hv=Rm,HY=J_,Ok=function(e,t){return e<=0?$t:Am(t)(e)},GY=function(e,t){return Ok(e,function(){return t})};function YY(e){return function(t){return e(t)?[t]:$t}}var wk=function(e){return Ft(e)?$t:[e.value]},Ek=function(e){return qt(e)?$t:[e.right]},xk=function(e,t){return function(n){return Mt(n)?t(n):e()}},Mk=xk,Rk=function(e,t){return function(n){return Mt(n)?t(kn(n),ci(n)):e()}},kk=Rk,JY=kk,Ak=function(e,t){return function(n){return Mt(n)?t(Kc(n),Ka(n)):e()}},Fk=Ak,ZY=Fk,Nk=function(e){return function(t){if(Zi(t))return $t;for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},XY=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[0]=e;for(var o=0;o<r;o++)i[o+1]=t(i[o],n[o]);return i}},QY=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[r]=e;for(var o=r-1;o>=0;o--)i[o]=t(n[o],i[o+1]);return i}},e7=function(e){return e.length},rl=Mm;function ls(e,t){return t===void 0?function(n){return ls(e,n)}:rl(e,t)?ye:fe(t[e])}var Pk=function(e){return Mt(e)?fe(kn(e)):ye},u$=function(e){return Mt(e)?fe(Ka(e)):ye},t7=function(e){return Mt(e)?fe(ci(e)):ye},n7=function(e){return Mt(e)?fe(Kc(e)):ye},r7=function(e){return function(t){return rl(e,t)?t:e===0?$t:t.slice(0,e)}},i7=function(e){return function(t){return rl(e,t)?t:e===0?$t:t.slice(-e)}};function o7(e){return function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(!e(o))break;n.push(o)}var a=n.length;return a===t.length?t:a===0?$t:n}}var Wk=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function a7(e){return function(t){var n=s$(Wk(t,e))(t),r=n[0],i=n[1];return{init:r,rest:i}}}var u7=function(e){return function(t){return e<=0||Zi(t)?t:e>=t.length?$t:t.slice(e,t.length)}},s7=function(e){return function(t){return e<=0||Zi(t)?t:e>=t.length?$t:t.slice(0,t.length-e)}};function c7(e){return function(t){var n=Wk(t,e);return n===0?t:n===t.length?$t:t.slice(n)}}var mv=function(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return fe(n);return ye}};function vv(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return fe(t[n]);return ye}}var jk=function(e){return function(t){for(var n=0;n<t.length;n++){var r=e(t[n]);if(gt(r))return r}return ye}};function Lk(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return fe(t[n]);return ye}}var Dk=function(e){return function(t){for(var n=t.length-1;n>=0;n--){var r=e(t[n]);if(gt(r))return r}return ye}},Bk=function(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return fe(n);return ye}},l7=function(e,t){return function(n){return e<0||e>n.length?ye:fe(km(e,t,n))}},f7=function(e,t){return Uk(e,function(){return t})},d7=function(e){return function(t){return rl(e,t)?ye:fe(vA(e,t))}},Uk=function(e,t){return function(n){return rl(e,n)?ye:fe(Ev(e,t(n[e]),n))}},p7=function(e){return e.length<=1?e:e.slice().reverse()},h7=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Right"&&t.push(r.right)}return t},m7=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Left"&&t.push(r.left)}return t},v7=function(e){return function(t){return t.length<=1?t:t.slice().sort(e.compare)}},qk=function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r};function zk(e,t){return t===void 0?function(n){return zk(n,e)}:qk(e,t,function(n,r){return[n,r]})}var g7=function(e){for(var t=[],n=[],r=0;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},Kk=function(e){var t=Fm(e);return function(n){return Mt(n)?t(n):n}},y7=function(e){var t=n0(e);return function(n){return Mt(n)?t(n):n}},b7=function(e){var t=e0(e);return function(n){return Mt(n)?t(n):n}};function Wd(e){return function(t,n){if(n===void 0){var r=Wd(e);return function(a){return r(t,a)}}for(var i=function(a){return e.equals(a,t)},o=0;o<n.length;o++)if(i(n[o]))return!0;return!1}}var _7=function(e){var t=X_(e);return function(n){return Mt(n)?t(n):n}},$7=function(e){var t=rR(e);return function(n){return Mt(n)?t(n):n}},S7=function(e){var t=r0(e);return function(n){return Mt(n)?t(n):$t}},s$=function(e){return function(t){return e>=1&&Mt(t)?Nm(e)(t):Zi(t)?[t,$t]:[$t,t]}},T7=function(e){var t=pR(e);return function(n){return Mt(n)?t(n):$t}},I7=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return wk(e.apply(void 0,t))}};function C7(e,t,n){n===void 0&&(n=function(){return!0});var r=function(i,o){return Mt(o)?v(kn(o),Ld(function(a){return r(v(i,hv(a)),ci(o))})):n.apply(void 0,i)?[t.apply(void 0,i)]:$t};return r($t,e)}var Vk=function(e){return function(t){return Zi(t)?e:Zi(e)?t:t.concat(e)}},O7=Vk;function c$(e){var t=Q_(e);return function(n,r){if(r===void 0){var i=c$(e);return function(o){return i(o,n)}}return Mt(n)&&Mt(r)?t(r)(n):Mt(n)?n:r}}function l$(e){var t=Wd(e);return function(n,r){if(r===void 0){var i=l$(e);return function(o){return i(o,n)}}return n.filter(function(o){return t(o,r)})}}function f$(e){var t=Wd(e);return function(n,r){if(r===void 0){var i=f$(e);return function(o){return i(o,n)}}return n.filter(function(o){return!t(o,r)})}}var rn=function(e,t){return v(e,Tv(t))},gv=function(e,t){return v(e,nA(t))},Ga=function(e,t){return v(e,tA(t))},jd=function(e,t){return v(e,Ld(t))},yv=function(e,t){return v(e,Xi(t))},bv=function(e,t){return v(e,_$(t))},_v=function(e,t){return v(e,rA(t))},$v=function(e,t){return v(e,iA(t))},Hk=function(e,t){return v(e,$$(t))},Gk=function(e,t){return v(e,S$(t))},d$=function(e,t){return v(e,eA(t))},fs=function(e,t,n){return v(e,Cv(t,n))},il=function(e){var t=I$(e);return function(n,r){return v(n,t(r))}},ol=function(e,t,n){return v(e,C$(t,n))},p$=function(e,t,n){return v(e,Dd(t,n))},h$=function(e){var t=Iv(e);return function(n,r){return v(n,t(r))}},m$=function(e,t,n){return v(e,Ov(t,n))},Yk=function(e,t){return v(e,b$(t))},Jk=function(e,t){return v(e,oA(t))},Zk=function(e,t){return v(e,T$(t))},Sv=function(e){var t=aA(e);return function(n,r){return v(n,t(r))}},Xk=function(e){var t=O$(e);return function(n,r){return v(n,t(r))}},v$=function(e,t){return v(e,k$(t))},g$=function(e,t){return v(e,A$(t))},ds=za,al=function(){return $t},Qk=function(e){return function(t){return t.concat(e())}},eA=Qk,tA=function(e){return Ld(function(t){return v(e,Tv(t))})},Ld=function(e){return function(t){return v(t,Nk(function(n,r){return e(r)}))}},y$=Ld(q),Tv=function(e){return function(t){return t.map(function(n){return e(n)})}},nA=function(e){return function(t){return t.map(function(n,r){return e(r,n)})}},ul=function(e){for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];o._tag==="Left"?t.push(o.left):n.push(o.right)}return Ee(t,n)},Xi=function(e){return function(t){return t.filter(e)}},b$=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);gt(i)&&n.push(i.value)}return n}},_$=function(e){return b$(function(t,n){return e(n)})},sl=_$(q),rA=function(e){return $$(function(t,n){return e(n)})},$$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return Ee(n,r)}},iA=function(e){return S$(function(t,n){return e(n)})},S$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=e(i,t[i]);o._tag==="Left"?n.push(o.left):r.push(o.right)}return Ee(n,r)}},oA=function(e){return function(t){return t.filter(function(n,r){return e(r,n)})}},T$=function(e){return function(t){return t.map(function(n,r){return e(t.slice(r))})}},w7=T$(q),Iv=function(e){return function(t){return function(n){return n.reduce(function(r,i,o){return e.concat(r,t(o,i))},e.empty)}}},Cv=function(e,t){return Dd(e,function(n,r,i){return t(r,i)})},I$=function(e){var t=Iv(e);return function(n){return t(function(r,i){return n(i)})}},Dd=function(e,t){return function(n){for(var r=n.length,i=e,o=0;o<r;o++)i=t(o,i,n[o]);return i}},C$=function(e,t){return Ov(e,function(n,r,i){return t(r,i)})},Ov=function(e,t){return function(n){return n.reduceRight(function(r,i,o){return t(o,i,r)},e)}},aA=function(e){var t=O$(e);return function(n){return t(function(r,i){return n(i)})}},Bd=function(e){return function(t){return fs(t,e.of(al()),function(n,r){return e.ap(e.map(n,function(i){return function(o){return v(i,hv(o))}}),r)})}},O$=function(e){return function(t){return Dd(e.of(al()),function(n,r,i){return e.ap(e.map(r,function(o){return function(a){return v(o,hv(a))}}),t(n,i))})}},E7=function(e){var t=F$(e);return function(n){return function(r){return t(r,n)}}},x7=function(e){var t=N$(e);return function(n){return function(r){return t(r,n)}}},w$=function(e,t){for(var n=[],r=e;;){var i=t(r);if(gt(i)){var o=i.value,a=o[0],u=o[1];n.push(a),r=u}else break}return n},ft="ReadonlyArray",uA=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},sA=function(){return{concat:function(e,t){return Zi(e)?t:Zi(t)?e:e.concat(t)}}},M7=function(){return{concat:sA().concat,empty:$t}},cA=function(e){return jr(function(t,n){return t.length===n.length&&t.every(function(r,i){return e.equals(r,n[i])})})},lA=function(e){return Zu(function(t,n){for(var r=t.length,i=n.length,o=Math.min(r,i),a=0;a<o;a++){var u=e.compare(t[a],n[a]);if(u!==0)return u}return pv.compare(r,i)})},fA=function(e){var t=c$(e);return{concat:function(n,r){return t(r)(n)}}},R7=function(e){return{concat:fA(e).concat,empty:$t}},k7=function(e){var t=l$(e);return{concat:function(n,r){return t(r)(n)}}},A7=function(e){var t=f$(e);return{concat:function(n,r){return t(r)(n)}}},E$={URI:ft,map:rn},F7=Ue(E$),dA={URI:ft,of:ds},N7={URI:ft,map:rn,mapWithIndex:gv},wv={URI:ft,map:rn,ap:Ga},P7=Ot(wv),W7=wt(wv),j7={URI:ft,map:rn,ap:Ga,of:ds},x$={URI:ft,map:rn,ap:Ga,chain:jd},L7={URI:ft,map:rn,ap:Ga,of:ds,chain:jd},D7=lt(x$),B7={URI:ft,unfold:w$},U7={URI:ft,map:rn,alt:d$},pA={URI:ft,zero:al},q7=nl(pA,dA),z7={URI:ft,map:rn,ap:Ga,of:ds,alt:d$,zero:al},K7={URI:ft,map:rn,extend:Zk},M$={URI:ft,compact:sl,separate:ul},V7={URI:ft,map:rn,compact:sl,separate:ul,filter:yv,filterMap:bv,partition:_v,partitionMap:$v},H7={URI:ft,map:rn,mapWithIndex:gv,compact:sl,separate:ul,filter:yv,filterMap:bv,partition:_v,partitionMap:$v,partitionMapWithIndex:Gk,partitionWithIndex:Hk,filterMapWithIndex:Yk,filterWithIndex:Jk},G7={URI:ft,reduce:fs,foldMap:il,reduceRight:ol},Y7={URI:ft,reduce:fs,foldMap:il,reduceRight:ol,reduceWithIndex:p$,foldMapWithIndex:h$,reduceRightWithIndex:m$},R$={URI:ft,map:rn,reduce:fs,foldMap:il,reduceRight:ol,traverse:Sv,sequence:Bd},J7={URI:ft,map:rn,mapWithIndex:gv,reduce:fs,foldMap:il,reduceRight:ol,reduceWithIndex:p$,foldMapWithIndex:h$,reduceRightWithIndex:m$,traverse:Sv,sequence:Bd,traverseWithIndex:Xk},k$=function(e){return function(t){for(var n=zY([],e(t),!0),r=[];n.length>0;){var i=n.shift();qt(i)?n.unshift.apply(n,e(i.left)):r.push(i.right)}return r}},Z7={URI:ft,map:rn,ap:Ga,chain:jd,chainRec:v$},A$=function(e){return function(t){var n=e(t),r=[],i=[];function o(c){qt(c)?e(c.left).forEach(function(l){return r.push(l)}):i.push(c.right)}for(var a=0,u=n;a<u.length;a++){var s=u[a];o(s)}for(;r.length>0;)o(r.shift());return i}},X7={URI:ft,map:rn,ap:Ga,chain:jd,chainRec:g$},F$=fi(R$,M$),N$=li(R$,M$),hA={URI:ft,map:rn,compact:sl,separate:ul,filter:yv,filterMap:bv,partition:_v,partitionMap:$v,reduce:fs,foldMap:il,reduceRight:ol,traverse:Sv,sequence:Bd,wither:F$,wilt:N$},Q7=_0(hA),mA={URI:ft,fromEither:Ek},eJ=Sr(mA),tJ=km,Ev=function(e,t,n){return Mt(n)?Z_(e,t,n):n},vA=function(e,t){var n=t.slice();return n.splice(e,1),n},nJ=function(e){return e.slice()},rJ=function(e){return Zi(e)?$t:e.slice()},$t=vd;function gA(e){return function(t){return t.every(e)}}var yA=function(e){return function(t){return t.some(e)}},iJ=yA,bA=function(e){var t=b0(e);return function(n){return Mk(function(){return e.empty},t(n))}},oJ=ds(zt),aJ=Ct(E$),uJ=xt(x$),sJ=Et(wv),cJ=iR,lJ=ER,fJ=xR,dJ=Kk,pJ={URI:ft,compact:sl,separate:ul,map:rn,ap:Ga,of:ds,chain:jd,filter:yv,filterMap:bv,partition:_v,partitionMap:$v,mapWithIndex:gv,partitionMapWithIndex:Gk,partitionWithIndex:Hk,filterMapWithIndex:Yk,filterWithIndex:Jk,alt:d$,zero:al,unfold:w$,reduce:fs,foldMap:il,reduceRight:ol,traverse:Sv,sequence:Bd,reduceWithIndex:p$,foldMapWithIndex:h$,reduceRightWithIndex:m$,traverseWithIndex:Xk,extend:Zk,wither:F$,wilt:N$};const hJ=Object.freeze(Object.defineProperty({__proto__:null,Alt:U7,Alternative:z7,Applicative:j7,Apply:wv,Chain:x$,ChainRecBreadthFirst:X7,ChainRecDepthFirst:Z7,Compactable:M$,Do:oJ,Extend:K7,Filterable:V7,FilterableWithIndex:H7,Foldable:G7,FoldableWithIndex:Y7,FromEither:mA,Functor:E$,FunctorWithIndex:N7,Monad:L7,Pointed:dA,Traversable:R$,TraversableWithIndex:J7,URI:ft,Unfoldable:B7,Witherable:hA,Zero:pA,_chainRecBreadthFirst:g$,_chainRecDepthFirst:v$,alt:eA,altW:Qk,ap:tA,apFirst:P7,apS:sJ,apSecond:W7,append:hv,appendW:HY,bind:uJ,bindTo:aJ,chain:Ld,chainFirst:D7,chainRecBreadthFirst:A$,chainRecDepthFirst:k$,chainWithIndex:Nk,chop:S7,chunksOf:T7,compact:sl,comprehension:C7,concat:O7,concatW:Vk,cons:lJ,deleteAt:d7,difference:f$,dropLeft:u7,dropLeftWhile:c7,dropRight:s7,duplicate:w7,elem:Wd,empty:$t,every:gA,exists:iJ,extend:T$,filter:Xi,filterE:Q7,filterMap:_$,filterMapWithIndex:b$,filterWithIndex:oA,findFirst:vv,findFirstMap:jk,findIndex:mv,findLast:Lk,findLastIndex:Bk,findLastMap:Dk,flap:F7,flatten:y$,foldLeft:JY,foldMap:I$,foldMapWithIndex:Iv,foldRight:ZY,fromArray:rJ,fromEither:Ek,fromEitherK:eJ,fromOption:wk,fromOptionK:I7,fromPredicate:YY,getDifferenceMagma:A7,getEq:cA,getIntersectionSemigroup:k7,getMonoid:M7,getOrd:lA,getSemigroup:sA,getShow:uA,getUnionMonoid:R7,getUnionSemigroup:fA,guard:q7,head:Pk,init:n7,insertAt:l7,intercalate:bA,intersection:l$,intersperse:y7,isEmpty:Zi,isNonEmpty:Mt,isOutOfBound:rl,last:u$,lefts:m7,lookup:ls,makeBy:Ok,map:Tv,mapWithIndex:nA,match:Mk,matchLeft:kk,matchLeftW:Rk,matchRight:Fk,matchRightW:Ak,matchW:xk,modifyAt:Uk,of:ds,partition:rA,partitionMap:iA,partitionMapWithIndex:S$,partitionWithIndex:$$,prepend:KY,prependAll:Kk,prependToAll:dJ,prependW:VY,range:cJ,readonlyArray:pJ,reduce:Cv,reduceRight:C$,reduceRightWithIndex:Ov,reduceWithIndex:Dd,replicate:GY,reverse:p7,rights:h7,rotate:b7,scanLeft:XY,scanRight:QY,separate:ul,sequence:Bd,size:e7,snoc:fJ,some:yA,sort:v7,sortBy:$7,spanLeft:a7,splitAt:s$,tail:t7,takeLeft:r7,takeLeftWhile:o7,takeRight:i7,toArray:nJ,traverse:aA,traverseWithIndex:O$,unfold:w$,union:c$,uniq:_7,unsafeDeleteAt:vA,unsafeInsertAt:tJ,unsafeUpdateAt:Ev,unzip:g7,updateAt:f7,wilt:x7,wither:E7,zero:al,zip:zk,zipWith:qk},Symbol.toStringTag,{value:"Module"}));var Ya=function(e){return e.length===0},Nt=Lo,mJ=Xc,vJ=P0,xv=Rd,gJ=W0,_A=function(e,t){return e<=0?[]:ov(t)(e)},yJ=function(e,t){return _A(e,function(){return t})};function bJ(e){return function(t){return e(t)?[t]:[]}}var $A=function(e){return Ft(e)?[]:[e.value]},SA=function(e){return qt(e)?[]:[e.right]},TA=function(e,t){return function(n){return Nt(n)?t(n):e()}},_J=TA,IA=function(e,t){return function(n){return Nt(n)?t(Dr(n),hi(n)):e()}},CA=IA,$J=CA,OA=function(e,t){return function(n){return Nt(n)?t(tl(n),el(n)):e()}},wA=OA,SJ=wA,EA=function(e){return function(t){for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},TJ=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[0]=e;for(var o=0;o<r;o++)i[o+1]=t(i[o],n[o]);return i}},IJ=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[r]=e;for(var o=r-1;o>=0;o--)i[o]=t(n[o],i[o+1]);return i}},CJ=function(e){return e.length},Ud=iv,OJ=ls,wJ=Pk,EJ=u$,xJ=function(e){return Nt(e)?fe(hi(e)):ye},MJ=function(e){return Nt(e)?fe(tl(e)):ye},RJ=function(e){return function(t){return Ud(e,t)?_n(t):t.slice(0,e)}},kJ=function(e){return function(t){return Ud(e,t)?_n(t):e===0?[]:t.slice(-e)}};function AJ(e){return function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(!e(o))break;n.push(o)}return n}}var xA=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function FJ(e){return function(t){var n=FA(xA(t,e))(t),r=n[0],i=n[1];return{init:r,rest:i}}}var NJ=function(e){return function(t){return e<=0||Ya(t)?_n(t):e>=t.length?[]:t.slice(e,t.length)}},PJ=function(e){return function(t){return e<=0||Ya(t)?_n(t):e>=t.length?[]:t.slice(0,t.length-e)}};function WJ(e){return function(t){return t.slice(xA(t,e))}}var jJ=mv;function LJ(e){return vv(e)}var DJ=jk;function BJ(e){return Lk(e)}var UJ=Dk,qJ=Bk,_n=function(e){return e.slice()},zJ=function(e,t){return function(n){return e<0||e>n.length?ye:fe(cF(e,t,n))}},KJ=function(e,t){return MA(e,function(){return t})},VJ=function(e){return function(t){return Ud(e,t)?ye:fe(fF(e,t))}},MA=function(e,t){return function(n){return Ud(e,n)?ye:fe(lF(e,t(n[e]),n))}},HJ=function(e){return Ya(e)?[]:e.slice().reverse()},GJ=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Right"&&t.push(r.right)}return t},YJ=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Left"&&t.push(r.left)}return t},JJ=function(e){return function(t){return t.length<=1?_n(t):t.slice().sort(e.compare)}},RA=function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r};function kA(e,t){return t===void 0?function(n){return kA(n,e)}:RA(e,t,function(n,r){return[n,r]})}var ZJ=function(e){for(var t=[],n=[],r=0;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},AA=function(e){var t=uv(e);return function(n){return Nt(n)?t(n):[]}},XJ=function(e){var t=ik(e);return function(n){return Nt(n)?t(n):_n(n)}},QJ=function(e){var t=U0(e);return function(n){return Nt(n)?t(n):_n(n)}},P$=Wd,e8=function(e){var t=D0(e);return function(n){return Nt(n)?t(n):_n(n)}},t8=function(e){var t=YR(e);return function(n){return Nt(n)?t(n):_n(n)}},n8=function(e){var t=K0(e);return function(n){return Nt(n)?t(n):[]}},FA=function(e){return function(t){return e>=1&&Nt(t)?sv(e)(t):Ya(t)?[_n(t),[]]:[[],_n(t)]}},r8=function(e){var t=sk(e);return function(n){return Nt(n)?t(n):[]}},i8=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return $A(e.apply(void 0,t))}};function o8(e,t,n){n===void 0&&(n=function(){return!0});var r=function(i,o){return Nt(o)?v(Dr(o),zd(function(a){return r(v(i,xv(a)),hi(o))})):n.apply(void 0,i)?[t.apply(void 0,i)]:[]};return r([],e)}var NA=function(e){return function(t){return Ya(t)?_n(e):Ya(e)?_n(t):t.concat(e)}},a8=NA;function W$(e){var t=B0(e);return function(n,r){if(r===void 0){var i=W$(e);return function(o){return i(o,n)}}return Nt(n)&&Nt(r)?t(r)(n):Nt(n)?_n(n):_n(r)}}function j$(e){var t=P$(e);return function(n,r){if(r===void 0){var i=j$(e);return function(o){return i(o,n)}}return n.filter(function(o){return t(o,r)})}}function L$(e){var t=P$(e);return function(n,r){if(r===void 0){var i=L$(e);return function(o){return i(o,n)}}return n.filter(function(o){return!t(o,r)})}}var on=function(e,t){return v(e,z$(t))},Mv=function(e,t){return v(e,qA(t))},Ja=function(e,t){return v(e,UA(t))},qd=function(e,t){return v(e,zd(t))},Rv=function(e,t){return v(e,zA(t))},kv=function(e,t){return v(e,H$(t))},Av=function(e,t){return v(e,KA(t))},Fv=function(e,t){return v(e,VA(t))},PA=function(e,t){return v(e,G$(t))},WA=function(e,t){return v(e,Y$(t))},D$=function(e,t){return v(e,GA(t))},ps=function(e,t,n){return v(e,XA(t,n))},cl=function(e){var t=JA(e);return function(n,r){return v(n,t(r))}},ll=function(e,t,n){return v(e,QA(t,n))},B$=function(e,t,n){return v(e,Z$(t,n))},U$=function(e){var t=ZA(e);return function(n,r){return v(n,t(r))}},q$=function(e,t,n){return v(e,eF(t,n))},jA=function(e,t){return v(e,V$(t))},LA=function(e,t){return v(e,YA(t))},DA=function(e,t){return v(e,J$(t))},Nv=function(e){var t=Pv(e);return function(n,r){return v(n,t(r))}},BA=function(e){var t=X$(e);return function(n,r){return v(n,t(r))}},u8=v$,s8=g$,Za=Ha,fl=function(){return[]},z$=function(e){return function(t){return t.map(function(n){return e(n)})}},UA=function(e){return zd(function(t){return v(e,z$(t))})},zd=function(e){return function(t){return v(t,EA(function(n,r){return e(r)}))}},K$=zd(q),qA=function(e){return function(t){return t.map(function(n,r){return e(r,n)})}},V$=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);gt(i)&&n.push(i.value)}return n}},H$=function(e){return V$(function(t,n){return e(n)})},dl=H$(q),pl=function(e){for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];o._tag==="Left"?t.push(o.left):n.push(o.right)}return Ee(t,n)},zA=function(e){return function(t){return t.filter(e)}},KA=function(e){return G$(function(t,n){return e(n)})},G$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return Ee(n,r)}},VA=function(e){return Y$(function(t,n){return e(n)})},Y$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=e(i,t[i]);o._tag==="Left"?n.push(o.left):r.push(o.right)}return Ee(n,r)}},HA=function(e){return function(t){return t.concat(e())}},GA=HA,YA=function(e){return function(t){return t.filter(function(n,r){return e(r,n)})}},J$=function(e){return function(t){return t.map(function(n,r){return e(t.slice(r))})}},c8=J$(q),JA=I$,ZA=Iv,XA=Cv,Z$=Dd,QA=C$,eF=Ov,Pv=function(e){var t=X$(e);return function(n){return t(function(r,i){return n(i)})}},Kd=function(e){return function(t){return ps(t,e.of(fl()),function(n,r){return e.ap(e.map(n,function(i){return function(o){return v(i,xv(o))}}),r)})}},X$=function(e){return function(t){return Z$(e.of(fl()),function(n,r,i){return e.ap(e.map(r,function(o){return function(a){return v(o,xv(a))}}),t(n,i))})}},l8=function(e){var t=oS(e);return function(n){return function(r){return t(r,n)}}},f8=function(e){var t=aS(e);return function(n){return function(r){return t(r,n)}}},Q$=function(e,t){for(var n=[],r=e;;){var i=t(r);if(gt(i)){var o=i.value,a=o[0],u=o[1];n.push(a),r=u}else break}return n},dt="Array",d8=uA,tF=function(){return{concat:function(e,t){return e.concat(t)}}},eS=function(){return{concat:tF().concat,empty:[]}},nF=cA,p8=lA,rF=function(e){var t=W$(e);return{concat:function(n,r){return t(r)(n)}}},h8=function(e){return{concat:rF(e).concat,empty:[]}},m8=function(e){var t=j$(e);return{concat:function(n,r){return t(r)(n)}}},v8=function(e){var t=L$(e);return{concat:function(n,r){return t(r)(n)}}},tS={URI:dt,map:on},g8=Ue(tS),iF={URI:dt,of:Za},y8={URI:dt,map:on,mapWithIndex:Mv},Wv={URI:dt,map:on,ap:Ja},b8=Ot(Wv),_8=wt(Wv),$8={URI:dt,map:on,ap:Ja,of:Za},nS={URI:dt,map:on,ap:Ja,chain:qd},S8=lt(nS),T8={URI:dt,map:on,ap:Ja,of:Za,chain:qd},I8={URI:dt,unfold:Q$},C8={URI:dt,map:on,alt:D$},oF={URI:dt,zero:fl},O8=nl(oF,iF),w8={URI:dt,map:on,ap:Ja,of:Za,alt:D$,zero:fl},E8={URI:dt,map:on,extend:DA},rS={URI:dt,compact:dl,separate:pl},x8={URI:dt,map:on,compact:dl,separate:pl,filter:Rv,filterMap:kv,partition:Av,partitionMap:Fv},M8={URI:dt,map:on,mapWithIndex:Mv,compact:dl,separate:pl,filter:Rv,filterMap:kv,partition:Av,partitionMap:Fv,partitionMapWithIndex:WA,partitionWithIndex:PA,filterMapWithIndex:jA,filterWithIndex:LA},aF={URI:dt,reduce:ps,foldMap:cl,reduceRight:ll},R8={URI:dt,reduce:ps,foldMap:cl,reduceRight:ll,reduceWithIndex:B$,foldMapWithIndex:U$,reduceRightWithIndex:q$},iS={URI:dt,map:on,reduce:ps,foldMap:cl,reduceRight:ll,traverse:Nv,sequence:Kd},k8={URI:dt,map:on,mapWithIndex:Mv,reduce:ps,foldMap:cl,reduceRight:ll,reduceWithIndex:B$,foldMapWithIndex:U$,reduceRightWithIndex:q$,traverse:Nv,sequence:Kd,traverseWithIndex:BA},oS=fi(iS,rS),aS=li(iS,rS),uF={URI:dt,map:on,compact:dl,separate:pl,filter:Rv,filterMap:kv,partition:Av,partitionMap:Fv,reduce:ps,foldMap:cl,reduceRight:ll,traverse:Nv,sequence:Kd,wither:oS,wilt:aS},A8=k$,F8={URI:dt,map:on,ap:Ja,chain:qd,chainRec:u8},N8=A$,P8={URI:dt,map:on,ap:Ja,chain:qd,chainRec:s8},W8=_0(uF),sF={URI:dt,fromEither:SA},j8=Sr(sF),cF=j0,lF=function(e,t,n){return Nt(n)?L0(e,t,n):[]},fF=function(e,t){var n=t.slice();return n.splice(e,1),n},L8=gA,dF=function(e){return function(t){return t.some(e)}},D8=dF,B8=bA,U8=Za(zt),q8=Ct(tS),z8=xt(nS),K8=Et(Wv),V8=JR,H8=[],G8=Tk,Y8=Ik,J8=AA,Z8={URI:dt,compact:dl,separate:pl,map:on,ap:Ja,of:Za,chain:qd,filter:Rv,filterMap:kv,partition:Av,partitionMap:Fv,mapWithIndex:Mv,partitionMapWithIndex:WA,partitionWithIndex:PA,filterMapWithIndex:jA,filterWithIndex:LA,alt:D$,zero:fl,unfold:Q$,reduce:ps,foldMap:cl,reduceRight:ll,traverse:Nv,sequence:Kd,reduceWithIndex:B$,foldMapWithIndex:U$,reduceRightWithIndex:q$,traverseWithIndex:BA,extend:DA,wither:oS,wilt:aS};const X8=Object.freeze(Object.defineProperty({__proto__:null,Alt:C8,Alternative:w8,Applicative:$8,Apply:Wv,Chain:nS,ChainRecBreadthFirst:P8,ChainRecDepthFirst:F8,Compactable:rS,Do:U8,Extend:E8,Filterable:x8,FilterableWithIndex:M8,Foldable:aF,FoldableWithIndex:R8,FromEither:sF,Functor:tS,FunctorWithIndex:y8,Monad:T8,Pointed:iF,Traversable:iS,TraversableWithIndex:k8,URI:dt,Unfoldable:I8,Witherable:uF,Zero:oF,alt:GA,altW:HA,ap:UA,apFirst:b8,apS:K8,apSecond:_8,append:xv,appendW:gJ,array:Z8,bind:z8,bindTo:q8,chain:zd,chainFirst:S8,chainRecBreadthFirst:N8,chainRecDepthFirst:A8,chainWithIndex:EA,chop:n8,chunksOf:r8,compact:dl,comprehension:o8,concat:a8,concatW:NA,cons:G8,copy:_n,deleteAt:VJ,difference:L$,dropLeft:NJ,dropLeftWhile:WJ,dropRight:PJ,duplicate:c8,elem:P$,empty:H8,every:L8,exists:D8,extend:J$,filter:zA,filterE:W8,filterMap:H$,filterMapWithIndex:V$,filterWithIndex:YA,findFirst:LJ,findFirstMap:DJ,findIndex:jJ,findLast:BJ,findLastIndex:qJ,findLastMap:UJ,flap:g8,flatten:K$,foldLeft:$J,foldMap:JA,foldMapWithIndex:ZA,foldRight:SJ,fromEither:SA,fromEitherK:j8,fromOption:$A,fromOptionK:i8,fromPredicate:bJ,getDifferenceMagma:v8,getEq:nF,getIntersectionSemigroup:m8,getMonoid:eS,getOrd:p8,getSemigroup:tF,getShow:d8,getUnionMonoid:h8,getUnionSemigroup:rF,guard:O8,head:wJ,init:MJ,insertAt:zJ,intercalate:B8,intersection:j$,intersperse:XJ,isEmpty:Ya,isNonEmpty:Nt,isOutOfBound:Ud,last:EJ,lefts:YJ,lookup:OJ,makeBy:_A,map:z$,mapWithIndex:qA,match:_J,matchLeft:CA,matchLeftW:IA,matchRight:wA,matchRightW:OA,matchW:TA,modifyAt:MA,of:Za,partition:KA,partitionMap:VA,partitionMapWithIndex:Y$,partitionWithIndex:G$,prepend:mJ,prependAll:AA,prependToAll:J8,prependW:vJ,range:V8,reduce:XA,reduceRight:QA,reduceRightWithIndex:eF,reduceWithIndex:Z$,replicate:yJ,reverse:HJ,rights:GJ,rotate:QJ,scanLeft:TJ,scanRight:IJ,separate:pl,sequence:Kd,size:CJ,snoc:Y8,some:dF,sort:JJ,sortBy:t8,spanLeft:FJ,splitAt:FA,tail:xJ,takeLeft:RJ,takeLeftWhile:AJ,takeRight:kJ,traverse:Pv,traverseWithIndex:X$,unfold:Q$,union:W$,uniq:e8,unsafeDeleteAt:fF,unsafeInsertAt:cF,unsafeUpdateAt:lF,unzip:ZJ,updateAt:KJ,wilt:f8,wither:l8,zero:fl,zip:kA,zipWith:RA},Symbol.toStringTag,{value:"Module"})),Q8=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var eZ=function(e){return typeof e=="boolean"},pF=function(e,t){return function(n){return n?t():e()}},hF=pF,mF=hF,tZ=mF,vF={equals:function(e,t){return e===t}},nZ={meet:function(e,t){return e&&t},join:function(e,t){return e||t},zero:!1,one:!0,implies:function(e,t){return!e||t},not:function(e){return!e}},gF={concat:function(e,t){return e&&t}},yF={concat:function(e,t){return e||t}},rZ={concat:gF.concat,empty:!0},iZ={concat:yF.concat,empty:!1},oZ={equals:vF.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},aZ={show:function(e){return JSON.stringify(e)}};const uZ=Object.freeze(Object.defineProperty({__proto__:null,BooleanAlgebra:nZ,Eq:vF,MonoidAll:rZ,MonoidAny:iZ,Ord:oZ,SemigroupAll:gF,SemigroupAny:yF,Show:aZ,fold:tZ,foldW:hF,isBoolean:eZ,match:mF,matchW:pF},Symbol.toStringTag,{value:"Module"}));var bF=function(e){return{meet:function(t,n){return e.join(t,n)},join:function(t,n){return e.meet(t,n)},zero:e.one,one:e.zero,implies:function(t,n){return e.join(e.not(t),n)},not:e.not}},sZ={meet:function(){},join:function(){},zero:void 0,one:void 0,implies:function(){},not:function(){}},cZ=bF,lZ={meet:function(e,t){return e&&t},join:function(e,t){return e||t},zero:!1,one:!0,implies:function(e,t){return!e||t},not:function(e){return!e}},fZ=$M;const dZ=Object.freeze(Object.defineProperty({__proto__:null,booleanAlgebraBoolean:lZ,booleanAlgebraVoid:sZ,getDualBooleanAlgebra:cZ,getFunctionBooleanAlgebra:fZ,reverse:bF},Symbol.toStringTag,{value:"Module"}));var pZ=function(e){return VM(e)(e.bottom,e.top)},hZ=function(e){var t=D_(e);return{equals:t.equals,compare:t.compare,top:e.bottom,bottom:e.top}},mZ={equals:Om.equals,compare:Om.compare,top:1/0,bottom:-1/0};const vZ=Object.freeze(Object.defineProperty({__proto__:null,boundedNumber:mZ,clamp:pZ,reverse:hZ},Symbol.toStringTag,{value:"Module"}));function _F(e){return{meet:Im(e),join:Cm(e)}}const gZ=Object.freeze(Object.defineProperty({__proto__:null,getMinMaxDistributiveLattice:_F},Symbol.toStringTag,{value:"Module"}));function yZ(e){var t=_F(e);return function(n,r){return{join:t.join,meet:t.meet,zero:n,one:r}}}const bZ=Object.freeze(Object.defineProperty({__proto__:null,getMinMaxBoundedDistributiveLattice:yZ},Symbol.toStringTag,{value:"Module"})),_Z=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),$Z=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),SZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),TZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var uS=function(e,t){for(var n=t(e);n._tag==="Left";)n=t(n.left);return n.right};const IZ=Object.freeze(Object.defineProperty({__proto__:null,tailRec:uS},Symbol.toStringTag,{value:"Module"}));function sS(e,t){return function(n,r){return t.compose(e.right(r),e.left(n))}}function $F(e,t){var n=sS(e,t);return function(r,i){return t.compose(e.promap(t.id(),function(o){return o._tag==="Left"?o.left:o.right},q),n(r,i))}}function CZ(e){return sS(e,e)}function OZ(e){return $F(e,e)}const wZ=Object.freeze(Object.defineProperty({__proto__:null,fanIn:$F,fanin:OZ,split:sS,splitChoice:CZ},Symbol.toStringTag,{value:"Module"})),EZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var xZ=function(e,t){return v(e,SF(t))},SF=function(e){return function(t){return H(e,t)}},TF="Predicate",IF=function(){return{concat:function(e,t){return v(e,OF(t))}}},MZ=function(){return{concat:IF().concat,empty:IM}},CF=function(){return{concat:function(e,t){return v(e,wF(t))}}},RZ=function(){return{concat:CF().concat,empty:F_}},kZ={URI:TF,contramap:xZ},Vd=function(e){return function(t){return!e(t)}},OF=function(e){return function(t){return function(n){return t(n)||e(n)}}},wF=function(e){return function(t){return function(n){return t(n)&&e(n)}}};const AZ=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:kZ,URI:TF,and:wF,contramap:SF,getMonoidAll:RZ,getMonoidAny:MZ,getSemigroupAll:CF,getSemigroupAny:IF,not:Vd,or:OF},Symbol.toStringTag,{value:"Module"}));var nt=ye,yt=fe;function jv(e){return function(t){return e(t)?yt(t):nt}}var Lv=function(e){return e._tag==="Right"?nt:yt(e.left)},Hd=function(e){return e._tag==="Left"?nt:yt(e.right)},Tr=function(e,t){return v(e,Qi(t))},hs=function(e,t){return v(e,RF(t))},Dv=function(e,t){return v(e,Yd(t))},Bv=function(e,t,n){return v(e,AF(t,n))},Uv=function(e){var t=FF(e);return function(n,r){return v(n,t(r))}},qv=function(e,t,n){return v(e,NF(t,n))},cS=function(e){var t=qF(e);return function(n,r){return v(n,t(r))}},lS=function(e,t){return v(e,WF(t))},Gd=function(e,t){return v(e,LF(t))},fS=function(e,t){return v(e,DF(t))},EF=function(e,t){return v(e,mS(t))},dS=function(e,t){return v(e,BF(t))},pS=function(e,t){return v(e,UF(t))},Lt="Option",FZ=function(e){return{show:function(t){return je(t)?"none":"some(".concat(e.show(t.value),")")}}},xF=function(e){return{equals:function(t,n){return t===n||(je(t)?je(n):je(n)?!1:e.equals(t.value,n.value))}}},NZ=function(e){return{equals:xF(e).equals,compare:function(t,n){return t===n?0:Hv(t)?Hv(n)?e.compare(t.value,n.value):1:-1}}},hS=function(e){return{concat:function(t,n){return je(t)?n:je(n)?t:yt(e.concat(t.value,n.value))},empty:nt}},Qi=function(e){return function(t){return je(t)?nt:yt(e(t.value))}},hl={URI:Lt,map:Tr},Do=yt,MF={URI:Lt,of:Do},RF=function(e){return function(t){return je(t)||je(e)?nt:yt(t.value(e.value))}},ml={URI:Lt,map:Tr,ap:hs},kF={URI:Lt,map:Tr,ap:hs,of:Do},Yd=function(e){return function(t){return je(t)?nt:e(t.value)}},Jd={URI:Lt,map:Tr,ap:hs,chain:Dv},PZ={URI:Lt,map:Tr,ap:hs,of:Do,chain:Dv},AF=function(e,t){return function(n){return je(n)?e:t(e,n.value)}},FF=function(e){return function(t){return function(n){return je(n)?e.empty:t(n.value)}}},NF=function(e,t){return function(n){return je(n)?e:t(n.value,e)}},WZ={URI:Lt,reduce:Bv,foldMap:Uv,reduceRight:qv},PF=function(e){return function(t){return je(t)?e():t}},WF=PF,jZ={URI:Lt,map:Tr,alt:lS},zv=function(){return nt},jF={URI:Lt,zero:zv},LZ=nl(jF,MF),DZ={URI:Lt,map:Tr,ap:hs,of:Do,alt:lS,zero:zv},mS=function(e){return function(t){return je(t)?nt:yt(e(t))}},BZ={URI:Lt,map:Tr,extend:EF},vl=Yd(q),UZ=Ee(nt,nt),gl=function(e){return je(e)?UZ:Ee(Lv(e.value),Hd(e.value))},ms={URI:Lt,compact:vl,separate:gl},LF=function(e){return function(t){return je(t)?nt:e(t.value)?t:nt}},DF=function(e){return function(t){return je(t)?nt:e(t.value)}},BF=function(e){return function(t){return Ee(Gd(t,Vd(e)),Gd(t,e))}},UF=function(e){return H(Qi(e),gl)},Bo={URI:Lt,map:Tr,compact:vl,separate:gl,filter:Gd,filterMap:fS,partition:dS,partitionMap:pS},qF=function(e){return function(t){return function(n){return je(n)?e.of(nt):e.map(t(n.value),yt)}}},Kv=function(e){return function(t){return je(t)?e.of(nt):e.map(t.value,yt)}},vS={URI:Lt,map:Tr,reduce:Bv,foldMap:Uv,reduceRight:qv,traverse:cS,sequence:Kv},gS=fi(vS,ms),yS=li(vS,ms),qZ=function(e){var t=gS(e);return function(n){return function(r){return t(r,n)}}},zZ=function(e){var t=yS(e);return function(n){return function(r){return t(r,n)}}},KZ={URI:Lt,map:Tr,reduce:Bv,foldMap:Uv,reduceRight:qv,traverse:cS,sequence:Kv,compact:vl,separate:gl,filter:Gd,filterMap:fS,partition:dS,partitionMap:pS,wither:gS,wilt:yS},bS=function(){return nt},VZ={URI:Lt,map:Tr,ap:hs,of:Do,chain:Dv,throwError:bS},yl=Hd,Vv={URI:Lt,fromEither:yl},Hv=gt,je=function(e){return e._tag==="None"},_S=function(e,t){return function(n){return je(n)?e():t(n.value)}},HZ=_S,Uo=_S,qo=Uo,$S=function(e){return function(t){return je(t)?e():t.value}},SS=$S,GZ=Ue(hl),YZ=Ot(ml),JZ=wt(ml),ZZ=vl,XZ=lt(Jd),QZ=mS(q),eX=Sr(Vv),tX=Wo(Vv,Jd),nX=jo(Vv,Jd),vs=function(e){return e==null?nt:yt(e)},zF=function(e){try{return yt(e())}catch{return nt}},rX=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return zF(function(){return e.apply(void 0,t)})}},iX=function(e){return H(e,vs)},KF=function(e){return function(t){return je(t)?nt:vs(e(t.value))}},TS=Uo(CM,q),VF=Uo(N_,q);function HF(e){return function(t,n){if(n===void 0){var r=HF(e);return function(i){return r(t,i)}}return je(n)?!1:e.equals(t,n.value)}}var oX=function(e){return function(t){return je(t)?!1:e(t.value)}},aX=Do(zt),uX=Ct(hl),sX=xt(Jd),cX=Et(ml),GF=Do(tn),Gv=function(e){return function(t){var n=e(0,gr(t));if(je(n))return nt;for(var r=[n.value],i=1;i<t.length;i++){var o=e(i,t[i]);if(je(o))return nt;r.push(o.value)}return yt(r)}},IS=function(e){var t=Gv(e);return function(n){return mt(n)?t(n):GF}},lX=IS,YF=function(e){return IS(function(t,n){return e(n)})},fX=YF(q);function dX(e){return function(t){return Hv(e(t))}}var pX=KF,JF={URI:Lt,map:Tr,of:Do,ap:hs,chain:Dv,reduce:Bv,foldMap:Uv,reduceRight:qv,traverse:cS,sequence:Kv,zero:zv,alt:lS,extend:EF,compact:vl,separate:gl,filter:Gd,filterMap:fS,partition:dS,partitionMap:pS,wither:gS,wilt:yS,throwError:bS},hX=Kt(ml),mX=Lr(kF),ZF=function(){return hS(H_())},vX=function(){return hS(xm())};const gX=Object.freeze(Object.defineProperty({__proto__:null,Alt:jZ,Alternative:DZ,ApT:GF,Applicative:kF,Apply:ml,Chain:Jd,Compactable:ms,Do:aX,Extend:BZ,Filterable:Bo,Foldable:WZ,FromEither:Vv,Functor:hl,Monad:PZ,MonadThrow:VZ,Pointed:MF,Traversable:vS,URI:Lt,Witherable:KZ,Zero:jF,alt:WF,altW:PF,ap:RF,apFirst:YZ,apS:cX,apSecond:JZ,bind:sX,bindTo:uX,chain:Yd,chainEitherK:tX,chainFirst:XZ,chainFirstEitherK:nX,chainNullableK:KF,compact:vl,duplicate:QZ,elem:HF,exists:oX,extend:mS,filter:LF,filterMap:DF,flap:GZ,flatten:ZZ,fold:qo,foldMap:FF,foldW:HZ,fromEither:yl,fromEitherK:eX,fromNullable:vs,fromNullableK:iX,fromPredicate:jv,getApplyMonoid:mX,getApplySemigroup:hX,getEq:xF,getFirstMonoid:ZF,getLastMonoid:vX,getLeft:Lv,getMonoid:hS,getOrElse:SS,getOrElseW:$S,getOrd:NZ,getRefinement:dX,getRight:Hd,getShow:FZ,guard:LZ,isNone:je,isSome:Hv,map:Qi,mapNullable:pX,match:Uo,matchW:_S,none:nt,of:Do,option:JF,partition:BF,partitionMap:UF,reduce:AF,reduceRight:NF,separate:gl,sequence:Kv,sequenceArray:fX,some:yt,throwError:bS,toNullable:TS,toUndefined:VF,traverse:qF,traverseArray:YF,traverseArrayWithIndex:lX,traverseReadonlyArrayWithIndex:IS,traverseReadonlyNonEmptyArrayWithIndex:Gv,tryCatch:zF,tryCatchK:rX,wilt:zZ,wither:qZ,zero:zv},Symbol.toStringTag,{value:"Module"}));function eo(e,t){return function(n){return e.map(n,t.compact)}}function zo(e,t,n){var r=eo(e,t),i=Bc(e,n);return function(o){return Ee(r(v(o,i(Lv))),r(v(o,i(Hd))))}}function yX(e,t){var n=Uc(e,t).map;return{map:n,compact:eo(e,t),separate:zo(e,t,t)}}const bX=Object.freeze(Object.defineProperty({__proto__:null,compact:eo,getCompactableComposition:yX,separate:zo},Symbol.toStringTag,{value:"Module"}));var _X=function(e){return function(){return console.log(e)}},$X=function(e){return function(){return console.warn(e)}},SX=function(e){return function(){return console.error(e)}},TX=function(e){return function(){return console.info(e)}};const IX=Object.freeze(Object.defineProperty({__proto__:null,error:SX,info:TX,log:_X,warn:$X},Symbol.toStringTag,{value:"Module"}));var bl=Lc;function CX(e){return{show:function(t){return"make(".concat(e.show(t),")")}}}var OX=q,wX=q,EX=q,xX=q,MX=q,RX=q,kX=q,AX=q,FX=q;function XF(e){return{URI:gs,_E:void 0,map:CS,ap:function(t,n){return bl(e.concat(t,n))}}}function QF(e){var t=XF(e);return{URI:gs,_E:void 0,map:t.map,ap:t.ap,of:function(){return bl(e.empty)}}}var eN=function(e,t){return v(e,rN())},CS=function(e,t){return v(e,iN())},tN=function(e,t,n){return v(e,oN(t))},nN=function(e,t){return v(e,aN(t))},rN=function(){return Lc},iN=function(){return Lc},oN=function(e){return function(t){return bl(e(t))}},aN=function(e){return function(t){return bl(e(t))}},gs="Const",uN={URI:gs,map:CS},NX=Ue(uN),PX={URI:gs,contramap:eN},WX={URI:gs,bimap:tN,mapLeft:nN},jX={URI:gs,map:CS,contramap:eN,bimap:tN,mapLeft:nN};const LX=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:WX,Contravariant:PX,Functor:uN,URI:gs,bimap:oN,const_:jX,contramap:rN,flap:NX,getApplicative:QF,getApply:XF,getBooleanAlgebra:FX,getBounded:EX,getEq:OX,getHeytingAlgebra:AX,getMonoid:MX,getOrd:wX,getRing:kX,getSemigroup:xX,getSemiring:RX,getShow:CX,make:bl,map:iN,mapLeft:aN},Symbol.toStringTag,{value:"Module"})),DX=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var BX={equals:function(e,t){return e.valueOf()===t.valueOf()}},UX={equals:function(e,t){return e.getDate()===t.getDate()}},qX={equals:function(e,t){return e.getMonth()===t.getMonth()}},zX={equals:function(e,t){return e.getFullYear()===t.getFullYear()}},KX=v(pv,Tm(function(e){return e.valueOf()})),VX=function(){return new Date},HX=function(){return new Date().getTime()};const GX=Object.freeze(Object.defineProperty({__proto__:null,Eq:BX,Ord:KX,create:VX,eqDate:UX,eqMonth:qX,eqYear:zX,now:HX},Symbol.toStringTag,{value:"Module"}));var St=ko,Ke=qa,$n=function(e,t){return v(e,_s(t))},ys=function(e,t){return v(e,fN(t))},_l=function(e,t){return v(e,Br(t))},Zd=function(e,t,n){return v(e,pN(t,n))},Xd=function(e){return function(t,n){var r=hN(e);return v(t,r(n))}},Qd=function(e,t,n){return v(e,mN(t,n))},Yv=function(e){var t=vN(e);return function(n,r){return v(n,t(r))}},OS=function(e,t,n){return v(e,kS(t,n))},wS=function(e,t){return v(e,rp(t))},sN=function(e,t){return v(e,yN(t))},ES=function(e,t){return v(e,AS(t))},xS=function(e,t){return uS(t(e),function(n){return ue(n)?Ke(St(n.left)):ue(n.right)?St(t(n.right.left)):Ke(Ke(n.right.right))})},Tt="Either",YX=function(e,t){return{show:function(n){return ue(n)?"left(".concat(e.show(n.left),")"):"right(".concat(t.show(n.right),")")}}},JX=function(e,t){return{equals:function(n,r){return n===r||(ue(n)?ue(r)&&e.equals(n.left,r.left):FS(r)&&t.equals(n.right,r.right))}}},ep=function(e){return{concat:function(t,n){return ue(n)?t:ue(t)?n:Ke(e.concat(t.right,n.right))}}},bs=function(e){var t=St(e.empty);return{URI:Tt,_E:void 0,compact:function(n){return ue(n)?n:n.right._tag==="None"?t:Ke(n.right.value)},separate:function(n){return ue(n)?Ee(n,n):ue(n.right)?Ee(Ke(n.right.left),t):Ee(t,Ke(n.right.right))}}},$l=function(e){var t=St(e.empty),n=bs(e),r=n.compact,i=n.separate,o=function(u,s){return ue(u)||s(u.right)?u:t},a=function(u,s){return ue(u)?Ee(u,u):s(u.right)?Ee(t,Ke(u.right)):Ee(Ke(u.right),t)};return{URI:Tt,_E:void 0,map:$n,compact:r,separate:i,filter:o,filterMap:function(u,s){if(ue(u))return u;var c=s(u.right);return c._tag==="None"?t:Ke(c.value)},partition:a,partitionMap:function(u,s){if(ue(u))return Ee(u,u);var c=s(u.right);return ue(c)?Ee(Ke(c.left),t):Ee(t,Ke(c.right))}}},ZX=function(e){var t=$l(e),n=bs(e);return{URI:Tt,_E:void 0,map:$n,compact:t.compact,separate:t.separate,filter:t.filter,filterMap:t.filterMap,partition:t.partition,partitionMap:t.partitionMap,traverse:Yv,sequence:np,reduce:Zd,foldMap:Xd,reduceRight:Qd,wither:fi(RS,n),wilt:li(RS,n)}},Xa=function(e){return{URI:Tt,_E:void 0,map:$n,ap:function(t,n){return ue(t)?ue(n)?St(e.concat(t.left,n.left)):t:ue(n)?n:Ke(t.right(n.right))},of:to}},cN=function(e){return{URI:Tt,_E:void 0,map:$n,alt:function(t,n){if(FS(t))return t;var r=n();return ue(r)?St(e.concat(t.left,r.left)):r}}},_s=function(e){return function(t){return ue(t)?t:Ke(e(t.right))}},Qa={URI:Tt,map:$n},to=Ke,XX={URI:Tt,of:to},lN=function(e){return function(t){return ue(t)?t:ue(e)?e:Ke(t.right(e.right))}},fN=lN,Sl={URI:Tt,map:$n,ap:ys},dN={URI:Tt,map:$n,ap:ys,of:to},MS=function(e){return function(t){return ue(t)?t:e(t.right)}},Br=MS,tp={URI:Tt,map:$n,ap:ys,chain:_l},QX={URI:Tt,map:$n,ap:ys,of:to,chain:_l},pN=function(e,t){return function(n){return ue(n)?e:t(e,n.right)}},hN=function(e){return function(t){return function(n){return ue(n)?e.empty:t(n.right)}}},mN=function(e,t){return function(n){return ue(n)?e:t(n.right,e)}},eQ={URI:Tt,reduce:Zd,foldMap:Xd,reduceRight:Qd},vN=function(e){return function(t){return function(n){return ue(n)?e.of(St(n.left)):e.map(t(n.right),Ke)}}},np=function(e){return function(t){return ue(t)?e.of(St(t.left)):e.map(t.right,Ke)}},RS={URI:Tt,map:$n,reduce:Zd,foldMap:Xd,reduceRight:Qd,traverse:Yv,sequence:np},kS=function(e,t){return function(n){return ue(n)?St(e(n.left)):Ke(t(n.right))}},rp=function(e){return function(t){return ue(t)?St(e(t.left)):t}},tQ={URI:Tt,bimap:OS,mapLeft:wS},gN=function(e){return function(t){return ue(t)?e():t}},yN=gN,nQ={URI:Tt,map:$n,alt:sN},AS=function(e){return function(t){return ue(t)?t:Ke(e(t))}},rQ={URI:Tt,map:$n,extend:ES},iQ={URI:Tt,map:$n,ap:ys,chain:_l,chainRec:xS},Jv=St,oQ={URI:Tt,map:$n,ap:ys,of:to,chain:_l,throwError:Jv},Tl={URI:Tt,fromEither:q},aQ=Va(Tl),bN=Yi(Tl),ue=qt,FS=P_,NS=function(e,t){return function(n){return ue(n)?e(n.left):t(n.right)}},_N=NS,eu=NS,PS=eu,WS=function(e){return function(t){return ue(t)?e(t.left):t.right}},uQ=WS,sQ=Ue(Qa),$N=Ot(Sl),cQ=$N,SN=wt(Sl),lQ=SN,TN=lt(tp),fQ=TN,IN=MS(q),dQ=IN,pQ=AS(q),hQ=Ji(Tl),mQ=ss(Tl,tp),CN=cs(Tl,tp),vQ=CN,ON=function(e){return ue(e)?Ke(e.left):St(e.right)},wN=function(e){return function(t){return ue(t)?e(t.left):t}},EN=wN,jS=function(e){return function(t){return t==null?St(e):Ke(t)}},$s=function(e,t){try{return Ke(e())}catch(n){return St(t(n))}},gQ=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return $s(function(){return e.apply(void 0,n)},t)}},xN=function(e){var t=jS(e);return function(n){return H(n,t)}},yQ=function(e){var t=xN(e);return function(n){return Br(t(n))}},MN=_N(q,q);function bQ(e){return e instanceof Error?e:new Error(String(e))}function RN(e){return function(t,n){if(n===void 0){var r=RN(e);return function(i){return r(t,i)}}return ue(n)?!1:e.equals(t,n.right)}}var _Q=function(e){return function(t){return ue(t)?!1:e(t.right)}},$Q=to(zt),SQ=Ct(Qa),kN=xt(tp),TQ=kN,AN=Et(Sl),IQ=AN,FN=to(tn),ip=function(e){return function(t){var n=e(0,gr(t));if(ue(n))return n;for(var r=[n.right],i=1;i<t.length;i++){var o=e(i,t[i]);if(ue(o))return o;r.push(o.right)}return Ke(r)}},LS=function(e){var t=ip(e);return function(n){return mt(n)?t(n):FN}},CQ=LS,NN=function(e){return LS(function(t,n){return e(n)})},OQ=NN(q);function wQ(e,t){return $s(function(){return JSON.parse(e)},t)}var EQ=function(e,t){return $s(function(){var n=JSON.stringify(e);if(typeof n!="string")throw new Error("Converting unsupported structure to JSON");return n},t)},xQ={URI:Tt,map:$n,of:to,ap:ys,chain:_l,reduce:Zd,foldMap:Xd,reduceRight:Qd,traverse:Yv,sequence:np,bimap:OS,mapLeft:wS,alt:sN,extend:ES,chainRec:xS,throwError:Jv},MQ=Kt(Sl),RQ=Lr(dN),kQ=function(e,t){return Kt(Xa(e))(t)},AQ=function(e,t){return Lr(Xa(e))(t)};function FQ(e){var t=Xa(e).ap,n=cN(e).alt;return{URI:Tt,_E:void 0,map:$n,of:to,chain:_l,bimap:OS,mapLeft:wS,reduce:Zd,foldMap:Xd,reduceRight:Qd,extend:ES,traverse:Yv,sequence:np,chainRec:xS,throwError:Jv,ap:t,alt:n}}const PN=Object.freeze(Object.defineProperty({__proto__:null,Alt:nQ,ApT:FN,Applicative:dN,Apply:Sl,Bifunctor:tQ,Chain:tp,ChainRec:iQ,Do:$Q,Extend:rQ,Foldable:eQ,FromEither:Tl,Functor:Qa,Monad:QX,MonadThrow:oQ,Pointed:XX,Traversable:RS,URI:Tt,alt:yN,altW:gN,ap:fN,apFirst:$N,apFirstW:cQ,apS:AN,apSW:IQ,apSecond:SN,apSecondW:lQ,apW:lN,bimap:kS,bind:kN,bindTo:SQ,bindW:TQ,chain:Br,chainFirst:TN,chainFirstW:fQ,chainNullableK:yQ,chainOptionK:mQ,chainW:MS,duplicate:pQ,either:xQ,elem:RN,exists:_Q,extend:AS,filterOrElse:CN,filterOrElseW:vQ,flap:sQ,flatten:dQ,flattenW:IN,fold:PS,foldMap:hN,foldW:_N,fromNullable:jS,fromNullableK:xN,fromOption:bN,fromOptionK:hQ,fromPredicate:aQ,getAltValidation:cN,getApplicativeValidation:Xa,getApplyMonoid:RQ,getApplySemigroup:MQ,getCompactable:bs,getEq:JX,getFilterable:$l,getOrElse:uQ,getOrElseW:WS,getSemigroup:ep,getShow:YX,getValidation:FQ,getValidationMonoid:AQ,getValidationSemigroup:kQ,getWitherable:ZX,isLeft:ue,isRight:FS,left:St,map:_s,mapLeft:rp,match:eu,matchW:NS,of:to,orElse:EN,orElseW:wN,parseJSON:wQ,reduce:pN,reduceRight:mN,right:Ke,sequence:np,sequenceArray:OQ,stringifyJSON:EQ,swap:ON,throwError:Jv,toError:bQ,toUnion:MN,traverse:vN,traverseArray:NN,traverseArrayWithIndex:CQ,traverseReadonlyArrayWithIndex:LS,traverseReadonlyNonEmptyArrayWithIndex:ip,tryCatch:$s,tryCatchK:gQ},Symbol.toStringTag,{value:"Module"}));function Ss(e){return H(Ke,e.of)}function Il(e){return H(St,e.of)}function Cl(e){return function(t){return e.map(t,Ke)}}function Ol(e){return function(t){return e.map(t,St)}}function Zv(e){return function(t){return H(jS(t),e.of)}}function Xv(e){var t=Zv(e);return function(n){var r=t(n);return function(i){return H(i,r)}}}function DS(e){var t=Ts(e),n=Xv(e);return function(r){var i=n(r);return function(o){return t(i(o))}}}function wl(e){return Bc(e,Qa)}function El(e){return Ao(e,Sl)}function Ts(e){return function(t){return function(n){return e.chain(n,function(r){return ue(r)?e.of(r):t(r.right)})}}}function xl(e){return function(t){return function(n){return e.chain(n,function(r){return ue(r)?t():e.of(r)})}}}function Ml(e){return function(t,n){return function(r){return e.map(r,kS(t,n))}}}function Rl(e){return function(t){return function(n){return e.map(n,rp(t))}}}function op(e,t){return function(n){return function(r){return e.chain(r,eu(function(i){return e.map(n(),rp(function(o){return t.concat(i,o)}))},Ss(e)))}}}function ap(e){return function(t,n){return function(r){return e.map(r,eu(t,n))}}}function kl(e){return function(t,n){return function(r){return e.chain(r,eu(t,n))}}}function Al(e){return function(t){return function(n){return e.chain(n,eu(t,e.of))}}}function Is(e){return function(t){return function(n){return e.chain(n,function(r){return ue(r)?t(r.left):e.of(r)})}}}function up(e){var t=Is(e);return function(n){return t(function(r){return e.map(n(r),function(i){return ue(i)?i:St(r)})})}}function sp(e){return function(t){return function(n){return e.chain(n,eu(function(r){return e.map(t(r),St)},function(r){return e.of(Ke(r))}))}}}function Fl(e){return function(t){return e.map(t,ON)}}function cp(e){return function(t){return e.map(t,MN)}}function NQ(e){var t=El(e),n=wl(e),r=Ts(e),i=xl(e),o=Ml(e),a=Rl(e),u=kl(e),s=Al(e),c=Is(e);return{map:function(l,f){return v(l,n(f))},ap:function(l,f){return v(l,t(f))},of:Ss(e),chain:function(l,f){return v(l,r(f))},alt:function(l,f){return v(l,i(f))},bimap:function(l,f,d){return v(l,o(f,d))},mapLeft:function(l,f){return v(l,a(f))},fold:function(l,f,d){return v(l,u(f,d))},getOrElse:function(l,f){return v(l,s(f))},orElse:function(l,f){return v(l,c(f))},swap:Fl(e),rightM:Cl(e),leftM:Ol(e),left:Il(e)}}const PQ=Object.freeze(Object.defineProperty({__proto__:null,alt:xl,altValidation:op,ap:El,bimap:Ml,chain:Ts,chainNullableK:DS,fromNullable:Zv,fromNullableK:Xv,getEitherM:NQ,getOrElse:Al,left:Il,leftF:Ol,map:wl,mapLeft:Rl,match:ap,matchE:kl,orElse:Is,orElseFirst:up,orLeft:sp,right:Ss,rightF:Cl,swap:Fl,toUnion:cp},Symbol.toStringTag,{value:"Module"}));var WQ="Endomorphism",WN=function(){return{concat:function(e,t){return H(e,t)}}},jN=function(){return{concat:WN().concat,empty:q}};const jQ=Object.freeze(Object.defineProperty({__proto__:null,URI:WQ,getMonoid:jN,getSemigroup:WN},Symbol.toStringTag,{value:"Module"})),LQ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function LN(e,t){var n=t.zero,r=function(i,o){return e.equals(o,n)?i:r(o,t.mod(i,o))};return r}function DQ(e,t){var n=t.zero,r=LN(e,t);return function(i,o){return e.equals(i,n)||e.equals(o,n)?n:t.div(t.mul(i,o),r(i,o))}}var BQ={add:function(e,t){return e+t},zero:0,mul:function(e,t){return e*t},one:1,sub:function(e,t){return e-t},degree:function(e){return 1},div:function(e,t){return e/t},mod:function(e,t){return e%t}};const UQ=Object.freeze(Object.defineProperty({__proto__:null,fieldNumber:BQ,gcd:LN,lcm:DQ},Symbol.toStringTag,{value:"Module"}));function Ko(e,t){return function(n){return function(r){return e.map(r,function(i){return t.filter(i,n)})}}}function Vo(e,t){return function(n){return function(r){return e.map(r,function(i){return t.filterMap(i,n)})}}}function tu(e,t){var n=Ko(e,t);return function(r){var i=n(Vd(r)),o=n(r);return function(a){return Ee(i(a),o(a))}}}function nu(e,t){var n=Vo(e,t);return function(r){return function(i){return Ee(v(i,n(function(o){return Lv(r(o))})),v(i,n(function(o){return Hd(r(o))})))}}}function qQ(e,t){var n=Uc(e,t).map,r=eo(e,t),i=zo(e,t,t),o=Ko(e,t),a=Vo(e,t),u=tu(e,t),s=nu(e,t);return{map:n,compact:r,separate:i,filter:function(c,l){return v(c,o(l))},filterMap:function(c,l){return v(c,a(l))},partition:function(c,l){return v(c,u(l))},partitionMap:function(c,l){return v(c,s(l))}}}const zQ=Object.freeze(Object.defineProperty({__proto__:null,filter:Ko,filterMap:Vo,getFilterableComposition:qQ,partition:tu,partitionMap:nu},Symbol.toStringTag,{value:"Module"})),KQ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function DN(e,t){return function(n,r){return function(i){return e.reduce(i,n,function(o,a){return t.reduce(a,o,r)})}}}function BN(e,t){return function(n){var r=e.foldMap(n),i=t.foldMap(n);return function(o){return function(a){return r(a,function(u){return i(u,o)})}}}}function UN(e,t){return function(n,r){return function(i){return e.reduceRight(i,n,function(o,a){return t.reduceRight(o,a,r)})}}}function VQ(e,t){return function(n,r){return function(i){return t.reduce(i,e.of(n),function(o,a){return e.chain(o,function(u){return r(u,a)})})}}}function HQ(e,t){return function(n,r){var i=function(o,a){var u=o.init,s=o.acc;return u?{init:!1,acc:a}:{init:!1,acc:e.concat(e.concat(s,n),a)}};return t.reduce(r,{init:!0,acc:e.empty},i).acc}}function qN(e){return function(t){return e.reduce(t,[],function(n,r){return n.push(r),n})}}function GQ(e,t){var n=function(i,o){return e.ap(e.map(i,Jn),o)},r=e.of(void 0);return function(i,o){return t.reduce(i,r,function(a,u){return n(a,o(u))})}}function YQ(e,t){return function(n,r,i){return t.reduce(n,e.of(r),function(o,a){return e.chain(o,function(u){return i(u,a)})})}}var JQ=qN;function BS(e,t){var n=DN(e,t),r=BN(e,t),i=UN(e,t);return{reduce:function(o,a,u){return v(o,n(a,u))},foldMap:function(o){var a=r(o);return function(u,s){return v(u,a(s))}},reduceRight:function(o,a,u){return v(o,i(a,u))}}}const ZQ=Object.freeze(Object.defineProperty({__proto__:null,foldM:YQ,foldMap:BN,getFoldableComposition:BS,intercalate:HQ,reduce:DN,reduceM:VQ,reduceRight:UN,toArray:JQ,toReadonlyArray:qN,traverse_:GQ},Symbol.toStringTag,{value:"Module"}));function zN(e,t){return function(n,r){return function(i){return e.reduceWithIndex(i,n,function(o,a,u){return t.reduceWithIndex(u,a,function(s,c,l){return r([o,s],c,l)})})}}}function KN(e,t){return function(n){var r=e.foldMapWithIndex(n),i=t.foldMapWithIndex(n);return function(o){return function(a){return r(a,function(u,s){return i(s,function(c,l){return o([u,c],l)})})}}}}function VN(e,t){return function(n,r){return function(i){return e.reduceRightWithIndex(i,n,function(o,a,u){return t.reduceRightWithIndex(a,u,function(s,c,l){return r([o,s],c,l)})})}}}function XQ(e,t){var n=BS(e,t),r=zN(e,t),i=KN(e,t),o=VN(e,t);return{reduce:n.reduce,foldMap:n.foldMap,reduceRight:n.reduceRight,reduceWithIndex:function(a,u,s){return v(a,r(u,s))},foldMapWithIndex:function(a){var u=i(a);return function(s,c){return v(s,u(c))}},reduceRightWithIndex:function(a,u,s){return v(a,o(u,s))}}}const QQ=Object.freeze(Object.defineProperty({__proto__:null,foldMapWithIndex:KN,getFoldableWithIndexComposition:XQ,reduceRightWithIndex:VN,reduceWithIndex:zN},Symbol.toStringTag,{value:"Module"}));function no(e){return function(t){return H(t,e.fromIO)}}function Ho(e,t){return function(n){var r=H(n,e.fromIO);return function(i){return t.chain(i,r)}}}function Go(e,t){var n=lt(t);return function(r){return n(H(r,e.fromIO))}}const eee=Object.freeze(Object.defineProperty({__proto__:null,chainFirstIOK:Go,chainIOK:Ho,fromIOK:no},Symbol.toStringTag,{value:"Module"}));var HN=function(){return q},tee=q,lp=function(e){return function(t){return function(n){return t(e(n))}}},fp=function(e){return function(t){return e(t)(t)}},nee=fp,Yo=function(e,t){return v(e,Cs(t))},dp=function(e,t){return v(e,JN(t))},US=function(e,t){return v(e,ZN(t))},GN=function(e,t){return v(e,QN(t))},Qv=function(e,t,n){return v(e,eP(t,n))},Cs=function(e){return function(t){return function(n){return e(t(n))}}},YN=function(e){return function(t){return function(n){return t(n)(e(n))}}},JN=YN,ro=Jn,qS=function(e){return function(t){return function(n){return e(t(n))(n)}}},ZN=qS,XN=qS(q),ree=XN,QN=function(e){return function(t){return H(e,t)}},eP=function(e,t){return function(n){return function(r){return t(n(e(r)))}}},zS=function(){return q},KS=function(e){return function(t){var n=t[0],r=t[1];return[e(n),r]}},VS=function(e){return function(t){var n=t[0],r=t[1];return[n,e(r)]}},HS=function(e){return PS(function(t){return ko(e(t))},Ke)},GS=function(e){return PS(St,function(t){return qa(e(t))})},Ur="Reader",an={URI:Ur,map:Yo},iee=Ue(an),YS={URI:Ur,of:ro},Jo={URI:Ur,map:Yo,ap:dp},tP=Ot(Jo),oee=tP,nP=wt(Jo),aee=nP,rP={URI:Ur,map:Yo,ap:dp,of:ro},JS={URI:Ur,map:Yo,ap:dp,chain:US},Zo={URI:Ur,map:Yo,of:ro,ap:dp,chain:US},iP=lt(JS),uee=iP,see={URI:Ur,map:Yo,promap:Qv},cee={URI:Ur,compose:GN,id:zS},lee={URI:Ur,map:Yo,promap:Qv,first:KS,second:VS},fee={URI:Ur,map:Yo,promap:Qv,left:HS,right:GS},dee=Ct(an),oP=xt(JS),pee=oP,hee=ro(zt),aP=Et(Jo),mee=aP,uP=ro(tn),Os=function(e){return function(t){return function(n){for(var r=[e(0,gr(t))(n)],i=1;i<t.length;i++)r.push(e(i,t[i])(n));return r}}},ZS=function(e){var t=Os(e);return function(n){return mt(n)?t(n):uP}},vee=ZS,sP=function(e){return ZS(function(t,n){return e(n)})},gee=sP(q),yee={URI:Ur,map:Yo,of:ro,ap:dp,chain:US,promap:Qv,compose:GN,id:zS,first:KS,second:VS,left:HS,right:GS},bee=Kt(Jo),_ee=Lr(rP);const $ee=Object.freeze(Object.defineProperty({__proto__:null,ApT:uP,Applicative:rP,Apply:Jo,Category:cee,Chain:JS,Choice:fee,Do:hee,Functor:an,Monad:Zo,Pointed:YS,Profunctor:see,Strong:lee,URI:Ur,ap:JN,apFirst:tP,apFirstW:oee,apS:aP,apSW:mee,apSecond:nP,apSecondW:aee,apW:YN,ask:HN,asks:tee,asksReader:nee,asksReaderW:fp,bind:oP,bindTo:dee,bindW:pee,chain:ZN,chainFirst:iP,chainFirstW:uee,chainW:qS,compose:QN,first:KS,flap:iee,flatten:ree,flattenW:XN,getMonoid:_ee,getSemigroup:bee,id:zS,left:HS,local:lp,map:Cs,of:ro,promap:eP,reader:yee,right:GS,second:VS,sequenceArray:gee,traverseArray:sP,traverseArrayWithIndex:vee,traverseReadonlyArrayWithIndex:ZS,traverseReadonlyNonEmptyArrayWithIndex:Os},Symbol.toStringTag,{value:"Module"}));function pp(e){return function(){return e.fromReader(HN())}}function hp(e){return e.fromReader}function ws(e){return function(t){return H(t,e.fromReader)}}function mp(e,t){var n=ws(e);return function(r){return function(i){return t.chain(i,n(r))}}}function vp(e,t){return H(ws(e),lt(t))}const See=Object.freeze(Object.defineProperty({__proto__:null,ask:pp,asks:hp,chainFirstReaderK:vp,chainReaderK:mp,fromReaderK:ws},Symbol.toStringTag,{value:"Module"}));var cP=function(){return function(e){return[e,e]}},lP=function(e){return function(){return[void 0,e]}},fP=function(e){return function(t){return[void 0,e(t)]}},dP=function(e){return function(t){return[e(t),t]}},gp=function(e,t){return v(e,hP(t))},eg=function(e,t){return v(e,mP(t))},pP=function(e,t){return v(e,XS(t))},hP=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return[e(i),o]}}},mP=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1],a=e(o),u=a[0],s=a[1];return[i(u),s]}}},yp=function(e){return function(t){return[e,t]}},XS=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return e(i)(o)}}},Tee=XS(q),ru="State",QS={URI:ru,map:gp},Iee=Ue(QS),Cee={URI:ru,of:yp},tg={URI:ru,map:gp,ap:eg},Oee=Ot(tg),wee=wt(tg),Eee={URI:ru,map:gp,ap:eg,of:yp},eT={URI:ru,map:gp,ap:eg,chain:pP},vP={URI:ru,map:gp,ap:eg,of:yp,chain:pP},xee=lt(eT),Mee={URI:ru,fromState:q},Ree=function(e){return function(t){return t(e)[0]}},kee=function(e){return function(t){return t(e)[1]}},Aee=Ct(QS),Fee=xt(eT),Nee=Et(tg),gP=function(e){return function(t){return function(n){for(var r=e(0,gr(t))(n),i=r[0],o=r[1],a=[i],u=o,s=1;s<t.length;s++){var c=e(s,t[s])(u),l=c[0],f=c[1];a.push(l),u=f}return[a,u]}}},tT=function(e){var t=gP(e);return function(n){return mt(n)?t(n):yp(tn)}},Pee=tT,yP=function(e){return tT(function(t,n){return e(n)})},Wee=yP(q),jee=function(e,t){return e(t)[0]},Lee=function(e,t){return e(t)[1]},Dee=vP;const Bee=Object.freeze(Object.defineProperty({__proto__:null,Applicative:Eee,Apply:tg,Chain:eT,FromState:Mee,Functor:QS,Monad:vP,Pointed:Cee,URI:ru,ap:mP,apFirst:Oee,apS:Nee,apSecond:wee,bind:Fee,bindTo:Aee,chain:XS,chainFirst:xee,evalState:jee,evaluate:Ree,execState:Lee,execute:kee,flap:Iee,flatten:Tee,get:cP,gets:dP,map:hP,modify:fP,of:yp,put:lP,sequenceArray:Wee,state:Dee,traverseArray:yP,traverseArrayWithIndex:Pee,traverseReadonlyArrayWithIndex:tT,traverseReadonlyNonEmptyArrayWithIndex:gP},Symbol.toStringTag,{value:"Module"}));function bP(e){return function(){return e.fromState(cP())}}function _P(e){return function(t){return e.fromState(lP(t))}}function $P(e){return H(fP,e.fromState)}function SP(e){return H(dP,e.fromState)}function nT(e){return function(t){return H(t,e.fromState)}}function TP(e,t){var n=nT(e);return function(r){return function(i){return t.chain(i,n(r))}}}const Uee=Object.freeze(Object.defineProperty({__proto__:null,chainStateK:TP,fromStateK:nT,get:bP,gets:SP,modify:$P,put:_P},Symbol.toStringTag,{value:"Module"}));function Es(e){return function(t){return H(t,e.fromTask)}}function Nl(e,t){return function(n){var r=H(n,e.fromTask);return function(i){return t.chain(i,r)}}}function Pl(e,t){var n=lt(t);return function(r){return n(H(r,e.fromTask))}}const qee=Object.freeze(Object.defineProperty({__proto__:null,chainFirstTaskK:Pl,chainTaskK:Nl,fromTaskK:Es},Symbol.toStringTag,{value:"Module"}));function IP(e){return function(t){return H(t,e.fromThese)}}const zee=Object.freeze(Object.defineProperty({__proto__:null,fromTheseK:IP},Symbol.toStringTag,{value:"Module"}));function CP(e,t){return function(n){return function(r){return e.mapWithIndex(r,function(i,o){return t.mapWithIndex(o,function(a,u){return n([i,a],u)})})}}}function Kee(e,t){var n=Uc(e,t).map,r=CP(e,t);return{map:n,mapWithIndex:function(i,o){return v(i,r(o))}}}const Vee=Object.freeze(Object.defineProperty({__proto__:null,getFunctorWithIndexComposition:Kee,mapWithIndex:CP},Symbol.toStringTag,{value:"Module"})),Hee=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Gee=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Yee=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var io=function(e,t){return v(e,MP(t))},Wl=function(e,t){return v(e,RP(t))},ng=function(e,t){return v(e,aT(t))},rT=function(e,t,n){return v(e,kP(t,n))},iT=function(e){return function(t,n){return v(t,AP()(n))}},oT=function(e,t,n){return v(e,FP(t,n))},OP=function(e,t){return v(e,WP())},wP=function(e,t){return v(e,uT(t))},EP=function(e){var t=NP(e);return function(n,r){return v(n,t(r))}},xP=uS,MP=function(e){return function(t){return e(t)}},RP=function(e){return function(t){return t(e)}},jl=q,aT=function(e){return function(t){return e(t)}},uT=function(e){return function(t){return e(t)}},sT=q,Jee=uT(q),Zee=aT(q),kP=function(e,t){return function(n){return t(e,n)}},AP=function(){return function(e){return function(t){return e(t)}}},FP=function(e,t){return function(n){return t(n,e)}},NP=function(e){return function(t){return function(n){return e.map(t(n),q)}}},cT=function(e){return function(t){return e.map(t,q)}},PP=function(){return q},WP=PP,Ir="Identity",Xee=q,Qee=q,lT={URI:Ir,map:io},ete=Ue(lT),tte={URI:Ir,of:jl},rg={URI:Ir,map:io,ap:Wl},nte=Ot(rg),rte=wt(rg),ite={URI:Ir,map:io,ap:Wl,of:jl},fT={URI:Ir,map:io,ap:Wl,chain:ng},ote={URI:Ir,map:io,ap:Wl,of:jl,chain:ng},ate=lt(fT),ute={URI:Ir,reduce:rT,foldMap:iT,reduceRight:oT},ste={URI:Ir,map:io,reduce:rT,foldMap:iT,reduceRight:oT,traverse:EP,sequence:cT},cte={URI:Ir,map:io,alt:OP},lte={URI:Ir,map:io,extend:wP,extract:sT},fte={URI:Ir,map:io,ap:Wl,chain:ng,chainRec:xP},dte=jl(zt),pte=Ct(lT),hte=xt(fT),mte=Et(rg),vte={URI:Ir,map:io,ap:Wl,of:jl,chain:ng,reduce:rT,foldMap:iT,reduceRight:oT,traverse:EP,sequence:cT,alt:OP,extract:sT,extend:wP,chainRec:xP};const gte=Object.freeze(Object.defineProperty({__proto__:null,Alt:cte,Applicative:ite,Apply:rg,Chain:fT,ChainRec:fte,Comonad:lte,Do:dte,Foldable:ute,Functor:lT,Monad:ote,Pointed:tte,Traversable:ste,URI:Ir,alt:WP,altW:PP,ap:RP,apFirst:nte,apS:mte,apSecond:rte,bind:hte,bindTo:pte,chain:aT,chainFirst:ate,duplicate:Jee,extend:uT,extract:sT,flap:ete,flatten:Zee,foldMap:AP,getEq:Qee,getShow:Xee,identity:vte,map:MP,of:jl,reduce:kP,reduceRight:FP,sequence:cT,traverse:NP},Symbol.toStringTag,{value:"Module"})),yte=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Xo=function(e,t){return function(){return t(e())}},iu=function(e,t){return function(){return e()(t())}},Ll=function(e,t){return function(){return t(e())()}},jP=function(e,t){return function(){for(var n=t(e)();n._tag==="Left";)n=t(n.left)();return n.right}},oo=function(e){return function(t){return Xo(t,e)}},bte=function(e){return function(t){return iu(t,e)}},mi=Jn,dT=function(e){return function(t){return Ll(t,e)}},_te=dT(q),vi="IO",ot={URI:vi,map:Xo},$te=Ue(ot),ao={URI:vi,of:mi},Qo={URI:vi,map:Xo,ap:iu},Ste=Ot(Qo),Tte=wt(Qo),LP={URI:vi,map:Xo,ap:iu,of:mi},ig={URI:vi,map:Xo,ap:iu,chain:Ll},Xn={URI:vi,map:Xo,ap:iu,of:mi,chain:Ll},Ite=lt(ig),pT=q,Cte={URI:vi,map:Xo,ap:iu,of:mi,chain:Ll,fromIO:pT},Ote={URI:vi,map:Xo,ap:iu,chain:Ll,chainRec:jP},wte={URI:vi,fromIO:q},Ete=mi(zt),xte=Ct(ot),Mte=xt(ig),Rte=Et(Qo),DP=mi(tn),og=function(e){return function(t){return function(){for(var n=[e(0,gr(t))()],r=1;r<t.length;r++)n.push(e(r,t[r])());return n}}},hT=function(e){var t=og(e);return function(n){return mt(n)?t(n):DP}},kte=hT,BP=function(e){return hT(function(t,n){return e(n)})},Ate=BP(q),Fte={URI:vi,map:Xo,of:mi,ap:iu,chain:Ll,fromIO:pT,chainRec:jP},Nte=Kt(Qo),Pte=Lr(LP);const Wte=Object.freeze(Object.defineProperty({__proto__:null,ApT:DP,Applicative:LP,Apply:Qo,Chain:ig,ChainRec:Ote,Do:Ete,FromIO:wte,Functor:ot,Monad:Xn,MonadIO:Cte,Pointed:ao,URI:vi,ap:bte,apFirst:Ste,apS:Rte,apSecond:Tte,bind:Mte,bindTo:xte,chain:dT,chainFirst:Ite,flap:$te,flatten:_te,fromIO:pT,getMonoid:Pte,getSemigroup:Nte,io:Fte,map:oo,of:mi,sequenceArray:Ate,traverseArray:BP,traverseArrayWithIndex:kte,traverseReadonlyArrayWithIndex:hT,traverseReadonlyNonEmptyArrayWithIndex:og},Symbol.toStringTag,{value:"Module"}));var UP=Il(ao),qP=Ss(ao),zP=Cl(ot),jte=Ol(ot),KP=mi,bp=zP,VP=ap(ot),Lte=VP,mT=kl(Xn),Dte=mT,HP=mT,Bte=HP,GP=Al(Xn),Ute=GP,YP=function(e,t){return function(){return $s(e,t)}},qte=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return YP(function(){return e.apply(void 0,n)},t)}},zte=cp(ot),JP=Is(Xn),Kte=JP,vT=up(Xn),Vte=vT,Hte=function(e){return vT(uW(e))},Gte=sp(Xn),Yte=Fl(ot),Qn=function(e,t){return v(e,bT(t))},xs=function(e,t){return v(e,_T(t))},Jte=function(e,t){return v(e,ag(function(n){return v(t,bT(n))}))},Dl=function(e,t){return v(e,ag(t))},gT=function(e,t,n){return v(e,XP(t,n))},yT=function(e,t){return v(e,QP(t))},ZP=function(e,t){return v(e,$T(t))},bT=wl(ot),XP=Ml(ot),QP=Rl(ot),_T=El(Qo),Zte=_T,qr=qP,ag=Ts(Xn),ug=ag,eW=ug(q),Xte=eW,$T=xl(Xn),Qte=$T,sg=UP,Pt="IOEither";function tW(e){var t=Ao(Qo,Xa(e));return{URI:Pt,_E:void 0,map:Qn,ap:function(n,r){return v(n,t(r))},of:qr}}function nW(e){var t=op(Xn,e);return{URI:Pt,_E:void 0,map:Qn,alt:function(n,r){return v(n,t(r))}}}var rW=function(e){var t=bs(e);return{URI:Pt,_E:void 0,compact:eo(ot,t),separate:zo(ot,t,Qa)}};function ene(e){var t=$l(e),n=rW(e),r=Ko(ot,t),i=Vo(ot,t),o=tu(ot,t),a=nu(ot,t);return{URI:Pt,_E:void 0,map:Qn,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}var ST={URI:Pt,map:Qn},tne=Ue(ST),nne={URI:Pt,of:qr},rne={URI:Pt,bimap:gT,mapLeft:yT},_p={URI:Pt,map:Qn,ap:xs},iW=Ot(_p),ine=iW,oW=wt(_p),one=oW,TT={URI:Pt,map:Qn,ap:xs,of:qr},ane={URI:Pt,map:Qn,ap:Jte,of:qr},ea={URI:Pt,map:Qn,ap:xs,chain:Dl},une={URI:Pt,map:Qn,ap:xs,of:qr,chain:Dl},aW=lt(ea),sne=aW,cne={URI:Pt,map:Qn,alt:ZP},lne={URI:Pt,map:Qn,ap:xs,of:qr,chain:Dl,fromIO:bp},fne={URI:Pt,map:Qn,ap:xs,of:qr,chain:Dl,throwError:sg},cg={URI:Pt,fromIO:bp},uW=no(cg),dne=Ho(cg,ea),pne=Go(cg,ea),ta={URI:Pt,fromEither:KP},hne=Yi(ta),mne=Ji(ta),vne=ss(ta,ea),sW=Wo(ta,ea),gne=sW,cW=jo(ta,ea),yne=cW,bne=Va(ta),lW=cs(ta,ea),_ne=lW,$ne=Sr(ta),Sne=function(e,t,n){return fW(e,t,n)},fW=function(e,t,n){return v(e,ug(function(r){return v(t(r),dT(function(i){return v(n(r,i),ug(function(){return mi(i)}))}))}))},Tne=qr(zt),Ine=Ct(ST),dW=xt(ea),Cne=dW,pW=Et(_p),One=pW,IT=qr(tn),hW=function(e){return H(og(e),oo(ip(Zn)))},CT=function(e){var t=hW(e);return function(n){return mt(n)?t(n):IT}},mW=function(e){return function(t){return function(){var n=e(0,gr(t))();if(qt(n))return n;for(var r=[n.right],i=1;i<t.length;i++){var o=e(i,t[i])();if(qt(o))return o;r.push(o.right)}return qa(r)}}},OT=function(e){var t=mW(e);return function(n){return mt(n)?t(n):IT}},wne=CT,vW=function(e){return CT(function(t,n){return e(n)})},Ene=vW(q),xne=OT,gW=function(e){return OT(function(t,n){return e(n)})},Mne=gW(q),Rne=TT,kne={URI:Pt,bimap:gT,mapLeft:yT,map:Qn,of:qr,ap:xs,chain:Dl,alt:ZP,fromIO:bp,throwError:sg},Ane=Kt(_p),Fne=Lr(TT),Nne=function(e){return Kt(Qo)(ep(e))};function Pne(e){var t=tW(e),n=nW(e);return{URI:Pt,_E:void 0,map:Qn,ap:t.ap,of:qr,chain:Dl,bimap:gT,mapLeft:yT,alt:n.alt,fromIO:bp,throwError:sg}}const Wne=Object.freeze(Object.defineProperty({__proto__:null,Alt:cne,ApT:IT,Applicative:Rne,ApplicativePar:TT,ApplicativeSeq:ane,ApplyPar:_p,Bifunctor:rne,Chain:ea,Do:Tne,FromEither:ta,FromIO:cg,Functor:ST,Monad:une,MonadIO:lne,MonadThrow:fne,Pointed:nne,URI:Pt,alt:$T,altW:Qte,ap:_T,apFirst:iW,apFirstW:ine,apS:pW,apSW:One,apSecond:oW,apSecondW:one,apW:Zte,bimap:XP,bind:dW,bindTo:Ine,bindW:Cne,bracket:Sne,bracketW:fW,chain:ag,chainEitherK:sW,chainEitherKW:gne,chainFirst:aW,chainFirstEitherK:cW,chainFirstEitherKW:yne,chainFirstIOK:pne,chainFirstW:sne,chainIOK:dne,chainOptionK:vne,chainW:ug,filterOrElse:lW,filterOrElseW:_ne,flap:tne,flatten:Xte,flattenW:eW,fold:Dte,foldW:Bte,fromEither:KP,fromEitherK:$ne,fromIO:bp,fromIOK:uW,fromOption:hne,fromOptionK:mne,fromPredicate:bne,getAltIOValidation:nW,getApplicativeIOValidation:tW,getApplyMonoid:Fne,getApplySemigroup:Ane,getCompactable:rW,getFilterable:ene,getIOValidation:Pne,getOrElse:GP,getOrElseW:Ute,getSemigroup:Nne,ioEither:kne,left:UP,leftIO:jte,map:bT,mapLeft:QP,match:VP,matchE:mT,matchEW:HP,matchW:Lte,of:qr,orElse:JP,orElseFirst:vT,orElseFirstIOK:Hte,orElseFirstW:Vte,orElseW:Kte,orLeft:Gte,right:qP,rightIO:zP,sequenceArray:Ene,sequenceSeqArray:Mne,swap:Yte,throwError:sg,toUnion:zte,traverseArray:vW,traverseArrayWithIndex:wne,traverseReadonlyArrayWithIndex:CT,traverseReadonlyArrayWithIndexSeq:OT,traverseReadonlyNonEmptyArrayWithIndex:hW,traverseReadonlyNonEmptyArrayWithIndexSeq:mW,traverseSeqArray:gW,traverseSeqArrayWithIndex:xne,tryCatch:YP,tryCatchK:qte},Symbol.toStringTag,{value:"Module"}));function $p(e){return H(yt,e.of)}function Sp(e){return Jn(e.of(nt))}function lg(e){return function(t){return e.map(t,yt)}}function fg(e){return H(vs,e.of)}function dg(e){var t=fg(e);return function(n){return H(n,t)}}function wT(e){var t=Bl(e),n=dg(e);return function(r){return t(n(r))}}function pg(e){return function(t){return H(t,e.of)}}function ET(e){var t=Bl(e),n=pg(e);return function(r){return t(n(r))}}function xT(e){return function(t){return function(n){return e.of(jv(t)(n))}}}function MT(e){return H(yl,e.of)}function RT(e){return function(t,n){return function(r){return e.map(r,Uo(t,n))}}}function hg(e){return function(t,n){return function(r){return e.chain(r,Uo(t,n))}}}function mg(e){return function(t){return function(n){return e.chain(n,Uo(t,e.of))}}}function vg(e){return Bc(e,hl)}function gg(e){return Ao(e,ml)}function Bl(e){var t=Sp(e);return function(n){return function(r){return e.chain(r,Uo(function(){return t()},n))}}}function yg(e){var t=$p(e);return function(n){return function(r){return e.chain(r,Uo(n,t))}}}function jne(e){var t=gg(e),n=vg(e),r=Bl(e),i=yg(e),o=hg(e),a=mg(e),u=Sp(e);return{map:function(s,c){return v(s,n(c))},ap:function(s,c){return v(s,t(c))},of:$p(e),chain:function(s,c){return v(s,r(c))},alt:function(s,c){return v(s,i(c))},fold:function(s,c,l){return v(s,o(c,l))},getOrElse:function(s,c){return v(s,a(c))},fromM:lg(e),none:function(){return u()}}}const Lne=Object.freeze(Object.defineProperty({__proto__:null,alt:yg,ap:gg,chain:Bl,chainNullableK:wT,chainOptionK:ET,fromEither:MT,fromF:lg,fromNullable:fg,fromNullableK:dg,fromOptionK:pg,fromPredicate:xT,getOptionM:jne,getOrElse:mg,map:vg,match:RT,matchE:hg,some:$p,zero:Sp},Symbol.toStringTag,{value:"Module"}));var yW=$p(ao),Dne=xT(ao),Bne=mi,bW=MT(ao),kT=lg(ot),Une=oo(yl),_W=RT(ot),qne=_W,AT=hg(ig),zne=AT,Kne=AT,$W=mg(Xn),Vne=$W,Hne=oo(VF),Gne=oo(TS),Yne=fg(ao),Jne=dg(ao),Zne=wT(Xn),Xne=pg(ao),Qne=ET(Xn),SW=vg(ot),TW=gg(Qo),ou=yW,FT=Bl(Xn),ere=FT(q),NT=yg(Xn),tre=NT,bg=Sp(ao),nre=bg(),PT=eo(ot,ms),WT=zo(ot,ms,hl),IW=Ko(ot,Bo),CW=Vo(ot,Bo),OW=tu(ot,Bo),wW=nu(ot,Bo),na=function(e,t){return v(e,SW(t))},Ul=function(e,t){return v(e,TW(t))},jT=function(e,t){return v(e,FT(t))},EW=function(e,t){return v(e,NT(t))},rre=function(e,t){return v(e,IW(t))},ire=function(e,t){return v(e,CW(t))},ore=function(e,t){return v(e,OW(t))},are=function(e,t){return v(e,wW(t))},er="IOOption",LT={URI:er,map:na},ure=Ue(LT),xW={URI:er,of:ou},_g={URI:er,map:na,ap:Ul},sre=Ot(_g),cre=wt(_g),lre={URI:er,map:na,ap:Ul,of:ou},Ms={URI:er,map:na,ap:Ul,chain:jT},fre=lt(Ms),dre={URI:er,map:na,alt:EW},MW={URI:er,zero:bg},pre=nl(MW,xW),hre={URI:er,map:na,ap:Ul,of:ou,alt:EW,zero:bg},mre={URI:er,map:na,ap:Ul,of:ou,chain:jT},vre={URI:er,map:na,ap:Ul,of:ou,chain:jT,fromIO:kT},gre={URI:er,compact:PT,separate:WT},yre={URI:er,map:na,compact:PT,separate:WT,filter:rre,filterMap:ire,partition:ore,partitionMap:are},$g={URI:er,fromIO:kT},bre=no($g),_re=Ho($g,Ms),$re=Go($g,Ms),Sg={URI:er,fromEither:bW},Sre=Sr(Sg),Tre=Wo(Sg,Ms),Ire=jo(Sg,Ms),Cre=ou(zt),Ore=Ct(LT),wre=xt(Ms),Ere=Et(_g),RW=ou(tn),kW=function(e){return H(og(e),oo(Gv(Zn)))},xre=function(e){var t=kW(e);return function(n){return mt(n)?t(n):RW}};const Mre=Object.freeze(Object.defineProperty({__proto__:null,Alt:dre,Alternative:hre,ApT:RW,Applicative:lre,Apply:_g,Chain:Ms,Compactable:gre,Do:Cre,Filterable:yre,FromEither:Sg,FromIO:$g,Functor:LT,Monad:mre,MonadIO:vre,Pointed:xW,Zero:MW,alt:NT,altW:tre,ap:TW,apFirst:sre,apS:Ere,apSecond:cre,bind:wre,bindTo:Ore,chain:FT,chainEitherK:Tre,chainFirst:fre,chainFirstEitherK:Ire,chainFirstIOK:$re,chainIOK:_re,chainNullableK:Zne,chainOptionK:Qne,compact:PT,filter:IW,filterMap:CW,flap:ure,flatten:ere,fold:zne,fromEither:bW,fromEitherK:Sre,fromIO:kT,fromIOEither:Une,fromIOK:bre,fromNullable:Yne,fromNullableK:Jne,fromOption:Bne,fromOptionK:Xne,fromPredicate:Dne,getOrElse:$W,getOrElseW:Vne,guard:pre,map:SW,match:_W,matchE:AT,matchEW:Kne,matchW:qne,none:nre,of:ou,partition:OW,partitionMap:wW,separate:WT,some:yW,toNullable:Gne,toUndefined:Hne,traverseReadonlyArrayWithIndex:xre,traverseReadonlyNonEmptyArrayWithIndex:kW,zero:bg},Symbol.toStringTag,{value:"Module"}));var AW=function(){function e(t){var n=this;this.value=t,this.read=function(){return n.value},this.write=this.write.bind(this),this.modify=this.modify.bind(this)}return e.prototype.write=function(t){var n=this;return function(){n.value=t}},e.prototype.modify=function(t){var n=this;return function(){n.value=t(n.value)}},e}();function Rre(e){return function(){return new AW(e)}}const kre=Object.freeze(Object.defineProperty({__proto__:null,IORef:AW,newIORef:Rre},Symbol.toStringTag,{value:"Module"})),Are=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Fre=function(e){return $s(function(){return JSON.parse(e)},q)},Nre=function(e){return $s(function(){var t=JSON.stringify(e);if(typeof t!="string")throw new Error("Converting unsupported structure to JSON");return t},q)};const Pre=Object.freeze(Object.defineProperty({__proto__:null,parse:Fre,stringify:Nre},Symbol.toStringTag,{value:"Module"})),Wre=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var jre=function(e){return new Map(e)};function Lre(e){return new Map(e)}function FW(e,t){return{show:function(n){var r=[];return n.forEach(function(i,o){r.push("[".concat(e.show(o),", ").concat(t.show(i),"]"))}),"new Map([".concat(r.sort().join(", "),"])")}}}var NW=function(e){return e.size},uo=function(e){return e.size===0};function Tg(e){var t=Rs(e);return function(n,r){if(r===void 0){var i=Tg(e);return function(o){return i(n,o)}}return gt(t(n,r))}}function DT(e){return function(t,n){if(n===void 0){var r=DT(e);return function(u){return r(t,u)}}for(var i=n.values(),o;!(o=i.next()).done;){var a=o.value;if(e.equals(t,a))return!0}return!1}}var ql=function(e){return function(t){return Array.from(t.keys()).sort(e.compare)}},Dre=function(e){return function(t){return Array.from(t.values()).sort(e.compare)}};function PW(e){var t=ql(e);return function(n){return function(r){for(var i=[],o=t(r),a=0,u=o;a<u.length;a++){var s=u[a];i.push(n(s,r.get(s)))}return i}}}var WW=function(e){return PW(e)(function(t,n){return[t,n]})};function Bre(e,t){var n=WW(e);return function(r){var i=n(r),o=i.length;return t.unfold(0,function(a){return a<o?fe([i[a],a+1]):ye})}}var jW=function(e){var t=ra(e);return function(n,r){var i=t(n);return function(o){var a=i(o);if(Ft(a)){var u=new Map(o);return u.set(n,r),u}else if(a.value[1]!==r){var u=new Map(o);return u.set(a.value[0],r),u}return o}}},LW=function(e){var t=ra(e);return function(n){return function(r){var i=t(n,r);if(gt(i)){var o=new Map(r);return o.delete(i.value[0]),o}return r}}},Ure=function(e){var t=DW(e);return function(n,r){return t(n,function(){return r})}},DW=function(e){var t=ra(e);return function(n,r){return function(i){var o=t(n,i);if(Ft(o))return ye;var a=o.value,u=a[0],s=a[1],c=r(s);if(c===s)return fe(i);var l=new Map(i);return l.set(u,c),fe(l)}}};function qre(e){var t=Rs(e),n=LW(e);return function(r){var i=n(r);return function(o){return v(t(r,o),Qi(function(a){return[a,i(o)]}))}}}function ra(e){return function(t,n){if(n===void 0){var r=ra(e);return function(c){return r(t,c)}}for(var i=n.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];if(e.equals(u,t))return fe([u,s])}return ye}}function Rs(e){var t=ra(e);return function(n,r){if(r===void 0){var i=Rs(e);return function(o){return i(n,o)}}return v(t(n,r),Qi(function(o){o[0];var a=o[1];return a}))}}function Ig(e,t){var n=ra(e);return function(r,i){if(i===void 0){var o=Ig(e,t);return function(d){return o(d,r)}}for(var a=r.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c,i);if(Ft(f)||!e.equals(c,f.value[0])||!t.equals(l,f.value[1]))return!1}return!0}}var Cg=new Map;function BW(e,t){var n=Ig(e,t);return jr(function(r,i){return n(r,i)&&n(i,r)})}function zre(e,t){var n=ra(e);return{concat:function(r,i){if(uo(r))return i;if(uo(i))return r;for(var o=new Map(r),a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c,r);gt(f)?o.set(f.value[0],t.concat(f.value[1],l)):o.set(c,l)}return o},empty:Cg}}var Kre=function(e,t){return new Map([[e,t]])};function Vre(e,t,n){return function(r){var i=ra(e);return n.reduce(r,new Map,function(o,a){var u=a[0],s=a[1],c=i(u,o);return gt(c)?o.set(c.value[0],t.concat(c.value[1],s)):o.set(u,s),o})}}var zl=function(e,t){for(var n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];n.set(a,t(a,u))}return n},UW=function(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1],c=e(u,s);qt(c)?n.set(u,c.left):r.set(u,c.right)}return Ee(n,r)}};function qW(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];e(u,s)?r.set(u,s):n.set(u,s)}return Ee(n,r)}}var zW=function(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1],s=e(a,u);gt(s)&&n.set(a,s.value)}return n}};function KW(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];e(a,u)&&n.set(a,u)}return n}}var ia=function(e,t){return zl(e,function(n,r){return t(r)})},Tp=function(e,t){return VW(e,function(n,r){return t(r)})},Ip=function(e,t){return HW(e,function(n,r){return t(r)})},Cp=function(e,t){return GW(e,function(n,r){return t(r)})},Op=function(e,t){return YW(e,function(n,r){return t(r)})},VW=function(e,t){return v(e,KW(t))},HW=function(e,t){return v(e,zW(t))},GW=function(e,t){return v(e,qW(t))},YW=function(e,t){return v(e,UW(t))},Kl=function(e){for(var t=new Map,n=e.entries(),r;!(r=n.next()).done;){var i=r.value,o=i[0],a=i[1];gt(a)&&t.set(o,a.value)}return t},Hre=function(e){return function(t){return Tp(t,e)}},Gre=function(e){return function(t){return Ip(t,e)}},Yre=function(e){return function(t){return ia(t,e)}},Jre=function(e){return function(t){return zl(t,e)}},Zre=function(e){return function(t){return Cp(t,e)}},Xre=function(e){return function(t){return Op(t,e)}},Vl=function(e){for(var t=new Map,n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];qt(u)?t.set(a,u.left):n.set(a,u.right)}return Ee(t,n)},zr="ReadonlyMap",JW=function(e,t){var n=HT(e,t);return{concat:function(r,i){return n(i)(r)}}},Qre=function(e,t){return{concat:JW(e,t).concat,empty:Cg}},eie=function(e,t){var n=GT(e,t);return{concat:function(r,i){return n(i)(r)}}},tie=function(e){return function(){var t=YT(e);return{concat:function(n,r){return t(r)(n)}}}};function nie(){return{URI:zr,_E:void 0,map:ia,mapWithIndex:zl,compact:Kl,separate:Vl,filter:Tp,filterMap:Ip,partition:Cp,partitionMap:Op,partitionMapWithIndex:YW,partitionWithIndex:GW,filterMapWithIndex:HW,filterWithIndex:VW}}var ZW={URI:zr,map:ia},rie=Ue(ZW),iie=function(){return{URI:zr,_E:void 0,map:ia,mapWithIndex:zl}},BT={URI:zr,compact:Kl,separate:Vl},oie={URI:zr,map:ia,compact:Kl,separate:Vl,filter:Tp,filterMap:Ip,partition:Cp,partitionMap:Op},UT=function(e){var t=wg(e);return function(n,r){return t(n,function(i,o,a){return r(o,a)})}},qT=function(e){var t=Eg(e);return function(n){var r=t(n);return function(i){return r(function(o,a){return i(a)})}}},zT=function(e){var t=xg(e);return function(n,r){return t(n,function(i,o,a){return r(o,a)})}},Og=function(e){var t=UT(e),n=qT(e),r=zT(e);return{URI:zr,_E:void 0,reduce:function(i,o,a){return v(i,t(o,a))},foldMap:function(i){var o=n(i);return function(a,u){return v(a,o(u))}},reduceRight:function(i,o,a){return v(i,r(o,a))}}},wg=function(e){var t=ql(e);return function(n,r){return function(i){for(var o=n,a=0,u=t(i);a<u.length;a++){var s=u[a];o=r(s,o,i.get(s))}return o}}},Eg=function(e){var t=ql(e);return function(n){return function(r){return function(i){for(var o=n.empty,a=0,u=t(i);a<u.length;a++){var s=u[a];o=n.concat(o,r(s,i.get(s)))}return o}}}},xg=function(e){var t=ql(e);return function(n,r){return function(i){for(var o=n,a=t(i),u=a.length,s=u-1;s>=0;s--){var c=a[s];o=r(c,i.get(c),o)}return o}}},KT=function(e){var t=Og(e),n=wg(e),r=Eg(e),i=xg(e);return{URI:zr,_E:void 0,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:function(o,a,u){return v(o,n(a,u))},foldMapWithIndex:function(o){var a=r(o);return function(u,s){return v(u,a(s))}},reduceRightWithIndex:function(o,a,u){return v(o,i(a,u))}}},aie=function(e){var t=VT(e),n=Og(e);return{URI:zr,_E:void 0,map:ia,reduce:n.reduce,foldMap:n.foldMap,reduceRight:n.reduceRight,traverse:t.traverse,sequence:t.sequence}},VT=function(e){var t=KT(e),n=ql(e),r=function(a){return function(u,s){for(var c=a.of(new Map),l=n(u),f=l.length,d=function(h){var m=l[h],g=u.get(m);c=a.ap(a.map(c,function(_){return function(S){return _.set(m,S)}}),s(m,g))},p=0;p<f;p++)d(p);return c}},i=function(a){var u=r(a);return function(s,c){return u(s,function(l,f){return c(f)})}},o=function(a){var u=r(a);return function(s){return u(s,Zn)}};return{URI:zr,_E:void 0,map:ia,mapWithIndex:zl,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverse:i,sequence:o,traverseWithIndex:r}};function uie(e){var t=VT(e);return{URI:zr,_E:void 0,map:ia,compact:Kl,separate:Vl,filter:Tp,filterMap:Ip,partition:Cp,partitionMap:Op,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,traverse:t.traverse,sequence:t.sequence,mapWithIndex:zl,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverseWithIndex:t.traverseWithIndex,wilt:li(t,BT),wither:fi(t,BT)}}var HT=function(e,t){var n=Rs(e);return function(r){return function(i){if(uo(i))return r;if(uo(r))return i;for(var o=new Map,a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c)(r);gt(f)?o.set(c,t.concat(l,f.value)):o.set(c,l)}for(var d=r.entries();!(u=d.next()).done;){var p=u.value,c=p[0],l=p[1],f=n(c)(o);Ft(f)&&o.set(c,l)}return o}}},GT=function(e,t){var n=Rs(e);return function(r){return function(i){if(uo(i)||uo(r))return Cg;for(var o=new Map,a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c)(r);gt(f)&&o.set(c,t.concat(l,f.value))}return o}}},YT=function(e){var t=Tg(e);return function(n){return function(r){if(uo(r))return n;if(uo(n))return r;for(var i=new Map,o=r.entries(),a;!(a=o.next()).done;){var u=a.value,s=u[0],c=u[1];t(s)(n)||i.set(s,c)}for(var l=n.entries();!(a=l.next()).done;){var f=a.value,s=f[0],c=f[1];t(s)(r)||i.set(s,c)}return i}}},sie=jW,cie={URI:zr,map:ia,compact:Kl,separate:Vl,filter:Tp,filterMap:Ip,partition:Cp,partitionMap:Op};const lie=Object.freeze(Object.defineProperty({__proto__:null,Compactable:BT,Filterable:oie,Functor:ZW,URI:zr,collect:PW,compact:Kl,deleteAt:LW,difference:YT,elem:DT,empty:Cg,filter:Hre,filterMap:Gre,filterMapWithIndex:zW,filterWithIndex:KW,flap:rie,foldMap:qT,foldMapWithIndex:Eg,fromFoldable:Vre,fromMap:jre,getDifferenceMagma:tie,getEq:BW,getFilterableWithIndex:nie,getFoldable:Og,getFoldableWithIndex:KT,getFunctorWithIndex:iie,getIntersectionSemigroup:eie,getMonoid:zre,getShow:FW,getTraversable:aie,getTraversableWithIndex:VT,getUnionMonoid:Qre,getUnionSemigroup:JW,getWitherable:uie,insertAt:sie,intersection:GT,isEmpty:uo,isSubmap:Ig,keys:ql,lookup:Rs,lookupWithKey:ra,map:Yre,mapWithIndex:Jre,member:Tg,modifyAt:DW,partition:Zre,partitionMap:Xre,partitionMapWithIndex:UW,partitionWithIndex:qW,pop:qre,readonlyMap:cie,reduce:UT,reduceRight:zT,reduceRightWithIndex:xg,reduceWithIndex:wg,separate:Vl,singleton:Kre,size:NW,toMap:Lre,toReadonlyArray:WW,toUnfoldable:Bre,union:HT,updateAt:Ure,upsertAt:jW,values:Dre},Symbol.toStringTag,{value:"Module"}));var Hl=globalThis&&globalThis.__assign||function(){return Hl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Hl.apply(this,arguments)},fie=FW,die=NW,oa=uo,pie=Tg,hie=DT,JT=function(e){return function(t){return Array.from(t.keys()).sort(e.compare)}},mie=function(e){return function(t){return Array.from(t.values()).sort(e.compare)}};function XW(e){var t=JT(e);return function(n){return function(r){for(var i=[],o=t(r),a=0,u=o;a<u.length;a++){var s=u[a];i.push(n(s,r.get(s)))}return i}}}function QW(e){return XW(e)(function(t,n){return[t,n]})}function vie(e,t){var n=QW(e);return function(r){var i=n(r),o=i.length;return t.unfold(0,function(a){return a<o?fe([i[a],a+1]):ye})}}var ej=function(e){var t=ks(e);return function(n,r){var i=t(n);return function(o){var a=i(o);if(Ft(a)){var u=new Map(o);return u.set(n,r),u}else if(a.value[1]!==r){var u=new Map(o);return u.set(a.value[0],r),u}return o}}},tj=function(e){var t=ks(e);return function(n){return function(r){var i=t(n,r);if(gt(i)){var o=new Map(r);return o.delete(i.value[0]),o}return r}}},gie=function(e){var t=nj(e);return function(n,r){return t(n,function(){return r})}},nj=function(e){var t=ks(e);return function(n,r){return function(i){var o=t(n,i);if(Ft(o))return ye;var a=new Map(i);return a.set(o.value[0],r(o.value[1])),fe(a)}}};function yie(e){var t=rj(e),n=tj(e);return function(r){var i=n(r);return function(o){return v(t(r,o),Qi(function(a){return[a,i(o)]}))}}}function ks(e){return function(t,n){if(n===void 0){var r=ks(e);return function(c){return r(t,c)}}for(var i=n.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];if(e.equals(u,t))return fe([u,s])}return ye}}var rj=Rs,bie=Ig,_ie=BW;function $ie(e,t){var n=ks(e);return{concat:function(r,i){if(oa(r))return i;if(oa(i))return r;for(var o=new Map(r),a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c,r);gt(f)?o.set(f.value[0],t.concat(f.value[1],l)):o.set(c,l)}return o},empty:new Map}}var Sie=function(e,t){return new Map([[e,t]])};function Tie(e,t,n){return function(r){var i=ks(e);return n.reduce(r,new Map,function(o,a){var u=a[0],s=a[1],c=i(u,o);return gt(c)?o.set(c.value[0],t.concat(c.value[1],s)):o.set(u,s),o})}}var wp=function(e,t){for(var n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];n.set(a,t(a,u))}return n},ij=function(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1],c=e(u,s);qt(c)?n.set(u,c.left):r.set(u,c.right)}return Ee(n,r)}};function oj(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];e(u,s)?r.set(u,s):n.set(u,s)}return Ee(n,r)}}var aj=function(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1],s=e(a,u);gt(s)&&n.set(a,s.value)}return n}};function uj(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];e(a,u)&&n.set(a,u)}return n}}var Gl=function(e,t){return wp(e,function(n,r){return t(r)})},Mg=function(e,t){return sj(e,function(n,r){return t(r)})},Rg=function(e,t){return cj(e,function(n,r){return t(r)})},kg=function(e,t){return lj(e,function(n,r){return t(r)})},Ag=function(e,t){return fj(e,function(n,r){return t(r)})},sj=function(e,t){return v(e,uj(t))},cj=function(e,t){return v(e,aj(t))},lj=function(e,t){return v(e,oj(t))},fj=function(e,t){return v(e,ij(t))},Ep=function(e){for(var t=new Map,n=e.entries(),r;!(r=n.next()).done;){var i=r.value,o=i[0],a=i[1];gt(a)&&t.set(o,a.value)}return t},Iie=function(e){return function(t){return Mg(t,e)}},Cie=function(e){return function(t){return Rg(t,e)}},Oie=function(e){return function(t){return Gl(t,e)}},wie=function(e){return function(t){return wp(t,e)}},Eie=function(e){return function(t){return kg(t,e)}},xie=function(e){return function(t){return Ag(t,e)}},xp=function(e){for(var t=new Map,n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];qt(u)?t.set(a,u.left):n.set(a,u.right)}return Ee(t,n)},aa="Map",dj=function(e,t){var n=gj(e,t);return{concat:function(r,i){return n(i)(r)}}},Mie=function(e,t){return{concat:dj(e,t).concat,empty:new Map}},Rie=function(e,t){var n=yj(e,t);return{concat:function(r,i){return n(i)(r)}}},kie=function(e){return function(){var t=bj(e);return{concat:function(n,r){return t(r)(n)}}}};function Aie(){return{URI:aa,_E:void 0,map:Gl,mapWithIndex:wp,compact:Ep,separate:xp,filter:Mg,filterMap:Rg,partition:kg,partitionMap:Ag,partitionMapWithIndex:fj,partitionWithIndex:lj,filterMapWithIndex:cj,filterWithIndex:sj}}function Fie(e){var t=hj(e);return{URI:aa,_E:void 0,map:Gl,compact:Ep,separate:xp,filter:Mg,filterMap:Rg,partition:kg,partitionMap:Ag,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,traverse:t.traverse,sequence:t.sequence,mapWithIndex:wp,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverseWithIndex:t.traverseWithIndex,wilt:li(t,ZT),wither:fi(t,ZT)}}var Nie=UT,Pie=qT,Wie=zT,jie=function(e){return Hl(Hl({},Og(e)),{URI:aa})},Lie=wg,Die=Eg,Bie=xg,pj=function(e){return Hl(Hl({},KT(e)),{URI:aa})},hj=function(e){var t=pj(e),n=JT(e),r=function(a){return function(u,s){for(var c=a.of(new Map),l=n(u),f=l.length,d=function(h){var m=l[h],g=u.get(m);c=a.ap(a.map(c,function(_){return function(S){return _.set(m,S)}}),s(m,g))},p=0;p<f;p++)d(p);return c}},i=function(a){var u=r(a);return function(s,c){return u(s,function(l,f){return c(f)})}},o=function(a){var u=r(a);return function(s){return u(s,function(c,l){return l})}};return{URI:aa,_E:void 0,map:Gl,mapWithIndex:wp,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverse:i,sequence:o,traverseWithIndex:r}},mj={URI:aa,map:Gl},Uie=Ue(mj),ZT={URI:aa,compact:Ep,separate:xp},vj={URI:aa,map:Gl,compact:Ep,separate:xp,filter:Mg,filterMap:Rg,partition:kg,partitionMap:Ag},Fg=function(e){return new Map(e)},gj=function(e,t){var n=HT(e,t);return function(r){return function(i){return oa(i)?Fg(r):oa(r)?Fg(i):n(r)(i)}}},yj=function(e,t){var n=GT(e,t);return function(r){return function(i){return oa(i)||oa(r)?new Map:n(r)(i)}}},bj=function(e){var t=YT(e);return function(n){return function(r){return oa(r)?Fg(n):oa(n)?Fg(r):t(n)(r)}}},qie=new Map,zie=ej,Kie=vj;const Vie=Object.freeze(Object.defineProperty({__proto__:null,Compactable:ZT,Filterable:vj,Functor:mj,URI:aa,collect:XW,compact:Ep,deleteAt:tj,difference:bj,elem:hie,empty:qie,filter:Iie,filterMap:Cie,filterMapWithIndex:aj,filterWithIndex:uj,flap:Uie,foldMap:Pie,foldMapWithIndex:Die,fromFoldable:Tie,getDifferenceMagma:kie,getEq:_ie,getFilterableWithIndex:Aie,getFoldable:jie,getFoldableWithIndex:pj,getIntersectionSemigroup:Rie,getMonoid:$ie,getShow:fie,getTraversableWithIndex:hj,getUnionMonoid:Mie,getUnionSemigroup:dj,getWitherable:Fie,insertAt:zie,intersection:yj,isEmpty:oa,isSubmap:bie,keys:JT,lookup:rj,lookupWithKey:ks,map:Oie,mapWithIndex:wie,map_:Kie,member:pie,modifyAt:nj,partition:Eie,partitionMap:xie,partitionMapWithIndex:ij,partitionWithIndex:oj,pop:yie,reduce:Nie,reduceRight:Wie,reduceRightWithIndex:Bie,reduceWithIndex:Lie,separate:xp,singleton:Sie,size:die,toArray:QW,toUnfoldable:vie,union:gj,updateAt:gie,upsertAt:ej,values:mie},Symbol.toStringTag,{value:"Module"})),Hie=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Gie=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Yie=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Jie=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Zie=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var _j=function(e){return{concat:wm(e).concat,empty:e.top}},$j=function(e){return{concat:Em(e).concat,empty:e.bottom}},XT=function(e){return{concat:z_(e).concat,empty:e.empty}},Sj=function(e){var t={};for(var n in e)ct.call(e,n)&&(t[n]=e[n].empty);return{concat:K_(e).concat,empty:t}},Tj=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{concat:V_.apply(nR,e).concat,empty:e.map(function(n){return n.empty})}},Ij=function(e){return G_(e)(e.empty)},Xie={concat:JM.concat,empty:void 0},Qie=Tj,eoe=Sj,toe=XT,noe=$j,roe=_j,ioe=Ij,Cj={concat:ZM.concat,empty:!0},Oj={concat:XM.concat,empty:!1},ooe=SM,aoe=function(){return XT(jN())},uoe={concat:QM.concat,empty:""},soe={concat:eR.concat,empty:0},coe={concat:tR.concat,empty:1};const loe=Object.freeze(Object.defineProperty({__proto__:null,concatAll:Ij,fold:ioe,getDualMonoid:toe,getEndomorphismMonoid:aoe,getFunctionMonoid:ooe,getJoinMonoid:noe,getMeetMonoid:roe,getStructMonoid:eoe,getTupleMonoid:Qie,max:$j,min:_j,monoidAll:Cj,monoidAny:Oj,monoidProduct:coe,monoidString:uoe,monoidSum:soe,monoidVoid:Xie,reverse:XT,struct:Sj,tuple:Tj},Symbol.toStringTag,{value:"Module"})),foe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var wj=function(e,t,n){return function(r){return r===-1?e():r===0?t():n()}},doe=wj,Ej=function(e){return e===-1?1:e===1?-1:0},xj={equals:function(e,t){return e===t}},QT={concat:function(e,t){return e!==0?e:t}},Mj={concat:QT.concat,empty:0},poe=function(e){return e<=-1?-1:e>=1?1:0},hoe=Ej,moe=QT,voe=xj,goe=Mj;const yoe=Object.freeze(Object.defineProperty({__proto__:null,Eq:xj,Monoid:Mj,Semigroup:QT,eqOrdering:voe,invert:hoe,match:doe,matchW:wj,monoidOrdering:goe,reverse:Ej,semigroupOrdering:moe,sign:poe},Symbol.toStringTag,{value:"Module"}));var boe=function(e){return typeof e.map=="function"},_oe=function(e){return typeof e.contramap=="function"},$oe=function(e){return typeof e.mapWithIndex=="function"},Soe=function(e){return typeof e.ap=="function"},Toe=function(e){return typeof e.chain=="function"},Ioe=function(e){return typeof e.bimap=="function"},Coe=function(e){return typeof e.extend=="function"},Ooe=function(e){return typeof e.reduce=="function"},woe=function(e){return typeof e.reduceWithIndex=="function"},Eoe=function(e){return typeof e.alt=="function"},xoe=function(e){return typeof e.compact=="function"},Moe=function(e){return typeof e.filter=="function"},Roe=function(e){return typeof e.filterWithIndex=="function"},koe=function(e){return typeof e.promap=="function"},Aoe=function(e){return typeof e.compose=="function"},Foe=function(e){return typeof e.throwError=="function"};function Noe(e){var t={};if(boe(e)){var n=function(I){return function($){return e.map($,I)}};t.map=n}if(_oe(e)){var r=function(I){return function($){return e.contramap($,I)}};t.contramap=r}if($oe(e)){var i=function(I){return function($){return e.mapWithIndex($,I)}};t.mapWithIndex=i}if(Soe(e)){var o=function(I){return function($){return e.ap($,I)}},a=function(I){return function($){return e.ap(e.map($,function(R){return function(){return R}}),I)}};t.ap=o,t.apFirst=a,t.apSecond=function(I){return function($){return e.ap(e.map($,function(){return function(R){return R}}),I)}}}if(Toe(e)){var u=function(I){return function($){return e.chain($,I)}},s=function(I){return function($){return e.chain($,function(R){return e.map(I(R),function(){return R})})}},c=function(I){return e.chain(I,q)};t.chain=u,t.chainFirst=s,t.flatten=c}if(Ioe(e)){var l=function(I,$){return function(R){return e.bimap(R,I,$)}},f=function(I){return function($){return e.mapLeft($,I)}};t.bimap=l,t.mapLeft=f}if(Coe(e)){var d=function(I){return function($){return e.extend($,I)}},p=function(I){return e.extend(I,q)};t.extend=d,t.duplicate=p}if(Ooe(e)){var h=function(I,$){return function(R){return e.reduce(R,I,$)}},m=function(I){var $=e.foldMap(I);return function(R){return function(L){return $(L,R)}}},g=function(I,$){return function(R){return e.reduceRight(R,I,$)}};t.reduce=h,t.foldMap=m,t.reduceRight=g}if(woe(e)){var _=function(I,$){return function(R){return e.reduceWithIndex(R,I,$)}},S=function(I){var $=e.foldMapWithIndex(I);return function(R){return function(L){return $(L,R)}}},C=function(I,$){return function(R){return e.reduceRightWithIndex(R,I,$)}};t.reduceWithIndex=_,t.foldMapWithIndex=S,t.reduceRightWithIndex=C}if(Eoe(e)){var b=function(I){return function($){return e.alt($,I)}};t.alt=b}if(xoe(e)&&(t.compact=e.compact,t.separate=e.separate),Moe(e)){var w=function(I){return function($){return e.filter($,I)}},O=function(I){return function($){return e.filterMap($,I)}},M=function(I){return function($){return e.partition($,I)}},x=function(I){return function($){return e.partitionMap($,I)}};t.filter=w,t.filterMap=O,t.partition=M,t.partitionMap=x}if(Roe(e)){var U=function(I){return function($){return e.filterWithIndex($,I)}},B=function(I){return function($){return e.filterMapWithIndex($,I)}},P=function(I){return function($){return e.partitionWithIndex($,I)}},Z=function(I){return function($){return e.partitionMapWithIndex($,I)}};t.filterWithIndex=U,t.filterMapWithIndex=B,t.partitionWithIndex=P,t.partitionMapWithIndex=Z}if(koe(e)){var ee=function(I,$){return function(R){return e.promap(R,I,$)}};t.promap=ee}if(Aoe(e)){var J=function(I){return function($){return e.compose($,I)}};t.compose=J}if(Foe(e)){var ge=function(I){return function($){return $._tag==="None"?e.throwError(I()):e.of($.value)}},Ie=function(I){return I._tag==="Left"?e.throwError(I.left):e.of(I.right)},k=function(I,$){return function(R){return I(R)?e.of(R):e.throwError($(R))}},A=function(I,$){return function(R){return e.chain(R,function(L){return I(L)?e.of(L):e.throwError($(L))})}};t.fromOption=ge,t.fromEither=Ie,t.fromPredicate=k,t.filterOrElse=A}return t}var le=v;const Poe=Object.freeze(Object.defineProperty({__proto__:null,pipe:le,pipeable:Noe},Symbol.toStringTag,{value:"Module"})),Woe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),joe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Ng=function(){return Math.random()};function Rj(e,t){return v(Ng,oo(function(n){return Math.floor((t-e+1)*n+e)}))}function Loe(e,t){return v(Ng,oo(function(n){return(t-e)*n+e}))}var Doe=v(Ng,oo(function(e){return e<.5})),Boe=function(e){return v(Rj(0,e.length-1),oo(function(t){return e[t]}))};const Uoe=Object.freeze(Object.defineProperty({__proto__:null,random:Ng,randomBool:Doe,randomElem:Boe,randomInt:Rj,randomRange:Loe},Symbol.toStringTag,{value:"Module"}));var eI=Il(YS),kj=Ss(YS),Aj=Cl(an),qoe=Ol(an),Fj=ro,Nj=Aj,Pj=ap(an),zoe=Pj,tI=kl(Zo),Koe=tI,Wj=tI,Voe=Wj,jj=Al(Zo),Hoe=jj,Goe=cp(an),Yoe=lp,Lj=fp,Joe=Lj,Dj=Is(Zo),Zoe=Dj,Bj=up(Zo),Xoe=Bj,Qoe=sp(Zo),eae=Fl(an),Kr=function(e,t){return v(e,qj(t))},nI=function(e,t,n){return v(e,zj(t,n))},rI=function(e,t){return v(e,Kj(t))},Yl=function(e,t){return v(e,iI(t))},Mp=function(e,t){return v(e,oI(t))},Uj=function(e,t){return v(e,aI(t))},qj=wl(an),zj=Ml(an),Kj=Rl(an),iI=El(Jo),tae=iI,so=kj,oI=Ts(Zo),Vj=oI,Hj=Vj(q),nae=Hj,aI=xl(Zo),rae=aI,uI=eI,Vt="ReaderEither",Gj=function(e){var t=bs(e);return{URI:Vt,_E:void 0,compact:eo(an,t),separate:zo(an,t,Qa)}};function iae(e){var t=$l(e),n=Gj(e),r=Ko(an,t),i=Vo(an,t),o=tu(an,t),a=nu(an,t);return{URI:Vt,_E:void 0,map:Kr,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}function Yj(e){var t=Ao(Jo,Xa(e));return{URI:Vt,_E:void 0,map:Kr,ap:function(n,r){return v(n,t(r))},of:so}}function Jj(e){var t=op(Zo,e);return{URI:Vt,_E:void 0,map:Kr,alt:function(n,r){return v(n,t(r))}}}var sI={URI:Vt,map:Kr},oae=Ue(sI),aae={URI:Vt,of:so},Rp={URI:Vt,map:Kr,ap:Yl},Zj=Ot(Rp),uae=Zj,Xj=wt(Rp),sae=Xj,Qj={URI:Vt,map:Kr,ap:Yl,of:so},ua={URI:Vt,map:Kr,ap:Yl,chain:Mp},cae={URI:Vt,map:Kr,ap:Yl,of:so,chain:Mp},eL=lt(ua),lae=eL,fae={URI:Vt,bimap:nI,mapLeft:rI},dae={URI:Vt,map:Kr,alt:Uj},Jl={URI:Vt,fromReader:Nj},pae=pp(Jl),hae=hp(Jl),mae=ws(Jl),tL=mp(Jl,ua),vae=tL,nL=vp(Jl,ua),gae=nL,yae={URI:Vt,map:Kr,ap:Yl,of:so,chain:Mp,throwError:uI},sa={URI:Vt,fromEither:Fj},bae=Yi(sa),_ae=Ji(sa),$ae=ss(sa,ua),rL=Wo(sa,ua),Sae=rL,iL=jo(sa,ua),Tae=iL,Iae=Va(sa),oL=cs(sa,ua),Cae=oL,Oae=Sr(sa),wae=so(zt),Eae=Ct(sI),aL=xt(ua),xae=aL,uL=Et(Rp),Mae=uL,sL=so(tn),cL=function(e){return H(Os(e),Cs(ip(Zn)))},cI=function(e){var t=cL(e);return function(n){return mt(n)?t(n):sL}},Rae=cI,lL=function(e){return cI(function(t,n){return e(n)})},kae=lL(q),Aae={URI:Vt,bimap:nI,mapLeft:rI,map:Kr,of:so,ap:Yl,chain:Mp,alt:Uj,throwError:eI},Fae=Kt(Rp),Nae=Lr(Qj),Pae=function(e){return Kt(Jo)(ep(e))};function Wae(e){var t=Yj(e),n=Jj(e);return{URI:Vt,_E:void 0,map:Kr,ap:t.ap,of:so,chain:Mp,bimap:nI,mapLeft:rI,alt:n.alt,throwError:uI}}const jae=Object.freeze(Object.defineProperty({__proto__:null,Alt:dae,ApT:sL,Applicative:Qj,Apply:Rp,Bifunctor:fae,Chain:ua,Do:wae,FromEither:sa,FromReader:Jl,Functor:sI,Monad:cae,MonadThrow:yae,Pointed:aae,URI:Vt,alt:aI,altW:rae,ap:iI,apFirst:Zj,apFirstW:uae,apS:uL,apSW:Mae,apSecond:Xj,apSecondW:sae,apW:tae,ask:pae,asks:hae,asksReaderEither:Joe,asksReaderEitherW:Lj,bimap:zj,bind:aL,bindTo:Eae,bindW:xae,chain:oI,chainEitherK:rL,chainEitherKW:Sae,chainFirst:eL,chainFirstEitherK:iL,chainFirstEitherKW:Tae,chainFirstReaderK:nL,chainFirstReaderKW:gae,chainFirstW:lae,chainOptionK:$ae,chainReaderK:tL,chainReaderKW:vae,chainW:Vj,filterOrElse:oL,filterOrElseW:Cae,flap:oae,flatten:nae,flattenW:Hj,fold:Koe,foldW:Voe,fromEither:Fj,fromEitherK:Oae,fromOption:bae,fromOptionK:_ae,fromPredicate:Iae,fromReader:Nj,fromReaderK:mae,getAltReaderValidation:Jj,getApplicativeReaderValidation:Yj,getApplyMonoid:Nae,getApplySemigroup:Fae,getCompactable:Gj,getFilterable:iae,getOrElse:jj,getOrElseW:Hoe,getReaderValidation:Wae,getSemigroup:Pae,left:eI,leftReader:qoe,local:Yoe,map:qj,mapLeft:Kj,match:Pj,matchE:tI,matchEW:Wj,matchW:zoe,of:so,orElse:Dj,orElseFirst:Bj,orElseFirstW:Xoe,orElseW:Zoe,orLeft:Qoe,readerEither:Aae,right:kj,rightReader:Aj,sequenceArray:kae,swap:eae,throwError:uI,toUnion:Goe,traverseArray:lL,traverseArrayWithIndex:Rae,traverseReadonlyArrayWithIndex:cI,traverseReadonlyNonEmptyArrayWithIndex:cL},Symbol.toStringTag,{value:"Module"}));function lI(e){return function(t){return function(){return e.of(t)}}}function fI(e){return function(t){return function(n){return function(r){return e.map(n(r),t)}}}}function dI(e){return function(t){return function(n){return function(r){return e.ap(n(r),t(r))}}}}function pI(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){return t(i)(r)})}}}}function hI(e){return function(t){return H(t,e.of)}}function Lae(e){return function(t){return H(t,e)}}function Dae(e){var t=dI(e),n=fI(e),r=pI(e);return{map:function(i,o){return v(i,n(o))},ap:function(i,o){return v(i,t(o))},of:lI(e),chain:function(i,o){return v(i,r(o))},ask:function(){return e.of},asks:function(i){return H(i,e.of)},local:function(i,o){return function(a){return i(o(a))}},fromReader:hI(e),fromM:function(i){return function(){return i}}}}const Bae=Object.freeze(Object.defineProperty({__proto__:null,ap:dI,chain:pI,fromNaturalTransformation:Lae,fromReader:hI,getReaderM:Dae,map:fI,of:lI},Symbol.toStringTag,{value:"Module"}));var Fn=function(e){return function(){return Promise.resolve().then(e)}};function Uae(e){return function(t){return function(){return new Promise(function(n){setTimeout(function(){Promise.resolve().then(t).then(n)},e)})}}}var gi=function(e,t){return v(e,au(t))},As=function(e,t){return v(e,fL(t))},mI=function(e,t){return v(e,kp(function(n){return v(t,au(n))}))},Zl=function(e,t){return v(e,kp(t))},au=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},fL=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Sn=function(e){return function(){return Promise.resolve(e)}},kp=function(e){return function(t){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}},qae=kp(q),Nn="Task";function zae(){return{concat:function(e,t){return function(){return Promise.race([Promise.resolve().then(e),Promise.resolve().then(t)])}},empty:pL}}var Le={URI:Nn,map:gi},Kae=Ue(Le),un={URI:Nn,of:Sn},Fs={URI:Nn,map:gi,ap:As},Vae=Ot(Fs),Hae=wt(Fs),Ap={URI:Nn,map:gi,ap:As,of:Sn},Pg={URI:Nn,map:gi,ap:mI},dL={URI:Nn,map:gi,ap:mI,of:Sn},Xl={URI:Nn,map:gi,ap:As,chain:Zl},Ht={URI:Nn,map:gi,of:Sn,ap:As,chain:Zl},Gae={URI:Nn,map:gi,of:Sn,ap:As,chain:Zl,fromIO:Fn},Fp=q,Yae={URI:Nn,map:gi,of:Sn,ap:As,chain:Zl,fromIO:Fn,fromTask:Fp},Jae=lt(Xl),Wg={URI:Nn,fromIO:Fn},Zae=no(Wg),Xae=Ho(Wg,Xl),Qae=Go(Wg,Xl),eue={URI:Nn,fromIO:Fn,fromTask:Fp},pL=function(){return new Promise(function(e){})},tue=Sn(zt),nue=Ct(Le),rue=xt(Xl),iue=Et(Fs),vI=Sn(tn),Ql=function(e){return function(t){return function(){return Promise.all(t.map(function(n,r){return Promise.resolve().then(function(){return e(r,n)()})}))}}},gI=function(e){var t=Ql(e);return function(n){return mt(n)?t(n):vI}},yI=function(e){return function(t){return function(){return qc(t).reduce(function(n,r,i){return n.then(function(o){return Promise.resolve().then(e(i+1,r)).then(function(a){return o.push(a),o})})},Promise.resolve().then(e(0,gr(t))).then(hd))}}},bI=function(e){var t=yI(e);return function(n){return mt(n)?t(n):vI}},oue=gI,hL=function(e){return gI(function(t,n){return e(n)})},aue=hL(q),uue=bI,mL=function(e){return bI(function(t,n){return e(n)})},sue=mL(q),cue={URI:Nn,map:gi,of:Sn,ap:As,chain:Zl,fromIO:Fn,fromTask:Fp},lue={URI:Nn,map:gi,of:Sn,ap:mI,chain:Zl,fromIO:Fn,fromTask:Fp},fue=Kt(Pg),due=Lr(dL);const pue=Object.freeze(Object.defineProperty({__proto__:null,ApT:vI,ApplicativePar:Ap,ApplicativeSeq:dL,ApplyPar:Fs,ApplySeq:Pg,Chain:Xl,Do:tue,FromIO:Wg,FromTask:eue,Functor:Le,Monad:Ht,MonadIO:Gae,MonadTask:Yae,Pointed:un,URI:Nn,ap:fL,apFirst:Vae,apS:iue,apSecond:Hae,bind:rue,bindTo:nue,chain:kp,chainFirst:Jae,chainFirstIOK:Qae,chainIOK:Xae,delay:Uae,flap:Kae,flatten:qae,fromIO:Fn,fromIOK:Zae,fromTask:Fp,getMonoid:due,getRaceMonoid:zae,getSemigroup:fue,map:au,never:pL,of:Sn,sequenceArray:aue,sequenceSeqArray:sue,task:cue,taskSeq:lue,traverseArray:hL,traverseArrayWithIndex:oue,traverseReadonlyArrayWithIndex:gI,traverseReadonlyArrayWithIndexSeq:bI,traverseReadonlyNonEmptyArrayWithIndex:Ql,traverseReadonlyNonEmptyArrayWithIndexSeq:yI,traverseSeqArray:mL,traverseSeqArrayWithIndex:uue},Symbol.toStringTag,{value:"Module"}));var vL=hI(un),ef=ro,Ns=H(Fn,ef),hue=lp,gL=fp,mue=gL,yi=function(e,t){return v(e,$I(t))},Ps=function(e,t){return v(e,SI(t))},_I=function(e,t){return v(e,jg(function(n){return v(t,$I(n))}))},tf=function(e,t){return v(e,jg(t))},$I=fI(Le),SI=dI(Fs),vue=SI,Vr=lI(un),jg=pI(Ht),yL=jg,bL=yL(q),gue=bL,Tn="ReaderTask",sn={URI:Tn,map:yi},yue=Ue(sn),Np={URI:Tn,of:Vr},Pp={URI:Tn,map:yi,ap:Ps},bue=Ot(Pp),_ue=wt(Pp),$ue={URI:Tn,map:yi,ap:Ps,of:Vr},TI={URI:Tn,map:yi,ap:_I},_L={URI:Tn,map:yi,ap:_I,of:Vr},co={URI:Tn,map:yi,ap:Ps,chain:tf},ca={URI:Tn,map:yi,of:Vr,ap:Ps,chain:tf},Sue={URI:Tn,map:yi,of:Vr,ap:Ps,chain:tf,fromIO:Ns},Tue={URI:Tn,map:yi,of:Vr,ap:Ps,chain:tf,fromIO:Ns,fromTask:ef},$L=lt(co),Iue=$L,Lg={URI:Tn,fromIO:Ns},Cue=no(Lg),Oue=Ho(Lg,co),wue=Go(Lg,co),nf={URI:Tn,fromReader:vL},Eue=pp(nf),xue=hp(nf),Mue=ws(nf),SL=mp(nf,co),Rue=SL,TL=vp(nf,co),kue=TL,Dg={URI:Tn,fromIO:Ns,fromTask:ef},Aue=Es(Dg),Fue=Nl(Dg,co),Nue=Pl(Dg,co),Pue=Vr(zt),Wue=Ct(sn),IL=xt(co),jue=IL,CL=Et(Pp),Lue=CL,II=Vr(tn),OL=function(e){return H(Os(e),Cs(Ql(Zn)))},CI=function(e){var t=OL(e);return function(n){return mt(n)?t(n):II}},wL=function(e){return H(Os(e),Cs(yI(Zn)))},OI=function(e){var t=wL(e);return function(n){return mt(n)?t(n):II}},Due=CI,EL=function(e){return CI(function(t,n){return e(n)})},Bue=EL(q),Uue=OI,xL=function(e){return OI(function(t,n){return e(n)})},que=xL(q),zue={URI:Tn,map:yi,of:Vr,ap:Ps,chain:tf,fromIO:Ns,fromTask:ef},Kue={URI:Tn,map:yi,of:Vr,ap:_I,chain:tf,fromIO:Ns,fromTask:ef},Vue=Kt(TI),Hue=Lr(_L);function Gue(e,t){return e(t)()}const Yue=Object.freeze(Object.defineProperty({__proto__:null,ApT:II,ApplicativePar:$ue,ApplicativeSeq:_L,ApplyPar:Pp,ApplySeq:TI,Chain:co,Do:Pue,FromIO:Lg,FromReader:nf,FromTask:Dg,Functor:sn,Monad:ca,MonadIO:Sue,MonadTask:Tue,Pointed:Np,URI:Tn,ap:SI,apFirst:bue,apS:CL,apSW:Lue,apSecond:_ue,apW:vue,ask:Eue,asks:xue,asksReaderTask:mue,asksReaderTaskW:gL,bind:IL,bindTo:Wue,bindW:jue,chain:jg,chainFirst:$L,chainFirstIOK:wue,chainFirstReaderK:TL,chainFirstReaderKW:kue,chainFirstTaskK:Nue,chainFirstW:Iue,chainIOK:Oue,chainReaderK:SL,chainReaderKW:Rue,chainTaskK:Fue,chainW:yL,flap:yue,flatten:gue,flattenW:bL,fromIO:Ns,fromIOK:Cue,fromReader:vL,fromReaderK:Mue,fromTask:ef,fromTaskK:Aue,getMonoid:Hue,getSemigroup:Vue,local:hue,map:$I,of:Vr,readerTask:zue,readerTaskSeq:Kue,run:Gue,sequenceArray:Bue,sequenceSeqArray:que,traverseArray:EL,traverseArrayWithIndex:Due,traverseReadonlyArrayWithIndex:CI,traverseReadonlyArrayWithIndexSeq:OI,traverseReadonlyNonEmptyArrayWithIndex:OL,traverseReadonlyNonEmptyArrayWithIndexSeq:wL,traverseSeqArray:xL,traverseSeqArrayWithIndex:Uue},Symbol.toStringTag,{value:"Module"}));var Jue=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(f){a(f)}}function s(l){try{c(r.throw(l))}catch(f){a(f)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(e,t||[])).next())})},Zue=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},wI=Il(un),EI=Ss(un),Bg=Cl(Le),xI=Ol(Le),MI=H(Fn,Bg),ML=H(Fn,xI),uu=MI,rf=Bg,RI=Sn,kI=Fn,RL=function(e){return au(bN(e))},kL=ap(Le),Xue=kL,AI=kl(Ht),Que=AI,AL=AI,ese=AL,FL=Al(Ht),tse=FL,NL=function(e,t){return function(){return Jue(void 0,void 0,void 0,function(){var n;return Zue(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(qa)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,ko(t(n))];case 3:return[2]}})})}},nse=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return NL(function(){return e.apply(void 0,n)},t)}},rse=cp(Le),ise=Zv(un),ose=Xv(un),ase=DS(Ht),PL=Is(Ht),use=PL,Ug=up(Ht),sse=Ug,cse=function(e){return Ug(eD(e))},lse=function(e){return Ug(tD(e))},fse=sp(Ht),dse=Fl(Le),WL=function(e){var t=RL(e);return function(n){return H(n,t)}},jL=function(e){return function(t){return function(n){return v(n,Wp(WL(e)(t)))}}},pse=jL,LL=function(e){return H(e,kI)},DL=function(e){return jp(LL(e))},hse=DL,cn=function(e,t){return v(e,PI(t))},su=function(e,t){return v(e,WI(t))},FI=function(e,t){return v(e,Wp(function(n){return v(t,PI(n))}))},cu=function(e,t){return v(e,Wp(t))},qg=function(e,t,n){return v(e,BL(t,n))},zg=function(e,t){return v(e,UL(t))},NI=function(e,t){return v(e,jI(t))},PI=wl(Le),BL=Ml(Le),UL=Rl(Le),WI=El(Fs),mse=WI,Wp=Ts(Ht),jp=Wp,qL=jp(q),vse=qL,jI=xl(Ht),gse=jI,tr=EI,Lp=wI,vt="TaskEither";function LI(e,t){var n=Ao(e,Xa(t));return{URI:vt,_E:void 0,map:cn,ap:function(r,i){return v(r,n(i))},of:tr}}function zL(e){var t=op(Ht,e);return{URI:vt,_E:void 0,map:cn,alt:function(n,r){return v(n,t(r))}}}var KL=function(e){var t=bs(e);return{URI:vt,_E:void 0,compact:eo(Le,t),separate:zo(Le,t,Qa)}};function yse(e){var t=$l(e),n=KL(e),r=Ko(Le,t),i=Vo(Le,t),o=tu(Le,t),a=nu(Le,t);return{URI:vt,_E:void 0,map:cn,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}var DI={URI:vt,map:cn},bse=Ue(DI),_se={URI:vt,of:tr},Kg={URI:vt,map:cn,ap:su},VL=Ot(Kg),$se=VL,HL=wt(Kg),Sse=HL,Tse={URI:vt,map:cn,ap:su,of:tr},GL={URI:vt,map:cn,ap:FI},YL={URI:vt,map:cn,ap:FI,of:tr},bi={URI:vt,map:cn,ap:su,chain:cu},Ise={URI:vt,map:cn,ap:su,chain:cu,of:tr},Cse={URI:vt,map:cn,ap:su,chain:cu,of:tr,fromIO:uu},Ose={URI:vt,map:cn,ap:su,chain:cu,of:tr,fromIO:uu,fromTask:rf},wse={URI:vt,map:cn,ap:su,chain:cu,of:tr,throwError:Lp},JL=lt(bi),Ese=JL,xse={URI:vt,bimap:qg,mapLeft:zg},Mse={URI:vt,map:cn,alt:NI},la={URI:vt,fromEither:RI},Rse=Yi(la),kse=Ji(la),Ase=ss(la,bi),ZL=Wo(la,bi),Fse=ZL,XL=jo(la,bi),Nse=XL,Pse=Va(la),QL=cs(la,bi),Wse=QL,jse=Sr(la),Vg={URI:vt,fromIO:uu},eD=no(Vg),Lse=Ho(Vg,bi),Dse=Go(Vg,bi),Hg={URI:vt,fromIO:uu,fromTask:rf},tD=Es(Hg),Bse=Nl(Hg,bi),Use=Pl(Hg,bi);function qse(e){return function(){var t=Array.prototype.slice.call(arguments);return function(){return new Promise(function(n){var r=function(i,o){return i!=null?n(ko(i)):n(qa(o))};e.apply(null,t.concat(r))})}}}var zse=function(e,t,n){return BI(e,t,n)},BI=function(e,t,n){return v(e,jp(function(r){return v(t(r),kp(function(i){return v(n(r,i),jp(function(){return Sn(i)}))}))}))},Kse=tr(zt),Vse=Ct(DI),nD=xt(bi),Hse=nD,rD=Et(Kg),Gse=rD,UI=tr(tn),qI=function(e){return H(Ql(e),au(ip(Zn)))},zI=function(e){var t=qI(e);return function(n){return mt(n)?t(n):UI}},KI=function(e){return function(t){return function(){return qc(t).reduce(function(n,r,i){return n.then(function(o){return qt(o)?n:e(i+1,r)().then(function(a){return qt(a)?a:(o.right.push(a.right),o)})})},e(0,gr(t))().then(_s(hd)))}}},VI=function(e){var t=KI(e);return function(n){return mt(n)?t(n):UI}},Yse=zI,iD=function(e){return zI(function(t,n){return e(n)})},Jse=iD(q),Zse=VI,oD=function(e){return VI(function(t,n){return e(n)})},Xse=oD(q),Qse={URI:vt,bimap:qg,mapLeft:zg,map:cn,of:tr,ap:su,chain:cu,alt:NI,fromIO:uu,fromTask:rf,throwError:Lp},ece={URI:vt,bimap:qg,mapLeft:zg,map:cn,of:tr,ap:FI,chain:cu,alt:NI,fromIO:uu,fromTask:rf,throwError:Lp},tce=Kt(GL),nce=Lr(YL),rce=function(e){return Kt(Pg)(ep(e))};function ice(e){var t=LI(Ap,e),n=zL(e);return{URI:vt,_E:void 0,map:cn,ap:t.ap,of:tr,chain:cu,bimap:qg,mapLeft:zg,alt:n.alt,fromIO:uu,fromTask:rf,throwError:Lp}}const oce=Object.freeze(Object.defineProperty({__proto__:null,Alt:Mse,ApT:UI,ApplicativePar:Tse,ApplicativeSeq:YL,ApplyPar:Kg,ApplySeq:GL,Bifunctor:xse,Chain:bi,Do:Kse,FromEither:la,FromIO:Vg,FromTask:Hg,Functor:DI,Monad:Ise,MonadIO:Cse,MonadTask:Ose,MonadThrow:wse,Pointed:_se,URI:vt,alt:jI,altW:gse,ap:WI,apFirst:VL,apFirstW:$se,apS:rD,apSW:Gse,apSecond:HL,apSecondW:Sse,apW:mse,bimap:BL,bind:nD,bindTo:Vse,bindW:Hse,bracket:zse,bracketW:BI,chain:Wp,chainEitherK:ZL,chainEitherKW:Fse,chainFirst:JL,chainFirstEitherK:XL,chainFirstEitherKW:Nse,chainFirstIOK:Dse,chainFirstTaskK:Use,chainFirstW:Ese,chainIOEitherK:hse,chainIOEitherKW:DL,chainIOK:Lse,chainNullableK:ase,chainOptionK:Ase,chainTaskK:Bse,chainTaskOptionK:pse,chainTaskOptionKW:jL,chainW:jp,filterOrElse:QL,filterOrElseW:Wse,flap:bse,flatten:vse,flattenW:qL,fold:Que,foldW:ese,fromEither:RI,fromEitherK:jse,fromIO:uu,fromIOEither:kI,fromIOEitherK:LL,fromIOK:eD,fromNullable:ise,fromNullableK:ose,fromOption:Rse,fromOptionK:kse,fromPredicate:Pse,fromTask:rf,fromTaskK:tD,fromTaskOption:RL,fromTaskOptionK:WL,getAltTaskValidation:zL,getApplicativeTaskValidation:LI,getApplyMonoid:nce,getApplySemigroup:tce,getCompactable:KL,getFilterable:yse,getOrElse:FL,getOrElseW:tse,getSemigroup:rce,getTaskValidation:ice,left:wI,leftIO:ML,leftTask:xI,map:PI,mapLeft:UL,match:kL,matchE:AI,matchEW:AL,matchW:Xue,of:tr,orElse:PL,orElseFirst:Ug,orElseFirstIOK:cse,orElseFirstTaskK:lse,orElseFirstW:sse,orElseW:use,orLeft:fse,right:EI,rightIO:MI,rightTask:Bg,sequenceArray:Jse,sequenceSeqArray:Xse,swap:dse,taskEither:Qse,taskEitherSeq:ece,taskify:qse,throwError:Lp,toUnion:rse,traverseArray:iD,traverseArrayWithIndex:Yse,traverseReadonlyArrayWithIndex:zI,traverseReadonlyArrayWithIndexSeq:VI,traverseReadonlyNonEmptyArrayWithIndex:qI,traverseReadonlyNonEmptyArrayWithIndexSeq:KI,traverseSeqArray:oD,traverseSeqArrayWithIndex:Zse,tryCatch:NL,tryCatchK:nse},Symbol.toStringTag,{value:"Module"}));var lu=ro,Gg=Il(Np),HI=Ss(Np),GI=H(Bg,lu),aD=H(xI,lu),YI=function(e){return H(e,EI)},uD=function(e){return H(e,wI)},sD=Cl(sn),ace=Ol(sn),JI=H(MI,lu),cD=H(ML,lu),lD=Vr,fD=YI,fu=JI,of=GI,ZI=H(kI,lu),XI=function(e){return H(e,RI)},dD=ap(sn),uce=dD,QI=kl(co),sce=QI,pD=QI,cce=pD,hD=Al(ca),lce=hD,fce=cp(sn),dce=Zv(Np),pce=Xv(Np),hce=DS(ca),mce=lp,mD=fp,vce=mD,vD=Is(ca),gce=vD,gD=up(ca),yce=gD,bce=sp(ca),_ce=Fl(sn),yD=function(e){return H(e,ZI)},bD=function(e){return af(yD(e))},$ce=bD,e1=function(e){return H(e,lu)},_D=function(e){return af(e1(e))},Sce=_D,$D=function(e){return ey(e1(e))},Tce=$D,t1=function(e){return H(e,XI)},SD=function(e){return af(t1(e))},Ice=SD,TD=function(e){return ey(t1(e))},Cce=TD,ln=function(e,t){return v(e,Dp(t))},du=function(e,t){return v(e,a1(t))},n1=function(e,t){return v(e,Zg(function(n){return v(t,Dp(n))}))},pu=function(e,t){return v(e,Zg(t))},r1=function(e,t){return v(e,Xg(t))},Yg=function(e,t,n){return v(e,i1(t,n))},Jg=function(e,t){return v(e,o1(t))},Dp=wl(sn),i1=Ml(sn),o1=Rl(sn),a1=El(Pp),Oce=a1,nr=HI,Zg=Ts(ca),af=Zg,ID=af(q),wce=ID,Xg=xl(ca),CD=Xg,Bp=Gg,pt="ReaderTaskEither",OD=function(e){var t=bs(e);return{URI:pt,_E:void 0,compact:eo(sn,t),separate:zo(sn,t,Qa)}};function Ece(e){var t=$l(e),n=OD(e),r=Ko(sn,t),i=Vo(sn,t),o=tu(sn,t),a=nu(sn,t);return{URI:pt,_E:void 0,map:ln,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}function wD(e,t){var n=Ao(Jo,LI(e,t));return{URI:pt,_E:void 0,map:ln,ap:function(r,i){return v(r,n(i))},of:nr}}function ED(e){var t=op(ca,e);return{URI:pt,_E:void 0,map:ln,alt:function(n,r){return v(n,t(r))}}}var Ws={URI:pt,map:ln},xce=Ue(Ws),u1={URI:pt,of:nr},Qg={URI:pt,map:ln,ap:du},xD=Ot(Qg),Mce=xD,MD=wt(Qg),Rce=MD,kce={URI:pt,map:ln,ap:du,of:nr},RD={URI:pt,map:ln,ap:n1},kD={URI:pt,map:ln,ap:n1,of:nr},Pn={URI:pt,map:ln,ap:du,chain:pu},Ace={URI:pt,map:ln,ap:du,chain:pu,of:nr},Fce={URI:pt,map:ln,ap:du,chain:pu,of:nr,fromIO:fu},Nce={URI:pt,map:ln,ap:du,chain:pu,of:nr,fromIO:fu,fromTask:of},Pce={URI:pt,map:ln,ap:du,chain:pu,of:nr,throwError:Bp},AD=lt(Pn),ey=AD,Wce={URI:pt,bimap:Yg,mapLeft:Jg},jce={URI:pt,map:ln,alt:r1},uf={URI:pt,fromReader:fD},Lce=pp(uf),Dce=hp(uf),Bce=ws(uf),FD=mp(uf,Pn),Uce=FD,ND=vp(uf,Pn),qce=ND,s1=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return sD(e.apply(void 0,t))}},PD=function(e){return af(s1(e))},zce=PD,WD=function(e){return ey(s1(e))},Kce=WD,fa={URI:pt,fromEither:lD},Vce=Yi(fa),Hce=Ji(fa),Gce=ss(fa,Pn),jD=Wo(fa,Pn),Yce=jD,LD=jo(fa,Pn),Jce=LD,Zce=Va(fa),DD=cs(fa,Pn),Xce=DD,Qce=Sr(fa),ty={URI:pt,fromIO:fu},ele=no(ty),tle=Ho(ty,Pn),nle=Go(ty,Pn),ny={URI:pt,fromIO:fu,fromTask:of},rle=Es(ny),ile=Nl(ny,Pn),ole=Pl(ny,Pn);function ale(e,t,n){return BD(e,t,n)}function BD(e,t,n){return function(r){return BI(e(r),function(i){return t(i)(r)},function(i,o){return n(i,o)(r)})}}var ule=nr(zt),sle=Ct(Ws),UD=xt(Pn),cle=UD,qD=Et(Qg),lle=qD,c1=nr(tn),zD=function(e){return H(Os(e),Cs(qI(Zn)))},l1=function(e){var t=zD(e);return function(n){return mt(n)?t(n):c1}},KD=function(e){return H(Os(e),Cs(KI(Zn)))},f1=function(e){var t=KD(e);return function(n){return mt(n)?t(n):c1}},fle=l1,VD=function(e){return l1(function(t,n){return e(n)})},dle=VD(q),ple=f1,HD=function(e){return f1(function(t,n){return e(n)})},hle=HD(q),mle={URI:pt,map:ln,of:nr,ap:du,chain:pu,alt:r1,bimap:Yg,mapLeft:Jg,fromIO:fu,fromTask:of,throwError:Bp},vle={URI:pt,map:ln,of:nr,ap:n1,chain:pu,alt:r1,bimap:Yg,mapLeft:Jg,fromIO:fu,fromTask:of,throwError:Bp},gle=Kt(RD),yle=Lr(kD),ble=function(e){return Kt(TI)(ep(e))};function _le(e){var t=wD(Ap,e),n=ED(e);return{URI:pt,_E:void 0,map:ln,of:nr,chain:pu,bimap:Yg,mapLeft:Jg,ap:t.ap,alt:n.alt,fromIO:fu,fromTask:of,throwError:Bp}}function $le(e,t){return e(t)()}const Sle=Object.freeze(Object.defineProperty({__proto__:null,Alt:jce,ApT:c1,ApplicativePar:kce,ApplicativeSeq:kD,ApplyPar:Qg,ApplySeq:RD,Bifunctor:Wce,Chain:Pn,Do:ule,FromEither:fa,FromIO:ty,FromReader:uf,FromTask:ny,Functor:Ws,Monad:Ace,MonadIO:Fce,MonadTask:Nce,MonadThrow:Pce,Pointed:u1,URI:pt,alt:Xg,altW:CD,ap:a1,apFirst:xD,apFirstW:Mce,apS:qD,apSW:lle,apSecond:MD,apSecondW:Rce,apW:Oce,ask:Lce,asks:Dce,asksReaderTaskEither:vce,asksReaderTaskEitherW:mD,bimap:i1,bind:UD,bindTo:sle,bindW:cle,bracket:ale,bracketW:BD,chain:Zg,chainEitherK:jD,chainEitherKW:Yce,chainFirst:AD,chainFirstEitherK:LD,chainFirstEitherKW:Jce,chainFirstIOK:nle,chainFirstReaderEitherK:Cce,chainFirstReaderEitherKW:TD,chainFirstReaderK:ND,chainFirstReaderKW:qce,chainFirstReaderTaskK:Kce,chainFirstReaderTaskKW:WD,chainFirstTaskEitherK:Tce,chainFirstTaskEitherKW:$D,chainFirstTaskK:ole,chainFirstW:ey,chainIOEitherK:$ce,chainIOEitherKW:bD,chainIOK:tle,chainNullableK:hce,chainOptionK:Gce,chainReaderEitherK:Ice,chainReaderEitherKW:SD,chainReaderK:FD,chainReaderKW:Uce,chainReaderTaskK:zce,chainReaderTaskKW:PD,chainTaskEitherK:Sce,chainTaskEitherKW:_D,chainTaskK:ile,chainW:af,filterOrElse:DD,filterOrElseW:Xce,flap:xce,flatten:wce,flattenW:ID,fold:sce,foldW:cce,fromEither:lD,fromEitherK:Qce,fromIO:fu,fromIOEither:ZI,fromIOEitherK:yD,fromIOK:ele,fromNullable:dce,fromNullableK:pce,fromOption:Vce,fromOptionK:Hce,fromPredicate:Zce,fromReader:fD,fromReaderEither:XI,fromReaderEitherK:t1,fromReaderK:Bce,fromReaderTaskK:s1,fromTask:of,fromTaskEither:lu,fromTaskEitherK:e1,fromTaskK:rle,getAltReaderTaskValidation:ED,getApplicativeReaderTaskValidation:wD,getApplyMonoid:yle,getApplySemigroup:gle,getCompactable:OD,getFilterable:Ece,getOrElse:hD,getOrElseW:lce,getReaderTaskValidation:_le,getSemigroup:ble,left:Gg,leftIO:cD,leftReader:uD,leftReaderTask:ace,leftTask:aD,local:mce,map:Dp,mapLeft:o1,match:dD,matchE:QI,matchEW:pD,matchW:uce,of:nr,orElse:vD,orElseFirst:gD,orElseFirstW:yce,orElseW:gce,orLeft:bce,readerTaskEither:mle,readerTaskEitherSeq:vle,right:HI,rightIO:JI,rightReader:YI,rightReaderTask:sD,rightTask:GI,run:$le,sequenceArray:dle,sequenceSeqArray:hle,swap:_ce,throwError:Bp,toUnion:fce,traverseArray:VD,traverseArrayWithIndex:fle,traverseReadonlyArrayWithIndex:l1,traverseReadonlyArrayWithIndexSeq:f1,traverseReadonlyNonEmptyArrayWithIndex:zD,traverseReadonlyNonEmptyArrayWithIndexSeq:KD,traverseSeqArray:HD,traverseSeqArrayWithIndex:ple},Symbol.toStringTag,{value:"Module"}));var Tle=function(e){return new Set(e)},Ile=function(e){return new Set([e])},GD=function(e){return function(t){for(var n=t.length,r=new Set,i=fn(e),o=0;o<n;o++){var a=t[o];i(a,r)||r.add(a)}return r}};function Cle(e){return new Set(e)}function Ole(e){var t=fn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);t(a,i)||i.add(a)}),i}}}function wle(e){var t=fn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){n(o).forEach(function(a){t(a,i)||i.add(a)})}),i}}}function d1(e){return function(t){for(var n=t.values(),r,i=new Set;!(r=n.next()).done;){var o=r.value;e(o)&&i.add(o)}return i}}function Ele(e){return function(t){for(var n=t.values(),r,i=new Set,o=new Set;!(r=n.next()).done;){var a=r.value;e(a)?i.add(a):o.add(a)}return Ee(o,i)}}function p1(e){var t=fn(e);return function(n,r){if(r===void 0){var i=p1(e);return function(a){return i(n,a)}}if(Up(n))return r;if(Up(r))return n;var o=new Set(n);return r.forEach(function(a){t(a,o)||o.add(a)}),o}}function h1(e){var t=fn(e);return function(n,r){if(r===void 0){var i=h1(e);return function(a){return i(a,n)}}if(Up(n)||Up(r))return v1;var o=new Set;return n.forEach(function(a){t(a,r)&&o.add(a)}),o}}function xle(e,t){return function(n){return function(r){for(var i=r.values(),o,a=new Set,u=new Set,s=fn(e),c=fn(t);!(o=i.next()).done;){var l=n(o.value);switch(l._tag){case"Left":s(l.left,a)||a.add(l.left);break;case"Right":c(l.right,u)||u.add(l.right);break}}return Ee(a,u)}}}function m1(e){var t=fn(e);return function(n,r){if(r===void 0){var i=m1(e);return function(o){return i(o,n)}}return d1(function(o){return!t(o,r)})(n)}}function YD(e){var t=ry(e);return function(n,r){return function(i){return t(i).reduce(r,n)}}}function JD(e,t){var n=ry(e);return function(r){return function(i){return n(i).reduce(function(o,a){return t.concat(o,r(a))},t.empty)}}}var ZD=function(e){var t=ry(e);return function(n,r){return function(i){return t(i).reduceRight(function(o,a){return r(a,o)},n)}}};function XD(e){var t=fn(e);return function(n){return function(r){if(t(n)(r))return r;var i=new Set(r);return i.add(n),i}}}var QD=function(e){return function(t){return function(n){return d1(function(r){return!e.equals(t,r)})(n)}}},Mle=function(e){var t=fn(e),n=QD(e),r=XD(e);return function(i){return function(o){return(t(i,o)?n:r)(i)(o)}}},Rle=function(e){return eB(e)(q)};function kle(e,t){return function(n){var r=fn(e),i=fn(t),o=new Set,a=new Set;return n.forEach(function(u){switch(u._tag){case"Left":r(u.left,o)||o.add(u.left);break;case"Right":i(u.right,a)||a.add(u.right);break}}),Ee(o,a)}}function eB(e){var t=fn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);a._tag==="Some"&&!t(a.value,i)&&i.add(a.value)}),i}}}var v1=new Set,Up=function(e){return e.size===0},Ale=function(e){return e.size},g1=function(e){return function(t){for(var n=t.values(),r,i=!1;!i&&!(r=n.next()).done;)i=e(r.value);return i}};function y1(e){return Vd(g1(Vd(e)))}function qp(e){var t=fn(e);return function(n,r){if(r===void 0){var i=qp(e);return function(o){return i(o,n)}}return y1(function(o){return t(o,r)})(n)}}function fn(e){return function(t,n){if(n===void 0){var r=fn(e);return function(u){return r(t,u)}}for(var i=n.values(),o,a=!1;!a&&!(o=i.next()).done;)a=e.equals(t,o.value);return a}}var ry=function(e){return function(t){var n=[];return t.forEach(function(r){return n.push(r)}),n.sort(e.compare)}},Fle="ReadonlySet";function tB(e){return{show:function(t){var n=[];return t.forEach(function(r){n.push(e.show(r))}),"new Set([".concat(n.sort().join(", "),"])")}}}function nB(e){var t=qp(e);return jr(function(n,r){return t(n,r)&&t(r,n)})}var rB=function(e){return{concat:p1(e)}},Nle=function(e){return{concat:rB(e).concat,empty:v1}},Ple=function(e){return{concat:h1(e)}},Wle=function(e){return{concat:m1(e)}},jle=GD;const Lle=Object.freeze(Object.defineProperty({__proto__:null,URI:Fle,chain:wle,compact:Rle,difference:m1,elem:fn,empty:v1,every:y1,filter:d1,filterMap:eB,foldMap:JD,fromArray:jle,fromReadonlyArray:GD,fromSet:Tle,getDifferenceMagma:Wle,getEq:nB,getIntersectionSemigroup:Ple,getShow:tB,getUnionMonoid:Nle,getUnionSemigroup:rB,insert:XD,intersection:h1,isEmpty:Up,isSubset:qp,map:Ole,partition:Ele,partitionMap:xle,reduce:YD,reduceRight:ZD,remove:QD,separate:kle,singleton:Ile,size:Ale,some:g1,toReadonlyArray:ry,toSet:Cle,toggle:Mle,union:p1},Symbol.toStringTag,{value:"Module"}));function Gt(e){return e[0]}function In(e){return e[1]}var Dle=function(e){return[In(e),Gt(e)]};function b1(e){return{URI:Cr,_E:void 0,map:zp,ap:function(t,n){return[Gt(t)(Gt(n)),e.concat(In(t),In(n))]}}}var iB=function(e){return function(t){return[t,e.empty]}};function Ble(e){var t=b1(e);return{URI:Cr,_E:void 0,map:t.map,ap:t.ap,of:iB(e)}}function _1(e){var t=b1(e);return{URI:Cr,_E:void 0,map:t.map,ap:t.ap,chain:function(n,r){var i=r(Gt(n)),o=i[0],a=i[1];return[o,e.concat(In(n),a)]}}}function Ule(e){var t=_1(e);return{URI:Cr,_E:void 0,map:t.map,ap:t.ap,chain:t.chain,of:iB(e)}}function qle(e){var t=function(r,i){for(var o=i(r),a=e.empty,u=Gt(o);u._tag==="Left";)a=e.concat(a,In(o)),o=i(u.left),u=Gt(o);return[u.right,e.concat(a,In(o))]},n=_1(e);return{URI:Cr,_E:void 0,map:n.map,ap:n.ap,chain:n.chain,chainRec:t}}var oB=function(e,t){return v(e,fB(t))},zp=function(e,t){return v(e,I1(t))},aB=function(e,t,n){return v(e,lB(t,n))},uB=function(e,t){return v(e,C1(t))},sB=function(e,t){return v(e,O1(t))},$1=function(e,t,n){return v(e,w1(t,n))},S1=function(e){var t=E1();return function(n,r){return v(n,t(r))}},T1=function(e,t,n){return v(e,x1(t,n))},cB=function(e){var t=dB(e);return function(n,r){return v(n,t(r))}},lB=function(e,t){return function(n){return[t(Gt(n)),e(In(n))]}},I1=function(e){return function(t){return[e(Gt(t)),In(t)]}},C1=function(e){return function(t){return[Gt(t),e(In(t))]}},fB=function(e){return function(t){return[Gt(t),In(e)]}},O1=function(e){return function(t){return[e(t),In(t)]}},iy=Gt,zle=O1(q),w1=function(e,t){return function(n){return t(e,Gt(n))}},E1=function(){return function(e){return function(t){return e(Gt(t))}}},x1=function(e,t){return function(n){return t(Gt(n),e)}},dB=function(e){return function(t){return function(n){return e.map(t(Gt(n)),function(r){return[r,In(n)]})}}},M1=function(e){return function(t){return e.map(Gt(t),function(n){return[n,In(t)]})}},Cr="ReadonlyTuple",pB={URI:Cr,map:zp},Kle=Ue(pB),Vle={URI:Cr,bimap:aB,mapLeft:uB},Hle={URI:Cr,compose:oB},Gle={URI:Cr,map:zp,extend:sB,extract:iy},Yle={URI:Cr,reduce:$1,foldMap:S1,reduceRight:T1},Jle={URI:Cr,map:zp,reduce:$1,foldMap:S1,reduceRight:T1,traverse:cB,sequence:M1},Zle=I1,Xle=C1,Qle={URI:Cr,compose:oB,map:zp,bimap:aB,mapLeft:uB,extract:iy,extend:sB,reduce:$1,foldMap:S1,reduceRight:T1,traverse:cB,sequence:M1};const efe=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:Vle,Comonad:Gle,Foldable:Yle,Functor:pB,Semigroupoid:Hle,Traversable:Jle,URI:Cr,bimap:lB,compose:fB,duplicate:zle,extend:O1,extract:iy,flap:Kle,foldMap:E1,fst:Gt,getApplicative:Ble,getApply:b1,getChain:_1,getChainRec:qle,getMonad:Ule,map:Zle,mapFst:I1,mapLeft:Xle,mapSnd:C1,readonlyTuple:Qle,reduce:w1,reduceRight:x1,sequence:M1,snd:In,swap:Dle,traverse:dB},Symbol.toStringTag,{value:"Module"}));var sf=globalThis&&globalThis.__assign||function(){return sf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},sf.apply(this,arguments)},tfe=AR,js=di,R1=function(e){return function(t){return Object.keys(t).sort(e.compare)}},nfe=R1(V);function k1(e){if(typeof e=="function")return k1(V)(e);var t=R1(e);return function(n){return function(r){for(var i=[],o=0,a=t(r);o<a.length;o++){var u=a[o];i.push(n(u,r[u]))}return i}}}var A1=k1(V)(function(e,t){return[e,t]});function rfe(e){return function(t){var n=A1(t),r=n.length;return e.unfold(0,function(i){return i<r?fe([n[i],i+1]):ye})}}var hB=S0,mB=Fo;function vB(e){return function(t){if(!ct.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}var ife=function(e,t){return gB(e,function(){return t})},gB=function(e,t){return function(n){if(!mB(e,n))return ye;var r=Object.assign({},n);return r[e]=t(n[e]),fe(r)}};function ofe(e){var t=vB(e);return function(n){var r=yB(e,n);return Ft(r)?ye:fe([r.value,t(n)])}}var afe=Vm,yB=Xu,ufe=Hm,sfe=T0;function cfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Hc(e[0]):Hc(V).apply(void 0,e)}function lfe(e){return"compare"in e?Gc(e):Gc(V)(e)}function ffe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Yc(e[0]):Yc(V).apply(void 0,e)}var dfe=FR;function pfe(e){return NR(e)}function F1(e){return Gm(e)}function Kp(e){return Jc(e)}var hfe=function(e){var t=F1(e);return function(n){return function(r){return e.map(v(r,t(n)),hu)}}},mfe=function(e){var t=F1(e);return function(n){return function(r){return e.map(v(r,t(n)),mu)}}},vfe=Ym;function gfe(e){return Jm(e)}var yfe=Zm;function bfe(e){return Xm(e)}function bB(e,t){return PR(e,t)}var _fe=A1,$fe=function(e){return bB(xm(),aF)(e)};function Sfe(e,t){return I0(e,t)}var Tfe=WR,Ife=jR,Cfe=C0,_B=function(e){var t=O0(e);return function(n){return function(r){return js(r)?sf({},n):js(n)?sf({},r):t(n)(r)}}},$B=function(e){return function(t){return function(n){return js(n)||js(t)?{}:w0(e)(t)(n)}}},SB=function(e){return function(t){return js(t)?sf({},e):js(e)?sf({},t):E0(e)(t)}},_i=yr,Vp=Qu,$i=br,Si=_r,Ti=$r,Hp=es,Gp=ts,Yp=ns,Jp=rs,Zp=is,Xp=as,Qp=us,TB=Qm,IB=ev,CB=tv,OB=nv,cf=Hi,wB=Id,N1=function(e){return function(t){var n=R1(e);return function(r,i){var o=n(r);if(o.length===0)return t.of({});for(var a=t.of({}),u=function(f){a=t.ap(t.map(a,function(d){return function(p){return d[f]=p,d}}),i(f,r[f]))},s=0,c=o;s<c.length;s++){var l=c[s];u(l)}return a}}},Ofe=x0,wfe=M0,Efe=R0,xfe=k0;function Mfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Od(e[0]):Od(V).apply(void 0,e)}function Rfe(e){return"compare"in e?wd(e):wd(V)(e)}function kfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Ed(e[0]):Ed(V).apply(void 0,e)}var hu=No,mu=Po,dn="Record";function Afe(e){return"compare"in e?rv(e):rv(V)(e)}var Ffe=LR,Nfe=DR,EB={URI:dn,map:_i},Pfe=Ue(EB),Wfe={URI:dn,map:_i,mapWithIndex:Vp},jfe=function(e){return{URI:dn,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e)}},Lfe=function(e){return{URI:dn,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),reduceWithIndex:Zp(e),foldMapWithIndex:Xp(e),reduceRightWithIndex:Qp(e)}},eh={URI:dn,compact:hu,separate:mu},Dfe={URI:dn,map:_i,compact:hu,separate:mu,filter:Hp,filterMap:Gp,partition:Yp,partitionMap:Jp},Bfe={URI:dn,map:_i,mapWithIndex:Vp,compact:hu,separate:mu,filter:Hp,filterMap:Gp,partition:Yp,partitionMap:Jp,filterMapWithIndex:CB,filterWithIndex:OB,partitionMapWithIndex:TB,partitionWithIndex:IB},xB=function(e){return{URI:dn,map:_i,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),traverse:cf(e),sequence:wB(e)}},Ufe=function(e){return{URI:dn,map:_i,mapWithIndex:Vp,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),reduceWithIndex:Zp(e),foldMapWithIndex:Xp(e),reduceRightWithIndex:Qp(e),traverse:cf(e),sequence:wB(e),traverseWithIndex:N1(e)}},qfe=function(e){var t=xB(e);return{URI:dn,map:_i,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),traverse:t.traverse,sequence:t.sequence,compact:hu,separate:mu,filter:Hp,filterMap:Gp,partition:Yp,partitionMap:Jp,wither:fi(t,eh),wilt:li(t,eh)}},MB=function(e){var t=_B(e);return{concat:function(n,r){return t(r)(n)}}},zfe=function(e){return{concat:MB(e).concat,empty:{}}},Kfe=function(e){var t=$B(e);return{concat:function(n,r){return t(r)(n)}}},Vfe=function(){return{concat:function(e,t){return SB(t)(e)}}},Hfe={URI:dn,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V)},Gfe={URI:dn,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),reduceWithIndex:Zp(V),foldMapWithIndex:Xp(V),reduceRightWithIndex:Qp(V)},P1={URI:dn,map:_i,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),traverse:cf(V),sequence:Kp},Yfe={URI:dn,map:_i,mapWithIndex:Vp,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),reduceWithIndex:Zp(V),foldMapWithIndex:Xp(V),reduceRightWithIndex:Qp(V),traverse:cf(V),sequence:Kp,traverseWithIndex:N1(V)},RB=fi(P1,eh),kB=li(P1,eh),Jfe={URI:dn,map:_i,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),traverse:cf(V),sequence:Kp,compact:hu,separate:mu,filter:Hp,filterMap:Gp,partition:Yp,partitionMap:Jp,wither:RB,wilt:kB},Zfe={},Xfe=hB,Qfe=VR,ede={URI:dn,map:_i,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),traverse:cf(V),sequence:Kp,compact:hu,separate:mu,filter:Hp,filterMap:Gp,partition:Yp,partitionMap:Jp,mapWithIndex:Vp,reduceWithIndex:Zp(V),foldMapWithIndex:Xp(V),reduceRightWithIndex:Qp(V),filterMapWithIndex:CB,filterWithIndex:OB,partitionMapWithIndex:TB,partitionWithIndex:IB,traverseWithIndex:N1(V),wither:RB,wilt:kB};const tde=Object.freeze(Object.defineProperty({__proto__:null,Compactable:eh,Filterable:Dfe,FilterableWithIndex:Bfe,Foldable:Hfe,FoldableWithIndex:Gfe,Functor:EB,FunctorWithIndex:Wfe,Traversable:P1,TraversableWithIndex:Yfe,URI:dn,Witherable:Jfe,collect:k1,compact:hu,deleteAt:vB,difference:SB,elem:Cfe,empty:Zfe,every:Tfe,filter:Ofe,filterMap:wfe,filterMapWithIndex:yfe,filterWithIndex:bfe,flap:Pfe,foldMap:Rfe,foldMapWithIndex:lfe,fromEntries:$fe,fromFoldable:bB,fromFoldableMap:Sfe,getDifferenceMagma:Vfe,getEq:Ffe,getFoldable:jfe,getFoldableWithIndex:Lfe,getIntersectionSemigroup:Kfe,getMonoid:Nfe,getShow:Afe,getTraversable:xB,getTraversableWithIndex:Ufe,getUnionMonoid:zfe,getUnionSemigroup:MB,getWitherable:qfe,has:mB,hasOwnProperty:Qfe,insertAt:Xfe,intersection:$B,isEmpty:js,isSubrecord:afe,keys:nfe,lookup:yB,map:sfe,mapWithIndex:ufe,modifyAt:gB,partition:Efe,partitionMap:xfe,partitionMapWithIndex:vfe,partitionWithIndex:gfe,pop:ofe,record:ede,reduce:Mfe,reduceRight:kfe,reduceRightWithIndex:ffe,reduceWithIndex:cfe,separate:mu,sequence:Kp,singleton:dfe,size:tfe,some:Ife,toArray:A1,toEntries:_fe,toUnfoldable:rfe,traverse:F1,traverseWithIndex:pfe,union:_B,updateAt:ife,upsertAt:hB,wilt:mfe,wither:hfe},Symbol.toStringTag,{value:"Module"}));var nde=function(e){return function(t){return gt(e(t))}},rde=function(e){return function(t){return P_(e(t))}},ide=function(){return function(e){return!0}},ode=function(e){return function(t){return!e(t)}},ade=function(e){return function(t){return function(n){return t(n)||e(n)}}},ude=function(e){return function(t){return function(n){return t(n)&&e(n)}}},sde=function(){return function(e){return!1}},cde=function(e){return function(t){return function(n){return t(n)&&e(n)}}};const lde=Object.freeze(Object.defineProperty({__proto__:null,and:ude,compose:cde,fromEitherK:rde,fromOptionK:nde,id:ide,not:ode,or:ade,zero:sde},Symbol.toStringTag,{value:"Module"}));var AB=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{add:function(n,r){return e.map(function(i,o){return i.add(n[o],r[o])})},zero:e.map(function(n){return n.zero}),mul:function(n,r){return e.map(function(i,o){return i.mul(n[o],r[o])})},one:e.map(function(n){return n.one}),sub:function(n,r){return e.map(function(i,o){return i.sub(n[o],r[o])})}}},fde=function(e){return function(t){return e.sub(e.zero,t)}},dde=AB,pde=TM;const hde=Object.freeze(Object.defineProperty({__proto__:null,getFunctionRing:pde,getTupleRing:dde,negate:fde,tuple:AB},Symbol.toStringTag,{value:"Module"})),mde=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var vde=A_;const gde=Object.freeze(Object.defineProperty({__proto__:null,getFunctionSemiring:vde},Symbol.toStringTag,{value:"Module"}));var yde=tB,bde=nB;function _de(e){var t=rr(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);t(a,i)||i.add(a)}),i}}}function $de(e){var t=rr(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){n(o).forEach(function(a){t(a,i)||i.add(a)})}),i}}}function W1(e){return function(t){for(var n=t.values(),r,i=new Set;!(r=n.next()).done;){var o=r.value;e(o)&&i.add(o)}return i}}function Sde(e){return function(t){for(var n=t.values(),r,i=new Set,o=new Set;!(r=n.next()).done;){var a=r.value;e(a)?i.add(a):o.add(a)}return Ee(o,i)}}function j1(e){var t=rr(e);return function(n,r){if(r===void 0){var i=j1(e);return function(a){return i(n,a)}}if(th(n))return r;if(th(r))return n;var o=new Set(n);return r.forEach(function(a){t(a,o)||o.add(a)}),o}}function L1(e){var t=rr(e);return function(n,r){if(r===void 0){var i=L1(e);return function(a){return i(a,n)}}if(th(n)||th(r))return new Set;var o=new Set;return n.forEach(function(a){t(a,r)&&o.add(a)}),o}}function Tde(e,t){return function(n){return function(r){for(var i=r.values(),o,a=new Set,u=new Set,s=rr(e),c=rr(t);!(o=i.next()).done;){var l=n(o.value);switch(l._tag){case"Left":s(l.left,a)||a.add(l.left);break;case"Right":c(l.right,u)||u.add(l.right);break}}return Ee(a,u)}}}function D1(e){var t=rr(e);return function(n,r){if(r===void 0){var i=D1(e);return function(o){return i(o,n)}}return W1(function(o){return!t(o,r)})(n)}}var FB=function(e){return{concat:j1(e)}},Ide=function(e){return{concat:FB(e).concat,empty:new Set}},Cde=function(e){return{concat:L1(e)}},Ode=function(e){return{concat:D1(e)}},wde=YD,Ede=JD,xde=ZD,Mde=function(e){return new Set([e])};function NB(e){var t=rr(e);return function(n){return function(r){if(t(n)(r))return r;var i=new Set(r);return i.add(n),i}}}var PB=function(e){return function(t){return function(n){return W1(function(r){return!e.equals(t,r)})(n)}}},Rde=function(e){var t=rr(e),n=PB(e),r=NB(e);return function(i){return function(o){return(t(i,o)?n:r)(i)(o)}}},WB=function(e){return function(t){for(var n=t.length,r=new Set,i=rr(e),o=0;o<n;o++){var a=t[o];i(a,r)||r.add(a)}return r}},kde=function(e){return jB(e)(q)};function Ade(e,t){return function(n){var r=rr(e),i=rr(t),o=new Set,a=new Set;return n.forEach(function(u){switch(u._tag){case"Left":r(u.left,o)||o.add(u.left);break;case"Right":i(u.right,a)||a.add(u.right);break}}),Ee(o,a)}}function jB(e){var t=rr(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);a._tag==="Some"&&!t(a.value,i)&&i.add(a.value)}),i}}}var Fde=new Set,th=function(e){return e.size===0},Nde=function(e){return e.size},Pde=g1,LB=y1,Wde=qp,rr=fn,DB=function(e){return function(t){var n=[];return t.forEach(function(r){return n.push(r)}),n.sort(e.compare)}},jde=qp;const Lde=Object.freeze(Object.defineProperty({__proto__:null,chain:$de,compact:kde,difference:D1,elem:rr,empty:Fde,every:LB,filter:W1,filterMap:jB,foldMap:Ede,fromArray:WB,getDifferenceMagma:Ode,getEq:bde,getIntersectionSemigroup:Cde,getShow:yde,getUnionMonoid:Ide,getUnionSemigroup:FB,insert:NB,intersection:L1,isEmpty:th,isSubset:Wde,map:_de,partition:Sde,partitionMap:Tde,reduce:wde,reduceRight:xde,remove:PB,separate:Ade,singleton:Mde,size:Nde,some:Pde,subset:jde,toArray:DB,toggle:Rde,union:j1},Symbol.toStringTag,{value:"Module"}));var BB=function(e){return{show:function(t){var n="{";for(var r in e)ct.call(e,r)&&(n+=" ".concat(r,": ").concat(e[r].show(t[r]),","));return n.length>1&&(n=n.slice(0,-1)+" "),n+="}",n}}},UB=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{show:function(n){return"[".concat(n.map(function(r,i){return e[i].show(r)}).join(", "),"]")}}},Dde=UB,Bde=BB,Ude={show:function(e){return JSON.stringify(e)}},qde={show:function(e){return JSON.stringify(e)}},zde={show:function(e){return JSON.stringify(e)}};const Kde=Object.freeze(Object.defineProperty({__proto__:null,getStructShow:Bde,getTupleShow:Dde,showBoolean:Ude,showNumber:zde,showString:qde,struct:BB,tuple:UB},Symbol.toStringTag,{value:"Module"}));function B1(e){return function(t){return function(n){return e.of([t,n])}}}function U1(e){return function(t){return function(n){return function(r){return e.map(n(r),function(i){var o=i[0],a=i[1];return[t(o),a]})}}}}function q1(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){var o=i[0],a=i[1];return e.map(t(a),function(u){var s=u[0],c=u[1];return[o(s),c]})})}}}}function z1(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){var o=i[0],a=i[1];return t(o)(a)})}}}}function K1(e){return function(t){return function(n){return e.of(t(n))}}}function V1(e){return function(t){return function(n){return e.map(t,function(r){return[r,n]})}}}function H1(e){return function(t){return function(n){return e.map(n(t),function(r){var i=r[0];return i})}}}function G1(e){return function(t){return function(n){return e.map(n(t),In)}}}function Vde(e){var t=q1(e),n=U1(e),r=z1(e),i=H1(e),o=G1(e);return{map:function(a,u){return v(a,n(u))},ap:function(a,u){return v(a,t(u))},of:B1(e),chain:function(a,u){return v(a,r(u))},get:function(){return function(a){return e.of([a,a])}},put:function(a){return function(){return e.of([void 0,a])}},modify:function(a){return function(u){return e.of([void 0,a(u)])}},gets:function(a){return function(u){return e.of([a(u),u])}},fromState:K1(e),fromM:V1(e),evalState:function(a,u){return v(a,i(u))},execState:function(a,u){return v(a,o(u))}}}const Hde=Object.freeze(Object.defineProperty({__proto__:null,ap:q1,chain:z1,evaluate:H1,execute:G1,fromF:V1,fromState:K1,getStateM:Vde,map:U1,of:B1},Symbol.toStringTag,{value:"Module"}));var Y1=function(e){return function(){return Gg(e)}},J1=B1(u1);function qB(e){return Ii(GI(e))}function Gde(e){return Ii(aD(e))}function zB(e){return Ii(YI(e))}function Yde(e){return Ii(uD(e))}function KB(e){return Ii(JI(e))}function Jde(e){return Ii(cD(e))}var Zde=function(e){return H(e,HI)},Xde=function(e){return function(t){return Gg(e(t)[0])}},VB=eu(function(e){return Y1(e)},J1),HB=zB,Ls=KB,nh=qB,GB=K1(u1),YB=function(e){return Ii(lu(e))},JB=function(e){return Ii(ZI(e))},Qde=function(e){return Ii(XI(e))},Ii=V1(Ws),epe=function(e){return function(t){return H(t,lp(e))}},ZB=function(e){return function(t){return function(n){return e(n)(t)(n)}}},tpe=ZB,XB=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return JB(e.apply(void 0,t))}},QB=function(e){return function(t){return v(t,rh(XB(e)))}},npe=QB,eU=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YB(e.apply(void 0,t))}},tU=function(e){return function(t){return v(t,rh(eU(e)))}},rpe=tU,nU=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Ii(e.apply(void 0,t))}},rU=function(e){return function(t){return v(t,rh(nU(e)))}},ipe=rU,Ci=function(e,t){return v(e,iU(t))},da=function(e,t){return v(e,X1(t))},Ds=function(e,t){return v(e,Q1(t))},Z1=function(e,t){return function(n){return v(e(n),Xg(function(){return t()(n)}))}},oy=function(e,t,n){return function(r){return v(e(r),i1(t,function(i){var o=i[0],a=i[1];return[n(o),a]}))}},ay=function(e,t){return function(n){return v(e(n),o1(t))}},iU=U1(Ws),ope=function(e,t){return function(n){return oy(n,e,t)}},ape=function(e){return function(t){return ay(t,e)}},X1=q1(Pn),upe=X1,lo=J1,Q1=z1(Pn),rh=Q1,oU=rh(q),spe=oU,aU=function(e){return function(t){return function(n){return v(t(n),CD(function(){return e()(n)}))}}},cpe=aU,uy=Y1,Dt="StateReaderTaskEither",eC={URI:Dt,map:Ci},lpe=Ue(eC),fpe={URI:Dt,of:lo},sy={URI:Dt,map:Ci,ap:da},uU=Ot(sy),dpe=uU,sU=wt(sy),ppe=sU,hpe={URI:Dt,map:Ci,ap:da,of:lo},ir={URI:Dt,map:Ci,ap:da,chain:Ds},Bs={URI:Dt,fromState:GB},mpe=bP(Bs),vpe=_P(Bs),gpe=$P(Bs),ype=SP(Bs),bpe=nT(Bs),_pe=TP(Bs,ir),$pe={URI:Dt,map:Ci,ap:da,of:lo,chain:Ds},Spe={URI:Dt,map:Ci,ap:da,of:lo,chain:Ds,fromIO:Ls},Tpe={URI:Dt,map:Ci,ap:da,of:lo,chain:Ds,fromIO:Ls,fromTask:nh},Ipe={URI:Dt,map:Ci,ap:da,of:lo,chain:Ds,throwError:uy},cU=lt(ir),Cpe=cU,Ope={URI:Dt,bimap:oy,mapLeft:ay},wpe={URI:Dt,map:Ci,alt:Z1},lf={URI:Dt,fromReader:HB},Epe=pp(lf),xpe=hp(lf),Mpe=ws(lf),lU=mp(lf,ir),Rpe=lU,fU=vp(lf,ir),kpe=fU,pa={URI:Dt,fromEither:VB},Ape=Yi(pa),Fpe=Ji(pa),Npe=ss(pa,ir),dU=Wo(pa,ir),Ppe=dU,pU=jo(pa,ir),Wpe=pU,jpe=Va(pa),hU=cs(pa,ir),Lpe=hU,Dpe=Sr(pa),cy={URI:Dt,fromIO:Ls},Bpe=no(cy),Upe=Ho(cy,ir),qpe=Go(cy,ir),ly={URI:Dt,fromIO:Ls,fromTask:nh},zpe=Es(ly),Kpe=Nl(ly,ir),Vpe=Pl(ly,ir),Hpe=H1(Ws),Gpe=G1(Ws),Ype=Ct(eC),mU=xt(ir),Jpe=mU,vU=Et(sy),Zpe=vU,gU=function(e){return function(t){return function(n){return function(r){return function(){return qc(t).reduce(function(i,o,a){return i.then(function(u){return qt(u)?i:e(a+1,o)(u.right[1])(r)().then(function(s){if(qt(s))return s;var c=s.right,l=c[0],f=c[1];return u.right[0].push(l),u.right[1]=f,u})})},e(0,gr(t))(n)(r)().then(_s(function(i){var o=i[0],a=i[1];return[[o],a]})))}}}}},tC=function(e){var t=gU(e);return function(n){return mt(n)?t(n):lo(tn)}},Xpe=tC,yU=function(e){return tC(function(t,n){return e(n)})},Qpe=yU(q),ehe={URI:Dt,map:Ci,of:lo,ap:da,chain:Ds,bimap:oy,mapLeft:ay,alt:Z1,fromIO:Ls,fromTask:nh,throwError:uy},the={URI:Dt,map:Ci,of:lo,ap:da,chain:Ds,bimap:oy,mapLeft:ay,alt:Z1,fromIO:Ls,fromTask:nh,throwError:uy},nhe=function(e,t){return v(e(t),Dp(function(n){var r=n[0];return r}))},rhe=function(e,t){return v(e(t),Dp(function(n){n[0];var r=n[1];return r}))};function ihe(e,t,n){return e(t)(n)()}const ohe=Object.freeze(Object.defineProperty({__proto__:null,Alt:wpe,Applicative:hpe,Apply:sy,Bifunctor:Ope,Chain:ir,FromEither:pa,FromIO:cy,FromReader:lf,FromState:Bs,FromTask:ly,Functor:eC,Monad:$pe,MonadIO:Spe,MonadTask:Tpe,MonadThrow:Ipe,Pointed:fpe,URI:Dt,alt:cpe,altW:aU,ap:X1,apFirst:uU,apFirstW:dpe,apS:vU,apSW:Zpe,apSecond:sU,apSecondW:ppe,apW:upe,ask:Epe,asks:xpe,asksStateReaderTaskEither:tpe,asksStateReaderTaskEitherW:ZB,bimap:ope,bind:mU,bindTo:Ype,bindW:Jpe,chain:Q1,chainEitherK:dU,chainEitherKW:Ppe,chainFirst:cU,chainFirstEitherK:pU,chainFirstEitherKW:Wpe,chainFirstIOK:qpe,chainFirstReaderK:fU,chainFirstReaderKW:kpe,chainFirstTaskK:Vpe,chainFirstW:Cpe,chainIOEitherK:npe,chainIOEitherKW:QB,chainIOK:Upe,chainOptionK:Npe,chainReaderK:lU,chainReaderKW:Rpe,chainReaderTaskEitherK:ipe,chainReaderTaskEitherKW:rU,chainStateK:_pe,chainTaskEitherK:rpe,chainTaskEitherKW:tU,chainTaskK:Kpe,chainW:rh,evalState:nhe,evaluate:Hpe,execState:rhe,execute:Gpe,filterOrElse:hU,filterOrElseW:Lpe,flap:lpe,flatten:spe,flattenW:oU,fromEither:VB,fromEitherK:Dpe,fromIO:Ls,fromIOEither:JB,fromIOEitherK:XB,fromIOK:Bpe,fromOption:Ape,fromOptionK:Fpe,fromPredicate:jpe,fromReader:HB,fromReaderEither:Qde,fromReaderK:Mpe,fromReaderTaskEither:Ii,fromReaderTaskEitherK:nU,fromState:GB,fromStateK:bpe,fromTask:nh,fromTaskEither:YB,fromTaskEitherK:eU,fromTaskK:zpe,get:mpe,gets:ype,left:Y1,leftIO:Jde,leftReader:Yde,leftState:Xde,leftTask:Gde,local:epe,map:iU,mapLeft:ape,modify:gpe,of:lo,put:vpe,right:J1,rightIO:KB,rightReader:zB,rightState:Zde,rightTask:qB,run:ihe,sequenceArray:Qpe,stateReaderTaskEither:ehe,stateReaderTaskEitherSeq:the,throwError:uy,traverseArray:yU,traverseArrayWithIndex:Xpe,traverseReadonlyArrayWithIndex:tC,traverseReadonlyNonEmptyArrayWithIndex:gU},Symbol.toStringTag,{value:"Module"}));function ahe(e){return function(t){return{peek:t.peek,pos:e}}}function uhe(e){return function(t){return{peek:t.peek,pos:e(t.pos)}}}function she(e){return function(t){return t.peek(e(t.pos))}}function che(e){return function(t){return function(n){return e.map(t(n.pos),function(r){return n.peek(r)})}}}var bU=function(e,t){return v(e,$U(t))},lhe=function(e,t){return v(e,nC(t))},nC=function(e){return function(t){return{peek:function(n){return e({peek:t.peek,pos:n})},pos:t.pos}}},_U=function(e){return e.peek(e.pos)},fhe=nC(q),$U=function(e){return function(t){return{peek:function(n){return e(t.peek(n))},pos:t.pos}}},rC="Store",SU={URI:rC,map:bU},dhe=Ue(SU),TU={URI:rC,map:bU,extend:lhe,extract:_U},phe=TU;const hhe=Object.freeze(Object.defineProperty({__proto__:null,Comonad:TU,Functor:SU,URI:rC,duplicate:fhe,experiment:che,extend:nC,extract:_U,flap:dhe,map:$U,peeks:she,seek:ahe,seeks:uhe,store:phe},Symbol.toStringTag,{value:"Module"}));function iC(e,t){return function(n,r){return t.compose(e.second(r),e.first(n))}}function IU(e,t){var n=iC(e,t);return function(r,i){return t.compose(n(r,i),e.promap(t.id(),q,function(o){return[o,o]}))}}function mhe(e){return iC(e,e)}function vhe(e){return IU(e,e)}const ghe=Object.freeze(Object.defineProperty({__proto__:null,fanOut:IU,fanout:vhe,split:iC,splitStrong:mhe},Symbol.toStringTag,{value:"Module"}));var yhe=function(){return{concat:function(e,t){return Object.assign({},e,t)}}},bhe=function(e){return function(t){var n={};for(var r in t)ct.call(t,r)&&(n[r]=e[r](t[r]));return n}};const _he=Object.freeze(Object.defineProperty({__proto__:null,evolve:bhe,getAssignSemigroup:yhe},Symbol.toStringTag,{value:"Module"}));var $he=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(f){a(f)}}function s(l){try{c(r.throw(l))}catch(f){a(f)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(e,t||[])).next())})},She=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},CU=$p(un),The=xT(un),Ihe=Sn,OU=MT(un),ih=function(e){return fy(Fn(e))},fy=lg(Le),Che=au(yl),wU=RT(Le),Ohe=wU,oC=hg(Xl),whe=oC,EU=oC,Ehe=EU,xU=mg(Ht),xhe=xU,Mhe=fg(un),MU=function(e){return function(){return $he(void 0,void 0,void 0,function(){return She(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e().then(fe)];case 1:return[2,t.sent()];case 2:return t.sent(),[2,ye];case 3:return[2]}})})}},Rhe=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return MU(function(){return e.apply(void 0,t)})}},khe=dg(un),Ahe=wT(Ht),Fhe=pg(un),Nhe=ET(Ht),aC=vg(Le),RU=gg(Fs),fo=CU,dy=Bl(Ht),Phe=dy(q),uC=yg(Ht),Whe=uC,py=Sp(un),jhe=py(),sC=eo(Le,ms),cC=zo(Le,ms,hl),kU=Ko(Le,Bo),AU=Vo(Le,Bo),FU=tu(Le,Bo),NU=nu(Le,Bo),Hr=function(e,t){return v(e,aC(t))},Us=function(e,t){return v(e,RU(t))},hy=function(e,t){return v(e,dy(t))},PU=function(e,t){return v(e,uC(t))},Lhe=function(e,t){return v(e,kU(t))},Dhe=function(e,t){return v(e,AU(t))},Bhe=function(e,t){return v(e,FU(t))},Uhe=function(e,t){return v(e,NU(t))},Yt="TaskOption",lC={URI:Yt,map:Hr},qhe=Ue(lC),WU={URI:Yt,of:fo},my={URI:Yt,map:Hr,ap:Us},zhe=Ot(my),Khe=wt(my),Vhe={URI:Yt,map:Hr,ap:Us,of:fo},jU=function(e,t){return v(e,dy(function(n){return v(t,aC(n))}))},Hhe={URI:Yt,map:Hr,ap:jU},Ghe={URI:Yt,map:Hr,ap:jU,of:fo},ha={URI:Yt,map:Hr,ap:Us,chain:hy},Yhe=lt(ha),Jhe={URI:Yt,map:Hr,alt:PU},LU={URI:Yt,zero:py},Zhe=nl(LU,WU),Xhe={URI:Yt,map:Hr,ap:Us,of:fo,alt:PU,zero:py},Qhe={URI:Yt,map:Hr,ap:Us,of:fo,chain:hy},eme={URI:Yt,map:Hr,ap:Us,of:fo,chain:hy,fromIO:ih},tme={URI:Yt,map:Hr,ap:Us,of:fo,chain:hy,fromIO:ih,fromTask:fy},nme={URI:Yt,compact:sC,separate:cC},rme={URI:Yt,map:Hr,compact:sC,separate:cC,filter:Lhe,filterMap:Dhe,partition:Bhe,partitionMap:Uhe},vy={URI:Yt,fromIO:ih},ime=no(vy),ome=Ho(vy,ha),ame=Go(vy,ha),gy={URI:Yt,fromEither:OU},ume=Sr(gy),sme=Wo(gy,ha),cme=jo(gy,ha),yy={URI:Yt,fromIO:ih,fromTask:fy},lme=Es(yy),fme=Nl(yy,ha),dme=Pl(yy,ha),pme=fo(zt),hme=Ct(lC),mme=xt(ha),vme=Et(my),fC=fo(tn),DU=function(e){return H(Ql(e),au(Gv(Zn)))},dC=function(e){var t=DU(e);return function(n){return mt(n)?t(n):fC}},BU=function(e){return function(t){return function(){return qc(t).reduce(function(n,r,i){return n.then(function(o){return Ft(o)?n:e(i+1,r)().then(function(a){return Ft(a)?a:(o.value.push(a.value),o)})})},e(0,gr(t))().then(Qi(hd)))}}},pC=function(e){var t=BU(e);return function(n){return mt(n)?t(n):fC}},gme=dC,UU=function(e){return dC(function(t,n){return e(n)})},yme=UU(q),bme=pC,qU=function(e){return pC(function(t,n){return e(n)})},_me=qU(q);const $me=Object.freeze(Object.defineProperty({__proto__:null,Alt:Jhe,Alternative:Xhe,ApT:fC,ApplicativePar:Vhe,ApplicativeSeq:Ghe,ApplyPar:my,ApplySeq:Hhe,Chain:ha,Compactable:nme,Do:pme,Filterable:rme,FromEither:gy,FromIO:vy,FromTask:yy,Functor:lC,Monad:Qhe,MonadIO:eme,MonadTask:tme,Pointed:WU,Zero:LU,alt:uC,altW:Whe,ap:RU,apFirst:zhe,apS:vme,apSecond:Khe,bind:mme,bindTo:hme,chain:dy,chainEitherK:sme,chainFirst:Yhe,chainFirstEitherK:cme,chainFirstIOK:ame,chainFirstTaskK:dme,chainIOK:ome,chainNullableK:Ahe,chainOptionK:Nhe,chainTaskK:fme,compact:sC,filter:kU,filterMap:AU,flap:qhe,flatten:Phe,fold:whe,foldW:Ehe,fromEither:OU,fromEitherK:ume,fromIO:ih,fromIOK:ime,fromNullable:Mhe,fromNullableK:khe,fromOption:Ihe,fromOptionK:Fhe,fromPredicate:The,fromTask:fy,fromTaskEither:Che,fromTaskK:lme,getOrElse:xU,getOrElseW:xhe,guard:Zhe,map:aC,match:wU,matchE:oC,matchEW:EU,matchW:Ohe,none:jhe,of:fo,partition:FU,partitionMap:NU,separate:cC,sequenceArray:yme,sequenceSeqArray:_me,some:CU,traverseArray:UU,traverseArrayWithIndex:gme,traverseReadonlyArrayWithIndex:dC,traverseReadonlyArrayWithIndexSeq:pC,traverseReadonlyNonEmptyArrayWithIndex:DU,traverseReadonlyNonEmptyArrayWithIndexSeq:BU,traverseSeqArray:qU,traverseSeqArrayWithIndex:bme,tryCatch:MU,tryCatchK:Rhe,zero:py},Symbol.toStringTag,{value:"Module"}));var Ge=function(e){return e._tag==="Left"},Rt=function(e){return e._tag==="Right"};function qs(e){return e._tag==="Both"}function pn(e){return{_tag:"Left",left:e}}function or(e){return{_tag:"Right",right:e}}function et(e,t){return{_tag:"Both",left:e,right:t}}var hC=function(e,t,n){return function(r){switch(r._tag){case"Left":return e(r.left);case"Right":return t(r.right);case"Both":return n(r.left,r.right)}}},Sme=hC,vu=hC,Tme=vu,zU=vu(or,pn,function(e,t){return et(t,e)});function Ime(e,t){return{show:vu(function(n){return"left(".concat(e.show(n),")")},function(n){return"right(".concat(t.show(n),")")},function(n,r){return"both(".concat(e.show(n),", ").concat(t.show(r),")")})}}function Cme(e,t){return jr(function(n,r){return Ge(n)?Ge(r)&&e.equals(n.left,r.left):Rt(n)?Rt(r)&&t.equals(n.right,r.right):qs(r)&&e.equals(n.left,r.left)&&t.equals(n.right,r.right)})}function KU(e,t){return{concat:function(n,r){return Ge(n)?Ge(r)?pn(e.concat(n.left,r.left)):Rt(r)?et(n.left,r.right):et(e.concat(n.left,r.left),r.right):Rt(n)?Ge(r)?et(r.left,n.right):Rt(r)?or(t.concat(n.right,r.right)):et(r.left,t.concat(n.right,r.right)):Ge(r)?et(e.concat(n.left,r.left),n.right):Rt(r)?et(n.left,t.concat(n.right,r.right)):et(e.concat(n.left,r.left),t.concat(n.right,r.right))}}}var by=function(e){return{URI:Or,_E:void 0,map:zs,ap:function(t,n){return Ge(t)?Ge(n)?pn(e.concat(t.left,n.left)):Rt(n)?pn(t.left):pn(e.concat(t.left,n.left)):Rt(t)?Ge(n)?pn(n.left):Rt(n)?or(t.right(n.right)):et(n.left,t.right(n.right)):Ge(n)?pn(e.concat(t.left,n.left)):Rt(n)?et(t.left,t.right(n.right)):et(e.concat(t.left,n.left),t.right(n.right))}}};function Ome(e){var t=by(e);return{URI:Or,_E:void 0,map:zs,ap:t.ap,of:oh}}function VU(e){var t=by(e),n=function(r,i){if(Ge(r))return r;if(Rt(r))return i(r.right);var o=i(r.right);return Ge(o)?pn(e.concat(r.left,o.left)):Rt(o)?et(r.left,o.right):et(e.concat(r.left,o.left),o.right)};return{URI:Or,_E:void 0,map:zs,ap:t.ap,chain:n}}function wme(e){var t=VU(e);return{URI:Or,_E:void 0,map:zs,of:oh,ap:t.ap,chain:t.chain,throwError:pn}}function Eme(e){return Ge(e)?fe(e.left):Rt(e)?ye:fe(e.left)}function xme(e){return Ge(e)?ye:(Rt(e),fe(e.right))}function Mme(e){return function(t){return Ft(t)?pn(e):et(e,t.value)}}function Rme(e){return function(t){return Ft(t)?or(e):et(t.value,e)}}function kme(e){return Ge(e)?fe(e.left):ye}function Ame(e){return Rt(e)?fe(e.right):ye}var Fme=function(e,t){return Ft(e)?Ft(t)?ye:fe(or(t.value)):Ft(t)?fe(pn(e.value)):fe(et(e.value,t.value))},zs=function(e,t){return v(e,_C(t))},HU=function(e,t,n){return v(e,yC(t,n))},GU=function(e,t){return v(e,bC(t))},mC=function(e,t,n){return v(e,JU(t,n))},vC=function(e){var t=ZU(e);return function(n,r){return v(n,t(r))}},gC=function(e,t,n){return v(e,XU(t,n))},YU=function(e){var t=QU(e);return function(n,r){return v(n,t(r))}},yC=function(e,t){return function(n){return Ge(n)?pn(e(n.left)):Rt(n)?or(t(n.right)):et(e(n.left),t(n.right))}},bC=function(e){return function(t){return Ge(t)?pn(e(t.left)):qs(t)?et(e(t.left),t.right):t}},_C=function(e){return function(t){return Ge(t)?t:Rt(t)?or(e(t.right)):et(t.left,e(t.right))}},JU=function(e,t){return function(n){return Ge(n)?e:t(e,n.right)}},ZU=function(e){return function(t){return function(n){return Ge(n)?e.empty:t(n.right)}}},XU=function(e,t){return function(n){return Ge(n)?e:t(n.right,e)}},QU=function(e){return function(t){return function(n){return Ge(n)?e.of(n):Rt(n)?e.map(t(n.right),or):e.map(t(n.right),function(r){return et(n.left,r)})}}},$C=function(e){return function(t){return Ge(t)?e.of(t):Rt(t)?e.map(t.right,or):e.map(t.right,function(n){return et(t.left,n)})}},oh=or,Or="These",SC={URI:Or,map:zs},Nme=Ue(SC),Pme={URI:Or,of:oh},Wme={URI:Or,bimap:HU,mapLeft:GU},jme={URI:Or,fromThese:q},Lme={URI:Or,reduce:mC,foldMap:vC,reduceRight:gC},Dme={URI:Or,map:zs,reduce:mC,foldMap:vC,reduceRight:gC,traverse:YU,sequence:$C},TC={URI:Or,fromEither:q},Bme=Yi(TC),Ume=Ji(TC),qme=function(e){return function(t){return function(n){return Ge(n)?!1:e.equals(t,n.right)}}},zme=function(e){return function(t){return Ge(t)?!1:e(t.right)}},IC=function(e,t){return function(n){return Ge(n)?[n.left,t()]:Rt(n)?[e(),n.right]:[n.left,n.right]}},Kme=function(e,t){return IC(function(){return e},function(){return t})},e2=oh(tn),CC=function(e){return function(t){return function(n){var r=ye,i=t(0,gr(n));if(Ge(i))return i;qs(i)&&(r=fe(i.left));for(var o=[i.right],a=1;a<n.length;a++){var u=t(a,n[a]);if(Ge(u))return u;qs(u)&&(r=Ft(r)?fe(u.left):fe(e.concat(r.value,u.left))),o.push(u.right)}return Ft(r)?or(o):et(r.value,o)}}},Vme=function(e){return function(t){var n=CC(e)(t);return function(r){return mt(r)?n(r):e2}}},Hme={URI:Or,map:zs,bimap:HU,mapLeft:GU,reduce:mC,foldMap:vC,reduceRight:gC,traverse:YU,sequence:$C};const Gme=Object.freeze(Object.defineProperty({__proto__:null,ApT:e2,Bifunctor:Wme,Foldable:Lme,FromEither:TC,FromThese:jme,Functor:SC,Pointed:Pme,Traversable:Dme,URI:Or,bimap:yC,both:et,elem:qme,exists:zme,flap:Nme,fold:Tme,foldMap:ZU,foldW:Sme,fromOption:Bme,fromOptionK:Ume,fromOptions:Fme,getApplicative:Ome,getApply:by,getChain:VU,getEq:Cme,getLeft:Eme,getLeftOnly:kme,getMonad:wme,getRight:xme,getRightOnly:Ame,getSemigroup:KU,getShow:Ime,isBoth:qs,isLeft:Ge,isRight:Rt,left:pn,leftOrBoth:Mme,map:_C,mapLeft:bC,match:vu,matchW:hC,of:oh,reduce:JU,reduceRight:XU,right:or,rightOrBoth:Rme,sequence:$C,swap:zU,these:Hme,toTuple:Kme,toTuple2:IC,traverse:QU,traverseReadonlyArrayWithIndex:Vme,traverseReadonlyNonEmptyArrayWithIndex:CC},Symbol.toStringTag,{value:"Module"}));function _y(e){return H(or,e.of)}function $y(e){return H(pn,e.of)}function OC(e){return H(et,e.of)}function wC(e){return function(t){return e.map(t,or)}}function EC(e){return function(t){return e.map(t,pn)}}function xC(e){return Bc(e,SC)}function MC(e,t){return Ao(e,by(t))}function RC(e,t){var n=$y(e);return function(r){return function(i){return e.chain(i,vu(n,r,function(o,a){return e.map(r(a),vu(function(u){return pn(t.concat(o,u))},function(u){return et(o,u)},function(u,s){return et(t.concat(o,u),s)}))}))}}}function kC(e){return function(t,n){return function(r){return e.map(r,yC(t,n))}}}function AC(e){return function(t){return function(n){return e.map(n,bC(t))}}}function t2(e){return function(t,n,r){return function(i){return e.map(i,vu(t,n,r))}}}function FC(e){return function(t,n,r){return function(i){return e.chain(i,vu(t,n,r))}}}function NC(e){return function(t){return e.map(t,zU)}}function PC(e){return function(t,n){return function(r){return e.map(r,IC(t,n))}}}function Yme(e){var t=xC(e),n=kC(e),r=AC(e),i=FC(e),o=PC(e),a=_y(e),u=function(s,c){return v(s,t(c))};return{map:u,bimap:function(s,c,l){return v(s,n(c,l))},mapLeft:function(s,c){return v(s,r(c))},fold:function(s,c,l,f){return v(s,i(c,l,f))},swap:NC(e),rightM:wC(e),leftM:EC(e),left:$y(e),right:_y(e),both:OC(e),toTuple:function(s,c,l){return v(s,o(function(){return c},function(){return l}))},getMonad:function(s){var c=MC(e,s),l=RC(e,s);return{_E:void 0,map:u,of:a,ap:function(f,d){return v(f,c(d))},chain:function(f,d){return v(f,l(d))}}}}}const Jme=Object.freeze(Object.defineProperty({__proto__:null,ap:MC,bimap:kC,both:OC,chain:RC,getTheseM:Yme,left:$y,leftF:EC,map:xC,mapLeft:AC,match:t2,matchE:FC,right:_y,rightF:wC,swap:NC,toTuple2:PC},Symbol.toStringTag,{value:"Module"}));var Zme=$y(un),n2=_y(un),Xme=OC(un),WC=wC(Le),r2=EC(Le),i2=H(Fn,WC),Qme=H(Fn,r2),o2=Sn,a2=Sn,Sy=i2,eve=Fn,jC=WC,u2=t2(Le),tve=u2,s2=FC(Ht),c2=s2,l2=c2,nve=l2,rve=NC(Le),Ks=function(e,t){return v(e,f2(t))},LC=function(e,t,n){return v(e,d2(t,n))},DC=function(e,t){return v(e,p2(t))},f2=xC(Le),d2=kC(Le),p2=AC(Le),ah=n2,Wn="TaskThese",BC=function(e,t){var n=MC(e,t);return{URI:Wn,_E:void 0,map:Ks,ap:function(r,i){return v(r,n(i))}}};function h2(e,t){var n=BC(e,t).ap;return{URI:Wn,_E:void 0,map:Ks,ap:n,of:ah}}function m2(e){var t=BC(Ap,e),n=RC(Ht,e);return{URI:Wn,_E:void 0,map:Ks,ap:t.ap,chain:function(r,i){return v(r,n(i))}}}function ive(e){var t=h2(Ap,e),n=m2(e);return{URI:Wn,_E:void 0,map:Ks,ap:t.ap,of:ah,chain:n.chain,fromIO:Sy,fromTask:jC}}var v2={URI:Wn,map:Ks},ove=Ue(v2),ave={URI:Wn,of:ah},uve={URI:Wn,bimap:LC,mapLeft:DC},Ty={URI:Wn,fromEither:o2},sve=Yi(Ty),cve=Ji(Ty),lve=Va(Ty),g2={URI:Wn,fromThese:a2},fve=IP(g2),y2={URI:Wn,fromIO:Sy},dve=no(y2),b2={URI:Wn,fromIO:Sy,fromTask:jC},pve=Es(b2),_2=PC(Le),UC=ah(tn),$2=function(e){var t=CC(e);return function(n){return H(Ql(n),au(t(Zn)))}},hve=function(e){return function(t){var n=$2(e)(t);return function(r){return mt(r)?n(r):UC}}},S2=function(e){return function(t){return function(n){return function(){return qc(n).reduce(function(r,i,o){return r.then(function(a){return Ge(a)?r:t(o+1,i)().then(function(u){if(Ge(u))return u;if(qs(u)){var s=a.right;return s.push(u.right),qs(a)?et(e.concat(a.left,u.left),s):et(u.left,s)}return a.right.push(u.right),a})})},t(0,gr(n))().then(_C(hd)))}}}},mve=function(e){return function(t){var n=S2(e)(t);return function(r){return mt(r)?n(r):UC}}},vve={URI:Wn,map:Ks},gve={URI:Wn,bimap:LC,mapLeft:DC},yve=function(e,t){return _2(function(){return e},function(){return t})},bve={URI:Wn,map:Ks,bimap:LC,mapLeft:DC},_ve=function(e,t){return Kt(Pg)(KU(e,t))};const $ve=Object.freeze(Object.defineProperty({__proto__:null,ApT:UC,Bifunctor:uve,FromEither:Ty,FromIO:y2,FromTask:b2,FromThese:g2,Functor:v2,Pointed:ave,URI:Wn,bifunctorTaskThese:gve,bimap:d2,both:Xme,flap:ove,fold:c2,foldW:nve,fromEither:o2,fromIO:Sy,fromIOEither:eve,fromIOK:dve,fromOption:sve,fromOptionK:cve,fromPredicate:lve,fromTask:jC,fromTaskK:pve,fromThese:a2,fromTheseK:fve,functorTaskThese:vve,getApplicative:h2,getApply:BC,getChain:m2,getMonad:ive,getSemigroup:_ve,left:Zme,leftIO:Qme,leftTask:r2,map:f2,mapLeft:p2,match:u2,matchE:s2,matchEW:l2,matchW:tve,of:ah,right:n2,rightIO:i2,rightTask:WC,swap:rve,taskThese:bve,toTuple:yve,toTuple2:_2,traverseReadonlyArrayWithIndex:hve,traverseReadonlyArrayWithIndexSeq:mve,traverseReadonlyNonEmptyArrayWithIndex:$2,traverseReadonlyNonEmptyArrayWithIndexSeq:S2},Symbol.toStringTag,{value:"Module"}));function Sve(e,t){return function(n){return n(t(n(e.empty)))}}function Tve(e){return function(t){return[e(t),t]}}function Ive(e){return function(t){return function(n){return[t(n),e(n)]}}}function Cve(e){return function(t){return function(n){return t(e(n))}}}function Ove(e){function t(r,i){return function(o){return i(function(a){return r(e.concat(o,a))})}}function n(r){return r(e.empty)}return{URI:qC,_E:void 0,map:T2,extend:t,extract:n}}var T2=function(e,t){return v(e,I2(t))},I2=function(e){return function(t){return function(n){return e(t(n))}}},qC="Traced",zC={URI:qC,map:T2},wve=Ue(zC),Eve=zC;const xve=Object.freeze(Object.defineProperty({__proto__:null,Functor:zC,URI:qC,censor:Cve,flap:wve,getComonad:Ove,listen:Tve,listens:Ive,map:I2,traced:Eve,tracks:Sve},Symbol.toStringTag,{value:"Module"}));function C2(e,t){return function(n){var r=e.traverse(n),i=t.traverse(n);return function(o){return function(a){return r(a,function(u){return i(u,o)})}}}}function O2(e,t){return function(n){var r=e.sequence(n),i=t.sequence(n);return function(o){return r(e.map(o,i))}}}function Mve(e,t){var n=Uc(e,t).map,r=BS(e,t),i=C2(e,t),o=O2(e,t);return{map:n,reduce:r.reduce,foldMap:r.foldMap,reduceRight:r.reduceRight,traverse:function(a){var u=i(a);return function(s,c){return v(s,u(c))}},sequence:function(a){var u=o(a);return function(s){return v(s,u)}}}}const Rve=Object.freeze(Object.defineProperty({__proto__:null,getTraversableComposition:Mve,sequence:O2,traverse:C2},Symbol.toStringTag,{value:"Module"})),kve=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function w2(e,t){return t===void 0&&(t=[]),{value:e,forest:t}}function Ave(e){var t=function(n){return Ya(n.forest)?"make(".concat(e.show(n.value),")"):"make(".concat(e.show(n.value),", [").concat(n.forest.map(t).join(", "),"])")};return{show:t}}function Fve(e){var t,n=jr(function(r,i){return e.equals(r.value,i.value)&&t.equals(r.forest,i.forest)});return t=nF(n),n}var E2=function(e,t){for(var n="",r=t.length,i,o=0;o<r;o++){i=t[o];var a=o===r-1;n+=e+(a?"└":"├")+"─ "+i.value,n+=E2(e+(r>1&&!a?"│ ":" "),i.forest)}return n};function x2(e){return E2(`
28
- `,e)}function Nve(e){return e.value+x2(e.forest)}function M2(e,t){var n=t(e),r=n[0],i=n[1];return{value:r,forest:R2(i,t)}}function R2(e,t){return e.map(function(n){return M2(n,t)})}function k2(e){var t=A2(e);return function(n,r){return e.chain(r(n),function(i){var o=i[0],a=i[1];return e.map(t(a,r),function(u){return{value:o,forest:u}})})}}function A2(e){var t=Pv(e);return function(n,r){return v(n,t(function(i){return k2(e)(i,r)}))}}function Pve(e){var t=function(n){return e(n.value,n.forest.map(t))};return t}var gu=function(e,t){return v(e,Cy(t))},ff=function(e,t){return v(e,uh(function(n){return v(t,Cy(n))}))},KC=function(e,t){return v(e,uh(t))},VC=function(e,t,n){return v(e,Oy(t,n))},HC=function(e){var t=P2(e);return function(n,r){return v(n,t(r))}},GC=function(e,t,n){return v(e,YC(t,n))},F2=function(e,t){return v(e,Iy(t))},N2=function(e){var t=ZC(e);return function(n,r){return v(n,t(r))}},Wve=function(e){return function(t){return ff(t,e)}},uh=function(e){return function(t){var n=e(t.value),r=n.value,i=n.forest,o=eS().concat;return{value:r,forest:o(i,t.forest.map(uh(e)))}}},Iy=function(e){return function(t){return{value:e(t),forest:t.forest.map(Iy(e))}}},jve=Iy(q),Lve=uh(q),Cy=function(e){return function(t){return{value:e(t.value),forest:t.forest.map(Cy(e))}}},Oy=function(e,t){return function(n){for(var r=t(e,n.value),i=n.forest.length,o=0;o<i;o++)r=v(n.forest[o],Oy(r,t));return r}},P2=function(e){return function(t){return Oy(e.empty,function(n,r){return e.concat(n,t(r))})}},YC=function(e,t){return function(n){for(var r=e,i=n.forest.length,o=i-1;o>=0;o--)r=v(n.forest[o],YC(r,t));return t(n.value,r)}},JC=function(e){return e.value},ZC=function(e){var t=Pv(e),n=function(r){return function(i){return e.ap(e.map(r(i.value),function(o){return function(a){return{value:o,forest:a}}}),v(i.forest,t(n(r))))}};return n},XC=function(e){return ZC(e)(q)},df=function(e){return w2(e)},Oi="Tree",QC={URI:Oi,map:gu},Dve=Ue(QC),Bve={URI:Oi,of:df},wy={URI:Oi,map:gu,ap:ff},Uve=Ot(wy),qve=wt(wy),zve={URI:Oi,map:gu,ap:ff,of:df},eO={URI:Oi,map:gu,ap:ff,chain:KC},Kve={URI:Oi,map:gu,ap:ff,of:df,chain:KC},Vve=lt(eO),Hve={URI:Oi,reduce:VC,foldMap:HC,reduceRight:GC},Gve={URI:Oi,map:gu,reduce:VC,foldMap:HC,reduceRight:GC,traverse:N2,sequence:XC},Yve={URI:Oi,map:gu,extend:F2,extract:JC},Jve=df(zt),Zve=Ct(QC),Xve=xt(eO),Qve=Et(wy);function ege(e){var t=function(n,r){return e.equals(n,r.value)||r.forest.some(function(i){return t(n,i)})};return t}var W2=function(e){return function(t){return e(t.value)||t.forest.some(W2(e))}},tge={URI:Oi,map:gu,of:df,ap:ff,chain:KC,reduce:VC,foldMap:HC,reduceRight:GC,traverse:N2,sequence:XC,extract:JC,extend:F2};const nge=Object.freeze(Object.defineProperty({__proto__:null,Applicative:zve,Apply:wy,Chain:eO,Comonad:Yve,Do:Jve,Foldable:Hve,Functor:QC,Monad:Kve,Pointed:Bve,Traversable:Gve,URI:Oi,ap:Wve,apFirst:Uve,apS:Qve,apSecond:qve,bind:Xve,bindTo:Zve,chain:uh,chainFirst:Vve,drawForest:x2,drawTree:Nve,duplicate:jve,elem:ege,exists:W2,extend:Iy,extract:JC,flap:Dve,flatten:Lve,fold:Pve,foldMap:P2,getEq:Fve,getShow:Ave,make:w2,map:Cy,of:df,reduce:Oy,reduceRight:YC,sequence:XC,traverse:ZC,tree:tge,unfoldForest:R2,unfoldForestM:A2,unfoldTree:M2,unfoldTreeM:k2},Symbol.toStringTag,{value:"Module"}));var wr=Gt,ar=In,rge=function(e){return[ar(e),wr(e)]};function tO(e){return{URI:Er,_E:void 0,map:sh,ap:function(t,n){return[wr(t)(wr(n)),e.concat(ar(t),ar(n))]}}}var j2=function(e){return function(t){return[t,e.empty]}};function ige(e){var t=tO(e);return{URI:Er,_E:void 0,map:t.map,ap:t.ap,of:j2(e)}}function nO(e){var t=tO(e);return{URI:Er,_E:void 0,map:t.map,ap:t.ap,chain:function(n,r){var i=r(wr(n)),o=i[0],a=i[1];return[o,e.concat(ar(n),a)]}}}function oge(e){var t=nO(e);return{URI:Er,_E:void 0,map:t.map,ap:t.ap,chain:t.chain,of:j2(e)}}function age(e){var t=function(r,i){for(var o=i(r),a=e.empty,u=wr(o);u._tag==="Left";)a=e.concat(a,ar(o)),o=i(u.left),u=wr(o);return[u.right,e.concat(a,ar(o))]},n=nO(e);return{URI:Er,_E:void 0,map:n.map,ap:n.ap,chain:n.chain,chainRec:t}}var L2=function(e,t){return v(e,K2(t))},sh=function(e,t){return v(e,aO(t))},D2=function(e,t,n){return v(e,z2(t,n))},B2=function(e,t){return v(e,uO(t))},U2=function(e,t){return v(e,sO(t))},rO=function(e,t,n){return v(e,H2(t,n))},iO=function(e){var t=V2();return function(n,r){return v(n,t(r))}},oO=function(e,t,n){return v(e,G2(t,n))};function q2(e){var t=Y2(e);return function(n,r){return v(n,t(r))}}var z2=function(e,t){return function(n){return[t(wr(n)),e(ar(n))]}},aO=function(e){return function(t){return[e(wr(t)),ar(t)]}},uO=function(e){return function(t){return[wr(t),e(ar(t))]}},K2=function(e){return function(t){return[wr(t),ar(e)]}},sO=function(e){return function(t){return[e(t),ar(t)]}},uge=sO(q),cO=iy,V2=E1,H2=w1,G2=x1,Y2=function(e){return function(t){return function(n){return e.map(t(wr(n)),function(r){return[r,ar(n)]})}}},lO=function(e){return function(t){return e.map(wr(t),function(n){return[n,ar(t)]})}},Er="Tuple",J2={URI:Er,map:sh},sge=Ue(J2),cge={URI:Er,bimap:D2,mapLeft:B2},lge={URI:Er,compose:L2},fge={URI:Er,map:sh,extend:U2,extract:cO},dge={URI:Er,reduce:rO,foldMap:iO,reduceRight:oO},pge={URI:Er,map:sh,reduce:rO,foldMap:iO,reduceRight:oO,traverse:q2,sequence:lO},hge=aO,mge=uO,vge={URI:Er,compose:L2,map:sh,bimap:D2,mapLeft:B2,extract:cO,extend:U2,reduce:rO,foldMap:iO,reduceRight:oO,traverse:q2,sequence:lO};const gge=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:cge,Comonad:fge,Foldable:dge,Functor:J2,Semigroupoid:lge,Traversable:pge,URI:Er,bimap:z2,compose:K2,duplicate:uge,extend:sO,extract:cO,flap:sge,foldMap:V2,fst:wr,getApplicative:ige,getApply:tO,getChain:nO,getChainRec:age,getMonad:oge,map:hge,mapFst:aO,mapLeft:mge,mapSnd:uO,reduce:H2,reduceRight:G2,sequence:lO,snd:ar,swap:rge,traverse:Y2,tuple:vge},Symbol.toStringTag,{value:"Module"})),yge=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function bge(e,t){var n=GR(t,Xa(e));return{map:n.map,ap:n.ap,of:n.of,chain:function(r,i){return t.chain(r,function(o){return qt(o)?t.of(ko(o.left)):i(o.right)})},alt:function(r,i){return t.chain(r,function(o){return P_(o)?t.of(o):t.map(i(),function(a){return qt(a)?ko(e.concat(o.left,a.left)):a})})}}}const _ge=Object.freeze(Object.defineProperty({__proto__:null,getValidationM:bge},Symbol.toStringTag,{value:"Module"}));var Z2=q_(void 0),$ge={concat:Z2.concat,empty:void 0};const Sge=Object.freeze(Object.defineProperty({__proto__:null,Monoid:$ge,Semigroup:Z2},Symbol.toStringTag,{value:"Module"}));var Tge=function(e){return function(){return[void 0,e]}},Ige=function(e){return function(){var t=e(),n=t[0],r=t[1];return[[n,r],r]}},Cge=function(e){return function(){var t=e(),n=t[0],r=n[0],i=n[1],o=t[1];return[r,i(o)]}},Oge=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[[r,e(i)],i]}}},wge=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[r,e(i)]}}},ch=function(e,t){return v(e,X2(t))},X2=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[e(r),i]}}},Vs="Writer",Q2=function(e){return{URI:Vs,_E:void 0,of:function(t){return function(){return[t,e.empty]}}}},fO=function(e){return{URI:Vs,_E:void 0,map:ch,ap:function(t,n){return function(){var r=t(),i=r[0],o=r[1],a=n(),u=a[0],s=a[1];return[i(u),e.concat(o,s)]}}}},eq=function(e){var t=fO(e),n=Q2(e);return{URI:Vs,_E:void 0,map:ch,ap:t.ap,of:n.of}};function tq(e){var t=fO(e);return{URI:Vs,_E:void 0,map:ch,ap:t.ap,chain:function(n,r){return function(){var i=n(),o=i[0],a=i[1],u=r(o)(),s=u[0],c=u[1];return[s,e.concat(a,c)]}}}}function Ege(e){var t=eq(e),n=tq(e);return{URI:Vs,_E:void 0,map:ch,ap:t.ap,of:t.of,chain:n.chain}}var dO={URI:Vs,map:ch},xge=Ue(dO),Mge=function(e){return e()[0]},Rge=function(e){return e()[1]},kge=function(e){return e()[0]},Age=function(e){return e()[1]},Fge=dO;const Nge=Object.freeze(Object.defineProperty({__proto__:null,Functor:dO,URI:Vs,censor:wge,evalWriter:kge,evaluate:Mge,execWriter:Age,execute:Rge,flap:xge,getApplicative:eq,getApply:fO,getChain:tq,getMonad:Ege,getPointed:Q2,listen:Ige,listens:Oge,map:X2,pass:Cge,tell:Tge,writer:Fge},Symbol.toStringTag,{value:"Module"}));function Pge(e){var t=function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[r(o),a]})}};return{map:t,evalWriter:function(n){return e.map(n(),function(r){var i=r[0];return i})},execWriter:function(n){return e.map(n(),function(r){r[0];var i=r[1];return i})},tell:function(n){return function(){return e.of([void 0,n])}},listen:function(n){return function(){return e.map(n(),function(r){var i=r[0],o=r[1];return[[i,o],o]})}},pass:function(n){return function(){return e.map(n(),function(r){var i=r[0],o=i[0],a=i[1],u=r[1];return[o,a(u)]})}},listens:function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[[o,r(a)],a]})}},censor:function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[o,r(a)]})}},getMonad:function(n){return{_E:void 0,map:t,of:function(r){return function(){return e.of([r,n.empty])}},ap:function(r,i){return function(){return e.chain(r(),function(o){var a=o[0],u=o[1];return e.map(i(),function(s){var c=s[0],l=s[1];return[a(c),n.concat(u,l)]})})}},chain:function(r,i){return function(){return e.chain(r(),function(o){var a=o[0],u=o[1];return e.map(i(a)(),function(s){var c=s[0],l=s[1];return[c,n.concat(u,l)]})})}}}}}}const ht=jc(Object.freeze(Object.defineProperty({__proto__:null,alt:LG,alternative:BG,applicative:UG,apply:E6,array:X8,bifunctor:Q8,boolean:uZ,booleanAlgebra:dZ,bounded:vZ,boundedDistributiveLattice:bZ,boundedJoinSemilattice:_Z,boundedLattice:$Z,boundedMeetSemilattice:SZ,category:TZ,chain:x6,chainRec:IZ,choice:wZ,comonad:EZ,compactable:bX,console:IX,const:LX,contravariant:DX,date:GX,distributiveLattice:gZ,either:PN,eitherT:PQ,endomorphism:jQ,eq:m6,extend:LQ,field:UQ,filterable:zQ,filterableWithIndex:KQ,foldable:ZQ,foldableWithIndex:QQ,fromEither:qG,fromIO:eee,fromReader:See,fromState:Uee,fromTask:qee,fromThese:zee,function:EM,functor:v6,functorWithIndex:Vee,group:Hee,heytingAlgebra:Gee,hkt:Yee,identity:gte,invariant:yte,io:Wte,ioEither:Wne,ioOption:Mre,ioRef:kre,joinSemilattice:Are,json:Pre,lattice:Wre,magma:H6,map:Vie,meetSemilattice:Hie,monad:Gie,monadIO:Yie,monadTask:Jie,monadThrow:Zie,monoid:loe,naturalTransformation:foe,nonEmptyArray:NY,number:UY,option:gX,optionT:Lne,ord:q6,ordering:yoe,pipeable:Poe,pointed:Woe,predicate:AZ,profunctor:joe,random:Uoe,reader:$ee,readerEither:jae,readerT:Bae,readerTask:Yue,readerTaskEither:Sle,readonlyArray:hJ,readonlyMap:lie,readonlyNonEmptyArray:K9,readonlyRecord:WG,readonlySet:Lle,readonlyTuple:efe,record:tde,refinement:lde,ring:hde,semigroup:nR,semigroupoid:mde,semiring:gde,separated:T6,set:Lde,show:Kde,state:Bee,stateReaderTaskEither:ohe,stateT:Hde,store:hhe,string:sG,strong:ghe,struct:_he,task:pue,taskEither:oce,taskOption:$me,taskThese:$ve,these:Gme,theseT:Jme,traced:xve,traversable:Rve,traversableWithIndex:kve,tree:nge,tuple:gge,unfoldable:yge,validationT:_ge,void:Sge,witherable:cG,writer:Nge,writerT:Object.freeze(Object.defineProperty({__proto__:null,getWriterM:Pge},Symbol.toStringTag,{value:"Module"})),zero:qY},Symbol.toStringTag,{value:"Module"})));var Cn={},pf={},hn={},Ye={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getEndomorphismMonoid=e.not=e.SK=e.hole=e.pipe=e.untupled=e.tupled=e.absurd=e.decrement=e.increment=e.tuple=e.flow=e.flip=e.constVoid=e.constUndefined=e.constNull=e.constFalse=e.constTrue=e.constant=e.unsafeCoerce=e.identity=e.apply=e.getRing=e.getSemiring=e.getMonoid=e.getSemigroup=e.getBooleanAlgebra=void 0;var t=function(w){return function(){return{meet:function(O,M){return function(x){return w.meet(O(x),M(x))}},join:function(O,M){return function(x){return w.join(O(x),M(x))}},zero:function(){return w.zero},one:function(){return w.one},implies:function(O,M){return function(x){return w.implies(O(x),M(x))}},not:function(O){return function(M){return w.not(O(M))}}}}};e.getBooleanAlgebra=t;var n=function(w){return function(){return{concat:function(O,M){return function(x){return w.concat(O(x),M(x))}}}}};e.getSemigroup=n;var r=function(w){var O=(0,e.getSemigroup)(w);return function(){return{concat:O().concat,empty:function(){return w.empty}}}};e.getMonoid=r;var i=function(w){return{add:function(O,M){return function(x){return w.add(O(x),M(x))}},zero:function(){return w.zero},mul:function(O,M){return function(x){return w.mul(O(x),M(x))}},one:function(){return w.one}}};e.getSemiring=i;var o=function(w){var O=(0,e.getSemiring)(w);return{add:O.add,mul:O.mul,one:O.one,zero:O.zero,sub:function(M,x){return function(U){return w.sub(M(U),x(U))}}}};e.getRing=o;var a=function(w){return function(O){return O(w)}};e.apply=a;function u(w){return w}e.identity=u,e.unsafeCoerce=u;function s(w){return function(){return w}}e.constant=s,e.constTrue=s(!0),e.constFalse=s(!1),e.constNull=s(null),e.constUndefined=s(void 0),e.constVoid=e.constUndefined;function c(w){return function(O,M){return w(M,O)}}e.flip=c;function l(w,O,M,x,U,B,P,Z,ee){switch(arguments.length){case 1:return w;case 2:return function(){return O(w.apply(this,arguments))};case 3:return function(){return M(O(w.apply(this,arguments)))};case 4:return function(){return x(M(O(w.apply(this,arguments))))};case 5:return function(){return U(x(M(O(w.apply(this,arguments)))))};case 6:return function(){return B(U(x(M(O(w.apply(this,arguments))))))};case 7:return function(){return P(B(U(x(M(O(w.apply(this,arguments)))))))};case 8:return function(){return Z(P(B(U(x(M(O(w.apply(this,arguments))))))))};case 9:return function(){return ee(Z(P(B(U(x(M(O(w.apply(this,arguments)))))))))}}}e.flow=l;function f(){for(var w=[],O=0;O<arguments.length;O++)w[O]=arguments[O];return w}e.tuple=f;function d(w){return w+1}e.increment=d;function p(w){return w-1}e.decrement=p;function h(w){throw new Error("Called `absurd` function which should be uncallable")}e.absurd=h;function m(w){return function(O){return w.apply(void 0,O)}}e.tupled=m;function g(w){return function(){for(var O=[],M=0;M<arguments.length;M++)O[M]=arguments[M];return w(O)}}e.untupled=g;function _(w,O,M,x,U,B,P,Z,ee){switch(arguments.length){case 1:return w;case 2:return O(w);case 3:return M(O(w));case 4:return x(M(O(w)));case 5:return U(x(M(O(w))));case 6:return B(U(x(M(O(w)))));case 7:return P(B(U(x(M(O(w))))));case 8:return Z(P(B(U(x(M(O(w)))))));case 9:return ee(Z(P(B(U(x(M(O(w))))))));default:{for(var J=arguments[0],ge=1;ge<arguments.length;ge++)J=arguments[ge](J);return J}}}e.pipe=_,e.hole=h;var S=function(w,O){return O};e.SK=S;function C(w){return function(O){return!w(O)}}e.not=C;var b=function(){return{concat:function(w,O){return l(w,O)},empty:u}};e.getEndomorphismMonoid=b})(Ye);var ke={},Wge=de&&de.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(ke,"__esModule",{value:!0}),ke.fromReadonlyNonEmptyArray=ke.has=ke.emptyRecord=ke.emptyReadonlyArray=ke.tail=ke.head=ke.isNonEmpty=ke.singleton=ke.right=ke.left=ke.isRight=ke.isLeft=ke.some=ke.none=ke.isSome=ke.isNone=void 0;var jge=function(e){return e._tag==="None"};ke.isNone=jge;var Lge=function(e){return e._tag==="Some"};ke.isSome=Lge,ke.none={_tag:"None"};var Dge=function(e){return{_tag:"Some",value:e}};ke.some=Dge;var Bge=function(e){return e._tag==="Left"};ke.isLeft=Bge;var Uge=function(e){return e._tag==="Right"};ke.isRight=Uge;var qge=function(e){return{_tag:"Left",left:e}};ke.left=qge;var zge=function(e){return{_tag:"Right",right:e}};ke.right=zge;var Kge=function(e){return[e]};ke.singleton=Kge;var Vge=function(e){return e.length>0};ke.isNonEmpty=Vge;var Hge=function(e){return e[0]};ke.head=Hge;var Gge=function(e){return e.slice(1)};ke.tail=Gge,ke.emptyReadonlyArray=[],ke.emptyRecord={},ke.has=Object.prototype.hasOwnProperty;var Yge=function(e){return Wge([e[0]],e.slice(1),!0)};ke.fromReadonlyNonEmptyArray=Yge;var Jge=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Zge=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Xge=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Jge(t,e,n);return Zge(t,e),t};Object.defineProperty(hn,"__esModule",{value:!0}),hn.sequenceS=hn.sequenceT=hn.getApplySemigroup=hn.apS=hn.apSecond=hn.apFirst=hn.ap=void 0;var Qge=Ye,eye=Xge(ke);function tye(e,t){return function(n){return function(r){return e.ap(e.map(r,function(i){return function(o){return t.ap(i,o)}}),n)}}}hn.ap=tye;function nye(e){return function(t){return function(n){return e.ap(e.map(n,function(r){return function(){return r}}),t)}}}hn.apFirst=nye;function rye(e){return function(t){return function(n){return e.ap(e.map(n,function(){return function(r){return r}}),t)}}}hn.apSecond=rye;function iye(e){return function(t,n){return function(r){return e.ap(e.map(r,function(i){return function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))}}),n)}}}hn.apS=iye;function oye(e){return function(t){return{concat:function(n,r){return e.ap(e.map(n,function(i){return function(o){return t.concat(i,o)}}),r)}}}}hn.getApplySemigroup=oye;function pO(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,t===0?e.apply(null,i):pO(e,t-1,i)}}var hO={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function aye(e){return eye.has.call(hO,e)||(hO[e]=pO(Qge.tuple,e-1,[])),hO[e]}function uye(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=aye(r),o=e.map(t[0],i),a=1;a<r;a++)o=e.ap(o,t[a]);return o}}hn.sequenceT=uye;function sye(e){var t=e.length;switch(t){case 1:return function(n){var r;return r={},r[e[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[e[0]]=n,i[e[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[e[0]]=n,o[e[1]]=r,o[e[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[e[0]]=n,a[e[1]]=r,a[e[2]]=i,a[e[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[e[0]]=n,u[e[1]]=r,u[e[2]]=i,u[e[3]]=o,u[e[4]]=a,u}}}}};default:return pO(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i},t-1,[])}}function cye(e){return function(t){for(var n=Object.keys(t),r=n.length,i=sye(n),o=e.map(t[n[0]],i),a=1;a<r;a++)o=e.ap(o,t[n[a]]);return o}}hn.sequenceS=cye;var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.getFunctorComposition=Gr.bindTo=Gr.flap=Gr.map=void 0;var lye=Ye;function nq(e,t){return function(n){return function(r){return e.map(r,function(i){return t.map(i,n)})}}}Gr.map=nq;function fye(e){return function(t){return function(n){return e.map(n,function(r){return r(t)})}}}Gr.flap=fye;function dye(e){return function(t){return function(n){return e.map(n,function(r){var i;return i={},i[t]=r,i})}}}Gr.bindTo=dye;function pye(e,t){var n=nq(e,t);return{map:function(r,i){return(0,lye.pipe)(r,n(i))}}}Gr.getFunctorComposition=pye,Object.defineProperty(pf,"__esModule",{value:!0}),pf.getApplicativeComposition=pf.getApplicativeMonoid=void 0;var rq=hn,hye=Ye,mye=Gr;function vye(e){var t=(0,rq.getApplySemigroup)(e);return function(n){return{concat:t(n).concat,empty:e.of(n.empty)}}}pf.getApplicativeMonoid=vye;function gye(e,t){var n=(0,mye.getFunctorComposition)(e,t).map,r=(0,rq.ap)(e,t);return{map:n,of:function(i){return e.of(t.of(i))},ap:function(i,o){return(0,hye.pipe)(i,r(o))}}}pf.getApplicativeComposition=gye;var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.bind=Hs.chainFirst=void 0;function yye(e){return function(t){return function(n){return e.chain(n,function(r){return e.map(t(r),function(){return r})})}}}Hs.chainFirst=yye;function bye(e){return function(t,n){return function(r){return e.chain(r,function(i){return e.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))})})}}}Hs.bind=bye;var Ey={};Object.defineProperty(Ey,"__esModule",{value:!0}),Ey.tailRec=void 0;var _ye=function(e,t){for(var n=t(e);n._tag==="Left";)n=t(n.left);return n.right};Ey.tailRec=_ye;var Jt={},$ye=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Sye=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Tye=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&$ye(t,e,n);return Sye(t,e),t};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.filterOrElse=Jt.chainFirstEitherK=Jt.chainEitherK=Jt.fromEitherK=Jt.chainOptionK=Jt.fromOptionK=Jt.fromPredicate=Jt.fromOption=void 0;var Iye=Hs,mO=Ye,Gs=Tye(ke);function iq(e){return function(t){return function(n){return e.fromEither(Gs.isNone(n)?Gs.left(t()):Gs.right(n.value))}}}Jt.fromOption=iq;function Cye(e){return function(t,n){return function(r){return e.fromEither(t(r)?Gs.right(r):Gs.left(n(r)))}}}Jt.fromPredicate=Cye;function oq(e){var t=iq(e);return function(n){var r=t(n);return function(i){return(0,mO.flow)(i,r)}}}Jt.fromOptionK=oq;function Oye(e,t){var n=oq(e);return function(r){var i=n(r);return function(o){return function(a){return t.chain(a,i(o))}}}}Jt.chainOptionK=Oye;function vO(e){return function(t){return(0,mO.flow)(t,e.fromEither)}}Jt.fromEitherK=vO;function wye(e,t){var n=vO(e);return function(r){return function(i){return t.chain(i,n(r))}}}Jt.chainEitherK=wye;function Eye(e,t){return(0,mO.flow)(vO(e),(0,Iye.chainFirst)(t))}Jt.chainFirstEitherK=Eye;function xye(e,t){return function(n,r){return function(i){return t.chain(i,function(o){return e.fromEither(n(o)?Gs.right(o):Gs.left(r(o)))})}}}Jt.filterOrElse=xye;var aq={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.right=e.left=e.flap=e.Functor=e.Bifunctor=e.URI=e.bimap=e.mapLeft=e.map=e.separated=void 0;var t=Ye,n=Gr,r=function(d,p){return{left:d,right:p}};e.separated=r;var i=function(d,p){return(0,t.pipe)(d,(0,e.map)(p))},o=function(d,p){return(0,t.pipe)(d,(0,e.mapLeft)(p))},a=function(d,p,h){return(0,t.pipe)(d,(0,e.bimap)(p,h))},u=function(d){return function(p){return(0,e.separated)((0,e.left)(p),d((0,e.right)(p)))}};e.map=u;var s=function(d){return function(p){return(0,e.separated)(d((0,e.left)(p)),(0,e.right)(p))}};e.mapLeft=s;var c=function(d,p){return function(h){return(0,e.separated)(d((0,e.left)(h)),p((0,e.right)(h)))}};e.bimap=c,e.URI="Separated",e.Bifunctor={URI:e.URI,mapLeft:o,bimap:a},e.Functor={URI:e.URI,map:i},e.flap=(0,n.flap)(e.Functor);var l=function(d){return d.left};e.left=l;var f=function(d){return d.right};e.right=f})(aq);var yu={},Mye=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Rye=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),kye=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Mye(t,e,n);return Rye(t,e),t};Object.defineProperty(yu,"__esModule",{value:!0}),yu.filterE=yu.witherDefault=yu.wiltDefault=void 0;var uq=kye(ke);function Aye(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.separate)}}}yu.wiltDefault=Aye;function Fye(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.compact)}}}yu.witherDefault=Fye;function Nye(e){return function(t){var n=e.wither(t);return function(r){return function(i){return n(i,function(o){return t.map(r(o),function(a){return a?uq.some(o):uq.none})})}}}}yu.filterE=Nye,function(e){var t=de&&de.__createBinding||(Object.create?function(W,F,D,Fe){Fe===void 0&&(Fe=D);var j=Object.getOwnPropertyDescriptor(F,D);(!j||("get"in j?!F.__esModule:j.writable||j.configurable))&&(j={enumerable:!0,get:function(){return F[D]}}),Object.defineProperty(W,Fe,j)}:function(W,F,D,Fe){Fe===void 0&&(Fe=D),W[Fe]=F[D]}),n=de&&de.__setModuleDefault||(Object.create?function(W,F){Object.defineProperty(W,"default",{enumerable:!0,value:F})}:function(W,F){W.default=F}),r=de&&de.__importStar||function(W){if(W&&W.__esModule)return W;var F={};if(W!=null)for(var D in W)D!=="default"&&Object.prototype.hasOwnProperty.call(W,D)&&t(F,W,D);return n(F,W),F};Object.defineProperty(e,"__esModule",{value:!0}),e.fold=e.match=e.foldW=e.matchW=e.isRight=e.isLeft=e.fromOption=e.fromPredicate=e.FromEither=e.MonadThrow=e.throwError=e.ChainRec=e.Extend=e.extend=e.Alt=e.alt=e.altW=e.Bifunctor=e.mapLeft=e.bimap=e.Traversable=e.sequence=e.traverse=e.Foldable=e.reduceRight=e.foldMap=e.reduce=e.Monad=e.Chain=e.chain=e.chainW=e.Applicative=e.Apply=e.ap=e.apW=e.Pointed=e.of=e.Functor=e.map=e.getAltValidation=e.getApplicativeValidation=e.getWitherable=e.getFilterable=e.getCompactable=e.getSemigroup=e.getEq=e.getShow=e.URI=e.right=e.left=void 0,e.getValidation=e.getValidationMonoid=e.getValidationSemigroup=e.getApplyMonoid=e.getApplySemigroup=e.either=e.stringifyJSON=e.parseJSON=e.sequenceArray=e.traverseArray=e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex=e.traverseReadonlyNonEmptyArrayWithIndex=e.ApT=e.apSW=e.apS=e.bindW=e.bind=e.bindTo=e.Do=e.exists=e.elem=e.toError=e.toUnion=e.chainNullableK=e.fromNullableK=e.tryCatchK=e.tryCatch=e.fromNullable=e.orElse=e.orElseW=e.swap=e.filterOrElseW=e.filterOrElse=e.chainOptionK=e.fromOptionK=e.duplicate=e.flatten=e.flattenW=e.chainFirstW=e.chainFirst=e.apSecondW=e.apSecond=e.apFirstW=e.apFirst=e.flap=e.getOrElse=e.getOrElseW=void 0;var i=pf,o=hn,a=Hs,u=Ey,s=Jt,c=Ye,l=Gr,f=r(ke),d=aq,p=yu;e.left=f.left,e.right=f.right;var h=function(W,F){return(0,c.pipe)(W,(0,e.map)(F))},m=function(W,F){return(0,c.pipe)(W,(0,e.ap)(F))},g=function(W,F){return(0,c.pipe)(W,(0,e.chain)(F))},_=function(W,F,D){return(0,c.pipe)(W,(0,e.reduce)(F,D))},S=function(W){return function(F,D){var Fe=(0,e.foldMap)(W);return(0,c.pipe)(F,Fe(D))}},C=function(W,F,D){return(0,c.pipe)(W,(0,e.reduceRight)(F,D))},b=function(W){var F=(0,e.traverse)(W);return function(D,Fe){return(0,c.pipe)(D,F(Fe))}},w=function(W,F,D){return(0,c.pipe)(W,(0,e.bimap)(F,D))},O=function(W,F){return(0,c.pipe)(W,(0,e.mapLeft)(F))},M=function(W,F){return(0,c.pipe)(W,(0,e.alt)(F))},x=function(W,F){return(0,c.pipe)(W,(0,e.extend)(F))},U=function(W,F){return(0,u.tailRec)(F(W),function(D){return(0,e.isLeft)(D)?(0,e.right)((0,e.left)(D.left)):(0,e.isLeft)(D.right)?(0,e.left)(F(D.right.left)):(0,e.right)((0,e.right)(D.right.right))})};e.URI="Either";var B=function(W,F){return{show:function(D){return(0,e.isLeft)(D)?"left(".concat(W.show(D.left),")"):"right(".concat(F.show(D.right),")")}}};e.getShow=B;var P=function(W,F){return{equals:function(D,Fe){return D===Fe||((0,e.isLeft)(D)?(0,e.isLeft)(Fe)&&W.equals(D.left,Fe.left):(0,e.isRight)(Fe)&&F.equals(D.right,Fe.right))}}};e.getEq=P;var Z=function(W){return{concat:function(F,D){return(0,e.isLeft)(D)?F:(0,e.isLeft)(F)?D:(0,e.right)(W.concat(F.right,D.right))}}};e.getSemigroup=Z;var ee=function(W){var F=(0,e.left)(W.empty);return{URI:e.URI,_E:void 0,compact:function(D){return(0,e.isLeft)(D)?D:D.right._tag==="None"?F:(0,e.right)(D.right.value)},separate:function(D){return(0,e.isLeft)(D)?(0,d.separated)(D,D):(0,e.isLeft)(D.right)?(0,d.separated)((0,e.right)(D.right.left),F):(0,d.separated)(F,(0,e.right)(D.right.right))}}};e.getCompactable=ee;var J=function(W){var F=(0,e.left)(W.empty),D=(0,e.getCompactable)(W),Fe=D.compact,j=D.separate,ie=function(he,Ce){return(0,e.isLeft)(he)||Ce(he.right)?he:F},me=function(he,Ce){return(0,e.isLeft)(he)?(0,d.separated)(he,he):Ce(he.right)?(0,d.separated)(F,(0,e.right)(he.right)):(0,d.separated)((0,e.right)(he.right),F)};return{URI:e.URI,_E:void 0,map:h,compact:Fe,separate:j,filter:ie,filterMap:function(he,Ce){if((0,e.isLeft)(he))return he;var st=Ce(he.right);return st._tag==="None"?F:(0,e.right)(st.value)},partition:me,partitionMap:function(he,Ce){if((0,e.isLeft)(he))return(0,d.separated)(he,he);var st=Ce(he.right);return(0,e.isLeft)(st)?(0,d.separated)((0,e.right)(st.left),F):(0,d.separated)(F,(0,e.right)(st.right))}}};e.getFilterable=J;var ge=function(W){var F=(0,e.getFilterable)(W),D=(0,e.getCompactable)(W);return{URI:e.URI,_E:void 0,map:h,compact:F.compact,separate:F.separate,filter:F.filter,filterMap:F.filterMap,partition:F.partition,partitionMap:F.partitionMap,traverse:b,sequence:e.sequence,reduce:_,foldMap:S,reduceRight:C,wither:(0,p.witherDefault)(e.Traversable,D),wilt:(0,p.wiltDefault)(e.Traversable,D)}};e.getWitherable=ge;var Ie=function(W){return{URI:e.URI,_E:void 0,map:h,ap:function(F,D){return(0,e.isLeft)(F)?(0,e.isLeft)(D)?(0,e.left)(W.concat(F.left,D.left)):F:(0,e.isLeft)(D)?D:(0,e.right)(F.right(D.right))},of:e.of}};e.getApplicativeValidation=Ie;var k=function(W){return{URI:e.URI,_E:void 0,map:h,alt:function(F,D){if((0,e.isRight)(F))return F;var Fe=D();return(0,e.isLeft)(Fe)?(0,e.left)(W.concat(F.left,Fe.left)):Fe}}};e.getAltValidation=k;var A=function(W){return function(F){return(0,e.isLeft)(F)?F:(0,e.right)(W(F.right))}};e.map=A,e.Functor={URI:e.URI,map:h},e.of=e.right,e.Pointed={URI:e.URI,of:e.of};var I=function(W){return function(F){return(0,e.isLeft)(F)?F:(0,e.isLeft)(W)?W:(0,e.right)(F.right(W.right))}};e.apW=I,e.ap=e.apW,e.Apply={URI:e.URI,map:h,ap:m},e.Applicative={URI:e.URI,map:h,ap:m,of:e.of};var $=function(W){return function(F){return(0,e.isLeft)(F)?F:W(F.right)}};e.chainW=$,e.chain=e.chainW,e.Chain={URI:e.URI,map:h,ap:m,chain:g},e.Monad={URI:e.URI,map:h,ap:m,of:e.of,chain:g};var R=function(W,F){return function(D){return(0,e.isLeft)(D)?W:F(W,D.right)}};e.reduce=R;var L=function(W){return function(F){return function(D){return(0,e.isLeft)(D)?W.empty:F(D.right)}}};e.foldMap=L;var X=function(W,F){return function(D){return(0,e.isLeft)(D)?W:F(D.right,W)}};e.reduceRight=X,e.Foldable={URI:e.URI,reduce:_,foldMap:S,reduceRight:C};var ne=function(W){return function(F){return function(D){return(0,e.isLeft)(D)?W.of((0,e.left)(D.left)):W.map(F(D.right),e.right)}}};e.traverse=ne;var Re=function(W){return function(F){return(0,e.isLeft)(F)?W.of((0,e.left)(F.left)):W.map(F.right,e.right)}};e.sequence=Re,e.Traversable={URI:e.URI,map:h,reduce:_,foldMap:S,reduceRight:C,traverse:b,sequence:e.sequence};var se=function(W,F){return function(D){return(0,e.isLeft)(D)?(0,e.left)(W(D.left)):(0,e.right)(F(D.right))}};e.bimap=se;var Ae=function(W){return function(F){return(0,e.isLeft)(F)?(0,e.left)(W(F.left)):F}};e.mapLeft=Ae,e.Bifunctor={URI:e.URI,bimap:w,mapLeft:O};var ze=function(W){return function(F){return(0,e.isLeft)(F)?W():F}};e.altW=ze,e.alt=e.altW,e.Alt={URI:e.URI,map:h,alt:M};var He=function(W){return function(F){return(0,e.isLeft)(F)?F:(0,e.right)(W(F))}};e.extend=He,e.Extend={URI:e.URI,map:h,extend:x},e.ChainRec={URI:e.URI,map:h,ap:m,chain:g,chainRec:U},e.throwError=e.left,e.MonadThrow={URI:e.URI,map:h,ap:m,of:e.of,chain:g,throwError:e.throwError},e.FromEither={URI:e.URI,fromEither:c.identity},e.fromPredicate=(0,s.fromPredicate)(e.FromEither),e.fromOption=(0,s.fromOption)(e.FromEither),e.isLeft=f.isLeft,e.isRight=f.isRight;var ut=function(W,F){return function(D){return(0,e.isLeft)(D)?W(D.left):F(D.right)}};e.matchW=ut,e.foldW=e.matchW,e.match=e.matchW,e.fold=e.match;var Ut=function(W){return function(F){return(0,e.isLeft)(F)?W(F.left):F.right}};e.getOrElseW=Ut,e.getOrElse=e.getOrElseW,e.flap=(0,l.flap)(e.Functor),e.apFirst=(0,o.apFirst)(e.Apply),e.apFirstW=e.apFirst,e.apSecond=(0,o.apSecond)(e.Apply),e.apSecondW=e.apSecond,e.chainFirst=(0,a.chainFirst)(e.Chain),e.chainFirstW=e.chainFirst,e.flattenW=(0,e.chainW)(c.identity),e.flatten=e.flattenW,e.duplicate=(0,e.extend)(c.identity),e.fromOptionK=(0,s.fromOptionK)(e.FromEither),e.chainOptionK=(0,s.chainOptionK)(e.FromEither,e.Chain),e.filterOrElse=(0,s.filterOrElse)(e.FromEither,e.Chain),e.filterOrElseW=e.filterOrElse;var en=function(W){return(0,e.isLeft)(W)?(0,e.right)(W.left):(0,e.left)(W.right)};e.swap=en;var yn=function(W){return function(F){return(0,e.isLeft)(F)?W(F.left):F}};e.orElseW=yn,e.orElse=e.orElseW;var mr=function(W){return function(F){return F==null?(0,e.left)(W):(0,e.right)(F)}};e.fromNullable=mr;var Bi=function(W,F){try{return(0,e.right)(W())}catch(D){return(0,e.left)(F(D))}};e.tryCatch=Bi;var ii=function(W,F){return function(){for(var D=[],Fe=0;Fe<arguments.length;Fe++)D[Fe]=arguments[Fe];return(0,e.tryCatch)(function(){return W.apply(void 0,D)},F)}};e.tryCatchK=ii;var Ro=function(W){var F=(0,e.fromNullable)(W);return function(D){return(0,c.flow)(D,F)}};e.fromNullableK=Ro;var Wa=function(W){var F=(0,e.fromNullableK)(W);return function(D){return(0,e.chain)(F(D))}};e.chainNullableK=Wa,e.toUnion=(0,e.foldW)(c.identity,c.identity);function Ui(W){return W instanceof Error?W:new Error(String(W))}e.toError=Ui;function vr(W){return function(F,D){if(D===void 0){var Fe=vr(W);return function(j){return Fe(F,j)}}return(0,e.isLeft)(D)?!1:W.equals(F,D.right)}}e.elem=vr;var oi=function(W){return function(F){return(0,e.isLeft)(F)?!1:W(F.right)}};e.exists=oi,e.Do=(0,e.of)(f.emptyRecord),e.bindTo=(0,l.bindTo)(e.Functor),e.bind=(0,a.bind)(e.Chain),e.bindW=e.bind,e.apS=(0,o.apS)(e.Apply),e.apSW=e.apS,e.ApT=(0,e.of)(f.emptyReadonlyArray);var qi=function(W){return function(F){var D=W(0,f.head(F));if((0,e.isLeft)(D))return D;for(var Fe=[D.right],j=1;j<F.length;j++){var ie=W(j,F[j]);if((0,e.isLeft)(ie))return ie;Fe.push(ie.right)}return(0,e.right)(Fe)}};e.traverseReadonlyNonEmptyArrayWithIndex=qi;var zi=function(W){var F=(0,e.traverseReadonlyNonEmptyArrayWithIndex)(W);return function(D){return f.isNonEmpty(D)?F(D):e.ApT}};e.traverseReadonlyArrayWithIndex=zi,e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex;var ja=function(W){return(0,e.traverseReadonlyArrayWithIndex)(function(F,D){return W(D)})};e.traverseArray=ja,e.sequenceArray=(0,e.traverseArray)(c.identity);function La(W,F){return(0,e.tryCatch)(function(){return JSON.parse(W)},F)}e.parseJSON=La;var Da=function(W,F){return(0,e.tryCatch)(function(){var D=JSON.stringify(W);if(typeof D!="string")throw new Error("Converting unsupported structure to JSON");return D},F)};e.stringifyJSON=Da,e.either={URI:e.URI,map:h,of:e.of,ap:m,chain:g,reduce:_,foldMap:S,reduceRight:C,traverse:b,sequence:e.sequence,bimap:w,mapLeft:O,alt:M,extend:x,chainRec:U,throwError:e.throwError},e.getApplySemigroup=(0,o.getApplySemigroup)(e.Apply),e.getApplyMonoid=(0,i.getApplicativeMonoid)(e.Applicative);var ai=function(W,F){return(0,o.getApplySemigroup)((0,e.getApplicativeValidation)(W))(F)};e.getValidationSemigroup=ai;var Ju=function(W,F){return(0,i.getApplicativeMonoid)((0,e.getApplicativeValidation)(W))(F)};e.getValidationMonoid=Ju;function ad(W){var F=(0,e.getApplicativeValidation)(W).ap,D=(0,e.getAltValidation)(W).alt;return{URI:e.URI,_E:void 0,map:h,of:e.of,chain:g,bimap:w,mapLeft:O,reduce:_,foldMap:S,reduceRight:C,extend:x,traverse:b,sequence:e.sequence,chainRec:U,throwError:e.throwError,ap:F,alt:D}}e.getValidation=ad}(Cn);var Ze=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),hf=globalThis&&globalThis.__assign||function(){return hf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},hf.apply(this,arguments)},Pye=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},po=St,Xe=function(e,t,n){return po([{value:e,context:t,message:n}])},Oe=Ke,$e=function(){function e(t,n,r,i){this.name=t,this.is=n,this.validate=r,this.encode=i,this.decode=this.decode.bind(this)}return e.prototype.pipe=function(t,n){var r=this;return n===void 0&&(n="pipe(".concat(this.name,", ").concat(t.name,")")),new e(n,t.is,function(i,o){var a=r.validate(i,o);return ue(a)?a:t.validate(a.right,o)},this.encode===De&&t.encode===De?De:function(i){return r.encode(t.encode(i))})},e.prototype.asDecoder=function(){return this},e.prototype.asEncoder=function(){return this},e.prototype.decode=function(t){return this.validate(t,[{key:"",type:this,actual:t}])},e}(),De=function(e){return e};function sq(e){return e.displayName||e.name||"<function".concat(e.length,">")}function Wye(e,t){return{key:e,type:t}}function wi(e,t,n,r){for(var i=e.length,o=Array(i+1),a=0;a<i;a++)o[a]=e[a];return o[i]={key:t,type:n,actual:r},o}function ma(e,t){for(var n=t.length,r=0;r<n;r++)e.push(t[r])}var Ys=Object.prototype.hasOwnProperty;function gO(e){return Object.keys(e).map(function(t){return"".concat(t,": ").concat(e[t].name)}).join(", ")}function lh(e){for(var t=0;t<e.length;t++)if(e[t].encode!==De)return!1;return!0}function cq(e){return"{ ".concat(gO(e)," }")}function lq(e){return"Partial<".concat(e,">")}function jye(e,t,n,r){r===void 0&&(r="{ [K in ".concat(t.name,"]: ").concat(n.name," }"));var i=e.length;return new OO(r,function(o){return jn.is(o)&&e.every(function(a){return n.is(o[a])})},function(o,a){var u=jn.validate(o,a);if(ue(u))return u;for(var s=u.right,c={},l=[],f=!1,d=0;d<i;d++){var p=e[d],h=s[p],m=n.validate(h,wi(a,p,n,h));if(ue(m))ma(l,m.left);else{var g=m.right;f=f||g!==h,c[p]=g}}return l.length>0?po(l):Oe(f||Object.keys(s).length!==i?c:s)},n.encode===De?De:function(o){for(var a={},u=0;u<i;u++){var s=e[u];a[s]=n.encode(o[s])}return a},t,n)}function yO(e){var t;if(mq(e)){var n=e.value;if(Ei.is(n))return t={},t[n]=null,t}else{if(zye(e))return e.keys;if(gq(e)){var r=e.types.map(function(i){return yO(i)});return r.some(xy.is)?void 0:Object.assign.apply(Object,Pye([{}],r,!1))}}}function Lye(e,t,n){return n===void 0&&(n="{ [K in ".concat(e.name,"]: ").concat(t.name," }")),new OO(n,function(r){return jn.is(r)?Object.keys(r).every(function(i){return e.is(i)&&t.is(r[i])}):hq(t)&&Array.isArray(r)},function(r,i){if(jn.is(r)){for(var o={},a=[],u=Object.keys(r),s=u.length,c=!1,l=0;l<s;l++){var f=u[l],d=r[f],p=e.validate(f,wi(i,f,e,f));if(ue(p))ma(a,p.left);else{var h=p.right;c=c||h!==f,f=h;var m=t.validate(d,wi(i,f,t,d));if(ue(m))ma(a,m.left);else{var g=m.right;c=c||g!==d,o[f]=g}}}return a.length>0?po(a):Oe(c?o:r)}return hq(t)&&Array.isArray(r)?Oe(r):Xe(r,i)},e.encode===De&&t.encode===De?De:function(r){for(var i={},o=Object.keys(r),a=o.length,u=0;u<a;u++){var s=o[u];i[String(e.encode(s))]=t.encode(r[s])}return i},e,t)}function fq(e){return"("+e.map(function(t){return t.name}).join(" | ")+")"}function bO(e,t){for(var n=!0,r=!0,i=!jn.is(e),o=0,a=t;o<a.length;o++){var u=a[o];u!==e&&(n=!1),jn.is(u)&&(r=!1)}if(n)return e;if(r)return t[t.length-1];for(var s={},c=0,l=t;c<l.length;c++){var u=l[c];for(var f in u)(!Ys.call(s,f)||i||u[f]!==e[f])&&(s[f]=u[f])}return s}function _O(e){switch(e._tag){case"RefinementType":case"ReadonlyType":return _O(e.type);case"InterfaceType":case"StrictType":case"PartialType":return e.props;case"IntersectionType":return e.types.reduce(function(t,n){return Object.assign(t,_O(n))},{})}}function dq(e,t){for(var n=Object.getOwnPropertyNames(e),r=!1,i={},o=0;o<n.length;o++){var a=n[o];Ys.call(t,a)?i[a]=e[a]:r=!0}return r?i:e}function Dye(e){return vq(e)?"{| ".concat(gO(e.props)," |}"):Kye(e)?lq("{| ".concat(gO(e.props)," |}")):"Exact<".concat(e.name,">")}function Bye(e){return e.length>0}var ur={};function pq(e,t){for(var n=[],r=0,i=e;r<i.length;r++){var o=i[r];t.indexOf(o)!==-1&&n.push(o)}return n}function Uye(e,t){if(e===ur)return t;if(t===ur)return e;var n=Object.assign({},e);for(var r in t)if(Ys.call(e,r)){var i=pq(e[r],t[r]);if(Bye(i))n[r]=i;else{n=ur;break}}else n[r]=t[r];return n}function qye(e,t){if(e===ur||t===ur)return ur;var n=ur;for(var r in e)if(Ys.call(t,r)){var i=pq(e[r],t[r]);i.length===0&&(n===ur&&(n={}),n[r]=e[r].concat(t[r]))}return n}function hq(e){return e._tag==="AnyType"}function mq(e){return e._tag==="LiteralType"}function zye(e){return e._tag==="KeyofType"}function vq(e){return e._tag==="InterfaceType"}function Kye(e){return e._tag==="PartialType"}function Vye(e){return e._tag==="StrictType"}function Hye(e){return e._tag==="ExactType"}function Gye(e){return e._tag==="RefinementType"}function Yye(e){return e._tag==="IntersectionType"}function gq(e){return e._tag==="UnionType"}function Jye(e){return e._tag==="RecursiveType"}var $O=[];function bu(e){if($O.indexOf(e)!==-1)return ur;if(vq(e)||Vye(e)){var t=ur;for(var n in e.props){var r=e.props[n];mq(r)&&(t===ur&&(t={}),t[n]=[r.value])}return t}else{if(Hye(e)||Gye(e))return bu(e.type);if(Yye(e))return e.types.reduce(function(o,a){return Uye(o,bu(a))},ur);if(gq(e))return e.types.slice(1).reduce(function(o,a){return qye(o,bu(a))},bu(e.types[0]));if(Jye(e)){$O.push(e);var i=bu(e.type);return $O.pop(),i}}return ur}function yq(e){var t=bu(e[0]),n=Object.keys(t),r=e.length,i=function(c){for(var l=t[c].slice(),f=[t[c]],d=1;d<r;d++){var p=e[d],h=bu(p),m=h[c];if(m===void 0)return"continue-keys";if(m.some(function(g){return l.indexOf(g)!==-1}))return"continue-keys";l.push.apply(l,m),f.push(m)}return{value:[c,f]}};e:for(var o=0,a=n;o<a.length;o++){var u=a[o],s=i(u);if(typeof s=="object")return s.value;switch(s){case"continue-keys":continue e}}}var bq=function(e){Ze(t,e);function t(){var n=e.call(this,"null",function(r){return r===null},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="NullType",n}return t}($e),SO=new bq,_q=function(e){Ze(t,e);function t(){var n=e.call(this,"undefined",function(r){return r===void 0},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="UndefinedType",n}return t}($e),xy=new _q,$q=function(e){Ze(t,e);function t(){var n=e.call(this,"void",xy.is,xy.validate,De)||this;return n._tag="VoidType",n}return t}($e),Sq=new $q,Tq=function(e){Ze(t,e);function t(){var n=e.call(this,"unknown",function(r){return!0},Oe,De)||this;return n._tag="UnknownType",n}return t}($e),Zye=new Tq,Iq=function(e){Ze(t,e);function t(){var n=e.call(this,"string",function(r){return typeof r=="string"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="StringType",n}return t}($e),Ei=new Iq,Cq=function(e){Ze(t,e);function t(){var n=e.call(this,"number",function(r){return typeof r=="number"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="NumberType",n}return t}($e),Js=new Cq,Oq=function(e){Ze(t,e);function t(){var n=e.call(this,"bigint",function(r){return typeof r=="bigint"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="BigIntType",n}return t}($e),Xye=new Oq,wq=function(e){Ze(t,e);function t(){var n=e.call(this,"boolean",function(r){return typeof r=="boolean"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="BooleanType",n}return t}($e),My=new wq,Eq=function(e){Ze(t,e);function t(){var n=e.call(this,"UnknownArray",Array.isArray,function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="AnyArrayType",n}return t}($e),mf=new Eq,xq=function(e){Ze(t,e);function t(){var n=e.call(this,"UnknownRecord",function(r){var i=Object.prototype.toString.call(r);return i==="[object Object]"||i==="[object Window]"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="AnyDictionaryType",n}return t}($e),jn=new xq,Mq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.value=a,u._tag="LiteralType",u}return t}($e);function fh(e,t){t===void 0&&(t=JSON.stringify(e));var n=function(r){return r===e};return new Mq(t,n,function(r,i){return n(r)?Oe(e):Xe(r,i)},De,e)}var Rq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.keys=a,u._tag="KeyofType",u}return t}($e);function Qye(e,t){t===void 0&&(t=Object.keys(e).map(function(r){return JSON.stringify(r)}).join(" | "));var n=function(r){return Ei.is(r)&&Ys.call(e,r)};return new Rq(t,n,function(r,i){return n(r)?Oe(r):Xe(r,i)},De,e)}var kq=function(e){Ze(t,e);function t(n,r,i,o,a,u){var s=e.call(this,n,r,i,o)||this;return s.type=a,s.predicate=u,s._tag="RefinementType",s}return t}($e);function Ry(e,t,n){return xO(e,t,n)}var ky=Ry(Js,function(e){return Number.isInteger(e)},"Int"),TO=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.runDefinition=a,u._tag="RecursiveType",u}return t}($e);Object.defineProperty(TO.prototype,"type",{get:function(){return this.runDefinition()},enumerable:!0,configurable:!0});function IO(e,t){var n,r=function(){return n||(n=t(i),n.name=e),n},i=new TO(e,function(o){return r().is(o)},function(o,a){return r().validate(o,a)},function(o){return r().encode(o)},r);return i}var Aq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ArrayType",u}return t}($e);function Ay(e,t){return t===void 0&&(t="Array<".concat(e.name,">")),new Aq(t,function(n){return mf.is(n)&&n.every(e.is)},function(n,r){var i=mf.validate(n,r);if(ue(i))return i;for(var o=i.right,a=o.length,u=o,s=[],c=0;c<a;c++){var l=o[c],f=e.validate(l,wi(r,String(c),e,l));if(ue(f))ma(s,f.left);else{var d=f.right;d!==l&&(u===o&&(u=o.slice()),u[c]=d)}}return s.length>0?po(s):Oe(u)},e.encode===De?De:function(n){return n.map(e.encode)},e)}var Fq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.props=a,u._tag="InterfaceType",u}return t}($e);function CO(e,t){t===void 0&&(t=cq(e));var n=Object.keys(e),r=n.map(function(o){return e[o]}),i=n.length;return new Fq(t,function(o){if(jn.is(o)){for(var a=0;a<i;a++){var u=n[a],s=o[u];if(s===void 0&&!Ys.call(o,u)||!r[a].is(s))return!1}return!0}return!1},function(o,a){var u=jn.validate(o,a);if(ue(u))return u;for(var s=u.right,c=s,l=[],f=0;f<i;f++){var d=n[f],p=c[d],h=r[f],m=h.validate(p,wi(a,d,h,p));if(ue(m))ma(l,m.left);else{var g=m.right;(g!==p||g===void 0&&!Ys.call(c,d))&&(c===s&&(c=hf({},s)),c[d]=g)}}return l.length>0?po(l):Oe(c)},lh(r)?De:function(o){for(var a=hf({},o),u=0;u<i;u++){var s=n[u],c=r[u].encode;c!==De&&(a[s]=c(o[s]))}return a},e)}var Nq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.props=a,u._tag="PartialType",u}return t}($e);function ebe(e,t){t===void 0&&(t=lq(cq(e)));var n=Object.keys(e),r=n.map(function(o){return e[o]}),i=n.length;return new Nq(t,function(o){if(jn.is(o)){for(var a=0;a<i;a++){var u=n[a],s=o[u];if(s!==void 0&&!e[u].is(s))return!1}return!0}return!1},function(o,a){var u=jn.validate(o,a);if(ue(u))return u;for(var s=u.right,c=s,l=[],f=0;f<i;f++){var d=n[f],p=c[d],h=e[d],m=h.validate(p,wi(a,d,h,p));if(ue(m))p!==void 0&&ma(l,m.left);else{var g=m.right;g!==p&&(c===s&&(c=hf({},s)),c[d]=g)}}return l.length>0?po(l):Oe(c)},lh(r)?De:function(o){for(var a=hf({},o),u=0;u<i;u++){var s=n[u],c=o[s];c!==void 0&&(a[s]=r[u].encode(c))}return a},e)}var OO=function(e){Ze(t,e);function t(n,r,i,o,a,u){var s=e.call(this,n,r,i,o)||this;return s.domain=a,s.codomain=u,s._tag="DictionaryType",s}return t}($e);function wO(e,t,n){var r=yO(e);return r?jye(Object.keys(r),e,t,n):Lye(e,t,n)}var EO=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.types=a,u._tag="UnionType",u}return t}($e);function dh(e,t){t===void 0&&(t=fq(e));var n=yq(e);if(n!==void 0&&e.length>0){var r=n[0],i=n[1],o=i.length,a=function(u){for(var s=0;s<o;s++)if(i[s].indexOf(u)!==-1)return s};return new Fy(t,function(u){if(jn.is(u)){var s=a(u[r]);return s!==void 0?e[s].is(u):!1}return!1},function(u,s){var c=jn.validate(u,s);if(ue(c))return c;var l=c.right,f=a(l[r]);if(f===void 0)return Xe(u,s);var d=e[f];return d.validate(l,wi(s,String(f),d,l))},lh(e)?De:function(u){var s=a(u[r]);if(s===void 0)throw new Error("no codec found to encode value in union codec ".concat(t));return e[s].encode(u)},e,r)}else return new EO(t,function(u){return e.some(function(s){return s.is(u)})},function(u,s){for(var c=[],l=0;l<e.length;l++){var f=e[l],d=f.validate(u,wi(s,String(l),f,u));if(ue(d))ma(c,d.left);else return Oe(d.right)}return po(c)},lh(e)?De:function(u){for(var s=0,c=e;s<c.length;s++){var l=c[s];if(l.is(u))return l.encode(u)}throw new Error("no codec found to encode value in union type ".concat(t))},e)}var Pq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.types=a,u._tag="IntersectionType",u}return t}($e);function tbe(e,t){t===void 0&&(t="(".concat(e.map(function(r){return r.name}).join(" & "),")"));var n=e.length;return new Pq(t,function(r){return e.every(function(i){return i.is(r)})},e.length===0?Oe:function(r,i){for(var o=[],a=[],u=0;u<n;u++){var s=e[u],c=s.validate(r,wi(i,String(u),s,r));ue(c)?ma(a,c.left):o.push(c.right)}return a.length>0?po(a):Oe(bO(r,o))},e.length===0?De:function(r){return bO(r,e.map(function(i){return i.encode(r)}))},e)}var Wq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.types=a,u._tag="TupleType",u}return t}($e);function nbe(e,t){t===void 0&&(t="[".concat(e.map(function(r){return r.name}).join(", "),"]"));var n=e.length;return new Wq(t,function(r){return mf.is(r)&&r.length===n&&e.every(function(i,o){return i.is(r[o])})},function(r,i){var o=mf.validate(r,i);if(ue(o))return o;for(var a=o.right,u=a.length>n?a.slice(0,n):a,s=[],c=0;c<n;c++){var l=a[c],f=e[c],d=f.validate(l,wi(i,String(c),f,l));if(ue(d))ma(s,d.left);else{var p=d.right;p!==l&&(u===a&&(u=a.slice()),u[c]=p)}}return s.length>0?po(s):Oe(u)},lh(e)?De:function(r){return e.map(function(i,o){return i.encode(r[o])})},e)}var jq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ReadonlyType",u}return t}($e);function rbe(e,t){return t===void 0&&(t="Readonly<".concat(e.name,">")),new jq(t,e.is,e.validate,e.encode,e)}var Lq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ReadonlyArrayType",u}return t}($e);function Dq(e,t){t===void 0&&(t="ReadonlyArray<".concat(e.name,">"));var n=Ay(e);return new Lq(t,n.is,n.validate,n.encode,e)}var ph=function(e,t){return Uq(CO(e),t)},Bq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ExactType",u}return t}($e);function Uq(e,t){t===void 0&&(t=Dye(e));var n=_O(e);return new Bq(t,e.is,function(r,i){var o=jn.validate(r,i);if(ue(o))return o;var a=e.validate(r,i);return ue(a)?a:Ke(dq(a.right,n))},function(r){return e.encode(dq(r,n))},e)}var qq=function(e){Ze(t,e);function t(){var n=e.call(this,"Function",function(r){return typeof r=="function"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="FunctionType",n}return t}($e),ibe=new qq,Fy=function(e){Ze(t,e);function t(n,r,i,o,a,u){var s=e.call(this,n,r,i,o,a)||this;return s.tag=u,s}return t}(EO),obe=function(e,t,n){n===void 0&&(n=fq(t));var r=dh(t,n);return r instanceof Fy?r:(console.warn("[io-ts] Cannot build a tagged union for ".concat(n,", returning a de-optimized union")),new Fy(n,r.is,r.validate,r.encode,t,e))},abe=function(e,t){return{value:e,context:t}},zq=function(e){return[{key:"",type:e}]},Kq=function(e){Ze(t,e);function t(){var n=e.call(this,"never",function(r){return!1},function(r,i){return Xe(r,i)},function(){throw new Error("cannot encode never")})||this;return n._tag="NeverType",n}return t}($e),ube=new Kq,Vq=function(e){Ze(t,e);function t(){var n=e.call(this,"any",function(r){return!0},Oe,De)||this;return n._tag="AnyType",n}return t}($e),sbe=new Vq,cbe=jn,Hq=function(e){Ze(t,e);function t(){var n=e.call(this,"object",function(r){return r!==null&&typeof r=="object"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="ObjectType",n}return t}($e),lbe=new Hq;function xO(e,t,n){return n===void 0&&(n="(".concat(e.name," | ").concat(sq(t),")")),new kq(n,function(r){return e.is(r)&&t(r)},function(r,i){var o=e.validate(r,i);if(ue(o))return o;var a=o.right;return t(a)?Oe(a):Xe(a,i)},e.encode,e,t)}var fbe=xO(Js,Number.isInteger,"Integer"),dbe=wO,pbe=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.props=a,u._tag="StrictType",u}return t}($e);function hbe(e){return e}function mbe(e){return function(){return e}}const Q=jc(Object.freeze(Object.defineProperty({__proto__:null,AnyArrayType:Eq,AnyDictionaryType:xq,AnyType:Vq,Array:mf,ArrayType:Aq,BigIntType:Oq,BooleanType:wq,Dictionary:cbe,DictionaryType:OO,ExactType:Bq,Function:ibe,FunctionType:qq,Int:ky,Integer:fbe,InterfaceType:Fq,IntersectionType:Pq,KeyofType:Rq,LiteralType:Mq,NeverType:Kq,NullType:bq,NumberType:Cq,ObjectType:Hq,PartialType:Nq,ReadonlyArrayType:Lq,ReadonlyType:jq,RecursiveType:TO,RefinementType:kq,StrictType:pbe,StringType:Iq,TaggedUnionType:Fy,TupleType:Wq,Type:$e,UndefinedType:_q,UnionType:EO,UnknownArray:mf,UnknownRecord:jn,UnknownType:Tq,VoidType:$q,alias:mbe,any:sbe,appendContext:wi,array:Ay,bigint:Xye,boolean:My,brand:Ry,clean:hbe,dictionary:dbe,emptyTags:ur,exact:Uq,failure:Xe,failures:po,getContextEntry:Wye,getDefaultContext:zq,getDomainKeys:yO,getFunctionName:sq,getIndex:yq,getTags:bu,getValidationError:abe,identity:De,interface:CO,intersection:tbe,keyof:Qye,literal:fh,mergeAll:bO,never:ube,null:SO,nullType:SO,number:Js,object:lbe,partial:ebe,readonly:rbe,readonlyArray:Dq,record:wO,recursion:IO,refinement:xO,strict:ph,string:Ei,success:Oe,taggedUnion:obe,tuple:nbe,type:CO,undefined:xy,union:dh,unknown:Zye,void:Sq,voidType:Sq},Symbol.toStringTag,{value:"Module"})));var Zs={},Ny={},rt={};const xi=jc(EM);function Gq(e,t,n){return n===void 0&&(n=e.name),new $e(n,e.is,e.validate,function(r){return t(e.encode(r))})}const vbe=jc(Object.freeze(Object.defineProperty({__proto__:null,mapOutput:Gq},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(rt,"__esModule",{value:!0}),rt.addType=rt.isEmpty=rt.objectToMap=rt.grouped=rt.formatDate=rt.formatDateTime=rt.filterDouble=rt.refineType=rt.nullable=void 0;const gbe=G,ybe=ht,bbe=xi,vf=(0,gbe.__importStar)(Q),_be=vbe;function $be(e){return vf.union([e,vf.null,vf.undefined])}rt.nullable=$be;function Sbe(e,t,n){return new vf.Type(t,e.is,(r,i)=>(0,bbe.pipe)(e.validate(r,i),ybe.either.chain(o=>n(o)?vf.success(o):vf.failure(r,i))),e.encode)}rt.refineType=Sbe;function Tbe(e){if(e==="")return null;const t=Number(e);return Number.isNaN(t)?null:t}rt.filterDouble=Tbe;function Ibe(e){return e.toISOString().replace(/\.\d{3}Z$/,"+0000")}rt.formatDateTime=Ibe;function Cbe(e){return e.toISOString().replace(/T.*/,"")}rt.formatDate=Cbe;function Obe(e,t){return e.reduce((n,r,i)=>(i%t===0?n.push([r]):n[Math.floor(i/t)].push(r),n),new Array)}rt.grouped=Obe;function wbe(e){return new Map(Object.entries(e))}rt.objectToMap=wbe;function Ebe(e){for(const t in e)return!1;return!0}rt.isEmpty=Ebe;function xbe(e,t){return(0,_be.mapOutput)(e,n=>({...n,__TYPE__:t}))}rt.addType=xbe,Object.defineProperty(Ny,"__esModule",{value:!0}),Ny.WidgetKey=void 0;const Mbe=(0,G.__importStar)(Q),Rbe=rt,kbe=new RegExp("^[^<>]+$");Ny.WidgetKey=(0,Rbe.refineType)(Mbe.string,"WidgetKey",e=>e.length===0||kbe.test(e)),function(e){Object.defineProperty(e,"__esModule",{value:!0}),(0,G.__exportStar)(Ny,e)}(Zs);var MO={},RO={},Xs={},Yq;function kt(){if(Yq)return Xs;Yq=1,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.hasContentType=Xs.hasFieldContentType=void 0;const e=Cn,t=rE();function n(i){var o;return r(i)&&i.__TYPE__===t.FieldContentType&&((o=i)===null||o===void 0?void 0:o.type)!==void 0&&typeof i.type=="string"&&(0,e.isRight)(t.FieldType.decode(i.type))}Xs.hasFieldContentType=n;function r(i){return typeof i=="object"&&i!==null&&"__TYPE__"in i}return Xs.hasContentType=r,Xs}var Jq;function Zq(){return Jq||(Jq=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmptyContent=e.EmptyLegacy=e.isEmptyContent=e.EmptyContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.EmptyContentType="EmptyContent";const a=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.EmptyContentType;e.isEmptyContent=a;const u=i.union([i.null,i.type({value:i.null})]),s=c=>new i.Type("EmptyLegacy",e.isEmptyContent,l=>(0,r.pipe)(u.decode(l),n.either.map(()=>({type:c,__TYPE__:e.EmptyContentType}))),()=>null);e.EmptyLegacy=s,e.EmptyContent=i.strict({type:i.string,__TYPE__:i.literal(e.EmptyContentType)})}(RO)),RO}var kO={},Ln={},ho={},Py={},at={},AO={};const va=jc(PN);Object.defineProperty(AO,"__esModule",{value:!0});const Abe=G,Fbe=va,Nbe=xi,Wy=(0,Abe.__importStar)(Q);AO.default=new Wy.Type("dateFromString",e=>e instanceof Date,(e,t)=>(0,Nbe.pipe)(Wy.string.validate(e,t),(0,Fbe.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?Wy.failure(e,t):Wy.success(r)})),e=>e.toISOString());var FO={};Object.defineProperty(FO,"__esModule",{value:!0});const Pbe=G,Wbe=va,jbe=xi,gf=(0,Pbe.__importStar)(Q);FO.default=new gf.Type("dateFromStringOrNumber",e=>e instanceof Date,(e,t)=>(0,jbe.pipe)(gf.union([gf.number,gf.string]).validate(e,t),(0,Wbe.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?gf.failure(e,t):gf.success(r)})),e=>e);var NO={};Object.defineProperty(NO,"__esModule",{value:!0});const Lbe=G,Dbe=va,Bbe=xi,jy=(0,Lbe.__importStar)(Q);NO.default=new jy.Type("dateFromTsMs",e=>e instanceof Date,(e,t)=>(0,Bbe.pipe)(jy.number.validate(e,t),(0,Dbe.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?jy.failure(e,t):jy.success(r)})),e=>e.getTime());var PO={};Object.defineProperty(PO,"__esModule",{value:!0});const Ube=G,qbe=va,zbe=xi,Qs=(0,Ube.__importStar)(Q);PO.default=new Qs.Type("IntFromNumber",Qs.Int.is,(e,t)=>(0,zbe.pipe)(Qs.number.validate(e,t),(0,qbe.chain)(n=>Qs.Int.is(n)?Qs.success(n):Qs.success(Math.round(n)))),Qs.Int.encode);var WO={};Object.defineProperty(WO,"__esModule",{value:!0});const Kbe=G,Vbe=va,Hbe=xi,yf=(0,Kbe.__importStar)(Q),Gbe=/^([0-9]+)px$/;WO.default=new yf.Type("IntFromPixels",yf.Int.is,(e,t)=>(0,Hbe.pipe)(yf.string.validate(e,t),(0,Vbe.chain)(n=>{try{const r=n.match(Gbe);if(!r)return yf.failure(e,t);const i=parseInt(r[1]);return yf.success(i)}catch{return yf.failure(e,t)}})),String);var jO={};Object.defineProperty(jO,"__esModule",{value:!0});const Ybe=(0,G.__importStar)(Q),Jbe=rt;jO.default=(0,Jbe.refineType)(Ybe.string,"nonEmptyString",e=>e.trim().length>0);var LO={},Ly={};Object.defineProperty(Ly,"__esModule",{value:!0});const Zbe=(0,G.__importStar)(Q),Xbe=rt;Ly.default=(0,Xbe.nullable)(Zbe.string),Object.defineProperty(LO,"__esModule",{value:!0});const Qbe=G,e_e=va,t_e=xi,DO=Q,n_e=(0,Qbe.__importDefault)(Ly);LO.default=new DO.Type("nonEmptyStringOrNull",e=>typeof e=="string"||e===null,(e,t)=>(0,t_e.pipe)(n_e.default.validate(e,t),(0,e_e.chain)(n=>typeof n=="string"&&n.length>0?(0,DO.success)(n):(0,DO.success)(null))),e=>e);var BO={};Object.defineProperty(BO,"__esModule",{value:!0});const r_e=(0,G.__importStar)(Q),i_e=rt;BO.default=(0,i_e.nullable)(r_e.number);var UO={};Object.defineProperty(UO,"__esModule",{value:!0});const o_e=G,a_e=va,u_e=xi,Dy=(0,o_e.__importStar)(Q);UO.default=new Dy.Type("StringFromInt",Dy.string.is,(e,t)=>(0,u_e.pipe)(Dy.boolean.validate(e,t),(0,a_e.chain)(n=>Dy.success(n.toString()))),e=>e);var qO={};Object.defineProperty(qO,"__esModule",{value:!0});const s_e=G,c_e=va,l_e=xi,By=(0,s_e.__importStar)(Q);qO.default=new By.Type("StringFromInt",By.string.is,(e,t)=>(0,l_e.pipe)(By.number.validate(e,t),(0,c_e.chain)(n=>By.success(n.toString()))),e=>e),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StringOrNull=e.StringFromNumber=e.StringFromBoolean=e.NumberOrNull=e.NonEmptyStringOrNull=e.NonEmptyString=e.IntFromPixels=e.IntFromNumber=e.Function=e.DateFromTsMs=e.DateFromStringOrNumber=e.DateFromString=void 0;const t=G;var n=AO;Object.defineProperty(e,"DateFromString",{enumerable:!0,get:function(){return(0,t.__importDefault)(n).default}});var r=FO;Object.defineProperty(e,"DateFromStringOrNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(r).default}});var i=NO;Object.defineProperty(e,"DateFromTsMs",{enumerable:!0,get:function(){return(0,t.__importDefault)(i).default}}),e.Function=(0,t.__importStar)(rt);var o=PO;Object.defineProperty(e,"IntFromNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(o).default}});var a=WO;Object.defineProperty(e,"IntFromPixels",{enumerable:!0,get:function(){return(0,t.__importDefault)(a).default}});var u=jO;Object.defineProperty(e,"NonEmptyString",{enumerable:!0,get:function(){return(0,t.__importDefault)(u).default}});var s=LO;Object.defineProperty(e,"NonEmptyStringOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(s).default}});var c=BO;Object.defineProperty(e,"NumberOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(c).default}});var l=UO;Object.defineProperty(e,"StringFromBoolean",{enumerable:!0,get:function(){return(0,t.__importDefault)(l).default}});var f=qO;Object.defineProperty(e,"StringFromNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(f).default}});var d=Ly;Object.defineProperty(e,"StringOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(d).default}})}(at);var ga={},zO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BooleanField=e.BooleanConfig=e.BooleanFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.BooleanFieldType="Boolean",e.BooleanConfig=n.exact(n.partial({label:r.StringOrNull,default_value:n.boolean,placeholder_true:n.string,placeholder_false:n.string})),e.BooleanField=n.exact(n.intersection([n.type({type:n.literal(e.BooleanFieldType)}),n.partial({config:e.BooleanConfig})]))})(zO);var KO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Color=e.ColorConfig=e.ColorFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.ColorFieldType="Color",e.ColorConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string})),e.Color=n.exact(n.intersection([n.type({type:n.literal(e.ColorFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.ColorConfig})]))})(KO);var VO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Date=e.DateConfig=e.DateFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.DateFieldType="Date",e.DateConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),e.Date=n.exact(n.intersection([n.type({type:n.literal(e.DateFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.DateConfig})]))})(VO);var HO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Embed=e.EmbedConfig=e.EmbedFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.EmbedFieldType="Embed",e.EmbedConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,useAsTitle:n.boolean})),e.Embed=n.exact(n.intersection([n.type({type:n.literal(e.EmbedFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.EmbedConfig})]))})(HO);var GO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GeoPoint=e.GeoPointConfig=e.GeoPointFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.GeoPointFieldType="GeoPoint",e.GeoPointConfig=n.exact(n.partial({label:r.StringOrNull})),e.GeoPoint=n.exact(n.intersection([n.type({type:n.literal(e.GeoPointFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.GeoPointConfig})]))})(GO);var YO={},hh={},Uy={},bf={},ec={};Object.defineProperty(ec,"__esModule",{value:!0}),ec.pipe=ec.pipeable=void 0;var JO=Ye,f_e=function(e){return typeof e.map=="function"},d_e=function(e){return typeof e.contramap=="function"},p_e=function(e){return typeof e.mapWithIndex=="function"},h_e=function(e){return typeof e.ap=="function"},m_e=function(e){return typeof e.chain=="function"},v_e=function(e){return typeof e.bimap=="function"},g_e=function(e){return typeof e.extend=="function"},y_e=function(e){return typeof e.reduce=="function"},b_e=function(e){return typeof e.reduceWithIndex=="function"},__e=function(e){return typeof e.alt=="function"},$_e=function(e){return typeof e.compact=="function"},S_e=function(e){return typeof e.filter=="function"},T_e=function(e){return typeof e.filterWithIndex=="function"},I_e=function(e){return typeof e.promap=="function"},C_e=function(e){return typeof e.compose=="function"},O_e=function(e){return typeof e.throwError=="function"};function w_e(e){var t={};if(f_e(e)){var n=function(I){return function($){return e.map($,I)}};t.map=n}if(d_e(e)){var r=function(I){return function($){return e.contramap($,I)}};t.contramap=r}if(p_e(e)){var i=function(I){return function($){return e.mapWithIndex($,I)}};t.mapWithIndex=i}if(h_e(e)){var o=function(I){return function($){return e.ap($,I)}},a=function(I){return function($){return e.ap(e.map($,function(R){return function(){return R}}),I)}};t.ap=o,t.apFirst=a,t.apSecond=function(I){return function($){return e.ap(e.map($,function(){return function(R){return R}}),I)}}}if(m_e(e)){var u=function(I){return function($){return e.chain($,I)}},s=function(I){return function($){return e.chain($,function(R){return e.map(I(R),function(){return R})})}},c=function(I){return e.chain(I,JO.identity)};t.chain=u,t.chainFirst=s,t.flatten=c}if(v_e(e)){var l=function(I,$){return function(R){return e.bimap(R,I,$)}},f=function(I){return function($){return e.mapLeft($,I)}};t.bimap=l,t.mapLeft=f}if(g_e(e)){var d=function(I){return function($){return e.extend($,I)}},p=function(I){return e.extend(I,JO.identity)};t.extend=d,t.duplicate=p}if(y_e(e)){var h=function(I,$){return function(R){return e.reduce(R,I,$)}},m=function(I){var $=e.foldMap(I);return function(R){return function(L){return $(L,R)}}},g=function(I,$){return function(R){return e.reduceRight(R,I,$)}};t.reduce=h,t.foldMap=m,t.reduceRight=g}if(b_e(e)){var _=function(I,$){return function(R){return e.reduceWithIndex(R,I,$)}},S=function(I){var $=e.foldMapWithIndex(I);return function(R){return function(L){return $(L,R)}}},C=function(I,$){return function(R){return e.reduceRightWithIndex(R,I,$)}};t.reduceWithIndex=_,t.foldMapWithIndex=S,t.reduceRightWithIndex=C}if(__e(e)){var b=function(I){return function($){return e.alt($,I)}};t.alt=b}if($_e(e)&&(t.compact=e.compact,t.separate=e.separate),S_e(e)){var w=function(I){return function($){return e.filter($,I)}},O=function(I){return function($){return e.filterMap($,I)}},M=function(I){return function($){return e.partition($,I)}},x=function(I){return function($){return e.partitionMap($,I)}};t.filter=w,t.filterMap=O,t.partition=M,t.partitionMap=x}if(T_e(e)){var U=function(I){return function($){return e.filterWithIndex($,I)}},B=function(I){return function($){return e.filterMapWithIndex($,I)}},P=function(I){return function($){return e.partitionWithIndex($,I)}},Z=function(I){return function($){return e.partitionMapWithIndex($,I)}};t.filterWithIndex=U,t.filterMapWithIndex=B,t.partitionWithIndex=P,t.partitionMapWithIndex=Z}if(I_e(e)){var ee=function(I,$){return function(R){return e.promap(R,I,$)}};t.promap=ee}if(C_e(e)){var J=function(I){return function($){return e.compose($,I)}};t.compose=J}if(O_e(e)){var ge=function(I){return function($){return $._tag==="None"?e.throwError(I()):e.of($.value)}},Ie=function(I){return I._tag==="Left"?e.throwError(I.left):e.of(I.right)},k=function(I,$){return function(R){return I(R)?e.of(R):e.throwError($(R))}},A=function(I,$){return function(R){return e.chain(R,function(L){return I(L)?e.of(L):e.throwError($(L))})}};t.fromOption=ge,t.fromEither=Ie,t.fromPredicate=k,t.filterOrElse=A}return t}ec.pipeable=w_e,ec.pipe=JO.pipe;var E_e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),x_e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M_e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&E_e(t,e,n);return x_e(t,e),t};Object.defineProperty(bf,"__esModule",{value:!0}),bf.NumberFromString=void 0;var mh=M_e(Q),R_e=ec,k_e=Cn;bf.NumberFromString=new mh.Type("NumberFromString",mh.number.is,function(e,t){return R_e.pipe(mh.string.validate(e,t),k_e.chain(function(n){var r=+n;return isNaN(r)||n.trim()===""?mh.failure(e,t):mh.success(r)}))},String);var A_e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),F_e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),N_e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&A_e(t,e,n);return F_e(t,e),t};Object.defineProperty(Uy,"__esModule",{value:!0}),Uy.IntFromString=void 0;var vh=N_e(Q),Xq=bf,P_e=ec,W_e=Cn;Uy.IntFromString=new vh.Type("IntFromString",vh.Int.is,function(e,t){return P_e.pipe(Xq.NumberFromString.validate(e,t),W_e.chain(function(n){return vh.Int.is(n)?vh.success(n):vh.failure(e,t)}))},Xq.NumberFromString.encode),Object.defineProperty(hh,"__esModule",{value:!0});const j_e=G,L_e=Cn,ya=(0,j_e.__importStar)(Q),D_e=Uy,Qq=at,ez=new ya.Type("SideConstraints",e=>!e||typeof e=="number",(e,t)=>L_e.either.chain(ya.union([ya.literal("auto"),ya.literal(""),ya.Int,D_e.IntFromString,Qq.IntFromNumber,Qq.IntFromPixels,ya.null]).validate(e,t),n=>n==="auto"||n===""?ya.success(null):ya.success(n)),e=>e),B_e=ya.partial({width:ez,height:ez});hh.default=B_e,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Image=e.ImageConfig=e.Thumbnail=e.ImageFieldType=void 0;const t=G,n=(0,t.__importStar)(Q),r=at,i=(0,t.__importDefault)(hh);e.ImageFieldType="Image",e.Thumbnail=n.exact(n.intersection([n.type({name:n.string}),i.default])),e.ImageConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,constraint:i.default,thumbnails:n.readonlyArray(e.Thumbnail)})),e.Image=n.exact(n.intersection([n.type({type:n.literal(e.ImageFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.ImageConfig})]))}(YO);var ZO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationField=e.IntegrationFieldConfig=e.IntegrationFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.IntegrationFieldType="IntegrationFields",e.IntegrationFieldConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,catalog:n.string})),e.IntegrationField=n.exact(n.intersection([n.type({type:n.literal(e.IntegrationFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.IntegrationFieldConfig})]))})(ZO);var XO={},_f={},qy={},zy={};Object.defineProperty(zy,"__esModule",{value:!0}),zy.clone=void 0;function U_e(e){var t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t}zy.clone=U_e;var q_e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),z_e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),K_e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&q_e(t,e,n);return z_e(t,e),t};Object.defineProperty(qy,"__esModule",{value:!0}),qy.withValidate=void 0;var V_e=K_e(Q),H_e=zy;function G_e(e,t,n){n===void 0&&(n=e.name);var r=H_e.clone(e);return r.validate=t,r.decode=function(i){return t(i,V_e.getDefaultContext(r))},r.name=n,r}qy.withValidate=G_e;var Y_e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),J_e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Z_e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&Y_e(t,e,n);return J_e(t,e),t};Object.defineProperty(_f,"__esModule",{value:!0}),_f.withFallback=void 0;var X_e=Z_e(Q),Q_e=qy,e0e=Cn;function t0e(e,t,n){return n===void 0&&(n="withFallback("+e.name+")"),Q_e.withValidate(e,function(r,i){return e0e.orElse(function(){return X_e.success(t)})(e.validate(r,i))},n)}_f.withFallback=t0e,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Link=e.LinkConfig=e.LinkFieldType=void 0;const t=G,n=Cn,r=(0,t.__importStar)(Q),i=_f,o=at,a=c=>{if(c instanceof Array&&c.reduce((f,d)=>f&&typeof d=="string",!0))return r.success(c)},u=c=>{if(typeof c=="string")return r.success([c])},s=new r.Type("MasksArrayString",c=>c instanceof Array,(c,l)=>n.either.chain(r.union([r.array(r.string),r.string]).validate(c,l),f=>a(f)||u(f)||r.failure(c,l)),c=>c);e.LinkFieldType="Link",e.LinkConfig=r.exact(r.partial({label:o.StringOrNull,useAsTitle:r.boolean,placeholder:r.string,select:(0,i.withFallback)(r.union([r.literal("media"),r.literal("document"),r.literal("web"),r.null]),null),customtypes:r.readonlyArray(r.string),masks:s,tags:s,allowTargetBlank:r.boolean})),e.Link=r.exact(r.intersection([r.type({type:r.literal(e.LinkFieldType)}),r.partial({fieldset:o.StringOrNull,config:e.LinkConfig})]))}(XO);var QO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Number=e.NumberConfig=e.NumberFieldType=void 0;const n=(0,G.__importStar)(Q),r=bf,i=at;e.NumberFieldType="Number",e.NumberConfig=n.exact(n.partial({label:i.StringOrNull,placeholder:n.string,min:n.union([n.number,r.NumberFromString]),max:n.union([n.number,r.NumberFromString]),step:n.union([n.number,r.NumberFromString])})),e.Number=n.exact(n.intersection([n.type({type:n.literal(e.NumberFieldType)}),n.partial({fieldset:i.StringOrNull,config:e.NumberConfig})]))})(QO);var ew={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Range=e.RangeConfig=e.RangeFieldType=void 0;const n=(0,G.__importStar)(Q),r=bf,i=at;e.RangeFieldType="Range",e.RangeConfig=n.exact(n.partial({label:i.StringOrNull,placeholder:n.string,min:n.union([n.number,r.NumberFromString]),max:n.union([n.number,r.NumberFromString]),step:n.union([n.number,r.NumberFromString])})),e.Range=n.exact(n.intersection([n.type({type:n.literal(e.RangeFieldType)}),n.partial({fieldset:i.StringOrNull,config:e.RangeConfig})]))})(ew);var tw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RichText=e.RichTextConfig=e.RichTextNodeTypeCodec=e.RichTextNodeType=e.DEFAULT_OPTION=e.RichTextFieldType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=at,u=(0,t.__importDefault)(hh);e.RichTextFieldType="StructuredText",e.DEFAULT_OPTION="paragraph",e.RichTextNodeType={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",strong:"strong",em:"em",preformatted:"preformatted",hyperlink:"hyperlink",image:"image",embed:"embed",list:"list-item",orderedList:"o-list-item",rtl:"rtl"},e.RichTextNodeTypeCodec=o.keyof({[e.RichTextNodeType.heading1]:null,[e.RichTextNodeType.heading2]:null,[e.RichTextNodeType.heading3]:null,[e.RichTextNodeType.heading4]:null,[e.RichTextNodeType.heading5]:null,[e.RichTextNodeType.heading6]:null,[e.RichTextNodeType.paragraph]:null,[e.RichTextNodeType.strong]:null,[e.RichTextNodeType.em]:null,[e.RichTextNodeType.preformatted]:null,[e.RichTextNodeType.hyperlink]:null,[e.RichTextNodeType.image]:null,[e.RichTextNodeType.embed]:null,[e.RichTextNodeType.list]:null,[e.RichTextNodeType.orderedList]:null,[e.RichTextNodeType.rtl]:null});const s=new o.Type("RichTextOptions",h=>typeof h=="string",h=>(0,i.pipe)(o.union([o.string,o.null]).decode(h),n.either.map(m=>{if(!m)return e.DEFAULT_OPTION;const _=m.split(",").map(S=>S.trim()).filter(S=>(0,r.getOrElseW)(()=>{})(e.RichTextNodeTypeCodec.decode(S)));return _.length?_.join(","):e.DEFAULT_OPTION})),h=>h),c=h=>{if(!h)return o.success([])},l=h=>{if(h instanceof Object){const m=h;if(!Object.entries(m).length)return o.success([]);if(m[""])return o.success(m[""].map(_=>_.name));const g=Object.entries(m).reduce((_,[,S])=>_.concat(S.map(C=>C.name)),[]).filter(Boolean);return o.success(g)}},f=h=>{if(h instanceof Array&&h.reduce((g,_)=>g&&typeof _=="string",!0))return o.success(h)},d=h=>{if(typeof h=="string")return o.success([h])},p=new o.Type("RichTextLabels",h=>h instanceof Array,(h,m)=>{const g=o.record(o.string,o.readonlyArray(o.record(o.literal("name"),o.string))),_=o.readonlyArray(o.string);return(0,i.pipe)(o.union([g,_,o.string,o.null]).decode(h),n.either.chain(S=>c(S)||f(S)||l(S)||d(S)||o.failure(h,m)))},h=>h);e.RichTextConfig=o.exact(o.partial({label:a.StringOrNull,placeholder:o.string,useAsTitle:o.boolean,single:s,multi:s,imageConstraint:u.default,labels:p,allowTargetBlank:o.boolean})),e.RichText=o.exact(o.intersection([o.type({type:o.literal(e.RichTextFieldType)}),o.partial({fieldset:a.StringOrNull,config:e.RichTextConfig})]))})(tw);var nw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Select=e.SelectConfig=e.SelectFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.SelectFieldType="Select",e.SelectConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default_value:n.string,options:n.readonlyArray(n.union([n.string,r.StringFromNumber,r.StringFromBoolean]))})),e.Select=n.exact(n.intersection([n.type({type:n.literal(e.SelectFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.SelectConfig})]))})(nw);var rw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Separator=e.SeparatorConfig=e.SeparatorFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.SeparatorFieldType="Separator",e.SeparatorConfig=n.exact(n.partial({label:r.StringOrNull})),e.Separator=n.exact(n.intersection([n.type({type:n.literal(e.SeparatorFieldType)}),n.partial({config:e.SeparatorConfig})]))})(rw);var iw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Text=e.TextConfig=e.TextFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.TextFieldType="Text",e.TextConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),e.Text=n.exact(n.intersection([n.type({type:n.literal(e.TextFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.TextConfig})]))})(iw);var ow={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.TimestampConfig=e.TimestampFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.TimestampFieldType="Timestamp",e.TimestampConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),e.Timestamp=n.exact(n.intersection([n.type({type:n.literal(e.TimestampFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.TimestampConfig})]))})(ow),Object.defineProperty(ga,"__esModule",{value:!0}),ga.NestableWidget=void 0;const n0e=(0,G.__importStar)(Q),r0e=zO,i0e=KO,o0e=VO,a0e=HO,u0e=GO,s0e=YO,c0e=ZO,l0e=XO,f0e=QO,d0e=ew,p0e=tw,h0e=nw,m0e=rw,v0e=iw,g0e=ow;ga.NestableWidget=n0e.union([i0e.Color,r0e.BooleanField,a0e.Embed,u0e.GeoPoint,o0e.Date,f0e.Number,d0e.Range,p0e.RichText,h0e.Select,m0e.Separator,v0e.Text,g0e.Timestamp,l0e.Link,s0e.Image,c0e.IntegrationField]),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Group=e.GroupConfig=e.GroupFieldType=void 0;const n=(0,G.__importStar)(Q),r=Zs,i=at,o=ga;e.GroupFieldType="Group",e.GroupConfig=n.exact(n.partial({label:i.StringOrNull,repeat:n.boolean,fields:n.record(r.WidgetKey,o.NestableWidget)})),e.Group=n.exact(n.intersection([n.type({type:n.literal(e.GroupFieldType)}),n.partial({fieldset:i.StringOrNull,icon:n.string,description:n.string,config:e.GroupConfig})]))}(Py);var Ky={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(zO,e),(0,t.__exportStar)(KO,e),(0,t.__exportStar)(VO,e),(0,t.__exportStar)(HO,e),(0,t.__exportStar)(GO,e),(0,t.__exportStar)(YO,e),(0,t.__exportStar)(ZO,e),(0,t.__exportStar)(XO,e),(0,t.__exportStar)(ga,e),(0,t.__exportStar)(QO,e),(0,t.__exportStar)(ew,e),(0,t.__exportStar)(tw,e),(0,t.__exportStar)(nw,e),(0,t.__exportStar)(rw,e),(0,t.__exportStar)(iw,e),(0,t.__exportStar)(ow,e)})(Ky);var tz={};(function(e){var t=de&&de.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageConstraint=void 0;var n=hh;Object.defineProperty(e,"ImageConstraint",{enumerable:!0,get:function(){return t(n).default}})})(tz);var nz={},Vy={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CompositeSlice=e.CompositeSliceConfig=e.CompositeSliceType=void 0;const n=(0,G.__importStar)(Q),r=Zs,i=at,o=ga;e.CompositeSliceType="Slice",e.CompositeSliceConfig=n.exact(n.partial({label:i.StringOrNull})),e.CompositeSlice=n.exact(n.intersection([n.type({type:n.literal(e.CompositeSliceType)}),n.partial({fieldset:i.StringOrNull,description:n.string,icon:n.string,display:n.string,"non-repeat":n.record(r.WidgetKey,o.NestableWidget),repeat:n.record(r.WidgetKey,o.NestableWidget),config:e.CompositeSliceConfig})]))})(Vy);var gh={};Object.defineProperty(gh,"__esModule",{value:!0}),gh.LegacySlice=void 0;const y0e=(0,G.__importStar)(Q),b0e=Py,_0e=ga;gh.LegacySlice=y0e.union([_0e.NestableWidget,b0e.Group]);var yh={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SharedSlice=e.SharedSliceType=e.Variation=void 0;const n=(0,G.__importStar)(Q),r=_f,i=Zs,o=ga,a="https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format";e.Variation=n.exact(n.intersection([n.type({id:n.string,name:n.string,description:n.string,imageUrl:(0,r.withFallback)(n.string,a),docURL:n.string,version:n.string}),n.partial({display:n.string,primary:n.record(i.WidgetKey,o.NestableWidget),items:n.record(i.WidgetKey,o.NestableWidget)})])),e.SharedSliceType="SharedSlice",e.SharedSlice=n.exact(n.intersection([n.type({id:n.string,type:n.literal(e.SharedSliceType),name:n.string,variations:n.readonlyArray(e.Variation)}),n.partial({description:n.string})]))})(yh);var bh={};Object.defineProperty(bh,"__esModule",{value:!0}),bh.SharedSliceRef=void 0;const aw=(0,G.__importStar)(Q),$0e=yh;bh.SharedSliceRef=aw.exact(aw.type({type:aw.literal($0e.SharedSliceType)}));var rz={};Object.defineProperty(rz,"__esModule",{value:!0});var uw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Slices=e.DynamicSlices=e.StaticSlices=e.slicesReader=e.DynamicSlicesConfig=e.StaticSlicesConfig=e.slicesConfigReader=e.SlicesLabels=e.SlicesFieldType=e.LegacySlicesFieldType=void 0;const n=(0,G.__importStar)(Q),r=Zs,i=at,o=Vy,a=gh,u=yh,s=bh;e.LegacySlicesFieldType="Choice",e.SlicesFieldType="Slices",e.SlicesLabels=n.union([n.record(n.string,n.readonlyArray(n.exact(n.intersection([n.type({name:n.string}),n.partial({display:n.string})])))),n.null]);function c(d){return n.exact(n.partial({label:i.StringOrNull,labels:e.SlicesLabels,choices:n.record(r.WidgetKey,n.union([a.LegacySlice,o.CompositeSlice,d]))}))}e.slicesConfigReader=c,e.StaticSlicesConfig=c(u.SharedSlice),e.DynamicSlicesConfig=c(s.SharedSliceRef);const l={toStatic(d,p){const h=Object.entries(d.choices||{}).reduce((m,[g,_])=>{if(_.type==="SharedSlice"){const S=p.get(g);return S?{...m,[g]:S}:m}else return{...m,[g]:_}},{});return{...d,choices:h}}};function f(d){return n.exact(n.intersection([n.type({type:n.keyof({[e.SlicesFieldType]:null,[e.LegacySlicesFieldType]:null})}),n.partial({fieldset:i.StringOrNull,config:d})]))}e.slicesReader=f,e.StaticSlices=f(e.StaticSlicesConfig),e.DynamicSlices=f(e.DynamicSlicesConfig),e.Slices={toStatic(d,p){return d.config?{...d,config:l.toStatic(d.config,p)}:d}}})(uw);var Hy={};Object.defineProperty(Hy,"__esModule",{value:!0}),Hy.SlicesTypes=void 0;const S0e=(0,G.__importStar)(Q),T0e=Vy,I0e=yh;Hy.SlicesTypes=S0e.keyof({[T0e.CompositeSliceType]:null,[I0e.SharedSliceType]:null}),function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Vy,e),(0,t.__exportStar)(gh,e),(0,t.__exportStar)(yh,e),(0,t.__exportStar)(bh,e),(0,t.__exportStar)(rz,e),(0,t.__exportStar)(uw,e),(0,t.__exportStar)(Hy,e)}(nz);var sw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UID=e.UIDConfig=e.UIDFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.UIDFieldType="UID",e.UIDConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),e.UID=n.exact(n.intersection([n.type({type:n.literal(e.UIDFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.UIDConfig})]))})(sw);var xr={};Object.defineProperty(xr,"__esModule",{value:!0}),xr.Widgets=xr.FieldType=xr.DynamicWidget=xr.StaticWidget=xr.widgetReader=void 0;const iz=(0,G.__importStar)(Q),oz=Py,Dn=Ky,C0e=ga,_h=uw,az=sw;function cw(e){return iz.union([az.UID,C0e.NestableWidget,oz.Group,e])}xr.widgetReader=cw,xr.StaticWidget=cw(_h.StaticSlices),xr.DynamicWidget=cw(_h.DynamicSlices),xr.FieldType=iz.keyof({[Dn.ColorFieldType]:null,[Dn.BooleanFieldType]:null,[Dn.NumberFieldType]:null,[Dn.EmbedFieldType]:null,[Dn.GeoPointFieldType]:null,[Dn.DateFieldType]:null,[Dn.RangeFieldType]:null,[Dn.RichTextFieldType]:null,[Dn.SelectFieldType]:null,[Dn.SeparatorFieldType]:null,[Dn.TextFieldType]:null,[Dn.TimestampFieldType]:null,[Dn.LinkFieldType]:null,[Dn.ImageFieldType]:null,[Dn.IntegrationFieldType]:null,[az.UIDFieldType]:null,[oz.GroupFieldType]:null,[_h.SlicesFieldType]:null,[_h.LegacySlicesFieldType]:null}),xr.Widgets={toStatic(e,t){switch(e.type){case"Choice":case"Slices":return _h.Slices.toStatic(e,t);default:return e}}},function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Py,e),(0,t.__exportStar)(Ky,e),(0,t.__exportStar)(tz,e),(0,t.__exportStar)(nz,e),(0,t.__exportStar)(sw,e),(0,t.__exportStar)(xr,e)}(ho),Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.defaultCtx=Ln.getFieldCtx=Ln.LegacyContentCtx=Ln.FieldOrSliceType=void 0;const O0e=(0,G.__importStar)(Q),uz=ho;Ln.FieldOrSliceType=O0e.union([uz.FieldType,uz.SlicesTypes]);class lw{constructor(t,n,r){Object.defineProperty(this,"fieldKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prefixedKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fieldKey=t,this.fieldPath=n||[],this.allTypes=r||new Map;const i=Array.of(this.fieldPath,[this.fieldKey]).flat().join(".");this.prefixedKey=i,this.keyOfType=`${i}_TYPE`,this.fieldType=this.allTypes.get(this.prefixedKey)}}Ln.LegacyContentCtx=lw;function w0e(e,t,n){return new lw(e,[...t.fieldPath,t.fieldKey,...n||[]],t.allTypes)}Ln.getFieldCtx=w0e;function E0e(e,t=new Map){return new lw(e,[],t)}Ln.defaultCtx=E0e;var fw={},dw={},sz;function cz(){return sz||(sz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BooleanContent=e.BooleanLegacy=e.isBooleanContent=e.BooleanContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.BooleanContentType="BooleanContent";const a=s=>(0,o.hasContentType)(s)&&s.__TYPE__===e.BooleanContentType;e.isBooleanContent=a;const u=s=>new i.Type("BooleanLegacy",e.isBooleanContent,c=>(0,r.pipe)(i.boolean.decode(c),n.either.map(l=>e.BooleanContent.encode({value:l,__TYPE__:e.BooleanContentType}))),c=>({content:c.value,types:{[s.keyOfType]:"Boolean"}}));e.BooleanLegacy=u,e.BooleanContent=i.strict({__TYPE__:i.literal(e.BooleanContentType),value:i.boolean})}(dw)),dw}var pw={},lz;function hw(){return lz||(lz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedContent=e.EmbedLegacy=e.EmbedContentLegacy=e.isEmbedContent=e.EmbedContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=at,a=kt();e.EmbedContentType="EmbedContent";const u=c=>(0,a.hasContentType)(c)&&c.__TYPE__===e.EmbedContentType;e.isEmbedContent=u,e.EmbedContentLegacy=i.exact(i.intersection([i.type({embed_url:i.string,type:i.string}),i.partial({version:i.union([i.string,i.number,i.null]),title:o.StringOrNull,author_name:o.StringOrNull,author_url:o.StringOrNull,provider_name:o.StringOrNull,provider_url:o.StringOrNull,cache_age:i.union([i.string,i.number,i.null]),thumbnail_url:o.StringOrNull,thumbnail_width:o.NumberOrNull,thumbnail_height:o.NumberOrNull,html:o.StringOrNull})]));const s=c=>new i.Type("EmbedLegacy",e.isEmbedContent,l=>(0,r.pipe)(e.EmbedContentLegacy.decode(l),n.either.map(f=>({...f,all:l,__TYPE__:e.EmbedContentType}))),l=>({content:l.all,types:{[c.keyOfType]:"Embed"}}));e.EmbedLegacy=s,e.EmbedContent=i.intersection([e.EmbedContentLegacy,i.strict({__TYPE__:i.literal(e.EmbedContentType),all:i.unknown})])}(pw)),pw}var mw={},vw={},ba={};Object.defineProperty(ba,"__esModule",{value:!0});const x0e=G,M0e=va,R0e=xi,Gy=(0,x0e.__importStar)(Q);function k0e(e){let t=0;for(;t<e.length&&e[t]<=" ";)t++;let n=e.length;for(;t<n&&e[n-1]<=" ";)n--;return e.substring(t,n)}ba.default=new Gy.Type("TrimmedString",Gy.string.is,(e,t)=>(0,R0e.pipe)(Gy.string.validate(e,t),(0,M0e.chain)(n=>Gy.success(k0e(n)))),e=>e);var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.FieldContentType=void 0,Yr.FieldContentType="FieldContent";var fz;function dz(){return fz||(fz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorContent=e.ColorLegacy=e.isColorContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ho,a=(0,t.__importDefault)(ba),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Color";e.isColorContent=c;const l=f=>new i.Type("ColorLegacy",e.isColorContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.ColorContent.encode({value:p,type:o.ColorFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.ColorFieldType}}));e.ColorLegacy=l,e.ColorContent=i.strict({type:i.literal(o.ColorFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(vw)),vw}var gw={},pz;function hz(){return pz||(pz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DateContent=e.DateLegacy=e.isDateContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ho,a=(0,t.__importDefault)(ba),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Date";e.isDateContent=c;const l=f=>new i.Type("DateLegacy",e.isDateContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.DateContent.encode({value:p,type:o.DateFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.DateFieldType}}));e.DateLegacy=l,e.DateContent=i.strict({type:i.literal(o.DateFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(gw)),gw}var yw={},mz;function vz(){return mz||(mz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NumberContent=e.NumberLegacy=e.isNumberContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ho,a=(0,t.__importDefault)(ba),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Number";e.isNumberContent=c;const l=f=>new i.Type("NumberLegacy",e.isNumberContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.NumberContent.encode({value:p,type:o.NumberFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.NumberFieldType}}));e.NumberLegacy=l,e.NumberContent=i.strict({type:i.literal(o.NumberFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(yw)),yw}var bw={},gz;function yz(){return gz||(gz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RangeContent=e.RangeLegacy=e.isRangeContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ho,a=(0,t.__importDefault)(ba),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Range";e.isRangeContent=c;const l=f=>new i.Type("RangeLegacy",e.isRangeContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.RangeContent.encode({value:p,type:o.RangeFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.RangeFieldType}}));e.RangeLegacy=l,e.RangeContent=i.strict({type:i.literal(o.RangeFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(bw)),bw}var _w={},bz;function _z(){return bz||(bz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SelectContent=e.SelectLegacy=e.isSelectContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ho,a=(0,t.__importDefault)(ba),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Select";e.isSelectContent=c;const l=f=>new i.Type("SelectLegacy",e.isSelectContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.SelectContent.encode({value:p,type:o.SelectFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.SelectFieldType}}));e.SelectLegacy=l,e.SelectContent=i.strict({type:i.literal(o.SelectFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(_w)),_w}var $w={},$z;function Sz(){return $z||($z=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TextContent=e.TextLegacy=e.isTextContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ho,a=(0,t.__importDefault)(ba),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Text";e.isTextContent=c;const l=f=>new i.Type("TextLegacy",e.isTextContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.TextContent.encode({value:p,type:o.TextFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.TextFieldType}}));e.TextLegacy=l,e.TextContent=i.strict({type:i.literal(o.TextFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}($w)),$w}var Sw={},Tz;function Iz(){return Tz||(Tz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TimestampContent=e.TimestampLegacy=e.isTimestampContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ho,a=(0,t.__importDefault)(ba),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Timestamp";e.isTimestampContent=c;const l=f=>new i.Type("TimestampLegacy",e.isTimestampContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.TimestampContent.encode({value:p,type:o.TimestampFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.TimestampFieldType}}));e.TimestampLegacy=l,e.TimestampContent=i.strict({type:i.literal(o.TimestampFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(Sw)),Sw}var Cz;function Oz(){return Cz||(Cz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FieldContent=e.FieldType=void 0;const t=G,n=(0,t.__importStar)(Q),r=dz(),i=hz(),o=vz(),a=yz(),u=_z(),s=Sz(),c=Iz();e.FieldType=n.keyof({Text:null,Date:null,Timestamp:null,Color:null,Number:null,Range:null,Select:null}),e.FieldContent=n.union([i.DateContent,r.ColorContent,o.NumberContent,a.RangeContent,u.SelectContent,s.TextContent,c.TimestampContent]),(0,t.__exportStar)(dz(),e),(0,t.__exportStar)(Yr,e),(0,t.__exportStar)(hz(),e),(0,t.__exportStar)(vz(),e),(0,t.__exportStar)(yz(),e),(0,t.__exportStar)(_z(),e),(0,t.__exportStar)(Sz(),e),(0,t.__exportStar)(Iz(),e)}(mw)),mw}var Tw={},wz;function Ez(){return wz||(wz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GeoPointContent=e.GeoPointLegacy=e.isGeoPointContent=e.GeoPointContentType=void 0;const t=G,n=ht,r=xi,i=(0,t.__importStar)(Q),o=kt();e.GeoPointContentType="GeoPointContent";const a=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.GeoPointContentType;e.isGeoPointContent=a;const u=i.strict({position:i.strict({lat:i.number,lng:i.number})}),s=c=>new i.Type("GeoPointLegacy",e.isGeoPointContent,l=>(0,r.pipe)(u.decode(l),n.either.map(f=>e.GeoPointContent.encode({...f,__TYPE__:e.GeoPointContentType}))),l=>({content:{position:l.position},types:{[c.keyOfType]:"GeoPoint"}}));e.GeoPointLegacy=s,e.GeoPointContent=i.intersection([u,i.strict({__TYPE__:i.literal(e.GeoPointContentType)})])}(Tw)),Tw}var Iw={},_a={};Object.defineProperty(_a,"__esModule",{value:!0}),_a.withOptionals=_a.isNotEmpty=_a.zipObjects=void 0;function A0e(e,t){return[...new Set(Object.keys(e||{}).concat(Object.keys(t||{})))].reduce((r,i)=>{const o=e==null?void 0:e[i],a=t==null?void 0:t[i];return{...r,[i]:{left:o,right:a}}},{})}_a.zipObjects=A0e;function F0e(e){return Boolean(Object.keys(e).length)}_a.isNotEmpty=F0e;function N0e(e,t){return{...e,...t.reduce((n,[r,i])=>i?{...n,[r]:i}:n,{})}}_a.withOptionals=N0e;var xz;function Cw(){return xz||(xz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImageContent=e.ImageLegacy=e.ImageContentView=e.isImageContent=e.ImageContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=_a,a=at,u=kt();e.ImageContentType="ImageContent";const s=d=>(0,u.hasContentType)(d)&&d.__TYPE__===e.ImageContentType;e.isImageContent=s;const c=i.exact(i.type({id:i.string,url:i.string,width:i.number,height:i.number}));e.ImageContentView=i.exact(i.intersection([i.type({origin:c,width:i.number,height:i.number,edit:i.type({zoom:i.number,crop:i.type({x:i.number,y:i.number}),background:i.string})}),i.partial({url:i.string,credits:a.NonEmptyStringOrNull,alt:a.NonEmptyStringOrNull,provider:a.StringOrNull})]));const l=i.intersection([e.ImageContentView,i.partial({thumbnails:i.record(i.string,e.ImageContentView)})]),f=d=>new i.Type("ImageLegacy",e.isImageContent,p=>(0,r.pipe)(l.decode(p),n.either.map(h=>e.ImageContent.encode({...h,__TYPE__:e.ImageContentType}))),p=>({content:(0,o.withOptionals)({edit:p.edit,height:p.height,origin:p.origin,width:p.width},[["alt",p.alt],["credits",p.credits],["provider",p.provider],["thumbnails",p.thumbnails],["url",p.url]]),types:{[d.keyOfType]:"Image"}}));e.ImageLegacy=f,e.ImageContent=i.intersection([l,i.strict({__TYPE__:i.literal(e.ImageContentType)})])}(Iw)),Iw}var Ow={},Mz;function Rz(){return Mz||(Mz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationFieldContent=e.IntegrationFieldLegacy=e.isIntegrationFieldContent=e.IntegrationFieldContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.IntegrationFieldContentType="IntegrationFieldsContent";const a=s=>(0,o.hasContentType)(s)&&s.__TYPE__===e.IntegrationFieldContentType;e.isIntegrationFieldContent=a;const u=s=>new i.Type("IntegrationFieldLegacy",e.isIntegrationFieldContent,c=>(0,r.pipe)(i.string.decode(c),n.either.map(l=>e.IntegrationFieldContent.encode({value:l,__TYPE__:e.IntegrationFieldContentType}))),c=>({content:c.value,types:{[s.keyOfType]:"IntegrationFields"}}));e.IntegrationFieldLegacy=u,e.IntegrationFieldContent=i.strict({__TYPE__:i.literal(e.IntegrationFieldContentType),value:i.string})}(Ow)),Ow}var ww={},kz=Ry(Ei,function(e){return e.length>0},"NonEmptyString");function Az(e,t){t===void 0&&(t="NonEmptyArray<"+e.name+">");var n=Ay(e);return new $e(t,function(r){return n.is(r)&&Nt(r)},function(r,i){return le(n.validate(r,i),Br(function(o){var a=q0(o);return je(a)?Xe(r,i):Oe(a.value)}))},function(r){return n.encode(r)})}function Fz(e,t,n){n===void 0&&(n="Set<"+e.name+">");var r=Ay(e),i=DB(t),o=WB(t);return new $e(n,function(a){return a instanceof Set&&LB(e.is)(a)},function(a,u){return le(r.validate(a,u),Br(function(s){var c=o(s);return c.size!==s.length?Xe(a,u):Oe(c)}))},function(a){return r.encode(i(a))})}function P0e(e,t,n){return n===void 0&&(n="ReadonlySet<"+e.name+">"),Fz(e,t,n)}function Ew(e,t){return new $e(e,t,function(n,r){return t(n)?Oe(n):Xe(n,r)},De)}var W0e=function(e){return e instanceof Date},j0e=Ew("Date",W0e),L0e=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},D0e=function(e,t){return{get:e,reverseGet:t}},Nz=function(e){return _u(e.get,H(e.reverseGet,Jn))},B0e=function(e){return tc(H(e.get,yt),e.reverseGet)},U0e=function(e){return $a(H(e.get,yt),H(e.reverseGet,Jn))},q0e=function(e){return $f(function(t){return function(n){return function(r){return t.map(n(e.get(r)),function(i){return e.reverseGet(i)})}}})},_u=function(e,t){return{get:e,set:t}},xw=function(e){return $a(H(e.get,yt),e.set)},z0e=function(e){return $f(function(t){return function(n){return function(r){return t.map(n(e.get(r)),function(i){return e.set(i)(r)})}}})},Pz=function(e){return function(t){return _u(function(n){return e.get(t.get(n))},function(n){return function(r){return t.set(e.set(n)(t.get(r)))(r)}})}},K0e=function(e){return function(t){return tc(H(t.getOption,Yd(e.getOption)),H(e.reverseGet,t.reverseGet))}},V0e=function(e){return function(t){return nc(Mw(e))(xw(t))}},H0e=function(){return _u(q,Jn)},G0e=function(e){return function(t){return _u(function(n){return t.get(n)[e]},function(n){return function(r){var i,o=t.get(r);return n===o[e]?r:t.set(Object.assign({},o,(i={},i[e]=n,i)))(r)}})}},Y0e=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(n){return _u(function(r){for(var i=n.get(r),o={},a=0,u=e;a<u.length;a++){var s=u[a];o[s]=i[s]}return o},function(r){return function(i){for(var o=n.get(i),a=0,u=e;a<u.length;a++){var s=u[a];if(r[s]!==o[s])return n.set(Object.assign({},o,r))(i)}return i}})}},J0e=function(e){return function(t){return _u(function(n){return t.get(n)[e]},function(n){return function(r){var i=t.get(r);if(n===i[e])return r;var o=i.slice();return o[e]=n,t.set(o)(r)}})}},Z0e=function(e){return function(t){return le(t,Pz(b$e().at(e)))}},tc=function(e,t){return{getOption:e,reverseGet:t}},Mw=function(e){return $a(e.getOption,function(t){return jz(t)(e)})},Wz=function(e){return $f(function(t){return function(n){return function(r){return le(e.getOption(r),qo(function(){return t.of(r)},function(i){return t.map(n(i),function(o){return jz(o)(e)(r)})}))}}})},X0e=function(e){return function(t){return function(n){return le(t.getOption(n),Qi(function(r){var i=e(r);return i===r?n:t.reverseGet(i)}))}}},Q0e=function(e){return function(t){var n=X0e(e)(t);return function(r){return le(n(r),SS(function(){return r}))}}},jz=function(e){return Q0e(function(){return e})},e$e=function(e){return function(t){return nc(xw(e))(Mw(t))}},t$e=function(){return tc(vs,q)},Rw=function(e){return tc(jv(e),q)},n$e=function(){return tc(q,yt)},r$e=function(){return tc(yl,Ke)},i$e=function(){return tc(function(e){return ue(e)?yt(e.left):nt},St)},$a=function(e,t){return{getOption:e,set:t}},o$e=function(e){return $f(function(t){return function(n){return function(r){return le(e.getOption(r),qo(function(){return t.of(r)},function(i){return t.map(n(i),function(o){return e.set(o)(r)})}))}}})},Lz=function(e){return function(t){return function(n){return le(t.getOption(n),Qi(function(r){var i=e(r);return i===r?n:t.set(i)(n)}))}}},Dz=function(e){return function(t){var n=Lz(e)(t);return function(r){return le(n(r),SS(function(){return r}))}}},nc=function(e){return function(t){return $a(H(t.getOption,Yd(e.getOption)),function(n){return Dz(e.set(n))(t)})}},a$e=function(e){return function(t){return le(t,nc(m$e().index(e)))}},u$e=function(e){return function(t){return le(t,nc(v$e().index(e)))}},s$e=function(e){return function(t){return le(t,nc(g$e().index(e)))}},c$e=function(e){return $a(vv(e),function(t){return function(n){return le(mv(e)(n),qo(function(){return n},function(r){return Ev(r,t,n)}))}})},Bz=function(e,t,n){if(n[e]===t)return n;var r=L0e([n[0]],n.slice(1),!0);return r[e]=t,r},l$e=function(e){return $a(vv(e),function(t){return function(n){return le(mv(e)(n),qo(function(){return n},function(r){return Bz(r,t,n)}))}})},$f=function(e){return{modifyF:e}};function kw(e){return function(t){return $f(function(n){return function(r){return t.modifyF(n)(e.modifyF(n)(r))}})}}var f$e={URI:"Identity",map:function(e,t){return t(e)},of:q,ap:function(e,t){return e(t)}},d$e=function(e){return e.URI==="Identity"};function p$e(e){return function(){return $f(function(t){var n=d$e(t)?e.map:e.traverse(t);return function(r){return function(i){return n(i,r)}}})}}function h$e(e){return kw(p$e(e)())}var Aw=function(e){return{index:e}},m$e=function(){return Aw(function(e){return $a(function(t){return ls(e,t)},function(t){return function(n){return le(ls(e,n),qo(function(){return n},function(){return Ev(e,t,n)}))}})})},v$e=function(){return Aw(function(e){return $a(function(t){return ls(e,t)},function(t){return function(n){return le(ls(e,n),qo(function(){return n},function(){return Bz(e,t,n)}))}})})},g$e=function(){return Aw(function(e){return $a(function(t){return Xu(e,t)},function(t){return function(n){return n[e]===t||je(Xu(e,n))?n:F0(e,t)(n)}})})},y$e=function(e){return{at:e}};function b$e(){return y$e(function(e){return _u(function(t){return Xu(e,t)},qo(function(){return Km(e)},function(t){return F0(e,t)}))})}var Uz=D0e,Fw=Nz,Nw=B0e,Pw=U0e,Ww=q0e,_$e=function(e){return function(t){return Uz(H(t.get,e.get),H(e.reverseGet,t.reverseGet))}},$$e=function(e){return Uz(e.reverseGet,e.get)},S$e=function(e){return function(t){return function(n){return t.reverseGet(e(t.get(n)))}}},qz=_u,Yy=H0e,$u=xw,Sf=z0e,rc=Pz,T$e=rc,I$e=H(Nz,rc),ic=V0e,jw=function(e){return H($u,nc(e))},C$e=function(e){return H(Sf,kw(e))},zz=function(e){return function(t){return function(n){var r=t.get(n),i=e(r);return r===i?n:t.set(i)(n)}}};function O$e(e){return function(t){return function(n){return function(r){return le(n.get(r),t,function(i){return e.map(i,function(o){return n.set(o)(r)})})}}}}var w$e=function(e){return ic(t$e())(e)};function E$e(e){return ic(Rw(e))}var Kz=G0e,Vz=Y0e,x$e=J0e,M$e=function(e){return H($u,a$e(e))},R$e=function(e){return H($u,u$e(e))},k$e=function(e){return H($u,s$e(e))},A$e=Z0e,F$e=ic(n$e()),N$e=ic(r$e()),P$e=ic(i$e());function W$e(e){return H(Sf,h$e(e))}function j$e(e){return jw(c$e(e))}function L$e(e){return jw(l$e(e))}var D$e=function(e,t){return function(n){return Hz(n,e,t)}},Hz=function(e,t,n){return qz(H(e.get,t),H(n,e.set))},Jy="monocle-ts/Lens",B$e={URI:Jy,imap:Hz},Gz={URI:Jy,compose:function(e,t){return rc(e)(t)}},U$e={URI:Jy,compose:Gz.compose,id:Yy};const q$e=Object.freeze(Object.defineProperty({__proto__:null,Category:U$e,Invariant:B$e,Semigroupoid:Gz,URI:Jy,asOptional:$u,asTraversal:Sf,atKey:A$e,component:x$e,compose:rc,composeIso:I$e,composeLens:T$e,composeOptional:jw,composePrism:ic,composeTraversal:C$e,filter:E$e,findFirst:j$e,findFirstNonEmpty:L$e,fromNullable:w$e,id:Yy,imap:D$e,index:M$e,indexNonEmpty:R$e,key:k$e,left:P$e,lens:qz,modify:zz,modifyF:O$e,prop:Kz,props:Vz,right:N$e,some:F$e,traverse:W$e},Symbol.toStringTag,{value:"Module"}));var Yz=o$e,oc=nc,z$e=Lz,K$e=Dz,V$e=Rw,Lw=Mw,Dw=Wz,Bw=K0e,H$e=e$e,Sa=kw,Jz=function(e){return function(t){return t.modifyF(f$e)(e)}},G$e=function(e){return Jz(function(){return e})};function Y$e(e){return Sa(Wz(Rw(e)))}var Zz=function(e){return new Qz(e.get,e.reverseGet)},Tf=function(e){return new Uw(e.get,e.set)},$h=function(e){return new eK(e.getOption,e.reverseGet)},Jr=function(e){return new J$e(e.getOption,e.set)},Mr=function(e){return new Z$e(e.modifyF)},Xz=function(e,t,n){var r;return n===e[t]?e:Object.assign({},e,(r={},r[t]=n,r))},Qz=function(){function e(t,n){this.get=t,this.reverseGet=n,this._tag="Iso",this.unwrap=this.get,this.to=this.get,this.wrap=this.reverseGet,this.from=this.reverseGet}return e.prototype.reverse=function(){return Zz($$e(this))},e.prototype.modify=function(t){return S$e(t)(this)},e.prototype.asLens=function(){return Tf(Fw(this))},e.prototype.asPrism=function(){return $h(Nw(this))},e.prototype.asOptional=function(){return Jr(Pw(this))},e.prototype.asTraversal=function(){return Mr(Ww(this))},e.prototype.asFold=function(){var t=this;return new If(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.asGetter=function(){var t=this;return new nK(function(n){return t.get(n)})},e.prototype.asSetter=function(){var t=this;return new Sh(function(n){return t.modify(n)})},e.prototype.compose=function(t){return Zz(_$e(t)(this))},e.prototype.composeIso=function(t){return this.compose(t)},e.prototype.composeLens=function(t){return Tf(le(this,Fw,rc(t)))},e.prototype.composePrism=function(t){return $h(le(this,Nw,Bw(t)))},e.prototype.composeOptional=function(t){return Jr(le(this,Pw,oc(t)))},e.prototype.composeTraversal=function(t){return Mr(le(this,Ww,Sa(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeGetter=function(t){return this.asGetter().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e}(),Uw=function(){function e(t,n){this.get=t,this.set=n,this._tag="Lens"}return e.fromPath=function(){var t=e.fromProp();return function(n){var r=t(n[0]);return n.slice(1).reduce(function(i,o){return i.compose(t(o))},r)}},e.fromProp=function(){return function(t){return Tf(le(Yy(),Kz(t)))}},e.fromProps=function(){return function(t){return Tf(le(Yy(),Vz.apply(q$e,t)))}},e.fromNullableProp=function(){return function(t,n){return new e(function(r){var i=vs(r[t]);return je(i)?n:i.value},function(r){return function(i){return Xz(i,t,r)}})}},e.prototype.modify=function(t){return zz(t)(this)},e.prototype.asOptional=function(){return Jr($u(this))},e.prototype.asTraversal=function(){return Mr(Sf(this))},e.prototype.asSetter=function(){var t=this;return new Sh(function(n){return t.modify(n)})},e.prototype.asGetter=function(){var t=this;return new nK(function(n){return t.get(n)})},e.prototype.asFold=function(){var t=this;return new If(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.compose=function(t){return Tf(rc(t)(this))},e.prototype.composeLens=function(t){return this.compose(t)},e.prototype.composeGetter=function(t){return this.asGetter().compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeOptional=function(t){return Jr(le(this,$u,oc(t)))},e.prototype.composeTraversal=function(t){return Mr(le(this,Sf,Sa(t)))},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeIso=function(t){return Tf(le(this,rc(le(t,Fw))))},e.prototype.composePrism=function(t){return Jr(ic(t)(this))},e}(),eK=function(){function e(t,n){this.getOption=t,this.reverseGet=n,this._tag="Prism"}return e.fromPredicate=function(t){return $h(V$e(t))},e.some=function(){return tK},e.prototype.modify=function(t){var n=this;return function(r){var i=n.modifyOption(t)(r);return je(i)?r:i.value}},e.prototype.modifyOption=function(t){var n=this;return function(r){return JF.map(n.getOption(r),function(i){var o=t(i);return o===i?r:n.reverseGet(o)})}},e.prototype.set=function(t){return this.modify(function(){return t})},e.prototype.asOptional=function(){return Jr(Lw(this))},e.prototype.asTraversal=function(){return Mr(Dw(this))},e.prototype.asSetter=function(){var t=this;return new Sh(function(n){return t.modify(n)})},e.prototype.asFold=function(){var t=this;return new If(function(n){return function(r){return function(i){var o=t.getOption(i);return je(o)?n.empty:r(o.value)}}})},e.prototype.compose=function(t){return $h(Bw(t)(this))},e.prototype.composePrism=function(t){return this.compose(t)},e.prototype.composeOptional=function(t){return Jr(le(this,Lw,oc(t)))},e.prototype.composeTraversal=function(t){return Mr(le(this,Dw,Sa(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeIso=function(t){return $h(le(this,Bw(le(t,Nw))))},e.prototype.composeLens=function(t){return Jr(H$e(t)(this))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),tK=new eK(q,yt),J$e=function(){function e(t,n){this.getOption=t,this.set=n,this._tag="Optional"}return e.fromPath=function(){var t=e.fromNullableProp();return function(n){var r=t(n[0]);return n.slice(1).reduce(function(i,o){return i.compose(t(o))},r)}},e.fromNullableProp=function(){return function(t){return new e(function(n){return vs(n[t])},function(n){return function(r){return r[t]==null?r:Xz(r,t,n)}})}},e.fromOptionProp=function(){var t=Uw.fromProp();return function(n){return t(n).composePrism(tK)}},e.prototype.modify=function(t){return K$e(t)(this)},e.prototype.modifyOption=function(t){return z$e(t)(this)},e.prototype.asTraversal=function(){return Mr(Yz(this))},e.prototype.asFold=function(){var t=this;return new If(function(n){return function(r){return function(i){var o=t.getOption(i);return je(o)?n.empty:r(o.value)}}})},e.prototype.asSetter=function(){var t=this;return new Sh(function(n){return t.modify(n)})},e.prototype.compose=function(t){return Jr(oc(t)(this))},e.prototype.composeOptional=function(t){return this.compose(t)},e.prototype.composeTraversal=function(t){return Mr(le(this,Yz,Sa(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeLens=function(t){return Jr(le(this,oc(le(t,$u))))},e.prototype.composePrism=function(t){return Jr(le(this,oc(le(t,Lw))))},e.prototype.composeIso=function(t){return Jr(le(this,oc(le(t,Pw))))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),Z$e=function(){function e(t){this.modifyF=t,this._tag="Traversal"}return e.prototype.modify=function(t){return Jz(t)(this)},e.prototype.set=function(t){return G$e(t)(this)},e.prototype.filter=function(t){return Mr(Y$e(t)(this))},e.prototype.asFold=function(){var t=this;return new If(function(n){return function(r){return t.modifyF(QF(n))(function(i){return bl(r(i))})}})},e.prototype.asSetter=function(){var t=this;return new Sh(function(n){return t.modify(n)})},e.prototype.compose=function(t){return Mr(Sa(t)(this))},e.prototype.composeTraversal=function(t){return this.compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeOptional=function(t){return this.compose(t.asTraversal())},e.prototype.composeLens=function(t){return Mr(le(this,Sa(le(t,Sf))))},e.prototype.composePrism=function(t){return Mr(le(this,Sa(le(t,Dw))))},e.prototype.composeIso=function(t){return Mr(le(this,Sa(le(t,Ww))))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),nK=function(){function e(t){this.get=t,this._tag="Getter"}return e.prototype.asFold=function(){var t=this;return new If(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.compose=function(t){var n=this;return new e(function(r){return t.get(n.get(r))})},e.prototype.composeGetter=function(t){return this.compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeLens=function(t){return this.compose(t.asGetter())},e.prototype.composeIso=function(t){return this.compose(t.asGetter())},e.prototype.composeTraversal=function(t){return this.asFold().compose(t.asFold())},e.prototype.composeOptional=function(t){return this.asFold().compose(t.asFold())},e.prototype.composePrism=function(t){return this.asFold().compose(t.asFold())},e}(),If=function(){function e(t){this.foldMap=t,this._tag="Fold",this.getAll=t(eS())(Za),this.exist=t(Oj),this.all=t(Cj),this.foldMapFirst=t(ZF())}return e.prototype.compose=function(t){var n=this;return new e(function(r){return function(i){return n.foldMap(r)(t.foldMap(r)(i))}})},e.prototype.composeFold=function(t){return this.compose(t)},e.prototype.composeGetter=function(t){return this.compose(t.asFold())},e.prototype.composeTraversal=function(t){return this.compose(t.asFold())},e.prototype.composeOptional=function(t){return this.compose(t.asFold())},e.prototype.composeLens=function(t){return this.compose(t.asFold())},e.prototype.composePrism=function(t){return this.compose(t.asFold())},e.prototype.composeIso=function(t){return this.compose(t.asFold())},e.prototype.find=function(t){return this.foldMapFirst(jv(t))},e.prototype.headOption=function(t){return this.find(function(){return!0})(t)},e}(),Sh=function(){function e(t){this.modify=t,this._tag="Setter"}return e.prototype.set=function(t){return this.modify(Jn(t))},e.prototype.compose=function(t){var n=this;return new e(function(r){return n.modify(t.modify(r))})},e.prototype.composeSetter=function(t){return this.compose(t)},e.prototype.composeTraversal=function(t){return this.compose(t.asSetter())},e.prototype.composeOptional=function(t){return this.compose(t.asSetter())},e.prototype.composeLens=function(t){return this.compose(t.asSetter())},e.prototype.composePrism=function(t){return this.compose(t.asSetter())},e.prototype.composeIso=function(t){return this.compose(t.asSetter())},e}(),X$e=new Qz(Lc,Lc);function Q$e(){return X$e}function eSe(e,t){t===void 0&&(t="fromNewtype("+e.name+")");var n=Q$e();return new $e(t,function(r){return e.is(r)},function(r,i){return le(e.validate(r,i),_s(n.wrap))},function(r){return e.encode(n.unwrap(r))})}var tSe=ph({_tag:fh("None")}),nSe=fh("Some");function rK(e,t){return t===void 0&&(t="Option<"+e.name+">"),dh([tSe,ph({_tag:nSe,value:e},"Some<"+e.name+">")],t)}function rSe(e,t){return t===void 0&&(t="Option<"+e.name+">"),new $e(t,rK(e).is,function(n,r){return n==null?Oe(nt):le(e.validate(n,r),_s(yt))},function(n){return TS(le(n,Qi(e.encode)))})}var iSe=new $e("DateFromISOString",function(e){return e instanceof Date},function(e,t){return le(Ei.validate(e,t),Br(function(n){var r=new Date(n);return isNaN(r.getTime())?Xe(e,t):Oe(r)}))},function(e){return e.toISOString()});function oSe(e,t){return t===void 0&&(t="ReadonlyNonEmptyArray<"+e.name+">"),Az(e,t)}function iK(e){var t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t}var aSe=new $e("DateFromNumber",function(e){return e instanceof Date},function(e,t){return le(Js.validate(e,t),Br(function(n){var r=new Date(n);return isNaN(r.getTime())?Xe(e,t):Oe(r)}))},function(e){return e.getTime()});function Zy(e,t,n){n===void 0&&(n=e.name);var r=iK(e);return r.validate=t,r.decode=function(i){return t(i,zq(r))},r.name=n,r}function uSe(e,t,n){return n===void 0&&(n="withFallback("+e.name+")"),Zy(e,function(r,i){return EN(function(){return Oe(t)})(e.validate(r,i))},n)}var sSe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,cSe=Ry(Ei,function(e){return sSe.test(e)},"UUID");function lSe(e,t,n){return n===void 0&&(n="fromNullable("+e.name+")"),Zy(e,function(r,i){return r==null?Oe(t):e.validate(r,i)},n)}var fSe=new $e("BooleanFromString",My.is,function(e,t){return le(Ei.validate(e,t),Br(function(n){return n==="true"?Oe(!0):n==="false"?Oe(!1):Xe(e,t)}))},String);function dSe(e,t){return Zy(e,function(n,r){return rp(function(){return[{value:n,context:r,message:t(n,r),actual:n}]})(e.validate(n,r))})}function oK(e){switch(e._tag){case"InterfaceType":return e.props;case"ExactType":return oK(e.type)}}var pSe=Uw.fromProp();function hSe(e){var t={};for(var n in oK(e))t[n]=pSe(n);return t}var mSe=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},vSe=Ew("RegExp",mSe),gSe=new $e("DateFromUnixTime",function(e){return e instanceof Date},function(e,t){return le(ky.validate(e,t),Br(function(n){var r=new Date(n*1e3);return isNaN(r.getTime())?Xe(e,t):Oe(r)}))},function(e){return Math.floor(e.getTime()/1e3)}),qw=new $e("NumberFromString",Js.is,function(e,t){return le(Ei.validate(e,t),Br(function(n){var r=+n;return isNaN(r)||n.trim()===""?Xe(e,t):Oe(r)}))},String),ySe=new $e("IntFromString",ky.is,function(e,t){return le(qw.validate(e,t),Br(function(n){return ky.is(n)?Oe(n):Xe(e,t)}))},qw.encode),aK=IO("JsonArray",function(){return Dq(Xy)}),uK=IO("JsonRecord",function(){return wO(Ei,Xy)}),Xy=dh([My,Js,Ei,SO,aK,uK],"Json"),bSe=new $e("JsonFromString",Xy.is,function(e,t){try{return Oe(JSON.parse(e))}catch{return Xe(e,t)}},function(e){return JSON.stringify(e)}),_Se=fh("Left"),$Se=fh("Right");function SSe(e,t,n){return n===void 0&&(n="Either<"+e.name+", "+t.name+">"),dh([ph({_tag:_Se,left:e},"Left<"+e.name+">"),ph({_tag:$Se,right:t},"Right<"+e.name+">")],n)}var TSe=new $e("BigIntFromString",function(e){return typeof e=="bigint"},function(e,t){return le(Ei.validate(e,t),Br(function(n){if(!kz.is(n.trim()))return Xe(e,t);try{return Oe(BigInt(n))}catch{return Xe(e,t)}}))},String);function ISe(e,t,n){return n===void 0&&(n=e.name),new $e(n,e.is,e.validate,t)}var CSe=new $e("BooleanFromNumber",My.is,function(e,t){return le(Js.validate(e,t),_s(function(n){return n!==0}))},Number);const sK=jc(Object.freeze(Object.defineProperty({__proto__:null,BigIntFromString:TSe,BooleanFromNumber:CSe,BooleanFromString:fSe,DateFromISOString:iSe,DateFromNumber:aSe,DateFromUnixTime:gSe,IntFromString:ySe,Json:Xy,JsonArray:aK,JsonFromString:bSe,JsonRecord:uK,NonEmptyString:kz,NumberFromString:qw,UUID:cSe,clone:iK,date:j0e,either:SSe,fromNewtype:eSe,fromNullable:lSe,fromRefinement:Ew,getLenses:hSe,mapOutput:Gq,nonEmptyArray:Az,option:rK,optionFromNullable:rSe,readonlyNonEmptyArray:oSe,readonlySetFromArray:P0e,regexp:vSe,setFromArray:Fz,withEncode:ISe,withFallback:uSe,withMessage:dSe,withValidate:Zy},Symbol.toStringTag,{value:"Module"})));var cK;function zw(){return cK||(cK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LinkContent=e.Link=e.LinkContentLegacy=e.LinkLegacy=e.isLinkContent=e.LinkContentType=e.ExternalLinkContent=e.ExternalLinkType=e.DocumentLinkContent=e.DocumentLinkType=e.FileLinkContent=e.FileLinkType=e.ImageLinkContent=e.ImageLinkType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=sK,a=at,u=rt,s=kt();e.ImageLinkType="ImageLink";const c=i.exact(i.intersection([i.type({id:i.string,url:i.string,height:i.string,width:i.string,size:i.string,name:i.string,kind:i.string}),i.partial({date:a.StringOrNull})])),l=new i.Type("ImageLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.ImageLinkType,C=>(0,r.pipe)(c.decode(C),n.either.map(b=>e.ImageLinkContent.encode({...b,__TYPE__:e.ImageLinkType}))),C=>c.encode(C));e.ImageLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ImageLinkType)}),c]),e.FileLinkType="FileLink";const f=i.exact(i.intersection([i.type({id:i.string,url:i.string,name:i.string,kind:i.string,size:(0,o.withFallback)(i.string,"0")}),i.partial({date:(0,u.nullable)(i.string)})])),d=new i.Type("FileLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.FileLinkType,C=>(0,r.pipe)(f.decode(C),n.either.map(b=>e.FileLinkContent.encode({...b,__TYPE__:e.FileLinkType}))),C=>f.encode(C));e.FileLinkContent=i.intersection([f,i.exact(i.intersection([i.type({__TYPE__:i.literal(e.FileLinkType)}),i.partial({size:(0,o.withFallback)(i.string,"0")})]))]),e.DocumentLinkType="DocumentLink";const p=i.strict({id:a.NonEmptyString}),h=new i.Type("DocumentLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.DocumentLinkType,C=>(0,r.pipe)(p.decode(C),n.either.map(b=>e.DocumentLinkContent.encode({...b,__TYPE__:e.DocumentLinkType}))),C=>p.encode(C));e.DocumentLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.DocumentLinkType)}),p]),e.ExternalLinkType="ExternalLink";const m=i.exact(i.intersection([i.type({url:i.string}),i.partial({kind:i.literal("web"),target:a.StringOrNull,preview:(0,u.nullable)(i.partial({title:i.string}))})])),g=new i.Type("ExternalLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.ExternalLinkType,C=>(0,r.pipe)(m.decode(C),n.either.map(b=>e.ExternalLinkContent.encode({...b,__TYPE__:e.ExternalLinkType}))),C=>m.encode(C));e.ExternalLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ExternalLinkType)}),m]),e.LinkContentType="LinkContent";const _=C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.LinkContentType;e.isLinkContent=_,e.LinkLegacy=i.union([l,d,h,g]);const S=C=>new i.Type("LinkLegacy",e.isLinkContent,b=>(0,r.pipe)(e.LinkLegacy.decode(b),n.either.map(w=>e.LinkContent.encode({value:w,__TYPE__:e.LinkContentType}))),b=>({content:e.LinkLegacy.encode(b.value),types:{[C.keyOfType]:"Link"}}));e.LinkContentLegacy=S,e.Link=i.union([e.ImageLinkContent,e.FileLinkContent,e.DocumentLinkContent,e.ExternalLinkContent]),e.LinkContent=i.strict({__TYPE__:i.literal(e.LinkContentType),value:e.Link})}(ww)),ww}var Ta={},Kw={},Vw={},lK;function fK(){return lK||(lK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Block=e.BlockLegacy=e.TextBlock=e.checkEmbedBlock=e.EmbedBlock=e.checkImageBlock=e.ImageBlock=e.ValidatedMetas=e.Span=e.Meta=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=Ky,u=at,s=rt,c=hw(),l=Cw(),f=zw();e.Meta=o.exact(o.intersection([o.partial({data:o.unknown}),o.type({start:o.number,end:o.number,type:o.union([a.RichTextNodeTypeCodec,o.literal("label")])})])),e.Span=e.Meta;const d=O=>new o.Type("ValidatedMetas",M=>Array.isArray(M)&&M.every(e.Meta.is),(M,x)=>{if(Array.isArray(M)){const U=M.reduce((B,P)=>{const Z=e.Meta.decode(P);if((0,r.isRight)(Z)){const ee=Z.right;if(ee.data&&ee.type==="hyperlink"){const J=O.decode(ee.data);return(0,r.isLeft)(J)?B:[...B,{...ee,data:J.right}]}else if(ee.type!=="hyperlink")return[...B,ee]}return B},[]).sort((B,P)=>B.start-P.start);return o.success(U)}else return o.failure(M,x)},M=>M.reduce((x,U)=>{if(U.type==="hyperlink"&&U.data){const B=O.decode(U.data);return(0,r.isLeft)(B)?x:[...x,{...U,data:O.encode(B.right)}]}return[...x,e.Meta.encode(U)]},[]));e.ValidatedMetas=d;const p=O=>o.exact(o.intersection([o.type({type:o.literal(a.RichTextNodeType.image),data:o.intersection([l.ImageContentView,o.partial({linkTo:(0,s.nullable)(O)})])}),o.partial({label:u.StringOrNull,direction:u.StringOrNull})]));e.ImageBlock=p(f.Link);const h=p(f.LinkLegacy);function m(O){return O.type===a.RichTextNodeType.image}e.checkImageBlock=m;const g=o.exact(o.intersection([o.type({type:o.literal(a.RichTextNodeType.embed),data:o.unknown}),o.partial({label:u.StringOrNull,direction:u.StringOrNull})])),_=new o.Type("EmbedBlockLegacy",O=>O.type==="embed",O=>(0,i.pipe)(g.decode(O),n.either.chain(M=>n.either.map(x=>[M,x])(c.EmbedContentLegacy.decode(M.data))),n.either.map(([M,x])=>e.EmbedBlock.encode({...M,data:{...x,__TYPE__:c.EmbedContentType,all:M.data}}))),O=>({...g.encode(O),data:c.EmbedContentLegacy.encode(O.data)}));e.EmbedBlock=o.exact(o.intersection([o.type({type:o.literal(a.RichTextNodeType.embed),data:c.EmbedContent}),o.partial({label:u.StringOrNull,direction:u.StringOrNull})]));function S(O){return O.type===a.RichTextNodeType.embed}e.checkEmbedBlock=S;const C=O=>o.exact(o.intersection([o.type({type:(0,s.refineType)(a.RichTextNodeTypeCodec,`string which isn't ${a.RichTextNodeType.image} ${a.RichTextNodeType.embed}`,M=>M!==a.RichTextNodeType.image&&M!==a.RichTextNodeType.embed),content:o.intersection([o.type({text:o.string}),o.partial({spans:(0,e.ValidatedMetas)(O)})])}),o.partial({label:o.string,direction:o.string})]));e.TextBlock=C(f.Link);const b=C(f.LinkLegacy),w=o.union([_,h,b]);e.BlockLegacy=new o.Type("BlockLegacy",O=>_.is(O)||h.is(O)||b.is(O),O=>w.decode(O),O=>(()=>e.ImageBlock.is(O)?h.encode(O):e.EmbedBlock.is(O)?_.encode(O):b.encode(O))()),e.Block=o.union([e.ImageBlock,e.EmbedBlock,e.TextBlock])}(Vw)),Vw}var dK;function pK(){return dK||(dK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RichTextLegacy=e.RichTextContent=e.isRichTextContent=e.RichTextContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt(),a=fK();e.RichTextContentType="StructuredTextContent";const u=l=>(0,o.hasContentType)(l)&&l.__TYPE__===e.RichTextContentType;e.isRichTextContent=u;const s=i.array(a.BlockLegacy);e.RichTextContent=i.strict({__TYPE__:i.literal(e.RichTextContentType),value:i.array(a.Block)}),(0,t.__exportStar)(fK(),e);const c=l=>new i.Type("RichTextLegacy",e.isRichTextContent,f=>(0,r.pipe)(s.decode(f),n.either.map(d=>({value:d,__TYPE__:e.RichTextContentType}))),f=>({content:s.encode(f.value),types:{[l.keyOfType]:"StructuredText"}}));e.RichTextLegacy=c}(Kw)),Kw}var Hw={},hK;function mK(){return hK||(hK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SeparatorContent=e.SeparatorLegacy=e.isSeparatorContent=e.SeparatorContentType=void 0;const n=(0,G.__importStar)(Q),r=kt();e.SeparatorContentType="SeparatorContent";const i=a=>(0,r.hasContentType)(a)&&a.__TYPE__===e.SeparatorContentType;e.isSeparatorContent=i;const o=a=>new n.Type("SeparatorLegacy",e.isSeparatorContent,()=>n.success(e.SeparatorContent.encode({__TYPE__:e.SeparatorContentType})),()=>({content:{},types:{[a.keyOfType]:"Separator"}}));e.SeparatorLegacy=o,e.SeparatorContent=n.strict({__TYPE__:n.literal(e.SeparatorContentType)})}(Hw)),Hw}var vK;function OSe(){if(vK)return Ta;vK=1,Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.NestableLegacy=Ta.isNestableContent=Ta.NestableContent=void 0;const e=G,t=Cn,n=(0,e.__importStar)(Q),r=Zq(),i=cz(),o=hw(),a=Oz(),u=Yr,s=Ez(),c=Cw(),l=Rz(),f=zw(),d=pK(),p=mK();Ta.NestableContent=n.union([r.EmptyContent,i.BooleanContent,o.EmbedContent,a.TextContent,a.TimestampContent,a.SelectContent,a.RangeContent,a.NumberContent,a.DateContent,a.ColorContent,s.GeoPointContent,c.ImageContent,l.IntegrationFieldContent,f.LinkContent,d.RichTextContent,p.SeparatorContent]);const h=g=>(0,a.isTextContent)(g)||(0,a.isColorContent)(g)||(0,a.isDateContent)(g)||(0,a.isTimestampContent)(g)||(0,a.isNumberContent)(g)||(0,a.isRangeContent)(g)||(0,a.isSelectContent)(g)||(0,s.isGeoPointContent)(g)||(0,d.isRichTextContent)(g)||(0,i.isBooleanContent)(g)||(0,o.isEmbedContent)(g)||(0,c.isImageContent)(g)||(0,l.isIntegrationFieldContent)(g)||(0,f.isLinkContent)(g)||(0,p.isSeparatorContent)(g)||(0,r.isEmptyContent)(g);Ta.isNestableContent=h;const m=g=>({decode(_){if(!g.fieldType)return;const S=(0,r.EmptyLegacy)(g.fieldType).decode(_);if((0,t.isRight)(S))return S;const C=(()=>{switch(g.fieldType){case"Text":return(0,a.TextLegacy)(g);case"Color":return(0,a.ColorLegacy)(g);case"Date":return(0,a.DateLegacy)(g);case"Timestamp":return(0,a.TimestampLegacy)(g);case"Number":return(0,a.NumberLegacy)(g);case"Range":return(0,a.RangeLegacy)(g);case"Select":return(0,a.SelectLegacy)(g);case"GeoPoint":return(0,s.GeoPointLegacy)(g);case"StructuredText":return(0,d.RichTextLegacy)(g);case"Boolean":return(0,i.BooleanLegacy)(g);case"Embed":return(0,o.EmbedLegacy)(g);case"Image":return(0,c.ImageLegacy)(g);case"IntegrationFields":return(0,l.IntegrationFieldLegacy)(g);case"Link":return(0,f.LinkContentLegacy)(g);case"Separator":return(0,p.SeparatorLegacy)(g);default:return}})();if(C)return C.decode(_)},encode(_){switch(_.__TYPE__){case u.FieldContentType:return _.type==="Text"?(0,a.TextLegacy)(g).encode(_):_.type==="Color"?(0,a.ColorLegacy)(g).encode(_):_.type==="Range"?(0,a.RangeLegacy)(g).encode(_):_.type==="Date"?(0,a.DateLegacy)(g).encode(_):_.type==="Number"?(0,a.NumberLegacy)(g).encode(_):_.type==="Timestamp"?(0,a.TimestampLegacy)(g).encode(_):_.type==="Select"?(0,a.SelectLegacy)(g).encode(_):void 0;case s.GeoPointContentType:return(0,s.GeoPointLegacy)(g).encode(_);case d.RichTextContentType:return(0,d.RichTextLegacy)(g).encode(_);case o.EmbedContentType:return(0,o.EmbedLegacy)(g).encode(_);case i.BooleanContentType:return(0,i.BooleanLegacy)(g).encode(_);case c.ImageContentType:return(0,c.ImageLegacy)(g).encode(_);case l.IntegrationFieldContentType:return(0,l.IntegrationFieldLegacy)(g).encode(_);case f.LinkContentType:return(0,f.LinkContentLegacy)(g).encode(_);case p.SeparatorContentType:return(0,p.SeparatorLegacy)(g).encode(_);default:return}}});return Ta.NestableLegacy=m,Ta}var gK;function ac(){return gK||(gK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(cz(),e),(0,t.__exportStar)(hw(),e),(0,t.__exportStar)(Oz(),e),(0,t.__exportStar)(Ez(),e),(0,t.__exportStar)(Cw(),e),(0,t.__exportStar)(Rz(),e),(0,t.__exportStar)(zw(),e),(0,t.__exportStar)(OSe(),e),(0,t.__exportStar)(pK(),e),(0,t.__exportStar)(mK(),e)}(fw)),fw}var yK;function Qy(){return yK||(yK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GroupContent=e.isGroupContent=e.GroupContentType=e.GroupLegacy=e.GroupItemLegacy=e.GroupItemContent=e.GroupItemContentType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=Ln,u=kt(),s=ac();e.GroupItemContentType="GroupItemContent",e.GroupItemContent=o.strict({__TYPE__:o.literal(e.GroupItemContentType),value:o.array(o.tuple([o.string,s.NestableContent]))});const c=o.record(o.string,o.unknown),l=p=>new o.Type("GroupItemLegacy",h=>(0,u.hasContentType)(h)&&h.__TYPE__===e.GroupItemContentType,h=>(0,i.pipe)(c.decode(h),n.either.map(g=>({value:Object.entries(g).reduce((S,[C,b])=>{const w=(0,a.getFieldCtx)(C,p),O=(0,s.NestableLegacy)(w).decode(b);return!O||(0,r.isLeft)(O)?S:[...S,[C,O.right]]},[]),__TYPE__:e.GroupItemContentType}))),h=>h.value.reduce((m,[g,_])=>{const S=(0,a.getFieldCtx)(g,p),C=(0,s.NestableLegacy)(S).encode(_);return C?{content:{...m.content,[g]:C.content},types:{...m.types,...C.types}}:m},{content:{},types:{}}));e.GroupItemLegacy=l;const f=p=>{const h=o.array(o.union([o.null,(0,e.GroupItemLegacy)(p)])),m=o.array((0,e.GroupItemLegacy)(p));return new o.Type("GroupLegacy",e.isGroupContent,g=>(0,i.pipe)(h.decode(g),n.either.map(_=>({value:_.map(S=>S===null?{__TYPE__:e.GroupItemContentType,value:[]}:S),__TYPE__:e.GroupContentType}))),g=>{const _=m.encode(g.value);return{content:_.map(S=>S.content),types:_.reduce((S,C)=>({...S,...C.types}),{[p.keyOfType]:"Group"})}})};e.GroupLegacy=f,e.GroupContentType="GroupContentType";const d=p=>(0,u.hasContentType)(p)&&p.__TYPE__===e.GroupContentType;e.isGroupContent=d,e.GroupContent=o.strict({__TYPE__:o.literal(e.GroupContentType),value:o.array(e.GroupItemContent)})}(kO)),kO}var Gw={},Yw={},Jw={},uc={},bK;function _K(){if(bK)return uc;bK=1,Object.defineProperty(uc,"__esModule",{value:!0}),uc.RepeatableWidgets=uc.RepeatableWidgetsLegacy=void 0;const t=(0,G.__importStar)(Q),n=Qy(),r=ac(),i=u=>t.array((0,n.GroupItemLegacy)(u));uc.RepeatableWidgetsLegacy=i;const o=t.tuple([t.string,r.NestableContent]),a=t.strict({__TYPE__:t.literal(n.GroupItemContentType),value:t.array(o)});return t.array(o),uc.RepeatableWidgets=t.array(a),uc}var $K;function Zw(){return $K||($K=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CompositeSliceContent=e.CompositeSliceLegacy=e.isCompositeSliceContent=e.CompositeSliceContentType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=Ln,u=kt(),s=ac(),c=_K();e.CompositeSliceContentType="CompositeSliceContent";const l=p=>(0,u.hasContentType)(p)&&p.__TYPE__===e.CompositeSliceContentType;e.isCompositeSliceContent=l;const f=o.exact(o.partial({repeat:o.array(o.unknown),"non-repeat":o.UnknownRecord})),d=p=>new o.Type("CompositeSliceLegacy",e.isCompositeSliceContent,h=>(0,i.pipe)(f.decode(h),n.either.map(m=>{const g=(()=>{const S=(0,a.getFieldCtx)("repeat",p),C=(0,c.RepeatableWidgetsLegacy)(S).decode(m.repeat);if(!(!C||(0,r.isLeft)(C)))return C.right})()||[];return{nonRepeat:Object.entries(m["non-repeat"]||{}).reduce((S,[C,b])=>{const w=(0,a.getFieldCtx)(C,p,["non-repeat"]);if(!w)return S;const O=(0,s.NestableLegacy)(w).decode(b);return!O||(0,r.isLeft)(O)?S:{...S,[C]:O.right}},{}),repeat:g,__TYPE__:e.CompositeSliceContentType}})),h=>{const m=Object.entries(h.nonRepeat).reduce((_,[S,C])=>{const b=(0,a.getFieldCtx)(S,p,["non-repeat"]),w=(0,s.NestableLegacy)(b).encode(C);return w?{content:{..._.content,[S]:w.content},types:{..._.types,...w.types}}:_},{content:{},types:{}}),g=(()=>{const _=(0,a.getFieldCtx)("repeat",p);return(0,c.RepeatableWidgetsLegacy)(_).encode(h.repeat)})()||[];return{content:{"non-repeat":m.content,repeat:g.map(_=>_.content)},types:{[p.keyOfType]:"Slice",...m.types,...g.reduce((_,S)=>({..._,...S.types}),{})}}});e.CompositeSliceLegacy=d,e.CompositeSliceContent=o.strict({__TYPE__:o.literal(e.CompositeSliceContentType),nonRepeat:o.record(o.string,s.NestableContent),repeat:c.RepeatableWidgets})}(Jw)),Jw}var Xw={},SK;function Qw(){return SK||(SK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SharedSliceContent=e.SharedSliceLegacy=e.isSharedSliceContent=e.SharedSliceContentType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=sK,u=Ln,s=kt(),c=ac(),l=_K();e.SharedSliceContentType="SharedSliceContent";const f=h=>(0,s.hasContentType)(h)&&h.__TYPE__===e.SharedSliceContentType;e.isSharedSliceContent=f;const d=o.exact(o.type({variation:o.string,items:(0,a.withFallback)(o.array(o.unknown),[]),primary:(0,a.withFallback)(o.UnknownRecord,{})})),p=h=>new o.Type("SharedSliceLegacy",e.isSharedSliceContent,m=>(0,i.pipe)(d.decode(m),n.either.map(g=>{const _=(()=>{const C=(0,u.getFieldCtx)("items",h,["variations",g.variation]),b=(0,l.RepeatableWidgetsLegacy)(C).decode(g.items);if(!(!b||(0,r.isLeft)(b)))return b.right})()||[],S=Object.entries(g.primary).reduce((C,[b,w])=>{const O=(0,u.getFieldCtx)(b,h,["variations",g.variation,"primary"]),M=(0,c.NestableLegacy)(O).decode(w);return!M||(0,r.isLeft)(M)?C:{...C,[b]:M.right}},{});return{variation:g.variation,primary:S,items:_,__TYPE__:e.SharedSliceContentType}})),m=>{const g=Object.entries(m.primary).reduce((S,[C,b])=>{const w=(0,u.getFieldCtx)(C,h,["variations",m.variation,"primary"]),O=(0,c.NestableLegacy)(w).encode(b);return O?{content:{...S.content,[C]:O.content},types:{...S.types,...O.types}}:S},{content:{},types:{}}),_=(()=>{const S=(0,u.getFieldCtx)("items",h,["variations",m.variation]);return(0,l.RepeatableWidgetsLegacy)(S).encode(m.items)})()||[];return{content:{primary:g.content,items:_.map(S=>S.content),variation:m.variation},types:{[h.keyOfType]:"SharedSlice",...g.types,..._.reduce((S,C)=>({...S,...C.types}),{})}}});e.SharedSliceLegacy=p,e.SharedSliceContent=o.strict({__TYPE__:o.literal(e.SharedSliceContentType),variation:o.string,primary:o.record(o.string,c.NestableContent),items:l.RepeatableWidgets})}(Xw)),Xw}var Ia={},TK;function eE(){if(TK)return Ia;TK=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.SimpleSliceLegacy=Ia.isSimpleSliceContent=Ia.SimpleSliceContent=void 0;const t=(0,G.__importStar)(Q),n=Qy(),r=ac();Ia.SimpleSliceContent=t.union([r.NestableContent,n.GroupContent]);const i=a=>(0,r.isNestableContent)(a)||(0,n.isGroupContent)(a);Ia.isSimpleSliceContent=i;const o=a=>({decode:(()=>a.fieldType==="Group"?(0,n.GroupLegacy)(a).decode.bind(null):(0,r.NestableLegacy)(a).decode.bind(null))(),encode:u=>{switch(u.__TYPE__){case"GroupContentType":return(0,n.GroupLegacy)(a).encode(u);default:return(0,r.NestableLegacy)(a).encode(u)}}});return Ia.SimpleSliceLegacy=o,Ia}var IK;function CK(){return IK||(IK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SliceContent=e.SliceLegacy=void 0;const t=G,n=(0,t.__importStar)(Q),r=Zw(),i=Qw(),o=eE(),a=u=>({decode:s=>(()=>{switch(u.fieldType){case"Slice":return(0,r.CompositeSliceLegacy)(u);case"SharedSlice":return(0,i.SharedSliceLegacy)(u);default:return(0,o.SimpleSliceLegacy)(u)}})().decode(s),encode:s=>{switch(s.__TYPE__){case"SharedSliceContent":return(0,i.SharedSliceLegacy)(u).encode(s);case"CompositeSliceContent":return(0,r.CompositeSliceLegacy)(u).encode(s);default:return(0,o.SimpleSliceLegacy)(u).encode(s)}}});e.SliceLegacy=a,e.SliceContent=n.union([r.CompositeSliceContent,i.SharedSliceContent,o.SimpleSliceContent]),(0,t.__exportStar)(Zw(),e),(0,t.__exportStar)(Qw(),e),(0,t.__exportStar)(eE(),e)}(Yw)),Yw}var sc={},OK;function wK(){if(OK)return sc;OK=1,Object.defineProperty(sc,"__esModule",{value:!0}),sc.SlicesItemLegacy=sc.SliceItemContent=void 0;const e=G,t=ht,n=Cn,r=Ye,i=(0,e.__importStar)(Q),o=rt,a=Ln,u=CK(),s=Zw(),c=Qw(),l=eE();sc.SliceItemContent=i.type({key:i.string,name:i.string,maybeLabel:i.union([i.string,i.undefined]),widget:u.SliceContent});const f=i.exact(i.intersection([i.type({key:i.string,value:i.unknown}),i.partial({label:(0,o.nullable)(i.string)})])),d=p=>new i.Type("SlicesItemLegacy",h=>((0,c.isSharedSliceContent)(h.widget),(0,s.isCompositeSliceContent)(h.widget),(0,l.isSimpleSliceContent)(h.widget)),(h,m)=>(0,r.pipe)(f.decode(h),t.either.chain(g=>{var _;const S=g.key.indexOf("$"),C=g.key.substring(0,S>0?S:void 0),b=(0,a.getFieldCtx)(C,p),w=(0,u.SliceLegacy)(b).decode(g.value);return!w||(0,n.isLeft)(w)?i.failure(h,m):i.success({key:g.key,name:C,maybeLabel:(_=g.label)!==null&&_!==void 0?_:void 0,widget:w.right})})),h=>{const m=(0,a.getFieldCtx)(h.name,p),g=(0,u.SliceLegacy)(m).encode(h.widget);return{content:{key:h.key,label:h.maybeLabel,value:(g==null?void 0:g.content)||{}},types:(g==null?void 0:g.types)||{}}});return sc.SlicesItemLegacy=d,sc}var tE={},EK;function wSe(){return EK||(EK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SlicesContent=e.SlicesLegacy=e.isSlicesContent=e.SlicesContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt(),a=wK();e.SlicesContentType="SliceContentType";const u=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.SlicesContentType;e.isSlicesContent=u;const s=c=>{const l=i.array((0,a.SlicesItemLegacy)(c));return new i.Type("SlicesLegacy",e.isSlicesContent,f=>(0,r.pipe)(l.decode(f),n.either.map(d=>({__TYPE__:e.SlicesContentType,value:d}))),f=>{const d=l.encode(f.value);return{content:d.map(p=>p.content),types:d.reduce((p,h)=>({...p,...h.types}),{[c.keyOfType]:"Slices"})}})};e.SlicesLegacy=s,e.SlicesContent=i.type({__TYPE__:i.literal(e.SlicesContentType),value:i.array(a.SliceItemContent)})}(tE)),tE}var xK;function MK(){return xK||(xK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(CK(),e),(0,t.__exportStar)(wK(),e),(0,t.__exportStar)(wSe(),e)}(Gw)),Gw}var nE={},RK;function kK(){return RK||(RK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UIDContent=e.UIDLegacy=e.isUIDContent=e.UIDContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.UIDContentType="UIDContent";const a=s=>(0,o.hasContentType)(s)&&s.__TYPE__===e.UIDContentType;e.isUIDContent=a;const u=s=>new i.Type("UIDLegacy",e.isUIDContent,c=>(0,r.pipe)(i.string.decode(c),n.either.map(l=>e.UIDContent.encode({value:l,__TYPE__:e.UIDContentType}))),c=>({content:c.value,types:{[s.keyOfType]:"UID"}}));e.UIDLegacy=u,e.UIDContent=i.type({__TYPE__:i.literal(e.UIDContentType),value:i.string})}(nE)),nE}var Ca={},AK;function ESe(){if(AK)return Ca;AK=1,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.WidgetLegacy=Ca.isWidgetContent=Ca.WidgetContent=void 0;const t=(0,G.__importStar)(Q),n=Qy(),r=ac(),i=MK(),o=kK();Ca.WidgetContent=t.union([n.GroupContent,r.NestableContent,o.UIDContent,i.SlicesContent]);const a=s=>(0,n.isGroupContent)(s)||(0,r.isNestableContent)(s)||(0,o.isUIDContent)(s)||(0,i.isSlicesContent)(s);Ca.isWidgetContent=a;const u=s=>({decode(c){if(!s.fieldType)return;const l=(()=>{switch(s.fieldType){case"UID":return(0,o.UIDLegacy)(s);case"Group":return(0,n.GroupLegacy)(s);case"Choice":case"Slices":return(0,i.SlicesLegacy)(s);default:return(0,r.NestableLegacy)(s)}})();if(l)return l.decode(c)},encode(c){switch(c.__TYPE__){case o.UIDContentType:return(0,o.UIDLegacy)(s).encode(c);case n.GroupContentType:return(0,n.GroupLegacy)(s).encode(c);case i.SlicesContentType:return(0,i.SlicesLegacy)(s).encode(c);default:return(0,r.NestableLegacy)(s).encode(c)}}});return Ca.WidgetLegacy=u,Ca}var FK;function rE(){return FK||(FK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Zq(),e),(0,t.__exportStar)(Qy(),e),(0,t.__exportStar)(ac(),e),(0,t.__exportStar)(MK(),e),(0,t.__exportStar)(kK(),e),(0,t.__exportStar)(ESe(),e)}(MO)),MO}Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.DocumentLegacy=Zc.Document=void 0;const xSe=G,NK=ht,iE=Cn,PK=Ye,Cf=(0,xSe.__importStar)(Q),oE=Zs,aE=rE(),uE=Ln;Zc.Document=Cf.record(oE.WidgetKey,aE.WidgetContent);const MSe=Cf.record(oE.WidgetKey,Cf.unknown),sE=e=>new Cf.Type("Document",t=>!!t&&typeof t=="object",t=>(0,PK.pipe)(MSe.decode(t),NK.either.map(n=>Object.entries(n).reduce((r,[i,o])=>{const a=(0,uE.defaultCtx)(i,e),u=(0,aE.WidgetLegacy)(a).decode(o);return!u||(0,iE.isLeft)(u)?r:{...r,[i]:u.right}},{}))),t=>Object.entries(t).reduce((n,[r,i])=>{const o=(0,uE.defaultCtx)(r,e),a=(0,aE.WidgetLegacy)(o).encode(i);return a?{content:{...n.content,[r]:a.content},types:{...n.types,...a.types}}:n},{content:{},types:{}}));function WK(e){const t=Object.entries(e),{types:n,widgets:r}=t.reduce((a,[u,s])=>{if(u.endsWith("_TYPE")){const c=uE.FieldOrSliceType.decode(s);if((0,iE.isRight)(c))return{...a,types:a.types.set(u.substring(0,u.length-5),c.right)}}return!u.endsWith("_POSITION")&&!u.endsWith("_TYPE")?{...a,widgets:{...a.widgets,[u]:s}}:a},{types:new Map,widgets:{}}),i=e.slugs_INTERNAL||[],o=e.uid;return{widgets:r,types:n,uid:o,slugs:i}}function RSe(e){const t=(0,PK.pipe)(Cf.record(oE.WidgetKey,Cf.unknown).decode(e),NK.either.chain(n=>{const{types:r,widgets:i}=WK(n);return sE(r).decode(i)}));return(0,iE.isLeft)(t)?void 0:t.right}function kSe(e){const t=sE().encode(e);return{...t.content,...t.types}}Zc.DocumentLegacy={_codec:sE,extractMetadata:WK,parse:RSe,encode:kSe},function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Zc,e),(0,t.__exportStar)(rE(),e),(0,t.__exportStar)(Ln,e)}(Qe);function eb(e){const t=N.useRef(e);return N.useLayoutEffect(()=>{t.current=e}),N.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function jK(){const[e,t]=N.useState({});return N.useCallback(()=>t({}),[])}function Su(e,t,n){N.useEffect(()=>{const r=setTimeout(()=>n(e),t);return()=>clearTimeout(r)},[n,t,e])}function Bn(e){var t;return((t=e.config)==null?void 0:t.label)??(e.type==="Boolean"||e.type==="Separator"?void 0:e.fieldset)??e.type}const LK="...";function mo(e,t){var n,r,i;return e.type==="Boolean"?(t?(n=e.config)==null?void 0:n.placeholder_true:(r=e.config)==null?void 0:r.placeholder_false)??LK:e.type==="GeoPoint"?"TODO":((i=e.config)==null?void 0:i.placeholder)??LK}const ASe=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var a;const o=(e==null?void 0:e.value)??((a=t.config)==null?void 0:a.default_value)??!1;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"toggleOff"})}),y.jsx(T.FieldLabel,{htmlFor:n,children:Bn(t)}),y.jsxs(T.FieldControl,{children:[y.jsx(T.Text,{children:mo(t,o)}),y.jsx(T.Switch,{checked:o,id:n,onCheckedChange:u=>{i||r(FSe(u))}})]})]})};function FSe(e){return{__TYPE__:"BooleanContent",value:e}}const NSe=e=>e===void 0?void 0:{__TYPE__:"FieldContent",type:"Color",value:e},PSe=({id:e,field:t,content:n,onContentChange:r})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"colorLens"})}),y.jsx(T.FieldLabel,{id:e,children:Bn(t)}),y.jsx(T.FieldControl,{children:y.jsx(y.Fragment,{children:y.jsx(T.Box,{padding:{left:4},alignItems:"center",children:y.jsx(T.ColorInput,{onValueChange:i=>r(NSe(i)),value:n==null?void 0:n.value,"aria-labelledby":e,placeholder:mo(t)})})})})]}),WSe=e=>e===void 0?void 0:{__TYPE__:"FieldContent",type:"Date",value:e},jSe=({id:e,readOnly:t,field:n,content:r,onContentChange:i})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"dateRange"})}),y.jsx(T.FieldLabel,{id:e,children:Bn(n)}),y.jsx(T.FieldControl,{children:y.jsx(y.Fragment,{children:y.jsx(T.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:y.jsx(T.DateInput,{mode:"date","aria-labelledby":e,readOnly:t,value:r==null?void 0:r.value,onValueChange:o=>i(WSe(o))})})})})]});function Tu(e){return e!=null}async function Of(e,t){const{okType:n,signal:r,headers:i,body:o,timeout:a=1e4,...u}=t,s=new Headers(i);s.has("Content-Type")||s.set("Content-Type","application/json"),s.get("Content-Type")==="multipart/form-data"&&s.delete("Content-Type");const c=USe();c&&s.set("Authorization",`Bearer ${c}`);const l=s.get("Content-Type")==="application/json"?JSON.stringify(o):o;let f=!1;try{const d=new AbortController,p=DSe([d.signal,r].filter(Tu));setTimeout(()=>{f=!0,d.abort()},a);const h=await fetch(e,{...u,body:l,headers:s,signal:p}),{status:m}=h,g=h.clone(),_=await h.json().catch(S=>g.text());if(h.ok){const S=n.safeParse(_);if(!S.success)throw new Th({type:"validation",status:m,cause:S.error});return S.data}else throw new Th({type:"http",status:m,body:_})}catch(d){throw LSe(d)?d:BSe(d)?new Th({type:f?"timeout":"abort"}):new Th({type:"unknown",cause:d})}}class Th extends Error{constructor(t){super(JSON.stringify(t,null,2)),this.detail=t,this.name="RequestError"}}function LSe(e){return e instanceof Th}function DSe(e){const t=new AbortController;function n(){t.abort();for(const r of e)r.removeEventListener("abort",n)}for(const r of e){if(r.aborted){n();break}r.addEventListener("abort",n)}return t.signal}function BSe(e){return e instanceof DOMException&&e.name==="AbortError"}let USe=()=>"";const tb=e=>e==="dev"?"same-origin":"include";function Ih(e,t){VSe(e,t),KSe(e,t),zSe(e,t);const n=vo.get(e,t);if(!n){const r=e(...t);throw vo.set(e,t,{state:"fetching",promise:r}),DK(e,t,r).catch(i=>console.error(i)),r}if(n.state==="fetching")throw n.promise;if(n.ok)return n.body;throw n.error}function qSe(e,t,n,r){const{notify:i=!0}=r??{};vo.set(e,t,{state:"fetched",ok:!0,body:n}),i&&nb.forEach(o=>o(e,t))}function zSe(e,t){const n=N.useContext(GSe);if(!n){console.warn("It is not recommended to use editor-support->Suspense without a editor-ui->ErrorBoundary above it.");return}n.registerRequest(e,t)}function KSe(e,t){const n=jK(),r=Ch(e,t);N.useEffect(()=>{function i(o,a){if(e!==o)return;const u=Ch(e,a);r===u&&n()}return nb.push(i),()=>{const o=nb.indexOf(i);nb.splice(o,1)}},[e,n,r])}function VSe(e,t){const n=jK();N.useEffect(()=>{const r=vo.getFetcherConfig(e).revalidationStrategy;if((r==null?void 0:r.type)==="never"||!(r!=null&&r.onFocus))return;function i(){if(document.visibilityState==="hidden")return;const o=vo.get(e,t);if(!o||o.state!=="fetched")return;const a=e(...t);o.ok?vo.set(e,t,{state:"revalidating",promise:a,ok:!0,body:o.body}):vo.set(e,t,{state:"revalidating",promise:a,ok:!1,error:o.error}),DK(e,t,a).then(n).catch(u=>console.error(u))}return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)})}function DK(e,t,n){return n.then(r=>vo.set(e,t,{state:"fetched",ok:!0,body:r})).catch(r=>vo.set(e,t,{state:"fetched",ok:!1,error:r}))}const vo=HSe(),cE=vo;function HSe(){const e=new Map,t=new Map,n={cacheCapacity:500,revalidationStrategy:{type:"swr",onFocus:!0}};function r(i){return e.get(i)??n}return{get(i,o){const a=Ch(i,o),u=t.get(i);if(!u||!u.has(a))return;const s=u.get(a);return u.delete(a),s!==void 0&&u.set(a,s),s},set(i,o,a){let u=t.get(i);u||(u=new Map,t.set(i,u));const s=r(i),c=Ch(i,o);u.size===s.cacheCapacity&&!u.has(c)&&u.delete(u.keys().next().value),u.set(c,a)},getFetcherConfig:r,registerFetcherConfig(i,o){e.set(i,o)},clear(i,o){const a=t.get(i);if(!a)return;const u=Ch(i,o);a.delete(u)},clearAll(){t.clear()}}}function Ch(e,t){const n=e.length-t.length;if(n===0)return t.join(`
27
+ Check the top-level render call using <`+te+">.")}return z}}function sd(E,z){{if(!E._store||E._store.validated||E.key!=null)return;E._store.validated=!0;var te=pM(z);if(Ba[te])return;Ba[te]=!0;var $e="";E&&E._owner&&E._owner!==st.current&&($e=" It was passed a child from "+ee(E._owner.type)+"."),Wr(E),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',te,$e),Wr(null)}}function Pc(E,z){{if(typeof E!="object")return;if(zi(E))for(var te=0;te<E.length;te++){var $e=E[te];Vi($e)&&sd($e,z)}else if(Vi(E))E._store&&(E._store.validated=!0);else if(E){var Je=g(E);if(typeof Je=="function"&&Je!==E.entries)for(var it=Je.call(E),qe;!(qe=it.next()).done;)Vi(qe.value)&&sd(qe.value,z)}}}function JAe(E){{var z=E.type;if(z==null||typeof z=="string")return;var te;if(typeof z=="function")te=z.propTypes;else if(typeof z=="object"&&(z.$$typeof===s||z.$$typeof===f))te=z.propTypes;else return;if(te){var $e=ee(z);vr(te,E.props,"prop",$e,E)}else if(z.PropTypes!==void 0&&!od){od=!0;var Je=ee(z);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Je||"Unknown")}typeof z.getDefaultProps=="function"&&!z.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ZAe(E){{for(var z=Object.keys(E.props),te=0;te<z.length;te++){var $e=z[te];if($e!=="children"&&$e!=="key"){Wr(E),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",$e),Wr(null);break}}E.ref!==null&&(Wr(E),S("Invalid attribute `ref` supplied to `React.Fragment`."),Wr(null))}}function K5(E,z,te,$e,Je,it){{var qe=B(E);if(!qe){var We="";(E===void 0||typeof E=="object"&&E!==null&&Object.keys(E).length===0)&&(We+=" 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 Jn=ud(Je);Jn?We+=Jn:We+=ad();var At;E===null?At="null":zi(E)?At="array":E!==void 0&&E.$$typeof===t?(At="<"+(ee(E.type)||"Unknown")+" />",We=" Did you accidentally export a JSX literal instead of a component?"):At=typeof E,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",At,We)}var jt=Ie(E,z,te,Je,it);if(jt==null)return jt;if(qe){var ai=z.children;if(ai!==void 0)if($e)if(zi(ai)){for(var cd=0;cd<ai.length;cd++)Pc(ai[cd],E);Object.freeze&&Object.freeze(ai)}else S("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 Pc(ai,E)}return E===r?ZAe(jt):JAe(jt),jt}}function XAe(E,z,te){return K5(E,z,te,!0)}function QAe(E,z,te){return K5(E,z,te,!1)}var eFe=QAe,tFe=XAe;fd.Fragment=r,fd.jsx=eFe,fd.jsxs=tFe}()),fd}(function(e){process.env.NODE_ENV==="production"?e.exports=Z5():e.exports=X5()})(J5);var _M=function(e){return function(){return{meet:function(t,n){return function(r){return e.meet(t(r),n(r))}},join:function(t,n){return function(r){return e.join(t(r),n(r))}},zero:function(){return e.zero},one:function(){return e.one},implies:function(t,n){return function(r){return e.implies(t(r),n(r))}},not:function(t){return function(n){return e.not(t(n))}}}}},R_=function(e){return function(){return{concat:function(t,n){return function(r){return e.concat(t(r),n(r))}}}}},$M=function(e){var t=R_(e);return function(){return{concat:t().concat,empty:function(){return e.empty}}}},k_=function(e){return{add:function(t,n){return function(r){return e.add(t(r),n(r))}},zero:function(){return e.zero},mul:function(t,n){return function(r){return e.mul(t(r),n(r))}},one:function(){return e.one}}},SM=function(e){var t=k_(e);return{add:t.add,mul:t.mul,one:t.one,zero:t.zero,sub:function(n,r){return function(i){return e.sub(n(i),r(i))}}}},Q5=function(e){return function(t){return t(e)}};function q(e){return e}var jc=q;function Zn(e){return function(){return e}}var A_=Zn(!0),TM=Zn(!1),IM=Zn(null),F_=Zn(void 0),e6=F_;function t6(e){return function(t,n){return e(n,t)}}function H(e,t,n,r,i,o,a,u,s){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(t(e.apply(this,arguments)))))))))}}}function CM(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}function n6(e){return e+1}function r6(e){return e-1}function OM(e){throw new Error("Called `absurd` function which should be uncallable")}function i6(e){return function(t){return e.apply(void 0,t)}}function o6(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(t)}}function v(e,t,n,r,i,o,a,u,s){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return o(i(r(n(t(e)))));case 7:return a(o(i(r(n(t(e))))));case 8:return u(a(o(i(r(n(t(e)))))));case 9:return s(u(a(o(i(r(n(t(e))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var a6=OM,Xn=function(e,t){return t};function u6(e){return function(t){return!e(t)}}var s6=function(){return{concat:function(e,t){return H(e,t)},empty:q}};const wM=Object.freeze(Object.defineProperty({__proto__:null,SK:Xn,absurd:OM,apply:Q5,constFalse:TM,constNull:IM,constTrue:A_,constUndefined:F_,constVoid:e6,constant:Zn,decrement:r6,flip:t6,flow:H,getBooleanAlgebra:_M,getEndomorphismMonoid:s6,getMonoid:$M,getRing:SM,getSemigroup:R_,getSemiring:k_,hole:a6,identity:q,increment:n6,not:u6,pipe:v,tuple:CM,tupled:i6,unsafeCoerce:jc,untupled:o6},Symbol.toStringTag,{value:"Module"}));var jr=function(e){return{equals:function(t,n){return t===n||e(t,n)}}},EM=function(e){return jr(function(t,n){for(var r in e)if(!e[r].equals(t[r],n[r]))return!1;return!0})},xM=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return jr(function(n,r){return e.every(function(i,o){return i.equals(n[o],r[o])})})},c6=function(e,t){return v(e,MM(t))},MM=function(e){return function(t){return jr(function(n,r){return t.equals(e(n),e(r))})}},RM="Eq",Lc={equals:function(e,t){return e===t}},l6={equals:function(){return!0}},kM=function(){return{concat:function(e,t){return jr(function(n,r){return e.equals(n,r)&&t.equals(n,r)})}}},f6=function(){return{concat:kM().concat,empty:l6}},AM={URI:RM,contramap:c6},d6=xM,p6=EM,h6=Lc.equals,m6=AM,v6=Lc,g6=Lc,y6=Lc,b6={equals:function(e,t){return e.valueOf()===t.valueOf()}};const _6=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:AM,URI:RM,contramap:MM,eq:m6,eqBoolean:v6,eqDate:b6,eqNumber:y6,eqStrict:Lc,eqString:g6,fromEquals:jr,getMonoid:f6,getSemigroup:kM,getStructEq:p6,getTupleEq:d6,strictEqual:h6,struct:EM,tuple:xM},Symbol.toStringTag,{value:"Module"}));function Dc(e,t){return function(n){return function(r){return e.map(r,function(i){return t.map(i,n)})}}}function Ue(e){return function(t){return function(n){return e.map(n,function(r){return r(t)})}}}function Ct(e){return function(t){return function(n){return e.map(n,function(r){var i;return i={},i[t]=r,i})}}}function Bc(e,t){var n=Dc(e,t);return{map:function(r,i){return v(r,n(i))}}}const $6=Object.freeze(Object.defineProperty({__proto__:null,bindTo:Ct,flap:Ue,getFunctorComposition:Bc,map:Dc},Symbol.toStringTag,{value:"Module"}));var S6=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},Ft=function(e){return e._tag==="None"},gt=function(e){return e._tag==="Some"},ye={_tag:"None"},fe=function(e){return{_tag:"Some",value:e}},qt=function(e){return e._tag==="Left"},N_=function(e){return e._tag==="Right"},Ro=function(e){return{_tag:"Left",left:e}},za=function(e){return{_tag:"Right",right:e}},dd=function(e){return[e]},mt=function(e){return e.length>0},gr=function(e){return e[0]},Uc=function(e){return e.slice(1)},tn=[],zt={},ct=Object.prototype.hasOwnProperty,bm=function(e){return S6([e[0]],e.slice(1),!0)},Ee=function(e,t){return{left:e,right:t}},T6=function(e,t){return v(e,FM(t))},I6=function(e,t){return v(e,NM(t))},C6=function(e,t,n){return v(e,PM(t,n))},FM=function(e){return function(t){return Ee(_m(t),e($m(t)))}},NM=function(e){return function(t){return Ee(e(_m(t)),$m(t))}},PM=function(e,t){return function(n){return Ee(e(_m(n)),t($m(n)))}},P_="Separated",O6={URI:P_,mapLeft:I6,bimap:C6},WM={URI:P_,map:T6},w6=Ue(WM),_m=function(e){return e.left},$m=function(e){return e.right};const E6=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:O6,Functor:WM,URI:P_,bimap:PM,flap:w6,left:_m,map:FM,mapLeft:NM,right:$m,separated:Ee},Symbol.toStringTag,{value:"Module"}));function ko(e,t){return function(n){return function(r){return e.ap(e.map(r,function(i){return function(o){return t.ap(i,o)}}),n)}}}function Ot(e){return function(t){return function(n){return e.ap(e.map(n,function(r){return function(){return r}}),t)}}}function wt(e){return function(t){return function(n){return e.ap(e.map(n,function(){return function(r){return r}}),t)}}}function Et(e){return function(t,n){return function(r){return e.ap(e.map(r,function(i){return function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))}}),n)}}}function Kt(e){return function(t){return{concat:function(n,r){return e.ap(e.map(n,function(i){return function(o){return t.concat(i,o)}}),r)}}}}function W_(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,t===0?e.apply(null,i):W_(e,t-1,i)}}var j_={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function x6(e){return ct.call(j_,e)||(j_[e]=W_(CM,e-1,[])),j_[e]}function M6(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=x6(r),o=e.map(t[0],i),a=1;a<r;a++)o=e.ap(o,t[a]);return o}}function R6(e){var t=e.length;switch(t){case 1:return function(n){var r;return r={},r[e[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[e[0]]=n,i[e[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[e[0]]=n,o[e[1]]=r,o[e[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[e[0]]=n,a[e[1]]=r,a[e[2]]=i,a[e[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[e[0]]=n,u[e[1]]=r,u[e[2]]=i,u[e[3]]=o,u[e[4]]=a,u}}}}};default:return W_(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i},t-1,[])}}function k6(e){return function(t){for(var n=Object.keys(t),r=n.length,i=R6(n),o=e.map(t[n[0]],i),a=1;a<r;a++)o=e.ap(o,t[n[a]]);return o}}const A6=Object.freeze(Object.defineProperty({__proto__:null,ap:ko,apFirst:Ot,apS:Et,apSecond:wt,getApplySemigroup:Kt,sequenceS:k6,sequenceT:M6},Symbol.toStringTag,{value:"Module"}));function lt(e){return function(t){return function(n){return e.chain(n,function(r){return e.map(t(r),function(){return r})})}}}function xt(e){return function(t,n){return function(r){return e.chain(r,function(i){return e.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))})})}}}const F6=Object.freeze(Object.defineProperty({__proto__:null,bind:xt,chainFirst:lt},Symbol.toStringTag,{value:"Module"}));var jM=function(e){return function(t,n){return t===n||e(t,n)===0}},Zu=function(e){return{equals:jM(e),compare:function(t,n){return t===n?0:e(t,n)}}},LM=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Zu(function(n,r){for(var i=0;i<e.length-1;i++){var o=e[i].compare(n[i],r[i]);if(o!==0)return o}return e[i].compare(n[i],r[i])})},L_=function(e){return Zu(function(t,n){return e.compare(n,t)})},N6=function(e,t){return v(e,Sm(t))},Sm=function(e){return function(t){return Zu(function(n,r){return t.compare(e(n),e(r))})}},DM="Ord",BM=function(){return{concat:function(e,t){return Zu(function(n,r){var i=e.compare(n,r);return i!==0?i:t.compare(n,r)})}}},D_=function(){return{concat:BM().concat,empty:Zu(function(){return 0})}},UM={URI:DM,contramap:N6},P6={equals:A_,compare:Zn(0)},W6=function(e){return function(t){return function(n){return n===t||e.compare(n,t)===0}}},qM=function(e){return function(t,n){return e.compare(t,n)===-1}},zM=function(e){return function(t,n){return e.compare(t,n)===1}},j6=function(e){return function(t,n){return e.compare(t,n)!==1}},L6=function(e){return function(t,n){return e.compare(t,n)!==-1}},Tm=function(e){return function(t,n){return t===n||e.compare(t,n)<1?t:n}},Im=function(e){return function(t,n){return t===n||e.compare(t,n)>-1?t:n}},KM=function(e){var t=Tm(e),n=Im(e);return function(r,i){return function(o){return n(t(o,i),r)}}},D6=function(e){var t=qM(e),n=zM(e);return function(r,i){return function(o){return!(t(o,r)||n(o,i))}}},B6=LM,U6=L_,q6=UM;function z6(e,t){return e<t?-1:e>t?1:0}var B_={equals:Lc.equals,compare:z6},K6=B_,V6=B_,Cm=B_,H6=v(Cm,Sm(function(e){return e.valueOf()}));const G6=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:UM,URI:DM,between:D6,clamp:KM,contramap:Sm,equals:W6,equalsDefault:jM,fromCompare:Zu,geq:L6,getDualOrd:U6,getMonoid:D_,getSemigroup:BM,getTupleOrd:B6,gt:zM,leq:j6,lt:qM,max:Im,min:Tm,ord:q6,ordBoolean:K6,ordDate:H6,ordNumber:Cm,ordString:V6,reverse:L_,trivial:P6,tuple:LM},Symbol.toStringTag,{value:"Module"}));var VM=function(e){return{concat:function(t,n){return e.concat(n,t)}}},Y6=function(e){return function(t){return{concat:function(n,r){return e(n)?t.concat(n,r):r}}}},J6=function(e){return function(t){return{concat:function(n,r){return e(r)?t.concat(n,r):n}}}},Z6=function(e){return function(t){return{concat:function(n,r){return t.concat(e(n),e(r))}}}},HM=function(e){return function(t){return function(n){return n.reduce(function(r,i){return e.concat(r,i)},t)}}};const X6=Object.freeze(Object.defineProperty({__proto__:null,concatAll:HM,endo:Z6,filterFirst:Y6,filterSecond:J6,reverse:VM},Symbol.toStringTag,{value:"Module"}));var Om=function(e){return{concat:Tm(e)}},wm=function(e){return{concat:Im(e)}},U_=function(e){return{concat:function(){return e}}},q_=VM,z_=function(e){return{concat:function(t,n){var r={};for(var i in e)ct.call(e,i)&&(r[i]=e[i].concat(t[i],n[i]));return r}}},K_=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{concat:function(n,r){return e.map(function(i,o){return i.concat(n[o],r[o])})}}},GM=function(e){return function(t){return{concat:function(n,r){return t.concat(n,t.concat(e,r))}}}},V_=function(){return{concat:q}},Em=function(){return{concat:function(e,t){return t}}},H_=HM,YM=U_(void 0),Q6=function(){return{concat:function(e,t){return Object.assign({},e,t)}}},e9=Em,t9=V_,n9=K_,r9=z_,i9=q_,o9=wm,a9=Om,u9=GM;function s9(e){var t=H_(e);return function(n,r){return r===void 0?t(n):t(n)(r)}}var JM={concat:function(e,t){return e&&t}},ZM={concat:function(e,t){return e||t}},c9=R_,XM={concat:function(e,t){return e+t}},QM={concat:function(e,t){return e+t}},eR={concat:function(e,t){return e*t}};const tR=Object.freeze(Object.defineProperty({__proto__:null,concatAll:H_,constant:U_,first:V_,fold:s9,getDualSemigroup:i9,getFirstSemigroup:t9,getFunctionSemigroup:c9,getIntercalateSemigroup:u9,getJoinSemigroup:o9,getLastSemigroup:e9,getMeetSemigroup:a9,getObjectSemigroup:Q6,getStructSemigroup:r9,getTupleSemigroup:n9,intercalate:GM,last:Em,max:wm,min:Om,reverse:q_,semigroupAll:JM,semigroupAny:ZM,semigroupProduct:eR,semigroupString:XM,semigroupSum:QM,semigroupVoid:YM,struct:z_,tuple:K_},Symbol.toStringTag,{value:"Module"}));var pd=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},hd=tn,Hi=mt,xm=function(e,t){return e<0||e>=t.length},G_=function(e){return function(t){return pd([e],t,!0)}},qc=G_,Y_=function(e){return function(t){return pd(pd([],t,!0),[e],!1)}},Mm=Y_,Rm=function(e,t,n){if(Hi(n)){var r=bm(n);return r.splice(e,0,t),r}return[t]},J_=function(e,t,n){if(n[e]===t)return n;var r=bm(n);return r[e]=t,r},Z_=function(e){return function(t){if(t.length===1)return t;for(var n=[An(t)],r=si(t),i=function(s){n.every(function(c){return!e.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},nR=function(e){if(Hi(e)){var t=D_();return e0(e.reduce(t.concat,t.empty))}return q},X_=function(e){var t=Z_(e);return function(n){return function(r){return t(v(r,vd(n)))}}},Q_=function(e){return function(t){var n=t.length,r=Math.round(e)%n;if(xm(Math.abs(r),t)||r===0)return t;if(r<0){var i=Fm(-r)(t),o=i[0],a=i[1];return v(a,vd(o))}else return Q_(r-n)(t)}},md=function(e){return Hi(e)?fe(e):ye},km=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},l9=function(e){return km(function(){return e})},rR=function(e,t){return e<=t?km(function(n){return e+n})(t-e+1):[e]},iR=function(e){return[An(e),si(e)]},oR=function(e){return[zc(e),Va(e)]},f9=function(e){return md(e.slice())};function aR(e){return function(t){return t.concat(e)}}function vd(e,t){return t?e.concat(t):function(n){return n.concat(e)}}var d9=function(e){return e.length===1?e:pd([Va(e)],e.slice(0,-1).reverse(),!0)};function uR(e){return function(t){var n=t.length;if(n===0)return hd;for(var r=[],i=t[0],o=[i],a=1;a<n;a++){var u=t[a];e.equals(u,i)?o.push(u):(r.push(o),i=u,o=[i])}return r.push(o),r}}var p9=function(e){return function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=e(o);ct.call(n,a)?n[a].push(o):n[a]=[o]}return n}},e0=function(e){return function(t){return t.length===1?t:t.slice().sort(e.compare)}},h9=function(e,t){return sR(e,function(){return t})},sR=function(e,t){return function(n){return xm(e,n)?ye:fe(J_(e,t(n[e]),n))}},cR=function(e,t,n){for(var r=[n(e[0],t[0])],i=Math.min(e.length,t.length),o=1;o<i;o++)r[o]=n(e[o],t[o]);return r};function lR(e,t){return t===void 0?function(n){return lR(n,e)}:cR(e,t,function(n,r){return[n,r]})}var m9=function(e){for(var t=[e[0][0]],n=[e[0][1]],r=1;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},Am=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},t0=function(e){return function(t){var n=si(t);return Hi(n)?v(n,Am(e),qc(An(t))):t}},fR=function(e){return function(t){for(var n=bm(e(0,An(t))),r=1;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},n0=function(e){return function(t){for(var n=e(t),r=n[0],i=n[1],o=[r],a=i;Hi(a);){var u=e(a),s=u[0],c=u[1];o.push(s),a=c}return o}},Fm=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[t,hd]:[v(t.slice(1,n),qc(An(t))),t.slice(n)]}},dR=function(e){return n0(Fm(e))},ui=function(e,t){return v(e,l0(t))},r0=function(e,t){return v(e,f0(t))},gd=function(e,t){return v(e,yR(t))},i0=function(e,t){return v(e,Nm(t))},pR=function(e,t){return v(e,c0(t))},yd=function(e,t,n){return v(e,d0(t,n))},bd=function(e){var t=p0(e);return function(n,r){return v(n,t(r))}},_d=function(e,t,n){return v(e,h0(t,n))},o0=function(e){var t=bR(e);return function(n,r){return v(n,t(r))}},hR=function(e,t){return v(e,gR(t))},a0=function(e,t,n){return v(e,Pm(t,n))},u0=function(e){var t=m0(e);return function(n,r){return v(n,t(r))}},s0=function(e,t,n){return v(e,Wm(t,n))},mR=function(e){var t=Lm(e);return function(n,r){return v(n,t(r))}},Ka=dd,vR=function(e){return function(t){return v(t,aR(e()))}},gR=vR,yR=function(e){return Nm(function(t){return v(e,l0(t))})},Nm=function(e){return fR(function(t,n){return e(n)})},c0=function(e){return function(t){for(var n=si(t),r=[e(t)];Hi(n);)r.push(e(n)),n=si(n);return r}},v9=c0(q),g9=Nm(q),l0=function(e){return f0(function(t,n){return e(n)})},f0=function(e){return function(t){for(var n=[e(0,An(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},d0=function(e,t){return Pm(e,function(n,r,i){return t(r,i)})},p0=function(e){return function(t){return function(n){return n.slice(1).reduce(function(r,i){return e.concat(r,t(i))},t(n[0]))}}},h0=function(e,t){return Wm(e,function(n,r,i){return t(r,i)})},Pm=function(e,t){return function(n){return n.reduce(function(r,i,o){return t(o,r,i)},e)}},m0=function(e){return function(t){return function(n){return n.slice(1).reduce(function(r,i,o){return e.concat(r,t(o+1,i))},t(0,n[0]))}}},Wm=function(e,t){return function(n){return n.reduceRight(function(r,i,o){return t(o,i,r)},e)}},bR=function(e){var t=Lm(e);return function(n){return t(function(r,i){return n(i)})}},jm=function(e){return Lm(e)(Xn)},Lm=function(e){return function(t){return function(n){for(var r=e.map(t(0,An(n)),Ka),i=1;i<n.length;i++)r=e.ap(e.map(r,function(o){return function(a){return v(o,Mm(a))}}),t(i,n[i]));return r}}},Dm=gr,kn="ReadonlyNonEmptyArray",_R=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},y9=function(){return{concat:vd}},$R=function(e){return jr(function(t,n){return t.length===n.length&&t.every(function(r,i){return e.equals(r,n[i])})})},b9=function(e){var t=X_(e);return{concat:function(n,r){return t(r)(n)}}},v0={URI:kn,map:ui},_9=Ue(v0),$9={URI:kn,of:Ka},S9={URI:kn,map:ui,mapWithIndex:r0},Bm={URI:kn,map:ui,ap:gd},T9=Ot(Bm),I9=wt(Bm),C9={URI:kn,map:ui,ap:gd,of:Ka},g0={URI:kn,map:ui,ap:gd,chain:i0},O9=lt(g0),w9={URI:kn,map:ui,ap:gd,of:Ka,chain:i0},E9={URI:kn,reduce:yd,foldMap:bd,reduceRight:_d},x9={URI:kn,reduce:yd,foldMap:bd,reduceRight:_d,reduceWithIndex:a0,foldMapWithIndex:u0,reduceRightWithIndex:s0},M9={URI:kn,map:ui,reduce:yd,foldMap:bd,reduceRight:_d,traverse:o0,sequence:jm},R9={URI:kn,map:ui,mapWithIndex:r0,reduce:yd,foldMap:bd,reduceRight:_d,traverse:o0,sequence:jm,reduceWithIndex:a0,foldMapWithIndex:u0,reduceRightWithIndex:s0,traverseWithIndex:mR},k9={URI:kn,map:ui,alt:hR},A9={URI:kn,map:ui,extend:pR,extract:Dm},F9=Ka(zt),N9=Ct(v0),P9=xt(g0),W9=Et(Bm),An=Dm,si=Uc,Va=function(e){return e[e.length-1]},zc=function(e){return e.slice(0,-1)},SR=function(e){var t=Om(e);return function(n){return n.reduce(t.concat)}},TR=function(e){var t=wm(e);return function(n){return n.reduce(t.concat)}},Um=function(e){return function(t){return t.reduce(e.concat)}},j9=function(e){return function(t){return e(An(t),si(t))}},L9=function(e){return function(t){return e(zc(t),Va(t))}},IR=function(e){return function(t){return pd([e(An(t))],si(t),!0)}},D9=function(e){return IR(function(){return e})},CR=function(e){return function(t){return v(zc(t),Mm(e(Va(t))))}},B9=function(e){return CR(function(){return e})},y0=function(e){var t=Um(e);return function(n){return H(t0(n),t)}};function U9(e){var t=e0(e),n=uR(e);return function(r){return Hi(r)?n(t(r)):hd}}function q9(e){return OR(function(t,n){return e(n)})}var OR=function(e){return function(t){return md(t.filter(function(n,r){return e(r,n)}))}},z9=iR,K9=oR;function wR(e,t){return t===void 0?qc(e):v(t,qc(e))}var ER=function(e,t){return v(e,vd([t]))},V9=function(e,t){return function(n){return e<0||e>n.length?ye:fe(Rm(e,t,n))}},H9=Am,G9=Um,Y9={URI:kn,of:Ka,map:ui,mapWithIndex:r0,ap:gd,chain:i0,extend:pR,extract:Dm,reduce:yd,foldMap:bd,reduceRight:_d,traverse:o0,sequence:jm,reduceWithIndex:a0,foldMapWithIndex:u0,reduceRightWithIndex:s0,traverseWithIndex:mR,alt:hR};const J9=Object.freeze(Object.defineProperty({__proto__:null,Alt:k9,Applicative:C9,Apply:Bm,Chain:g0,Comonad:A9,Do:F9,Foldable:E9,FoldableWithIndex:x9,Functor:v0,FunctorWithIndex:S9,Monad:w9,Pointed:$9,Traversable:M9,TraversableWithIndex:R9,URI:kn,alt:gR,altW:vR,ap:yR,apFirst:T9,apS:W9,apSecond:I9,append:Mm,appendW:Y_,bind:P9,bindTo:N9,chain:Nm,chainFirst:O9,chainWithIndex:fR,chop:n0,chunksOf:dR,concat:vd,concatAll:Um,concatW:aR,cons:wR,duplicate:v9,empty:hd,extend:c0,extract:Dm,filter:q9,filterWithIndex:OR,flap:_9,flatten:g9,fold:G9,foldMap:p0,foldMapWithIndex:m0,fromArray:f9,fromReadonlyArray:md,getEq:$R,getSemigroup:y9,getShow:_R,getUnionSemigroup:b9,group:uR,groupBy:p9,groupSort:U9,head:An,init:zc,insertAt:V9,intercalate:y0,intersperse:t0,isNonEmpty:Hi,isOutOfBound:xm,last:Va,makeBy:km,map:l0,mapWithIndex:f0,matchLeft:j9,matchRight:L9,max:TR,min:SR,modifyAt:sR,modifyHead:IR,modifyLast:CR,of:Ka,prepend:qc,prependAll:Am,prependToAll:H9,prependW:G_,range:rR,readonlyNonEmptyArray:Y9,reduce:d0,reduceRight:h0,reduceRightWithIndex:Wm,reduceWithIndex:Pm,replicate:l9,reverse:d9,rotate:Q_,sequence:jm,snoc:ER,sort:e0,sortBy:nR,splitAt:Fm,tail:si,traverse:bR,traverseWithIndex:Lm,unappend:oR,uncons:z9,union:X_,uniq:Z_,unprepend:iR,unsafeInsertAt:Rm,unsafeUpdateAt:J_,unsnoc:K9,unzip:m9,updateAt:h9,updateHead:D9,updateLast:B9,zip:lR,zipWith:cR},Symbol.toStringTag,{value:"Module"}));var xR={equals:function(e,t){return e===t}},MR={concat:function(e,t){return e+t}},RR="",Z9={concat:MR.concat,empty:RR},V={equals:xR.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},X9={show:function(e){return JSON.stringify(e)}},Q9=function(e){return typeof e=="string"},eG=function(e){return e.toUpperCase()},tG=function(e){return e.toLowerCase()},nG=function(e,t){return function(n){return n.replace(e,t)}},rG=function(e){return e.trim()},iG=function(e){return e.trimLeft()},oG=function(e){return e.trimRight()},aG=function(e,t){return function(n){return n.slice(e,t)}},uG=function(e){return e.length===0},sG=function(e){return e.length},cG=function(e){return function(t){var n=t.split(e);return Hi(n)?n:[t]}},lG=function(e,t){return function(n){return n.includes(e,t)}},fG=function(e,t){return function(n){return n.startsWith(e,t)}},dG=function(e,t){return function(n){return n.endsWith(e,t)}};const pG=Object.freeze(Object.defineProperty({__proto__:null,Eq:xR,Monoid:Z9,Ord:V,Semigroup:MR,Show:X9,empty:RR,endsWith:dG,includes:lG,isEmpty:uG,isString:Q9,replace:nG,size:sG,slice:aG,split:cG,startsWith:fG,toLowerCase:tG,toUpperCase:eG,trim:rG,trimLeft:iG,trimRight:oG},Symbol.toStringTag,{value:"Module"}));function ci(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.separate)}}}function li(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.compact)}}}function b0(e){return function(t){var n=e.wither(t);return function(r){return function(i){return n(i,function(o){return t.map(r(o),function(a){return a?fe(o):ye})})}}}}const hG=Object.freeze(Object.defineProperty({__proto__:null,filterE:b0,wiltDefault:ci,witherDefault:li},Symbol.toStringTag,{value:"Module"}));var mG=function(e){return Object.assign({},e)},vG=function(e){return Object.assign({},e)},kR=function(e){return Object.keys(e).length},fi=function(e){for(var t in e)if(ct.call(e,t))return!1;return!0},Kc=function(e){return function(t){return Object.keys(t).sort(e.compare)}},gG=Kc(V);function qm(e){if(typeof e=="function")return qm(V)(e);var t=Kc(e);return function(n){return function(r){for(var i=[],o=0,a=t(r);o<a.length;o++){var u=a[o];i.push(n(u,r[u]))}return i}}}var _0=qm(V)(function(e,t){return[e,t]});function yG(e){return function(t){var n=_0(t),r=n.length;return e.unfold(0,function(i){return i<r?fe([n[i],i+1]):ye})}}var $0=function(e,t){return function(n){if(ct.call(n,e)&&n[e]===t)return n;var r=Object.assign({},n);return r[e]=t,r}},Ao=function(e,t){return ct.call(t,e)};function zm(e){return function(t){if(!ct.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}var bG=function(e,t){return function(n){if(!Ao(e,n))return ye;if(n[e]===t)return fe(n);var r=Object.assign({},n);return r[e]=t,fe(r)}},_G=function(e,t){return function(n){if(!Ao(e,n))return ye;var r=t(n[e]);if(r===n[e])return fe(n);var i=Object.assign({},n);return i[e]=r,fe(i)}};function $G(e){var t=zm(e);return function(n){var r=Xu(e,n);return Ft(r)?ye:fe([r.value,t(n)])}}function Km(e){return function(t,n){if(n===void 0){var r=Km(e);return function(o){return r(o,t)}}for(var i in t)if(!ct.call(n,i)||!e.equals(t[i],n[i]))return!1;return!0}}function Xu(e,t){return t===void 0?function(n){return Xu(e,n)}:ct.call(t,e)?fe(t[e]):ye}var $d={};function Vm(e){return function(t){var n={};for(var r in t)ct.call(t,r)&&(n[r]=e(r,t[r]));return n}}function S0(e){return Vm(function(t,n){return e(n)})}function Vc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return Vc(V).apply(void 0,e);var n=Kc(e[0]);return function(r,i){return function(o){for(var a=r,u=n(o),s=u.length,c=0;c<s;c++){var l=u[c];a=i(l,a,o[l])}return a}}}function Hc(e){if("compare"in e){var t=Kc(e);return function(n){return function(r){return function(i){for(var o=n.empty,a=t(i),u=a.length,s=0;s<u;s++){var c=a[s];o=n.concat(o,r(c,i[c]))}return o}}}}return Hc(V)(e)}function Gc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return Gc(V).apply(void 0,e);var n=Kc(e[0]);return function(r,i){return function(o){for(var a=r,u=n(o),s=u.length,c=s-1;c>=0;c--){var l=u[c];a=i(l,o[l],a)}return a}}}var AR=function(e,t){var n;return n={},n[e]=t,n};function FR(e){var t=Td(V)(e);return function(n){return function(r){return t(r,n)}}}function Hm(e){var t=Gi(V)(e);return function(n){return function(r){return t(r,n)}}}function Yc(e){return Sd(V)(e)}var SG=function(e){var t=Hm(e);return function(n){return function(r){return e.map(v(r,t(n)),Fo)}}},TG=function(e){var t=Hm(e);return function(n){return function(r){return e.map(v(r,t(n)),No)}}};function Gm(e){return function(t){var n={},r={};for(var i in t)if(ct.call(t,i)){var o=e(i,t[i]);switch(o._tag){case"Left":n[i]=o.left;break;case"Right":r[i]=o.right;break}}return Ee(n,r)}}function Ym(e){return function(t){var n={},r={};for(var i in t)if(ct.call(t,i)){var o=t[i];e(i,o)?r[i]=o:n[i]=o}return Ee(n,r)}}function Jm(e){return function(t){var n={};for(var r in t)if(ct.call(t,r)){var i=e(r,t[r]);gt(i)&&(n[r]=i.value)}return n}}function Zm(e){return function(t){var n={},r=!1;for(var i in t)if(ct.call(t,i)){var o=t[i];e(i,o)?n[i]=o:r=!0}return r?n:t}}function NR(e,t){var n=T0(e,t);return function(r){return n(r,q)}}function T0(e,t){return function(n,r){return t.reduce(n,{},function(i,o){var a=r(o),u=a[0],s=a[1];return i[u]=ct.call(i,u)?e.concat(i[u],s):s,i})}}var IG=_0,CG=function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];t[i[0]]=i[1]}return t};function PR(e){return function(t){for(var n in t)if(!e(t[n]))return!1;return!0}}function WR(e){return function(t){for(var n in t)if(e(t[n]))return!0;return!1}}function I0(e){return function(t,n){if(n===void 0){var r=I0(e);return function(o){return r(t,o)}}for(var i in n)if(e.equals(n[i],t))return!0;return!1}}var C0=function(e){return function(t){return function(n){if(fi(n))return t;if(fi(t))return n;var r={};for(var i in n)Ao(i,t)?r[i]=e.concat(n[i],t[i]):r[i]=n[i];for(var i in t)Ao(i,r)||(r[i]=t[i]);return r}}},O0=function(e){return function(t){return function(n){if(fi(n)||fi(t))return $d;var r={};for(var i in n)Ao(i,t)&&(r[i]=e.concat(n[i],t[i]));return r}}},w0=function(e){return function(t){if(fi(t))return e;if(fi(e))return t;var n={};for(var r in t)Ao(r,e)||(n[r]=t[r]);for(var r in e)Ao(r,t)||(n[r]=e[r]);return n}},yr=function(e,t){return v(e,S0(t))},Qu=function(e,t){return v(e,Vm(t))},br=function(e){var t=Id(e);return function(n,r,i){return v(n,t(r,i))}},_r=function(e){return function(t){var n=Cd(e)(t);return function(r,i){return v(r,n(i))}}},$r=function(e){var t=Od(e);return function(n,r,i){return v(n,t(r,i))}},es=function(e,t){return v(e,E0(t))},ts=function(e,t){return v(e,x0(t))},ns=function(e,t){return v(e,M0(t))},rs=function(e,t){return v(e,R0(t))},is=function(e){var t=Vc(e);return function(n,r,i){return v(n,t(r,i))}},as=function(e){var t=Hc(e);return function(n){var r=t(n);return function(i,o){return v(i,r(o))}}},us=function(e){var t=Gc(e);return function(n,r,i){return v(n,t(r,i))}},Xm=function(e,t){return v(e,Gm(t))},Qm=function(e,t){return v(e,Ym(t))},ev=function(e,t){return v(e,Jm(t))},tv=function(e,t){return v(e,Zm(t))},Gi=function(e){var t=Td(e);return function(n){var r=t(n);return function(i,o){return r(i,H(Xn,o))}}},Sd=function(e){var t=Gi(e);return function(n){var r=t(n);return function(i){return r(i,q)}}},Td=function(e){return function(t){var n=Kc(e);return function(r,i){var o=n(r);if(o.length===0)return t.of($d);for(var a=t.of({}),u=function(f){a=t.ap(t.map(a,function(d){return function(p){var h;return Object.assign({},d,(h={},h[f]=p,h))}}),i(f,r[f]))},s=0,c=o;s<c.length;s++){var l=c[s];u(l)}return a}}},E0=function(e){return Zm(function(t,n){return e(n)})},x0=function(e){return Jm(function(t,n){return e(n)})},M0=function(e){return Ym(function(t,n){return e(n)})},R0=function(e){return Gm(function(t,n){return e(n)})};function Id(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===1){var n=Vc(e[0]);return function(r,i){return n(r,function(o,a,u){return i(a,u)})}}return Id(V).apply(void 0,e)}function Cd(e){if("compare"in e){var t=Hc(e);return function(n){var r=t(n);return function(i){return r(function(o,a){return i(a)})}}}return Cd(V)(e)}function Od(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===1){var n=Gc(e[0]);return function(r,i){return n(r,function(o,a,u){return i(a,u)})}}return Od(V).apply(void 0,e)}var Fo=function(e){var t={};for(var n in e)if(ct.call(e,n)){var r=e[n];gt(r)&&(t[n]=r.value)}return t},No=function(e){var t={},n={};for(var r in e)if(ct.call(e,r)){var i=e[r];qt(i)?t[r]=i.left:n[r]=i.right}return Ee(t,n)},nn="ReadonlyRecord";function nv(e){return"compare"in e?function(t){return{show:function(n){var r=qm(e)(function(i,o){return"".concat(JSON.stringify(i),": ").concat(t.show(o))})(n).join(", ");return r===""?"{}":"{ ".concat(r," }")}}}:nv(V)(e)}function jR(e){var t=Km(e);return jr(function(n,r){return t(n)(r)&&t(r)(n)})}function LR(e){return{concat:function(t,n){if(fi(t))return n;if(fi(n))return t;var r=Object.assign({},t);for(var i in n)ct.call(n,i)&&(r[i]=ct.call(t,i)?e.concat(t[i],n[i]):n[i]);return r},empty:$d}}var DR={URI:nn,map:yr},OG=Ue(DR),wG={URI:nn,map:yr,mapWithIndex:Qu},EG=function(e){return{URI:nn,reduce:br(e),foldMap:_r(e),reduceRight:$r(e)}},xG=function(e){return{URI:nn,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),reduceWithIndex:is(e),foldMapWithIndex:as(e),reduceRightWithIndex:us(e)}},wd={URI:nn,compact:Fo,separate:No},MG={URI:nn,map:yr,compact:Fo,separate:No,filter:es,filterMap:ts,partition:ns,partitionMap:rs},RG={URI:nn,map:yr,mapWithIndex:Qu,compact:Fo,separate:No,filter:es,filterMap:ts,partition:ns,partitionMap:rs,filterMapWithIndex:ev,filterWithIndex:tv,partitionMapWithIndex:Xm,partitionWithIndex:Qm},BR=function(e){return{URI:nn,map:yr,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),traverse:Gi(e),sequence:Sd(e)}},kG=function(e){return{URI:nn,map:yr,mapWithIndex:Qu,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),reduceWithIndex:is(e),foldMapWithIndex:as(e),reduceRightWithIndex:us(e),traverse:Gi(e),sequence:Sd(e),traverseWithIndex:Td(e)}},AG=function(e){var t=BR(e);return{URI:nn,map:yr,reduce:br(e),foldMap:_r(e),reduceRight:$r(e),traverse:t.traverse,sequence:t.sequence,compact:Fo,separate:No,filter:es,filterMap:ts,partition:ns,partitionMap:rs,wither:li(t,wd),wilt:ci(t,wd)}},UR=function(e){var t=C0(e);return{concat:function(n,r){return t(r)(n)}}},FG=function(e){return{concat:UR(e).concat,empty:$d}},NG=function(e){var t=O0(e);return{concat:function(n,r){return t(r)(n)}}},PG=function(){return{concat:function(e,t){return w0(t)(e)}}},WG={URI:nn,reduce:br(V),foldMap:_r(V),reduceRight:$r(V)},jG={URI:nn,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),reduceWithIndex:is(V),foldMapWithIndex:as(V),reduceRightWithIndex:us(V)},k0={URI:nn,map:yr,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),traverse:Gi(V),sequence:Yc},LG={URI:nn,map:yr,mapWithIndex:Qu,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),reduceWithIndex:is(V),foldMapWithIndex:as(V),reduceRightWithIndex:us(V),traverse:Gi(V),sequence:Yc,traverseWithIndex:Td(V)},qR=li(k0,wd),zR=ci(k0,wd),DG={URI:nn,map:yr,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),traverse:Gi(V),sequence:Yc,compact:Fo,separate:No,filter:es,filterMap:ts,partition:ns,partitionMap:rs,wither:qR,wilt:zR},A0=$0;function KR(e,t){return ct.call(t===void 0?this:t,e)}var BG={URI:nn,map:yr,reduce:br(V),foldMap:_r(V),reduceRight:$r(V),traverse:Gi(V),sequence:Yc,compact:Fo,separate:No,filter:es,filterMap:ts,partition:ns,partitionMap:rs,mapWithIndex:Qu,reduceWithIndex:is(V),foldMapWithIndex:as(V),reduceRightWithIndex:us(V),filterMapWithIndex:ev,filterWithIndex:tv,partitionMapWithIndex:Xm,partitionWithIndex:Qm,traverseWithIndex:Td(V),wither:qR,wilt:zR};const UG=Object.freeze(Object.defineProperty({__proto__:null,Compactable:wd,Filterable:MG,FilterableWithIndex:RG,Foldable:WG,FoldableWithIndex:jG,Functor:DR,FunctorWithIndex:wG,Traversable:k0,TraversableWithIndex:LG,URI:nn,Witherable:DG,_filter:es,_filterMap:ts,_filterMapWithIndex:ev,_filterWithIndex:tv,_foldMap:_r,_foldMapWithIndex:as,_map:yr,_mapWithIndex:Qu,_partition:ns,_partitionMap:rs,_partitionMapWithIndex:Xm,_partitionWithIndex:Qm,_reduce:br,_reduceRight:$r,_reduceRightWithIndex:us,_reduceWithIndex:is,_sequence:Sd,_traverse:Gi,collect:qm,compact:Fo,deleteAt:zm,difference:w0,elem:I0,empty:$d,every:PR,filter:E0,filterMap:x0,filterMapWithIndex:Jm,filterWithIndex:Zm,flap:OG,foldMap:Cd,foldMapWithIndex:Hc,fromEntries:CG,fromFoldable:NR,fromFoldableMap:T0,fromRecord:mG,getDifferenceMagma:PG,getEq:jR,getFoldable:EG,getFoldableWithIndex:xG,getIntersectionSemigroup:NG,getMonoid:LR,getShow:nv,getTraversable:BR,getTraversableWithIndex:kG,getUnionMonoid:FG,getUnionSemigroup:UR,getWitherable:AG,has:Ao,hasOwnProperty:KR,insertAt:A0,intersection:O0,isEmpty:fi,isSubrecord:Km,keys:gG,lookup:Xu,map:S0,mapWithIndex:Vm,modifyAt:_G,partition:M0,partitionMap:R0,partitionMapWithIndex:Gm,partitionWithIndex:Ym,pop:$G,readonlyRecord:BG,reduce:Id,reduceRight:Od,reduceRightWithIndex:Gc,reduceWithIndex:Vc,separate:No,sequence:Yc,singleton:AR,size:kR,some:WR,toEntries:IG,toReadonlyArray:_0,toRecord:vG,toUnfoldable:yG,traverse:Hm,traverseWithIndex:FR,union:C0,updateAt:bG,upsertAt:$0,wilt:TG,wither:SG},Symbol.toStringTag,{value:"Module"})),F0=F.createContext(void 0);function di(){const e=F.useContext(F0);if(!e)throw new Error("Missing EditorConfigContext.Provider");return e}var Qe={},G={},qG={get exports(){return G},set exports(e){G=e}};(function(e){var t,n,r,i,o,a,u,s,c,l,f,d,p,h,m,g,_,S,C,b,w,O,M,x,U,B,P,Z,ee;(function(J){var ge=typeof de=="object"?de:typeof self=="object"?self:typeof this=="object"?this:{};J(Te(ge,Te(e.exports)));function Te(k,A){return k!==ge&&(typeof Object.create=="function"?Object.defineProperty(k,"__esModule",{value:!0}):k.__esModule=!0),function(I,$){return k[I]=A?A(I,$):$}}})(function(J){var ge=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,A){k.__proto__=A}||function(k,A){for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&(k[I]=A[I])};t=function(k,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");ge(k,A);function I(){this.constructor=k}k.prototype=A===null?Object.create(A):(I.prototype=A.prototype,new I)},n=Object.assign||function(k){for(var A,I=1,$=arguments.length;I<$;I++){A=arguments[I];for(var R in A)Object.prototype.hasOwnProperty.call(A,R)&&(k[R]=A[R])}return k},r=function(k,A){var I={};for(var $ in k)Object.prototype.hasOwnProperty.call(k,$)&&A.indexOf($)<0&&(I[$]=k[$]);if(k!=null&&typeof Object.getOwnPropertySymbols=="function")for(var R=0,$=Object.getOwnPropertySymbols(k);R<$.length;R++)A.indexOf($[R])<0&&Object.prototype.propertyIsEnumerable.call(k,$[R])&&(I[$[R]]=k[$[R]]);return I},i=function(k,A,I,$){var R=arguments.length,L=R<3?A:$===null?$=Object.getOwnPropertyDescriptor(A,I):$,X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(k,A,I,$);else for(var ne=k.length-1;ne>=0;ne--)(X=k[ne])&&(L=(R<3?X(L):R>3?X(A,I,L):X(A,I))||L);return R>3&&L&&Object.defineProperty(A,I,L),L},o=function(k,A){return function(I,$){A(I,$,k)}},a=function(k,A,I,$,R,L){function X(mr){if(mr!==void 0&&typeof mr!="function")throw new TypeError("Function expected");return mr}for(var ne=$.kind,ke=ne==="getter"?"get":ne==="setter"?"set":"value",se=!A&&k?$.static?k:k.prototype:null,Fe=A||(se?Object.getOwnPropertyDescriptor(se,$.name):{}),ze,He=!1,ut=I.length-1;ut>=0;ut--){var Ut={};for(var en in $)Ut[en]=en==="access"?{}:$[en];for(var en in $.access)Ut.access[en]=$.access[en];Ut.addInitializer=function(mr){if(He)throw new TypeError("Cannot add initializers after decoration has completed");L.push(X(mr||null))};var yn=(0,I[ut])(ne==="accessor"?{get:Fe.get,set:Fe.set}:Fe[ke],Ut);if(ne==="accessor"){if(yn===void 0)continue;if(yn===null||typeof yn!="object")throw new TypeError("Object expected");(ze=X(yn.get))&&(Fe.get=ze),(ze=X(yn.set))&&(Fe.set=ze),(ze=X(yn.init))&&R.push(ze)}else(ze=X(yn))&&(ne==="field"?R.push(ze):Fe[ke]=ze)}se&&Object.defineProperty(se,$.name,Fe),He=!0},u=function(k,A,I){for(var $=arguments.length>2,R=0;R<A.length;R++)I=$?A[R].call(k,I):A[R].call(k);return $?I:void 0},s=function(k){return typeof k=="symbol"?k:"".concat(k)},c=function(k,A,I){return typeof A=="symbol"&&(A=A.description?"[".concat(A.description,"]"):""),Object.defineProperty(k,"name",{configurable:!0,value:I?"".concat(I," ",A):A})},l=function(k,A){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(k,A)},f=function(k,A,I,$){function R(L){return L instanceof I?L:new I(function(X){X(L)})}return new(I||(I=Promise))(function(L,X){function ne(Fe){try{se($.next(Fe))}catch(ze){X(ze)}}function ke(Fe){try{se($.throw(Fe))}catch(ze){X(ze)}}function se(Fe){Fe.done?L(Fe.value):R(Fe.value).then(ne,ke)}se(($=$.apply(k,A||[])).next())})},d=function(k,A){var I={label:0,sent:function(){if(L[0]&1)throw L[1];return L[1]},trys:[],ops:[]},$,R,L,X;return X={next:ne(0),throw:ne(1),return:ne(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function ne(se){return function(Fe){return ke([se,Fe])}}function ke(se){if($)throw new TypeError("Generator is already executing.");for(;X&&(X=0,se[0]&&(I=0)),I;)try{if($=1,R&&(L=se[0]&2?R.return:se[0]?R.throw||((L=R.return)&&L.call(R),0):R.next)&&!(L=L.call(R,se[1])).done)return L;switch(R=0,L&&(se=[se[0]&2,L.value]),se[0]){case 0:case 1:L=se;break;case 4:return I.label++,{value:se[1],done:!1};case 5:I.label++,R=se[1],se=[0];continue;case 7:se=I.ops.pop(),I.trys.pop();continue;default:if(L=I.trys,!(L=L.length>0&&L[L.length-1])&&(se[0]===6||se[0]===2)){I=0;continue}if(se[0]===3&&(!L||se[1]>L[0]&&se[1]<L[3])){I.label=se[1];break}if(se[0]===6&&I.label<L[1]){I.label=L[1],L=se;break}if(L&&I.label<L[2]){I.label=L[2],I.ops.push(se);break}L[2]&&I.ops.pop(),I.trys.pop();continue}se=A.call(k,I)}catch(Fe){se=[6,Fe],R=0}finally{$=L=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}},p=function(k,A){for(var I in k)I!=="default"&&!Object.prototype.hasOwnProperty.call(A,I)&&ee(A,k,I)},ee=Object.create?function(k,A,I,$){$===void 0&&($=I);var R=Object.getOwnPropertyDescriptor(A,I);(!R||("get"in R?!A.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:function(){return A[I]}}),Object.defineProperty(k,$,R)}:function(k,A,I,$){$===void 0&&($=I),k[$]=A[I]},h=function(k){var A=typeof Symbol=="function"&&Symbol.iterator,I=A&&k[A],$=0;if(I)return I.call(k);if(k&&typeof k.length=="number")return{next:function(){return k&&$>=k.length&&(k=void 0),{value:k&&k[$++],done:!k}}};throw new TypeError(A?"Object is not iterable.":"Symbol.iterator is not defined.")},m=function(k,A){var I=typeof Symbol=="function"&&k[Symbol.iterator];if(!I)return k;var $=I.call(k),R,L=[],X;try{for(;(A===void 0||A-- >0)&&!(R=$.next()).done;)L.push(R.value)}catch(ne){X={error:ne}}finally{try{R&&!R.done&&(I=$.return)&&I.call($)}finally{if(X)throw X.error}}return L},g=function(){for(var k=[],A=0;A<arguments.length;A++)k=k.concat(m(arguments[A]));return k},_=function(){for(var k=0,A=0,I=arguments.length;A<I;A++)k+=arguments[A].length;for(var $=Array(k),R=0,A=0;A<I;A++)for(var L=arguments[A],X=0,ne=L.length;X<ne;X++,R++)$[R]=L[X];return $},S=function(k,A,I){if(I||arguments.length===2)for(var $=0,R=A.length,L;$<R;$++)(L||!($ in A))&&(L||(L=Array.prototype.slice.call(A,0,$)),L[$]=A[$]);return k.concat(L||Array.prototype.slice.call(A))},C=function(k){return this instanceof C?(this.v=k,this):new C(k)},b=function(k,A,I){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var $=I.apply(k,A||[]),R,L=[];return R={},X("next"),X("throw"),X("return"),R[Symbol.asyncIterator]=function(){return this},R;function X(He){$[He]&&(R[He]=function(ut){return new Promise(function(Ut,en){L.push([He,ut,Ut,en])>1||ne(He,ut)})})}function ne(He,ut){try{ke($[He](ut))}catch(Ut){ze(L[0][3],Ut)}}function ke(He){He.value instanceof C?Promise.resolve(He.value.v).then(se,Fe):ze(L[0][2],He)}function se(He){ne("next",He)}function Fe(He){ne("throw",He)}function ze(He,ut){He(ut),L.shift(),L.length&&ne(L[0][0],L[0][1])}},w=function(k){var A,I;return A={},$("next"),$("throw",function(R){throw R}),$("return"),A[Symbol.iterator]=function(){return this},A;function $(R,L){A[R]=k[R]?function(X){return(I=!I)?{value:C(k[R](X)),done:!1}:L?L(X):X}:L}},O=function(k){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var A=k[Symbol.asyncIterator],I;return A?A.call(k):(k=typeof h=="function"?h(k):k[Symbol.iterator](),I={},$("next"),$("throw"),$("return"),I[Symbol.asyncIterator]=function(){return this},I);function $(L){I[L]=k[L]&&function(X){return new Promise(function(ne,ke){X=k[L](X),R(ne,ke,X.done,X.value)})}}function R(L,X,ne,ke){Promise.resolve(ke).then(function(se){L({value:se,done:ne})},X)}},M=function(k,A){return Object.defineProperty?Object.defineProperty(k,"raw",{value:A}):k.raw=A,k};var Te=Object.create?function(k,A){Object.defineProperty(k,"default",{enumerable:!0,value:A})}:function(k,A){k.default=A};x=function(k){if(k&&k.__esModule)return k;var A={};if(k!=null)for(var I in k)I!=="default"&&Object.prototype.hasOwnProperty.call(k,I)&&ee(A,k,I);return Te(A,k),A},U=function(k){return k&&k.__esModule?k:{default:k}},B=function(k,A,I,$){if(I==="a"&&!$)throw new TypeError("Private accessor was defined without a getter");if(typeof A=="function"?k!==A||!$:!A.has(k))throw new TypeError("Cannot read private member from an object whose class did not declare it");return I==="m"?$:I==="a"?$.call(k):$?$.value:A.get(k)},P=function(k,A,I,$,R){if($==="m")throw new TypeError("Private method is not writable");if($==="a"&&!R)throw new TypeError("Private accessor was defined without a setter");if(typeof A=="function"?k!==A||!R:!A.has(k))throw new TypeError("Cannot write private member to an object whose class did not declare it");return $==="a"?R.call(k,I):R?R.value=I:A.set(k,I),I},Z=function(k,A){if(A===null||typeof A!="object"&&typeof A!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof k=="function"?A===k:k.has(A)},J("__extends",t),J("__assign",n),J("__rest",r),J("__decorate",i),J("__param",o),J("__esDecorate",a),J("__runInitializers",u),J("__propKey",s),J("__setFunctionName",c),J("__metadata",l),J("__awaiter",f),J("__generator",d),J("__exportStar",p),J("__createBinding",ee),J("__values",h),J("__read",m),J("__spread",g),J("__spreadArrays",_),J("__spreadArray",S),J("__await",C),J("__asyncGenerator",b),J("__asyncDelegator",w),J("__asyncValues",O),J("__makeTemplateObject",M),J("__importStar",x),J("__importDefault",U),J("__classPrivateFieldGet",B),J("__classPrivateFieldSet",P),J("__classPrivateFieldIn",Z)})})(qG);var Jc={};function VR(e){return function(t){return function(n){return n.reduce(function(r,i){return e.alt(r,function(){return i})},t)}}}const zG=Object.freeze(Object.defineProperty({__proto__:null,altAll:VR},Symbol.toStringTag,{value:"Module"}));function KG(e){return VR(e)(e.zero())}const VG=Object.freeze(Object.defineProperty({__proto__:null,altAll:KG},Symbol.toStringTag,{value:"Module"}));function Lr(e){var t=Kt(e);return function(n){return{concat:t(n).concat,empty:e.of(n.empty)}}}function HR(e,t){var n=Bc(e,t).map,r=ko(e,t);return{map:n,of:function(i){return e.of(t.of(i))},ap:function(i,o){return v(i,r(o))}}}const HG=Object.freeze(Object.defineProperty({__proto__:null,getApplicativeComposition:HR,getApplicativeMonoid:Lr},Symbol.toStringTag,{value:"Module"}));function Yi(e){return function(t){return function(n){return e.fromEither(Ft(n)?Ro(t()):za(n.value))}}}function Ha(e){return function(t,n){return function(r){return e.fromEither(t(r)?za(r):Ro(n(r)))}}}function Ji(e){var t=Yi(e);return function(n){var r=t(n);return function(i){return H(i,r)}}}function ss(e,t){var n=Ji(e);return function(r){var i=n(r);return function(o){return function(a){return t.chain(a,i(o))}}}}function Sr(e){return function(t){return H(t,e.fromEither)}}function Po(e,t){var n=Sr(e);return function(r){return function(i){return t.chain(i,n(r))}}}function Wo(e,t){return H(Sr(e),lt(t))}function cs(e,t){return function(n,r){return function(i){return t.chain(i,function(o){return e.fromEither(n(o)?za(o):Ro(r(o)))})}}}const GG=Object.freeze(Object.defineProperty({__proto__:null,chainEitherK:Po,chainFirstEitherK:Wo,chainOptionK:ss,filterOrElse:cs,fromEitherK:Sr,fromOption:Yi,fromOptionK:Ji,fromPredicate:Ha},Symbol.toStringTag,{value:"Module"}));var Ed=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},jo=function(e){return e.length>0},rv=function(e,t){return e<0||e>=t.length},N0=function(e){return function(t){return Ed([e],t,!0)}},Zc=N0,P0=function(e){return function(t){return Ed(Ed([],t,!0),[e],!1)}},xd=P0,W0=function(e,t,n){if(jo(n)){var r=Md(n);return r.splice(e,0,t),r}return[t]},j0=function(e,t,n){var r=Md(n);return r[e]=t,r},L0=function(e){return function(t){if(t.length===1)return Xc(t);for(var n=[Dr(t)],r=hi(t),i=function(s){n.every(function(c){return!e.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},GR=function(e){if(jo(e)){var t=D_();return q0(e.reduce(t.concat,t.empty))}return Xc},D0=function(e){var t=L0(e);return function(n){return function(r){return t(v(r,ov(n)))}}},B0=function(e){return function(t){var n=t.length,r=Math.round(e)%n;if(rv(Math.abs(r),t)||r===0)return Xc(t);if(r<0){var i=uv(-r)(t),o=i[0],a=i[1];return v(a,ov(o))}else return B0(r-n)(t)}},Md=bm,U0=function(e){return jo(e)?fe(e):ye},iv=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},YG=function(e){return iv(function(){return e})},YR=function(e,t){return e<=t?iv(function(n){return e+n})(t-e+1):[e]},JR=function(e){return[Dr(e),hi(e)]},ZR=function(e){return[el(e),Qc(e)]};function XR(e){return function(t){return t.concat(e)}}function ov(e,t){return t?e.concat(t):function(n){return n.concat(e)}}var JG=function(e){return Ed([Qc(e)],e.slice(0,-1).reverse(),!0)};function QR(e){return function(t){var n=t.length;if(n===0)return[];for(var r=[],i=t[0],o=[i],a=1;a<n;a++){var u=t[a];e.equals(u,i)?o.push(u):(r.push(o),i=u,o=[i])}return r.push(o),r}}var ZG=function(e){return function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=e(o);ct.call(n,a)?n[a].push(o):n[a]=[o]}return n}},q0=function(e){return function(t){return t.slice().sort(e.compare)}},XG=function(e,t){return function(n){return e<0||e>n.length?ye:fe(W0(e,t,n))}},QG=function(e,t){return ek(e,function(){return t})},ek=function(e,t){return function(n){return rv(e,n)?ye:fe(j0(e,t(n[e]),n))}},Xc=Md,Ga=function(e){return[e]},tk=function(e,t,n){for(var r=[n(e[0],t[0])],i=Math.min(e.length,t.length),o=1;o<i;o++)r[o]=n(e[o],t[o]);return r};function nk(e,t){return t===void 0?function(n){return nk(n,e)}:tk(e,t,function(n,r){return[n,r]})}var eY=function(e){for(var t=[e[0][0]],n=[e[0][1]],r=1;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},av=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},rk=function(e){return function(t){var n=hi(t);return jo(n)?v(n,av(e),Zc(Dr(t))):Xc(t)}},ik=m0,ok=p0,ak=function(e){return function(t){for(var n=Md(e(0,Dr(t))),r=1;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},z0=function(e){return function(t){for(var n=e(t),r=n[0],i=n[1],o=[r],a=i;jo(a);){var u=e(a),s=u[0],c=u[1];o.push(s),a=c}return o}},uv=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[Xc(t),[]]:[v(t.slice(1,n),Zc(Dr(t))),t.slice(n)]}},uk=function(e){return z0(uv(e))},pi=function(e,t){return v(e,X0(t))},K0=function(e,t){return v(e,Q0(t))},Rd=function(e,t){return v(e,pk(t))},V0=function(e,t){return v(e,sv(t))},sk=function(e,t){return v(e,Z0(t))},kd=function(e,t,n){return v(e,hk(t,n))},Ad=function(e){var t=ok(e);return function(n,r){return v(n,t(r))}},Fd=function(e,t,n){return v(e,vk(t,n))},H0=function(e){var t=yk(e);return function(n,r){return v(n,t(r))}},ck=function(e,t){return v(e,dk(t))},G0=function(e,t,n){return v(e,mk(t,n))},Y0=function(e){var t=ik(e);return function(n,r){return v(n,t(r))}},J0=function(e,t,n){return v(e,gk(t,n))},lk=function(e){var t=lv(e);return function(n,r){return v(n,t(r))}},fk=function(e){return function(t){return v(t,XR(e()))}},dk=fk,pk=function(e){return sv(function(t){return v(e,X0(t))})},sv=function(e){return ak(function(t,n){return e(n)})},Z0=function(e){return function(t){for(var n=hi(t),r=[e(t)];jo(n);)r.push(e(n)),n=hi(n);return r}},tY=Z0(q),nY=sv(q),X0=function(e){return Q0(function(t,n){return e(n)})},Q0=function(e){return function(t){for(var n=[e(0,Dr(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},hk=d0,mk=Pm,vk=h0,gk=Wm,yk=function(e){var t=lv(e);return function(n){return t(function(r,i){return n(i)})}},cv=function(e){return lv(e)(function(t,n){return n})},lv=function(e){return function(t){return function(n){for(var r=e.map(t(0,Dr(n)),Ga),i=1;i<n.length;i++)r=e.ap(e.map(r,function(o){return function(a){return v(o,xd(a))}}),t(i,n[i]));return r}}},e$=An,Fn="NonEmptyArray",rY=_R,iY=function(){return{concat:ov}},oY=$R,aY=function(e){var t=D0(e);return{concat:function(n,r){return t(r)(n)}}},t$={URI:Fn,map:pi},uY=Ue(t$),sY={URI:Fn,of:Ga},cY={URI:Fn,map:pi,mapWithIndex:K0},fv={URI:Fn,map:pi,ap:Rd},lY=Ot(fv),fY=wt(fv),dY={URI:Fn,map:pi,ap:Rd,of:Ga},n$={URI:Fn,map:pi,ap:Rd,chain:V0},pY=lt(n$),hY={URI:Fn,map:pi,ap:Rd,of:Ga,chain:V0},mY={URI:Fn,reduce:kd,foldMap:Ad,reduceRight:Fd},vY={URI:Fn,reduce:kd,foldMap:Ad,reduceRight:Fd,reduceWithIndex:G0,foldMapWithIndex:Y0,reduceRightWithIndex:J0},gY={URI:Fn,map:pi,reduce:kd,foldMap:Ad,reduceRight:Fd,traverse:H0,sequence:cv},yY={URI:Fn,map:pi,mapWithIndex:K0,reduce:kd,foldMap:Ad,reduceRight:Fd,traverse:H0,sequence:cv,reduceWithIndex:G0,foldMapWithIndex:Y0,reduceRightWithIndex:J0,traverseWithIndex:lk},bY={URI:Fn,map:pi,alt:ck},_Y={URI:Fn,map:pi,extend:sk,extract:e$},$Y=Ga(zt),SY=Ct(t$),TY=xt(n$),IY=Et(fv),Dr=An,hi=function(e){return e.slice(1)},Qc=Va,el=function(e){return e.slice(0,-1)},CY=SR,OY=TR,wY=function(e){return function(t){return t.reduce(e.concat)}},EY=function(e){return function(t){return e(Dr(t),hi(t))}},xY=function(e){return function(t){return e(el(t),Qc(t))}},bk=function(e){return function(t){return Ed([e(Dr(t))],hi(t),!0)}},MY=function(e){return bk(function(){return e})},_k=function(e){return function(t){return v(el(t),xd(e(Qc(t))))}},RY=function(e){return _k(function(){return e})},kY=y0;function AY(e){var t=q0(e),n=QR(e);return function(r){return jo(r)?n(t(r)):[]}}function FY(e){return $k(function(t,n){return e(n)})}var $k=function(e){return function(t){return U0(t.filter(function(n,r){return e(r,n)}))}},NY=JR,PY=ZR;function Sk(e,t){return t===void 0?Zc(e):v(t,Zc(e))}var Tk=function(e,t){return v(e,xd(t))},WY=av,jY=Um,LY={URI:Fn,of:Ga,map:pi,mapWithIndex:K0,ap:Rd,chain:V0,extend:sk,extract:e$,reduce:kd,foldMap:Ad,reduceRight:Fd,traverse:H0,sequence:cv,reduceWithIndex:G0,foldMapWithIndex:Y0,reduceRightWithIndex:J0,traverseWithIndex:lk,alt:ck};const DY=Object.freeze(Object.defineProperty({__proto__:null,Alt:bY,Applicative:dY,Apply:fv,Chain:n$,Comonad:_Y,Do:$Y,Foldable:mY,FoldableWithIndex:vY,Functor:t$,FunctorWithIndex:cY,Monad:hY,Pointed:sY,Traversable:gY,TraversableWithIndex:yY,URI:Fn,alt:dk,altW:fk,ap:pk,apFirst:lY,apS:IY,apSecond:fY,append:xd,appendW:P0,bind:TY,bindTo:SY,chain:sv,chainFirst:pY,chainWithIndex:ak,chop:z0,chunksOf:uk,concat:ov,concatAll:wY,concatW:XR,cons:Sk,copy:Xc,duplicate:tY,extend:Z0,extract:e$,filter:FY,filterWithIndex:$k,flap:uY,flatten:nY,fold:jY,foldMap:ok,foldMapWithIndex:ik,fromArray:U0,fromReadonlyNonEmptyArray:Md,getEq:oY,getSemigroup:iY,getShow:rY,getUnionSemigroup:aY,group:QR,groupBy:ZG,groupSort:AY,head:Dr,init:el,insertAt:XG,intercalate:kY,intersperse:rk,isNonEmpty:jo,isOutOfBound:rv,last:Qc,makeBy:iv,map:X0,mapWithIndex:Q0,matchLeft:EY,matchRight:xY,max:OY,min:CY,modifyAt:ek,modifyHead:bk,modifyLast:_k,nonEmptyArray:LY,of:Ga,prepend:Zc,prependAll:av,prependToAll:WY,prependW:N0,range:YR,reduce:hk,reduceRight:vk,reduceRightWithIndex:gk,reduceWithIndex:mk,replicate:YG,reverse:JG,rotate:B0,sequence:cv,snoc:Tk,sort:q0,sortBy:GR,splitAt:uv,tail:hi,traverse:yk,traverseWithIndex:lv,unappend:ZR,uncons:NY,union:D0,uniq:L0,unprepend:JR,unsafeInsertAt:W0,unsafeUpdateAt:j0,unsnoc:PY,unzip:eY,updateAt:QG,updateHead:MY,updateLast:RY,zip:nk,zipWith:tk},Symbol.toStringTag,{value:"Module"}));var BY=function(e){return typeof e=="number"},r$={equals:function(e,t){return e===t}},dv={equals:r$.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},UY={equals:r$.equals,compare:dv.compare,top:1/0,bottom:-1/0},qY={show:function(e){return JSON.stringify(e)}},Ik={concat:function(e,t){return e-t}},i$={concat:function(e,t){return e+t}},o$={concat:function(e,t){return e*t}},zY={concat:i$.concat,empty:0},KY={concat:o$.concat,empty:1},VY={add:i$.concat,zero:0,mul:o$.concat,one:1,sub:Ik.concat,degree:function(e){return 1},div:function(e,t){return e/t},mod:function(e,t){return e%t}};const HY=Object.freeze(Object.defineProperty({__proto__:null,Bounded:UY,Eq:r$,Field:VY,MagmaSub:Ik,MonoidProduct:KY,MonoidSum:zY,Ord:dv,SemigroupProduct:o$,SemigroupSum:i$,Show:qY,isNumber:BY},Symbol.toStringTag,{value:"Module"}));function tl(e,t){return function(n){return n?t.of(void 0):e.zero()}}const GY=Object.freeze(Object.defineProperty({__proto__:null,guard:tl},Symbol.toStringTag,{value:"Module"}));var YY=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},Zi=function(e){return e.length===0},Mt=Hi,JY=qc,ZY=G_,pv=Mm,XY=Y_,Ck=function(e,t){return e<=0?St:km(t)(e)},QY=function(e,t){return Ck(e,function(){return t})};function e7(e){return function(t){return e(t)?[t]:St}}var Ok=function(e){return Ft(e)?St:[e.value]},wk=function(e){return qt(e)?St:[e.right]},Ek=function(e,t){return function(n){return Mt(n)?t(n):e()}},xk=Ek,Mk=function(e,t){return function(n){return Mt(n)?t(An(n),si(n)):e()}},Rk=Mk,t7=Rk,kk=function(e,t){return function(n){return Mt(n)?t(zc(n),Va(n)):e()}},Ak=kk,n7=Ak,Fk=function(e){return function(t){if(Zi(t))return St;for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},r7=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[0]=e;for(var o=0;o<r;o++)i[o+1]=t(i[o],n[o]);return i}},i7=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[r]=e;for(var o=r-1;o>=0;o--)i[o]=t(n[o],i[o+1]);return i}},o7=function(e){return e.length},nl=xm;function ls(e,t){return t===void 0?function(n){return ls(e,n)}:nl(e,t)?ye:fe(t[e])}var Nk=function(e){return Mt(e)?fe(An(e)):ye},a$=function(e){return Mt(e)?fe(Va(e)):ye},a7=function(e){return Mt(e)?fe(si(e)):ye},u7=function(e){return Mt(e)?fe(zc(e)):ye},s7=function(e){return function(t){return nl(e,t)?t:e===0?St:t.slice(0,e)}},c7=function(e){return function(t){return nl(e,t)?t:e===0?St:t.slice(-e)}};function l7(e){return function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(!e(o))break;n.push(o)}var a=n.length;return a===t.length?t:a===0?St:n}}var Pk=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function f7(e){return function(t){var n=Kk(Pk(t,e))(t),r=n[0],i=n[1];return{init:r,rest:i}}}var d7=function(e){return function(t){return e<=0||Zi(t)?t:e>=t.length?St:t.slice(e,t.length)}},p7=function(e){return function(t){return e<=0||Zi(t)?t:e>=t.length?St:t.slice(0,t.length-e)}};function h7(e){return function(t){var n=Pk(t,e);return n===0?t:n===t.length?St:t.slice(n)}}var hv=function(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return fe(n);return ye}};function mv(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return fe(t[n]);return ye}}var Wk=function(e){return function(t){for(var n=0;n<t.length;n++){var r=e(t[n]);if(gt(r))return r}return ye}};function jk(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return fe(t[n]);return ye}}var Lk=function(e){return function(t){for(var n=t.length-1;n>=0;n--){var r=e(t[n]);if(gt(r))return r}return ye}},Dk=function(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return fe(n);return ye}},m7=function(e,t){return function(n){return e<0||e>n.length?ye:fe(Rm(e,t,n))}},v7=function(e,t){return Bk(e,function(){return t})},g7=function(e){return function(t){return nl(e,t)?ye:fe(vA(e,t))}},Bk=function(e,t){return function(n){return nl(e,n)?ye:fe(wv(e,t(n[e]),n))}},y7=function(e){return e.length<=1?e:e.slice().reverse()},b7=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Right"&&t.push(r.right)}return t},_7=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Left"&&t.push(r.left)}return t},$7=function(e){return function(t){return t.length<=1?t:t.slice().sort(e.compare)}},Uk=function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r};function qk(e,t){return t===void 0?function(n){return qk(n,e)}:Uk(e,t,function(n,r){return[n,r]})}var S7=function(e){for(var t=[],n=[],r=0;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},zk=function(e){var t=Am(e);return function(n){return Mt(n)?t(n):n}},T7=function(e){var t=t0(e);return function(n){return Mt(n)?t(n):n}},I7=function(e){var t=Q_(e);return function(n){return Mt(n)?t(n):n}};function Nd(e){return function(t,n){if(n===void 0){var r=Nd(e);return function(a){return r(t,a)}}for(var i=function(a){return e.equals(a,t)},o=0;o<n.length;o++)if(i(n[o]))return!0;return!1}}var C7=function(e){var t=Z_(e);return function(n){return Mt(n)?t(n):n}},O7=function(e){var t=nR(e);return function(n){return Mt(n)?t(n):n}},w7=function(e){var t=n0(e);return function(n){return Mt(n)?t(n):St}},Kk=function(e){return function(t){return e>=1&&Mt(t)?Fm(e)(t):Zi(t)?[t,St]:[St,t]}},E7=function(e){var t=dR(e);return function(n){return Mt(n)?t(n):St}},x7=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Ok(e.apply(void 0,t))}};function M7(e,t,n){n===void 0&&(n=function(){return!0});var r=function(i,o){return Mt(o)?v(An(o),Wd(function(a){return r(v(i,pv(a)),si(o))})):n.apply(void 0,i)?[t.apply(void 0,i)]:St};return r(St,e)}var Vk=function(e){return function(t){return Zi(t)?e:Zi(e)?t:t.concat(e)}},R7=Vk;function u$(e){var t=X_(e);return function(n,r){if(r===void 0){var i=u$(e);return function(o){return i(o,n)}}return Mt(n)&&Mt(r)?t(r)(n):Mt(n)?n:r}}function s$(e){var t=Nd(e);return function(n,r){if(r===void 0){var i=s$(e);return function(o){return i(o,n)}}return n.filter(function(o){return t(o,r)})}}function c$(e){var t=Nd(e);return function(n,r){if(r===void 0){var i=c$(e);return function(o){return i(o,n)}}return n.filter(function(o){return!t(o,r)})}}var rn=function(e,t){return v(e,v$(t))},vv=function(e,t){return v(e,nA(t))},Ya=function(e,t){return v(e,tA(t))},Pd=function(e,t){return v(e,Wd(t))},gv=function(e,t){return v(e,Sv(t))},yv=function(e,t){return v(e,y$(t))},bv=function(e,t){return v(e,rA(t))},_v=function(e,t){return v(e,iA(t))},Hk=function(e,t){return v(e,b$(t))},Gk=function(e,t){return v(e,_$(t))},l$=function(e,t){return v(e,eA(t))},fs=function(e,t,n){return v(e,Iv(t,n))},rl=function(e){var t=S$(e);return function(n,r){return v(n,t(r))}},il=function(e,t,n){return v(e,T$(t,n))},f$=function(e,t,n){return v(e,jd(t,n))},d$=function(e){var t=Tv(e);return function(n,r){return v(n,t(r))}},p$=function(e,t,n){return v(e,Cv(t,n))},Yk=function(e,t){return v(e,g$(t))},Jk=function(e,t){return v(e,oA(t))},Zk=function(e,t){return v(e,$$(t))},$v=function(e){var t=aA(e);return function(n,r){return v(n,t(r))}},Xk=function(e){var t=I$(e);return function(n,r){return v(n,t(r))}},h$=function(e,t){return v(e,M$(t))},m$=function(e,t){return v(e,R$(t))},ds=Ka,ol=function(){return St},Qk=function(e){return function(t){return t.concat(e())}},eA=Qk,tA=function(e){return Wd(function(t){return v(e,v$(t))})},Wd=function(e){return function(t){return v(t,Fk(function(n,r){return e(r)}))}},k7=Wd(q),v$=function(e){return function(t){return t.map(function(n){return e(n)})}},nA=function(e){return function(t){return t.map(function(n,r){return e(r,n)})}},al=function(e){for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];o._tag==="Left"?t.push(o.left):n.push(o.right)}return Ee(t,n)},Sv=function(e){return function(t){return t.filter(e)}},g$=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);gt(i)&&n.push(i.value)}return n}},y$=function(e){return g$(function(t,n){return e(n)})},ul=y$(q),rA=function(e){return b$(function(t,n){return e(n)})},b$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return Ee(n,r)}},iA=function(e){return _$(function(t,n){return e(n)})},_$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=e(i,t[i]);o._tag==="Left"?n.push(o.left):r.push(o.right)}return Ee(n,r)}},oA=function(e){return function(t){return t.filter(function(n,r){return e(r,n)})}},$$=function(e){return function(t){return t.map(function(n,r){return e(t.slice(r))})}},A7=$$(q),Tv=function(e){return function(t){return function(n){return n.reduce(function(r,i,o){return e.concat(r,t(o,i))},e.empty)}}},Iv=function(e,t){return jd(e,function(n,r,i){return t(r,i)})},S$=function(e){var t=Tv(e);return function(n){return t(function(r,i){return n(i)})}},jd=function(e,t){return function(n){for(var r=n.length,i=e,o=0;o<r;o++)i=t(o,i,n[o]);return i}},T$=function(e,t){return Cv(e,function(n,r,i){return t(r,i)})},Cv=function(e,t){return function(n){return n.reduceRight(function(r,i,o){return t(o,i,r)},e)}},aA=function(e){var t=I$(e);return function(n){return t(function(r,i){return n(i)})}},Ld=function(e){return function(t){return fs(t,e.of(ol()),function(n,r){return e.ap(e.map(n,function(i){return function(o){return v(i,pv(o))}}),r)})}},I$=function(e){return function(t){return jd(e.of(ol()),function(n,r,i){return e.ap(e.map(r,function(o){return function(a){return v(o,pv(a))}}),t(n,i))})}},F7=function(e){var t=k$(e);return function(n){return function(r){return t(r,n)}}},N7=function(e){var t=A$(e);return function(n){return function(r){return t(r,n)}}},C$=function(e,t){for(var n=[],r=e;;){var i=t(r);if(gt(i)){var o=i.value,a=o[0],u=o[1];n.push(a),r=u}else break}return n},ft="ReadonlyArray",uA=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},sA=function(){return{concat:function(e,t){return Zi(e)?t:Zi(t)?e:e.concat(t)}}},P7=function(){return{concat:sA().concat,empty:St}},cA=function(e){return jr(function(t,n){return t.length===n.length&&t.every(function(r,i){return e.equals(r,n[i])})})},lA=function(e){return Zu(function(t,n){for(var r=t.length,i=n.length,o=Math.min(r,i),a=0;a<o;a++){var u=e.compare(t[a],n[a]);if(u!==0)return u}return dv.compare(r,i)})},fA=function(e){var t=u$(e);return{concat:function(n,r){return t(r)(n)}}},W7=function(e){return{concat:fA(e).concat,empty:St}},j7=function(e){var t=s$(e);return{concat:function(n,r){return t(r)(n)}}},L7=function(e){var t=c$(e);return{concat:function(n,r){return t(r)(n)}}},O$={URI:ft,map:rn},D7=Ue(O$),dA={URI:ft,of:ds},B7={URI:ft,map:rn,mapWithIndex:vv},Ov={URI:ft,map:rn,ap:Ya},U7=Ot(Ov),q7=wt(Ov),z7={URI:ft,map:rn,ap:Ya,of:ds},w$={URI:ft,map:rn,ap:Ya,chain:Pd},K7={URI:ft,map:rn,ap:Ya,of:ds,chain:Pd},V7=lt(w$),H7={URI:ft,unfold:C$},G7={URI:ft,map:rn,alt:l$},pA={URI:ft,zero:ol},Y7=tl(pA,dA),J7={URI:ft,map:rn,ap:Ya,of:ds,alt:l$,zero:ol},Z7={URI:ft,map:rn,extend:Zk},E$={URI:ft,compact:ul,separate:al},X7={URI:ft,map:rn,compact:ul,separate:al,filter:gv,filterMap:yv,partition:bv,partitionMap:_v},Q7={URI:ft,map:rn,mapWithIndex:vv,compact:ul,separate:al,filter:gv,filterMap:yv,partition:bv,partitionMap:_v,partitionMapWithIndex:Gk,partitionWithIndex:Hk,filterMapWithIndex:Yk,filterWithIndex:Jk},eJ={URI:ft,reduce:fs,foldMap:rl,reduceRight:il},tJ={URI:ft,reduce:fs,foldMap:rl,reduceRight:il,reduceWithIndex:f$,foldMapWithIndex:d$,reduceRightWithIndex:p$},x$={URI:ft,map:rn,reduce:fs,foldMap:rl,reduceRight:il,traverse:$v,sequence:Ld},nJ={URI:ft,map:rn,mapWithIndex:vv,reduce:fs,foldMap:rl,reduceRight:il,reduceWithIndex:f$,foldMapWithIndex:d$,reduceRightWithIndex:p$,traverse:$v,sequence:Ld,traverseWithIndex:Xk},M$=function(e){return function(t){for(var n=YY([],e(t),!0),r=[];n.length>0;){var i=n.shift();qt(i)?n.unshift.apply(n,e(i.left)):r.push(i.right)}return r}},rJ={URI:ft,map:rn,ap:Ya,chain:Pd,chainRec:h$},R$=function(e){return function(t){var n=e(t),r=[],i=[];function o(c){qt(c)?e(c.left).forEach(function(l){return r.push(l)}):i.push(c.right)}for(var a=0,u=n;a<u.length;a++){var s=u[a];o(s)}for(;r.length>0;)o(r.shift());return i}},iJ={URI:ft,map:rn,ap:Ya,chain:Pd,chainRec:m$},k$=li(x$,E$),A$=ci(x$,E$),hA={URI:ft,map:rn,compact:ul,separate:al,filter:gv,filterMap:yv,partition:bv,partitionMap:_v,reduce:fs,foldMap:rl,reduceRight:il,traverse:$v,sequence:Ld,wither:k$,wilt:A$},oJ=b0(hA),mA={URI:ft,fromEither:wk},aJ=Sr(mA),uJ=Rm,wv=function(e,t,n){return Mt(n)?J_(e,t,n):n},vA=function(e,t){var n=t.slice();return n.splice(e,1),n},sJ=function(e){return e.slice()},cJ=function(e){return Zi(e)?St:e.slice()},St=hd;function gA(e){return function(t){return t.every(e)}}var yA=function(e){return function(t){return t.some(e)}},lJ=yA,bA=function(e){var t=y0(e);return function(n){return xk(function(){return e.empty},t(n))}},fJ=ds(zt),dJ=Ct(O$),pJ=xt(w$),hJ=Et(Ov),mJ=rR,vJ=wR,gJ=ER,yJ=zk,bJ={URI:ft,compact:ul,separate:al,map:rn,ap:Ya,of:ds,chain:Pd,filter:gv,filterMap:yv,partition:bv,partitionMap:_v,mapWithIndex:vv,partitionMapWithIndex:Gk,partitionWithIndex:Hk,filterMapWithIndex:Yk,filterWithIndex:Jk,alt:l$,zero:ol,unfold:C$,reduce:fs,foldMap:rl,reduceRight:il,traverse:$v,sequence:Ld,reduceWithIndex:f$,foldMapWithIndex:d$,reduceRightWithIndex:p$,traverseWithIndex:Xk,extend:Zk,wither:k$,wilt:A$};const _J=Object.freeze(Object.defineProperty({__proto__:null,Alt:G7,Alternative:J7,Applicative:z7,Apply:Ov,Chain:w$,ChainRecBreadthFirst:iJ,ChainRecDepthFirst:rJ,Compactable:E$,Do:fJ,Extend:Z7,Filterable:X7,FilterableWithIndex:Q7,Foldable:eJ,FoldableWithIndex:tJ,FromEither:mA,Functor:O$,FunctorWithIndex:B7,Monad:K7,Pointed:dA,Traversable:x$,TraversableWithIndex:nJ,URI:ft,Unfoldable:H7,Witherable:hA,Zero:pA,_chainRecBreadthFirst:m$,_chainRecDepthFirst:h$,alt:eA,altW:Qk,ap:tA,apFirst:U7,apS:hJ,apSecond:q7,append:pv,appendW:XY,bind:pJ,bindTo:dJ,chain:Wd,chainFirst:V7,chainRecBreadthFirst:R$,chainRecDepthFirst:M$,chainWithIndex:Fk,chop:w7,chunksOf:E7,compact:ul,comprehension:M7,concat:R7,concatW:Vk,cons:vJ,deleteAt:g7,difference:c$,dropLeft:d7,dropLeftWhile:h7,dropRight:p7,duplicate:A7,elem:Nd,empty:St,every:gA,exists:lJ,extend:$$,filter:Sv,filterE:oJ,filterMap:y$,filterMapWithIndex:g$,filterWithIndex:oA,findFirst:mv,findFirstMap:Wk,findIndex:hv,findLast:jk,findLastIndex:Dk,findLastMap:Lk,flap:D7,flatten:k7,foldLeft:t7,foldMap:S$,foldMapWithIndex:Tv,foldRight:n7,fromArray:cJ,fromEither:wk,fromEitherK:aJ,fromOption:Ok,fromOptionK:x7,fromPredicate:e7,getDifferenceMagma:L7,getEq:cA,getIntersectionSemigroup:j7,getMonoid:P7,getOrd:lA,getSemigroup:sA,getShow:uA,getUnionMonoid:W7,getUnionSemigroup:fA,guard:Y7,head:Nk,init:u7,insertAt:m7,intercalate:bA,intersection:s$,intersperse:T7,isEmpty:Zi,isNonEmpty:Mt,isOutOfBound:nl,last:a$,lefts:_7,lookup:ls,makeBy:Ck,map:v$,mapWithIndex:nA,match:xk,matchLeft:Rk,matchLeftW:Mk,matchRight:Ak,matchRightW:kk,matchW:Ek,modifyAt:Bk,of:ds,partition:rA,partitionMap:iA,partitionMapWithIndex:_$,partitionWithIndex:b$,prepend:JY,prependAll:zk,prependToAll:yJ,prependW:ZY,range:mJ,readonlyArray:bJ,reduce:Iv,reduceRight:T$,reduceRightWithIndex:Cv,reduceWithIndex:jd,replicate:QY,reverse:y7,rights:b7,rotate:I7,scanLeft:r7,scanRight:i7,separate:al,sequence:Ld,size:o7,snoc:gJ,some:yA,sort:$7,sortBy:O7,spanLeft:f7,splitAt:Kk,tail:a7,takeLeft:s7,takeLeftWhile:l7,takeRight:c7,toArray:sJ,traverse:aA,traverseWithIndex:I$,unfold:C$,union:u$,uniq:C7,unsafeDeleteAt:vA,unsafeInsertAt:uJ,unsafeUpdateAt:wv,unzip:S7,updateAt:v7,wilt:N7,wither:F7,zero:ol,zip:qk,zipWith:Uk},Symbol.toStringTag,{value:"Module"}));var Ja=function(e){return e.length===0},Nt=jo,$J=Zc,SJ=N0,Ev=xd,TJ=P0,_A=function(e,t){return e<=0?[]:iv(t)(e)},IJ=function(e,t){return _A(e,function(){return t})};function CJ(e){return function(t){return e(t)?[t]:[]}}var $A=function(e){return Ft(e)?[]:[e.value]},SA=function(e){return qt(e)?[]:[e.right]},TA=function(e,t){return function(n){return Nt(n)?t(n):e()}},OJ=TA,IA=function(e,t){return function(n){return Nt(n)?t(Dr(n),hi(n)):e()}},CA=IA,wJ=CA,OA=function(e,t){return function(n){return Nt(n)?t(el(n),Qc(n)):e()}},wA=OA,EJ=wA,EA=function(e){return function(t){for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},xJ=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[0]=e;for(var o=0;o<r;o++)i[o+1]=t(i[o],n[o]);return i}},MJ=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[r]=e;for(var o=r-1;o>=0;o--)i[o]=t(n[o],i[o+1]);return i}},RJ=function(e){return e.length},Dd=rv,kJ=ls,AJ=Nk,FJ=a$,NJ=function(e){return Nt(e)?fe(hi(e)):ye},PJ=function(e){return Nt(e)?fe(el(e)):ye},WJ=function(e){return function(t){return Dd(e,t)?_n(t):t.slice(0,e)}},jJ=function(e){return function(t){return Dd(e,t)?_n(t):e===0?[]:t.slice(-e)}};function LJ(e){return function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(!e(o))break;n.push(o)}return n}}var xA=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function DJ(e){return function(t){var n=FA(xA(t,e))(t),r=n[0],i=n[1];return{init:r,rest:i}}}var BJ=function(e){return function(t){return e<=0||Ja(t)?_n(t):e>=t.length?[]:t.slice(e,t.length)}},UJ=function(e){return function(t){return e<=0||Ja(t)?_n(t):e>=t.length?[]:t.slice(0,t.length-e)}};function qJ(e){return function(t){return t.slice(xA(t,e))}}var zJ=hv;function KJ(e){return mv(e)}var VJ=Wk;function HJ(e){return jk(e)}var GJ=Lk,YJ=Dk,_n=function(e){return e.slice()},JJ=function(e,t){return function(n){return e<0||e>n.length?ye:fe(cF(e,t,n))}},ZJ=function(e,t){return MA(e,function(){return t})},XJ=function(e){return function(t){return Dd(e,t)?ye:fe(fF(e,t))}},MA=function(e,t){return function(n){return Dd(e,n)?ye:fe(lF(e,t(n[e]),n))}},QJ=function(e){return Ja(e)?[]:e.slice().reverse()},e8=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Right"&&t.push(r.right)}return t},t8=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Left"&&t.push(r.left)}return t},n8=function(e){return function(t){return t.length<=1?_n(t):t.slice().sort(e.compare)}},RA=function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r};function kA(e,t){return t===void 0?function(n){return kA(n,e)}:RA(e,t,function(n,r){return[n,r]})}var r8=function(e){for(var t=[],n=[],r=0;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},AA=function(e){var t=av(e);return function(n){return Nt(n)?t(n):[]}},i8=function(e){var t=rk(e);return function(n){return Nt(n)?t(n):_n(n)}},o8=function(e){var t=B0(e);return function(n){return Nt(n)?t(n):_n(n)}},F$=Nd,a8=function(e){var t=L0(e);return function(n){return Nt(n)?t(n):_n(n)}},u8=function(e){var t=GR(e);return function(n){return Nt(n)?t(n):_n(n)}},s8=function(e){var t=z0(e);return function(n){return Nt(n)?t(n):[]}},FA=function(e){return function(t){return e>=1&&Nt(t)?uv(e)(t):Ja(t)?[_n(t),[]]:[[],_n(t)]}},c8=function(e){var t=uk(e);return function(n){return Nt(n)?t(n):[]}},l8=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return $A(e.apply(void 0,t))}};function f8(e,t,n){n===void 0&&(n=function(){return!0});var r=function(i,o){return Nt(o)?v(Dr(o),Ud(function(a){return r(v(i,Ev(a)),hi(o))})):n.apply(void 0,i)?[t.apply(void 0,i)]:[]};return r([],e)}var NA=function(e){return function(t){return Ja(t)?_n(e):Ja(e)?_n(t):t.concat(e)}},d8=NA;function N$(e){var t=D0(e);return function(n,r){if(r===void 0){var i=N$(e);return function(o){return i(o,n)}}return Nt(n)&&Nt(r)?t(r)(n):Nt(n)?_n(n):_n(r)}}function P$(e){var t=F$(e);return function(n,r){if(r===void 0){var i=P$(e);return function(o){return i(o,n)}}return n.filter(function(o){return t(o,r)})}}function W$(e){var t=F$(e);return function(n,r){if(r===void 0){var i=W$(e);return function(o){return i(o,n)}}return n.filter(function(o){return!t(o,r)})}}var on=function(e,t){return v(e,U$(t))},xv=function(e,t){return v(e,qA(t))},Za=function(e,t){return v(e,UA(t))},Bd=function(e,t){return v(e,Ud(t))},Mv=function(e,t){return v(e,zA(t))},Rv=function(e,t){return v(e,z$(t))},kv=function(e,t){return v(e,KA(t))},Av=function(e,t){return v(e,VA(t))},PA=function(e,t){return v(e,K$(t))},WA=function(e,t){return v(e,V$(t))},j$=function(e,t){return v(e,GA(t))},ps=function(e,t,n){return v(e,XA(t,n))},sl=function(e){var t=JA(e);return function(n,r){return v(n,t(r))}},cl=function(e,t,n){return v(e,QA(t,n))},L$=function(e,t,n){return v(e,G$(t,n))},D$=function(e){var t=ZA(e);return function(n,r){return v(n,t(r))}},B$=function(e,t,n){return v(e,eF(t,n))},jA=function(e,t){return v(e,q$(t))},LA=function(e,t){return v(e,YA(t))},DA=function(e,t){return v(e,H$(t))},Fv=function(e){var t=Nv(e);return function(n,r){return v(n,t(r))}},BA=function(e){var t=Y$(e);return function(n,r){return v(n,t(r))}},p8=h$,h8=m$,Xa=Ga,ll=function(){return[]},U$=function(e){return function(t){return t.map(function(n){return e(n)})}},UA=function(e){return Ud(function(t){return v(e,U$(t))})},Ud=function(e){return function(t){return v(t,EA(function(n,r){return e(r)}))}},m8=Ud(q),qA=function(e){return function(t){return t.map(function(n,r){return e(r,n)})}},q$=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);gt(i)&&n.push(i.value)}return n}},z$=function(e){return q$(function(t,n){return e(n)})},fl=z$(q),dl=function(e){for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];o._tag==="Left"?t.push(o.left):n.push(o.right)}return Ee(t,n)},zA=function(e){return function(t){return t.filter(e)}},KA=function(e){return K$(function(t,n){return e(n)})},K$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return Ee(n,r)}},VA=function(e){return V$(function(t,n){return e(n)})},V$=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=e(i,t[i]);o._tag==="Left"?n.push(o.left):r.push(o.right)}return Ee(n,r)}},HA=function(e){return function(t){return t.concat(e())}},GA=HA,YA=function(e){return function(t){return t.filter(function(n,r){return e(r,n)})}},H$=function(e){return function(t){return t.map(function(n,r){return e(t.slice(r))})}},v8=H$(q),JA=S$,ZA=Tv,XA=Iv,G$=jd,QA=T$,eF=Cv,Nv=function(e){var t=Y$(e);return function(n){return t(function(r,i){return n(i)})}},qd=function(e){return function(t){return ps(t,e.of(ll()),function(n,r){return e.ap(e.map(n,function(i){return function(o){return v(i,Ev(o))}}),r)})}},Y$=function(e){return function(t){return G$(e.of(ll()),function(n,r,i){return e.ap(e.map(r,function(o){return function(a){return v(o,Ev(a))}}),t(n,i))})}},g8=function(e){var t=nS(e);return function(n){return function(r){return t(r,n)}}},y8=function(e){var t=rS(e);return function(n){return function(r){return t(r,n)}}},J$=function(e,t){for(var n=[],r=e;;){var i=t(r);if(gt(i)){var o=i.value,a=o[0],u=o[1];n.push(a),r=u}else break}return n},dt="Array",b8=uA,tF=function(){return{concat:function(e,t){return e.concat(t)}}},Z$=function(){return{concat:tF().concat,empty:[]}},nF=cA,_8=lA,rF=function(e){var t=N$(e);return{concat:function(n,r){return t(r)(n)}}},$8=function(e){return{concat:rF(e).concat,empty:[]}},S8=function(e){var t=P$(e);return{concat:function(n,r){return t(r)(n)}}},T8=function(e){var t=W$(e);return{concat:function(n,r){return t(r)(n)}}},X$={URI:dt,map:on},I8=Ue(X$),iF={URI:dt,of:Xa},C8={URI:dt,map:on,mapWithIndex:xv},Pv={URI:dt,map:on,ap:Za},O8=Ot(Pv),w8=wt(Pv),E8={URI:dt,map:on,ap:Za,of:Xa},Q$={URI:dt,map:on,ap:Za,chain:Bd},x8=lt(Q$),M8={URI:dt,map:on,ap:Za,of:Xa,chain:Bd},R8={URI:dt,unfold:J$},k8={URI:dt,map:on,alt:j$},oF={URI:dt,zero:ll},A8=tl(oF,iF),F8={URI:dt,map:on,ap:Za,of:Xa,alt:j$,zero:ll},N8={URI:dt,map:on,extend:DA},eS={URI:dt,compact:fl,separate:dl},P8={URI:dt,map:on,compact:fl,separate:dl,filter:Mv,filterMap:Rv,partition:kv,partitionMap:Av},W8={URI:dt,map:on,mapWithIndex:xv,compact:fl,separate:dl,filter:Mv,filterMap:Rv,partition:kv,partitionMap:Av,partitionMapWithIndex:WA,partitionWithIndex:PA,filterMapWithIndex:jA,filterWithIndex:LA},aF={URI:dt,reduce:ps,foldMap:sl,reduceRight:cl},j8={URI:dt,reduce:ps,foldMap:sl,reduceRight:cl,reduceWithIndex:L$,foldMapWithIndex:D$,reduceRightWithIndex:B$},tS={URI:dt,map:on,reduce:ps,foldMap:sl,reduceRight:cl,traverse:Fv,sequence:qd},L8={URI:dt,map:on,mapWithIndex:xv,reduce:ps,foldMap:sl,reduceRight:cl,reduceWithIndex:L$,foldMapWithIndex:D$,reduceRightWithIndex:B$,traverse:Fv,sequence:qd,traverseWithIndex:BA},nS=li(tS,eS),rS=ci(tS,eS),uF={URI:dt,map:on,compact:fl,separate:dl,filter:Mv,filterMap:Rv,partition:kv,partitionMap:Av,reduce:ps,foldMap:sl,reduceRight:cl,traverse:Fv,sequence:qd,wither:nS,wilt:rS},D8=M$,B8={URI:dt,map:on,ap:Za,chain:Bd,chainRec:p8},U8=R$,q8={URI:dt,map:on,ap:Za,chain:Bd,chainRec:h8},z8=b0(uF),sF={URI:dt,fromEither:SA},K8=Sr(sF),cF=W0,lF=function(e,t,n){return Nt(n)?j0(e,t,n):[]},fF=function(e,t){var n=t.slice();return n.splice(e,1),n},V8=gA,dF=function(e){return function(t){return t.some(e)}},H8=dF,G8=bA,Y8=Xa(zt),J8=Ct(X$),Z8=xt(Q$),X8=Et(Pv),Q8=YR,eZ=[],tZ=Sk,nZ=Tk,rZ=AA,iZ={URI:dt,compact:fl,separate:dl,map:on,ap:Za,of:Xa,chain:Bd,filter:Mv,filterMap:Rv,partition:kv,partitionMap:Av,mapWithIndex:xv,partitionMapWithIndex:WA,partitionWithIndex:PA,filterMapWithIndex:jA,filterWithIndex:LA,alt:j$,zero:ll,unfold:J$,reduce:ps,foldMap:sl,reduceRight:cl,traverse:Fv,sequence:qd,reduceWithIndex:L$,foldMapWithIndex:D$,reduceRightWithIndex:B$,traverseWithIndex:BA,extend:DA,wither:nS,wilt:rS};const oZ=Object.freeze(Object.defineProperty({__proto__:null,Alt:k8,Alternative:F8,Applicative:E8,Apply:Pv,Chain:Q$,ChainRecBreadthFirst:q8,ChainRecDepthFirst:B8,Compactable:eS,Do:Y8,Extend:N8,Filterable:P8,FilterableWithIndex:W8,Foldable:aF,FoldableWithIndex:j8,FromEither:sF,Functor:X$,FunctorWithIndex:C8,Monad:M8,Pointed:iF,Traversable:tS,TraversableWithIndex:L8,URI:dt,Unfoldable:R8,Witherable:uF,Zero:oF,alt:GA,altW:HA,ap:UA,apFirst:O8,apS:X8,apSecond:w8,append:Ev,appendW:TJ,array:iZ,bind:Z8,bindTo:J8,chain:Ud,chainFirst:x8,chainRecBreadthFirst:U8,chainRecDepthFirst:D8,chainWithIndex:EA,chop:s8,chunksOf:c8,compact:fl,comprehension:f8,concat:d8,concatW:NA,cons:tZ,copy:_n,deleteAt:XJ,difference:W$,dropLeft:BJ,dropLeftWhile:qJ,dropRight:UJ,duplicate:v8,elem:F$,empty:eZ,every:V8,exists:H8,extend:H$,filter:zA,filterE:z8,filterMap:z$,filterMapWithIndex:q$,filterWithIndex:YA,findFirst:KJ,findFirstMap:VJ,findIndex:zJ,findLast:HJ,findLastIndex:YJ,findLastMap:GJ,flap:I8,flatten:m8,foldLeft:wJ,foldMap:JA,foldMapWithIndex:ZA,foldRight:EJ,fromEither:SA,fromEitherK:K8,fromOption:$A,fromOptionK:l8,fromPredicate:CJ,getDifferenceMagma:T8,getEq:nF,getIntersectionSemigroup:S8,getMonoid:Z$,getOrd:_8,getSemigroup:tF,getShow:b8,getUnionMonoid:$8,getUnionSemigroup:rF,guard:A8,head:AJ,init:PJ,insertAt:JJ,intercalate:G8,intersection:P$,intersperse:i8,isEmpty:Ja,isNonEmpty:Nt,isOutOfBound:Dd,last:FJ,lefts:t8,lookup:kJ,makeBy:_A,map:U$,mapWithIndex:qA,match:OJ,matchLeft:CA,matchLeftW:IA,matchRight:wA,matchRightW:OA,matchW:TA,modifyAt:MA,of:Xa,partition:KA,partitionMap:VA,partitionMapWithIndex:V$,partitionWithIndex:K$,prepend:$J,prependAll:AA,prependToAll:rZ,prependW:SJ,range:Q8,reduce:XA,reduceRight:QA,reduceRightWithIndex:eF,reduceWithIndex:G$,replicate:IJ,reverse:QJ,rights:e8,rotate:o8,scanLeft:xJ,scanRight:MJ,separate:dl,sequence:qd,size:RJ,snoc:nZ,some:dF,sort:n8,sortBy:u8,spanLeft:DJ,splitAt:FA,tail:NJ,takeLeft:WJ,takeLeftWhile:LJ,takeRight:jJ,traverse:Nv,traverseWithIndex:Y$,unfold:J$,union:N$,uniq:a8,unsafeDeleteAt:fF,unsafeInsertAt:cF,unsafeUpdateAt:lF,unzip:r8,updateAt:ZJ,wilt:y8,wither:g8,zero:ll,zip:kA,zipWith:RA},Symbol.toStringTag,{value:"Module"})),aZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var uZ=function(e){return typeof e=="boolean"},pF=function(e,t){return function(n){return n?t():e()}},hF=pF,mF=hF,sZ=mF,vF={equals:function(e,t){return e===t}},cZ={meet:function(e,t){return e&&t},join:function(e,t){return e||t},zero:!1,one:!0,implies:function(e,t){return!e||t},not:function(e){return!e}},gF={concat:function(e,t){return e&&t}},yF={concat:function(e,t){return e||t}},lZ={concat:gF.concat,empty:!0},fZ={concat:yF.concat,empty:!1},dZ={equals:vF.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},pZ={show:function(e){return JSON.stringify(e)}};const hZ=Object.freeze(Object.defineProperty({__proto__:null,BooleanAlgebra:cZ,Eq:vF,MonoidAll:lZ,MonoidAny:fZ,Ord:dZ,SemigroupAll:gF,SemigroupAny:yF,Show:pZ,fold:sZ,foldW:hF,isBoolean:uZ,match:mF,matchW:pF},Symbol.toStringTag,{value:"Module"}));var bF=function(e){return{meet:function(t,n){return e.join(t,n)},join:function(t,n){return e.meet(t,n)},zero:e.one,one:e.zero,implies:function(t,n){return e.join(e.not(t),n)},not:e.not}},mZ={meet:function(){},join:function(){},zero:void 0,one:void 0,implies:function(){},not:function(){}},vZ=bF,gZ={meet:function(e,t){return e&&t},join:function(e,t){return e||t},zero:!1,one:!0,implies:function(e,t){return!e||t},not:function(e){return!e}},yZ=_M;const bZ=Object.freeze(Object.defineProperty({__proto__:null,booleanAlgebraBoolean:gZ,booleanAlgebraVoid:mZ,getDualBooleanAlgebra:vZ,getFunctionBooleanAlgebra:yZ,reverse:bF},Symbol.toStringTag,{value:"Module"}));var _Z=function(e){return KM(e)(e.bottom,e.top)},$Z=function(e){var t=L_(e);return{equals:t.equals,compare:t.compare,top:e.bottom,bottom:e.top}},SZ={equals:Cm.equals,compare:Cm.compare,top:1/0,bottom:-1/0};const TZ=Object.freeze(Object.defineProperty({__proto__:null,boundedNumber:SZ,clamp:_Z,reverse:$Z},Symbol.toStringTag,{value:"Module"}));function _F(e){return{meet:Tm(e),join:Im(e)}}const IZ=Object.freeze(Object.defineProperty({__proto__:null,getMinMaxDistributiveLattice:_F},Symbol.toStringTag,{value:"Module"}));function CZ(e){var t=_F(e);return function(n,r){return{join:t.join,meet:t.meet,zero:n,one:r}}}const OZ=Object.freeze(Object.defineProperty({__proto__:null,getMinMaxBoundedDistributiveLattice:CZ},Symbol.toStringTag,{value:"Module"})),wZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),EZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),xZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),MZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var iS=function(e,t){for(var n=t(e);n._tag==="Left";)n=t(n.left);return n.right};const RZ=Object.freeze(Object.defineProperty({__proto__:null,tailRec:iS},Symbol.toStringTag,{value:"Module"}));function oS(e,t){return function(n,r){return t.compose(e.right(r),e.left(n))}}function $F(e,t){var n=oS(e,t);return function(r,i){return t.compose(e.promap(t.id(),function(o){return o._tag==="Left"?o.left:o.right},q),n(r,i))}}function kZ(e){return oS(e,e)}function AZ(e){return $F(e,e)}const FZ=Object.freeze(Object.defineProperty({__proto__:null,fanIn:$F,fanin:AZ,split:oS,splitChoice:kZ},Symbol.toStringTag,{value:"Module"})),NZ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var PZ=function(e,t){return v(e,SF(t))},SF=function(e){return function(t){return H(e,t)}},TF="Predicate",IF=function(){return{concat:function(e,t){return v(e,OF(t))}}},WZ=function(){return{concat:IF().concat,empty:TM}},CF=function(){return{concat:function(e,t){return v(e,wF(t))}}},jZ=function(){return{concat:CF().concat,empty:A_}},LZ={URI:TF,contramap:PZ},zd=function(e){return function(t){return!e(t)}},OF=function(e){return function(t){return function(n){return t(n)||e(n)}}},wF=function(e){return function(t){return function(n){return t(n)&&e(n)}}};const DZ=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:LZ,URI:TF,and:wF,contramap:SF,getMonoidAll:jZ,getMonoidAny:WZ,getSemigroupAll:CF,getSemigroupAny:IF,not:zd,or:OF},Symbol.toStringTag,{value:"Module"}));var nt=ye,yt=fe;function Wv(e){return function(t){return e(t)?yt(t):nt}}var jv=function(e){return e._tag==="Right"?nt:yt(e.left)},Kd=function(e){return e._tag==="Left"?nt:yt(e.right)},Tr=function(e,t){return v(e,Xi(t))},hs=function(e,t){return v(e,RF(t))},Lv=function(e,t){return v(e,Hd(t))},Dv=function(e,t,n){return v(e,AF(t,n))},Bv=function(e){var t=FF(e);return function(n,r){return v(n,t(r))}},Uv=function(e,t,n){return v(e,NF(t,n))},aS=function(e){var t=qF(e);return function(n,r){return v(n,t(r))}},uS=function(e,t){return v(e,WF(t))},Vd=function(e,t){return v(e,LF(t))},sS=function(e,t){return v(e,DF(t))},EF=function(e,t){return v(e,dS(t))},cS=function(e,t){return v(e,BF(t))},lS=function(e,t){return v(e,UF(t))},Lt="Option",BZ=function(e){return{show:function(t){return je(t)?"none":"some(".concat(e.show(t.value),")")}}},xF=function(e){return{equals:function(t,n){return t===n||(je(t)?je(n):je(n)?!1:e.equals(t.value,n.value))}}},UZ=function(e){return{equals:xF(e).equals,compare:function(t,n){return t===n?0:Vv(t)?Vv(n)?e.compare(t.value,n.value):1:-1}}},fS=function(e){return{concat:function(t,n){return je(t)?n:je(n)?t:yt(e.concat(t.value,n.value))},empty:nt}},Xi=function(e){return function(t){return je(t)?nt:yt(e(t.value))}},pl={URI:Lt,map:Tr},Lo=yt,MF={URI:Lt,of:Lo},RF=function(e){return function(t){return je(t)||je(e)?nt:yt(t.value(e.value))}},hl={URI:Lt,map:Tr,ap:hs},kF={URI:Lt,map:Tr,ap:hs,of:Lo},Hd=function(e){return function(t){return je(t)?nt:e(t.value)}},Gd={URI:Lt,map:Tr,ap:hs,chain:Lv},qZ={URI:Lt,map:Tr,ap:hs,of:Lo,chain:Lv},AF=function(e,t){return function(n){return je(n)?e:t(e,n.value)}},FF=function(e){return function(t){return function(n){return je(n)?e.empty:t(n.value)}}},NF=function(e,t){return function(n){return je(n)?e:t(n.value,e)}},zZ={URI:Lt,reduce:Dv,foldMap:Bv,reduceRight:Uv},PF=function(e){return function(t){return je(t)?e():t}},WF=PF,KZ={URI:Lt,map:Tr,alt:uS},qv=function(){return nt},jF={URI:Lt,zero:qv},VZ=tl(jF,MF),HZ={URI:Lt,map:Tr,ap:hs,of:Lo,alt:uS,zero:qv},dS=function(e){return function(t){return je(t)?nt:yt(e(t))}},GZ={URI:Lt,map:Tr,extend:EF},ml=Hd(q),YZ=Ee(nt,nt),vl=function(e){return je(e)?YZ:Ee(jv(e.value),Kd(e.value))},ms={URI:Lt,compact:ml,separate:vl},LF=function(e){return function(t){return je(t)?nt:e(t.value)?t:nt}},DF=function(e){return function(t){return je(t)?nt:e(t.value)}},BF=function(e){return function(t){return Ee(Vd(t,zd(e)),Vd(t,e))}},UF=function(e){return H(Xi(e),vl)},Do={URI:Lt,map:Tr,compact:ml,separate:vl,filter:Vd,filterMap:sS,partition:cS,partitionMap:lS},qF=function(e){return function(t){return function(n){return je(n)?e.of(nt):e.map(t(n.value),yt)}}},zv=function(e){return function(t){return je(t)?e.of(nt):e.map(t.value,yt)}},pS={URI:Lt,map:Tr,reduce:Dv,foldMap:Bv,reduceRight:Uv,traverse:aS,sequence:zv},hS=li(pS,ms),mS=ci(pS,ms),JZ=function(e){var t=hS(e);return function(n){return function(r){return t(r,n)}}},ZZ=function(e){var t=mS(e);return function(n){return function(r){return t(r,n)}}},XZ={URI:Lt,map:Tr,reduce:Dv,foldMap:Bv,reduceRight:Uv,traverse:aS,sequence:zv,compact:ml,separate:vl,filter:Vd,filterMap:sS,partition:cS,partitionMap:lS,wither:hS,wilt:mS},vS=function(){return nt},QZ={URI:Lt,map:Tr,ap:hs,of:Lo,chain:Lv,throwError:vS},gl=Kd,Kv={URI:Lt,fromEither:gl},Vv=gt,je=function(e){return e._tag==="None"},gS=function(e,t){return function(n){return je(n)?e():t(n.value)}},eX=gS,Bo=gS,Uo=Bo,yS=function(e){return function(t){return je(t)?e():t.value}},bS=yS,tX=Ue(pl),nX=Ot(hl),rX=wt(hl),iX=ml,oX=lt(Gd),aX=dS(q),uX=Sr(Kv),sX=Po(Kv,Gd),cX=Wo(Kv,Gd),vs=function(e){return e==null?nt:yt(e)},zF=function(e){try{return yt(e())}catch{return nt}},lX=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return zF(function(){return e.apply(void 0,t)})}},fX=function(e){return H(e,vs)},KF=function(e){return function(t){return je(t)?nt:vs(e(t.value))}},_S=Bo(IM,q),VF=Bo(F_,q);function HF(e){return function(t,n){if(n===void 0){var r=HF(e);return function(i){return r(t,i)}}return je(n)?!1:e.equals(t,n.value)}}var dX=function(e){return function(t){return je(t)?!1:e(t.value)}},pX=Lo(zt),hX=Ct(pl),mX=xt(Gd),vX=Et(hl),GF=Lo(tn),Hv=function(e){return function(t){var n=e(0,gr(t));if(je(n))return nt;for(var r=[n.value],i=1;i<t.length;i++){var o=e(i,t[i]);if(je(o))return nt;r.push(o.value)}return yt(r)}},$S=function(e){var t=Hv(e);return function(n){return mt(n)?t(n):GF}},gX=$S,YF=function(e){return $S(function(t,n){return e(n)})},yX=YF(q);function bX(e){return function(t){return Vv(e(t))}}var _X=KF,JF={URI:Lt,map:Tr,of:Lo,ap:hs,chain:Lv,reduce:Dv,foldMap:Bv,reduceRight:Uv,traverse:aS,sequence:zv,zero:qv,alt:uS,extend:EF,compact:ml,separate:vl,filter:Vd,filterMap:sS,partition:cS,partitionMap:lS,wither:hS,wilt:mS,throwError:vS},$X=Kt(hl),SX=Lr(kF),ZF=function(){return fS(V_())},TX=function(){return fS(Em())};const IX=Object.freeze(Object.defineProperty({__proto__:null,Alt:KZ,Alternative:HZ,ApT:GF,Applicative:kF,Apply:hl,Chain:Gd,Compactable:ms,Do:pX,Extend:GZ,Filterable:Do,Foldable:zZ,FromEither:Kv,Functor:pl,Monad:qZ,MonadThrow:QZ,Pointed:MF,Traversable:pS,URI:Lt,Witherable:XZ,Zero:jF,alt:WF,altW:PF,ap:RF,apFirst:nX,apS:vX,apSecond:rX,bind:mX,bindTo:hX,chain:Hd,chainEitherK:sX,chainFirst:oX,chainFirstEitherK:cX,chainNullableK:KF,compact:ml,duplicate:aX,elem:HF,exists:dX,extend:dS,filter:LF,filterMap:DF,flap:tX,flatten:iX,fold:Uo,foldMap:FF,foldW:eX,fromEither:gl,fromEitherK:uX,fromNullable:vs,fromNullableK:fX,fromPredicate:Wv,getApplyMonoid:SX,getApplySemigroup:$X,getEq:xF,getFirstMonoid:ZF,getLastMonoid:TX,getLeft:jv,getMonoid:fS,getOrElse:bS,getOrElseW:yS,getOrd:UZ,getRefinement:bX,getRight:Kd,getShow:BZ,guard:VZ,isNone:je,isSome:Vv,map:Xi,mapNullable:_X,match:Bo,matchW:gS,none:nt,of:Lo,option:JF,partition:BF,partitionMap:UF,reduce:AF,reduceRight:NF,separate:vl,sequence:zv,sequenceArray:yX,some:yt,throwError:vS,toNullable:_S,toUndefined:VF,traverse:qF,traverseArray:YF,traverseArrayWithIndex:gX,traverseReadonlyArrayWithIndex:$S,traverseReadonlyNonEmptyArrayWithIndex:Hv,tryCatch:zF,tryCatchK:lX,wilt:ZZ,wither:JZ,zero:qv},Symbol.toStringTag,{value:"Module"}));function Qi(e,t){return function(n){return e.map(n,t.compact)}}function qo(e,t,n){var r=Qi(e,t),i=Dc(e,n);return function(o){return Ee(r(v(o,i(jv))),r(v(o,i(Kd))))}}function CX(e,t){var n=Bc(e,t).map;return{map:n,compact:Qi(e,t),separate:qo(e,t,t)}}const OX=Object.freeze(Object.defineProperty({__proto__:null,compact:Qi,getCompactableComposition:CX,separate:qo},Symbol.toStringTag,{value:"Module"}));var wX=function(e){return function(){return console.log(e)}},EX=function(e){return function(){return console.warn(e)}},xX=function(e){return function(){return console.error(e)}},MX=function(e){return function(){return console.info(e)}};const RX=Object.freeze(Object.defineProperty({__proto__:null,error:xX,info:MX,log:wX,warn:EX},Symbol.toStringTag,{value:"Module"}));var yl=jc;function kX(e){return{show:function(t){return"make(".concat(e.show(t),")")}}}var AX=q,FX=q,NX=q,PX=q,WX=q,jX=q,LX=q,DX=q,BX=q;function XF(e){return{URI:gs,_E:void 0,map:SS,ap:function(t,n){return yl(e.concat(t,n))}}}function QF(e){var t=XF(e);return{URI:gs,_E:void 0,map:t.map,ap:t.ap,of:function(){return yl(e.empty)}}}var eN=function(e,t){return v(e,rN())},SS=function(e,t){return v(e,iN())},tN=function(e,t,n){return v(e,oN(t))},nN=function(e,t){return v(e,aN(t))},rN=function(){return jc},iN=function(){return jc},oN=function(e){return function(t){return yl(e(t))}},aN=function(e){return function(t){return yl(e(t))}},gs="Const",uN={URI:gs,map:SS},UX=Ue(uN),qX={URI:gs,contramap:eN},zX={URI:gs,bimap:tN,mapLeft:nN},KX={URI:gs,map:SS,contramap:eN,bimap:tN,mapLeft:nN};const VX=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:zX,Contravariant:qX,Functor:uN,URI:gs,bimap:oN,const_:KX,contramap:rN,flap:UX,getApplicative:QF,getApply:XF,getBooleanAlgebra:BX,getBounded:NX,getEq:AX,getHeytingAlgebra:DX,getMonoid:WX,getOrd:FX,getRing:LX,getSemigroup:PX,getSemiring:jX,getShow:kX,make:yl,map:iN,mapLeft:aN},Symbol.toStringTag,{value:"Module"})),HX=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var GX={equals:function(e,t){return e.valueOf()===t.valueOf()}},YX={equals:function(e,t){return e.getDate()===t.getDate()}},JX={equals:function(e,t){return e.getMonth()===t.getMonth()}},ZX={equals:function(e,t){return e.getFullYear()===t.getFullYear()}},XX=v(dv,Sm(function(e){return e.valueOf()})),QX=function(){return new Date},eQ=function(){return new Date().getTime()};const tQ=Object.freeze(Object.defineProperty({__proto__:null,Eq:GX,Ord:XX,create:QX,eqDate:YX,eqMonth:JX,eqYear:ZX,now:eQ},Symbol.toStringTag,{value:"Module"}));var Tt=Ro,Ke=za,$n=function(e,t){return v(e,_s(t))},ys=function(e,t){return v(e,fN(t))},bl=function(e,t){return v(e,Br(t))},Yd=function(e,t,n){return v(e,pN(t,n))},Jd=function(e){return function(t,n){var r=hN(e);return v(t,r(n))}},Zd=function(e,t,n){return v(e,mN(t,n))},Gv=function(e){var t=vN(e);return function(n,r){return v(n,t(r))}},TS=function(e,t,n){return v(e,xS(t,n))},IS=function(e,t){return v(e,tp(t))},sN=function(e,t){return v(e,yN(t))},CS=function(e,t){return v(e,MS(t))},OS=function(e,t){return iS(t(e),function(n){return ue(n)?Ke(Tt(n.left)):ue(n.right)?Tt(t(n.right.left)):Ke(Ke(n.right.right))})},It="Either",nQ=function(e,t){return{show:function(n){return ue(n)?"left(".concat(e.show(n.left),")"):"right(".concat(t.show(n.right),")")}}},rQ=function(e,t){return{equals:function(n,r){return n===r||(ue(n)?ue(r)&&e.equals(n.left,r.left):RS(r)&&t.equals(n.right,r.right))}}},Xd=function(e){return{concat:function(t,n){return ue(n)?t:ue(t)?n:Ke(e.concat(t.right,n.right))}}},bs=function(e){var t=Tt(e.empty);return{URI:It,_E:void 0,compact:function(n){return ue(n)?n:n.right._tag==="None"?t:Ke(n.right.value)},separate:function(n){return ue(n)?Ee(n,n):ue(n.right)?Ee(Ke(n.right.left),t):Ee(t,Ke(n.right.right))}}},_l=function(e){var t=Tt(e.empty),n=bs(e),r=n.compact,i=n.separate,o=function(u,s){return ue(u)||s(u.right)?u:t},a=function(u,s){return ue(u)?Ee(u,u):s(u.right)?Ee(t,Ke(u.right)):Ee(Ke(u.right),t)};return{URI:It,_E:void 0,map:$n,compact:r,separate:i,filter:o,filterMap:function(u,s){if(ue(u))return u;var c=s(u.right);return c._tag==="None"?t:Ke(c.value)},partition:a,partitionMap:function(u,s){if(ue(u))return Ee(u,u);var c=s(u.right);return ue(c)?Ee(Ke(c.left),t):Ee(t,Ke(c.right))}}},iQ=function(e){var t=_l(e),n=bs(e);return{URI:It,_E:void 0,map:$n,compact:t.compact,separate:t.separate,filter:t.filter,filterMap:t.filterMap,partition:t.partition,partitionMap:t.partitionMap,traverse:Gv,sequence:ep,reduce:Yd,foldMap:Jd,reduceRight:Zd,wither:li(ES,n),wilt:ci(ES,n)}},Qa=function(e){return{URI:It,_E:void 0,map:$n,ap:function(t,n){return ue(t)?ue(n)?Tt(e.concat(t.left,n.left)):t:ue(n)?n:Ke(t.right(n.right))},of:eo}},cN=function(e){return{URI:It,_E:void 0,map:$n,alt:function(t,n){if(RS(t))return t;var r=n();return ue(r)?Tt(e.concat(t.left,r.left)):r}}},_s=function(e){return function(t){return ue(t)?t:Ke(e(t.right))}},eu={URI:It,map:$n},eo=Ke,oQ={URI:It,of:eo},lN=function(e){return function(t){return ue(t)?t:ue(e)?e:Ke(t.right(e.right))}},fN=lN,$l={URI:It,map:$n,ap:ys},dN={URI:It,map:$n,ap:ys,of:eo},wS=function(e){return function(t){return ue(t)?t:e(t.right)}},Br=wS,Qd={URI:It,map:$n,ap:ys,chain:bl},aQ={URI:It,map:$n,ap:ys,of:eo,chain:bl},pN=function(e,t){return function(n){return ue(n)?e:t(e,n.right)}},hN=function(e){return function(t){return function(n){return ue(n)?e.empty:t(n.right)}}},mN=function(e,t){return function(n){return ue(n)?e:t(n.right,e)}},uQ={URI:It,reduce:Yd,foldMap:Jd,reduceRight:Zd},vN=function(e){return function(t){return function(n){return ue(n)?e.of(Tt(n.left)):e.map(t(n.right),Ke)}}},ep=function(e){return function(t){return ue(t)?e.of(Tt(t.left)):e.map(t.right,Ke)}},ES={URI:It,map:$n,reduce:Yd,foldMap:Jd,reduceRight:Zd,traverse:Gv,sequence:ep},xS=function(e,t){return function(n){return ue(n)?Tt(e(n.left)):Ke(t(n.right))}},tp=function(e){return function(t){return ue(t)?Tt(e(t.left)):t}},sQ={URI:It,bimap:TS,mapLeft:IS},gN=function(e){return function(t){return ue(t)?e():t}},yN=gN,cQ={URI:It,map:$n,alt:sN},MS=function(e){return function(t){return ue(t)?t:Ke(e(t))}},lQ={URI:It,map:$n,extend:CS},fQ={URI:It,map:$n,ap:ys,chain:bl,chainRec:OS},Yv=Tt,dQ={URI:It,map:$n,ap:ys,of:eo,chain:bl,throwError:Yv},Sl={URI:It,fromEither:q},pQ=Ha(Sl),bN=Yi(Sl),ue=qt,RS=N_,kS=function(e,t){return function(n){return ue(n)?e(n.left):t(n.right)}},_N=kS,tu=kS,AS=tu,$N=function(e){return function(t){return ue(t)?e(t.left):t.right}},hQ=$N,mQ=Ue(eu),SN=Ot($l),vQ=SN,TN=wt($l),gQ=TN,IN=lt(Qd),yQ=IN,CN=wS(q),bQ=CN,_Q=MS(q),$Q=Ji(Sl),SQ=ss(Sl,Qd),ON=cs(Sl,Qd),TQ=ON,wN=function(e){return ue(e)?Ke(e.left):Tt(e.right)},EN=function(e){return function(t){return ue(t)?e(t.left):t}},xN=EN,FS=function(e){return function(t){return t==null?Tt(e):Ke(t)}},$s=function(e,t){try{return Ke(e())}catch(n){return Tt(t(n))}},IQ=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return $s(function(){return e.apply(void 0,n)},t)}},MN=function(e){var t=FS(e);return function(n){return H(n,t)}},CQ=function(e){var t=MN(e);return function(n){return Br(t(n))}},RN=_N(q,q);function OQ(e){return e instanceof Error?e:new Error(String(e))}function kN(e){return function(t,n){if(n===void 0){var r=kN(e);return function(i){return r(t,i)}}return ue(n)?!1:e.equals(t,n.right)}}var wQ=function(e){return function(t){return ue(t)?!1:e(t.right)}},EQ=eo(zt),xQ=Ct(eu),AN=xt(Qd),MQ=AN,FN=Et($l),RQ=FN,NN=eo(tn),np=function(e){return function(t){var n=e(0,gr(t));if(ue(n))return n;for(var r=[n.right],i=1;i<t.length;i++){var o=e(i,t[i]);if(ue(o))return o;r.push(o.right)}return Ke(r)}},NS=function(e){var t=np(e);return function(n){return mt(n)?t(n):NN}},kQ=NS,PN=function(e){return NS(function(t,n){return e(n)})},AQ=PN(q);function FQ(e,t){return $s(function(){return JSON.parse(e)},t)}var NQ=function(e,t){return $s(function(){var n=JSON.stringify(e);if(typeof n!="string")throw new Error("Converting unsupported structure to JSON");return n},t)},PQ={URI:It,map:$n,of:eo,ap:ys,chain:bl,reduce:Yd,foldMap:Jd,reduceRight:Zd,traverse:Gv,sequence:ep,bimap:TS,mapLeft:IS,alt:sN,extend:CS,chainRec:OS,throwError:Yv},WQ=Kt($l),jQ=Lr(dN),LQ=function(e,t){return Kt(Qa(e))(t)},DQ=function(e,t){return Lr(Qa(e))(t)};function BQ(e){var t=Qa(e).ap,n=cN(e).alt;return{URI:It,_E:void 0,map:$n,of:eo,chain:bl,bimap:TS,mapLeft:IS,reduce:Yd,foldMap:Jd,reduceRight:Zd,extend:CS,traverse:Gv,sequence:ep,chainRec:OS,throwError:Yv,ap:t,alt:n}}const WN=Object.freeze(Object.defineProperty({__proto__:null,Alt:cQ,ApT:NN,Applicative:dN,Apply:$l,Bifunctor:sQ,Chain:Qd,ChainRec:fQ,Do:EQ,Extend:lQ,Foldable:uQ,FromEither:Sl,Functor:eu,Monad:aQ,MonadThrow:dQ,Pointed:oQ,Traversable:ES,URI:It,alt:yN,altW:gN,ap:fN,apFirst:SN,apFirstW:vQ,apS:FN,apSW:RQ,apSecond:TN,apSecondW:gQ,apW:lN,bimap:xS,bind:AN,bindTo:xQ,bindW:MQ,chain:Br,chainFirst:IN,chainFirstW:yQ,chainNullableK:CQ,chainOptionK:SQ,chainW:wS,duplicate:_Q,either:PQ,elem:kN,exists:wQ,extend:MS,filterOrElse:ON,filterOrElseW:TQ,flap:mQ,flatten:bQ,flattenW:CN,fold:AS,foldMap:hN,foldW:_N,fromNullable:FS,fromNullableK:MN,fromOption:bN,fromOptionK:$Q,fromPredicate:pQ,getAltValidation:cN,getApplicativeValidation:Qa,getApplyMonoid:jQ,getApplySemigroup:WQ,getCompactable:bs,getEq:rQ,getFilterable:_l,getOrElse:hQ,getOrElseW:$N,getSemigroup:Xd,getShow:nQ,getValidation:BQ,getValidationMonoid:DQ,getValidationSemigroup:LQ,getWitherable:iQ,isLeft:ue,isRight:RS,left:Tt,map:_s,mapLeft:tp,match:tu,matchW:kS,of:eo,orElse:xN,orElseW:EN,parseJSON:FQ,reduce:pN,reduceRight:mN,right:Ke,sequence:ep,sequenceArray:AQ,stringifyJSON:NQ,swap:wN,throwError:Yv,toError:OQ,toUnion:RN,traverse:vN,traverseArray:PN,traverseArrayWithIndex:kQ,traverseReadonlyArrayWithIndex:NS,traverseReadonlyNonEmptyArrayWithIndex:np,tryCatch:$s,tryCatchK:IQ},Symbol.toStringTag,{value:"Module"}));function Ss(e){return H(Ke,e.of)}function Tl(e){return H(Tt,e.of)}function Il(e){return function(t){return e.map(t,Ke)}}function Cl(e){return function(t){return e.map(t,Tt)}}function Jv(e){return function(t){return H(FS(t),e.of)}}function Zv(e){var t=Jv(e);return function(n){var r=t(n);return function(i){return H(i,r)}}}function PS(e){var t=Ts(e),n=Zv(e);return function(r){var i=n(r);return function(o){return t(i(o))}}}function Ol(e){return Dc(e,eu)}function wl(e){return ko(e,$l)}function Ts(e){return function(t){return function(n){return e.chain(n,function(r){return ue(r)?e.of(r):t(r.right)})}}}function El(e){return function(t){return function(n){return e.chain(n,function(r){return ue(r)?t():e.of(r)})}}}function xl(e){return function(t,n){return function(r){return e.map(r,xS(t,n))}}}function Ml(e){return function(t){return function(n){return e.map(n,tp(t))}}}function rp(e,t){return function(n){return function(r){return e.chain(r,tu(function(i){return e.map(n(),tp(function(o){return t.concat(i,o)}))},Ss(e)))}}}function ip(e){return function(t,n){return function(r){return e.map(r,tu(t,n))}}}function Rl(e){return function(t,n){return function(r){return e.chain(r,tu(t,n))}}}function kl(e){return function(t){return function(n){return e.chain(n,tu(t,e.of))}}}function Is(e){return function(t){return function(n){return e.chain(n,function(r){return ue(r)?t(r.left):e.of(r)})}}}function op(e){var t=Is(e);return function(n){return t(function(r){return e.map(n(r),function(i){return ue(i)?i:Tt(r)})})}}function ap(e){return function(t){return function(n){return e.chain(n,tu(function(r){return e.map(t(r),Tt)},function(r){return e.of(Ke(r))}))}}}function Al(e){return function(t){return e.map(t,wN)}}function up(e){return function(t){return e.map(t,RN)}}function UQ(e){var t=wl(e),n=Ol(e),r=Ts(e),i=El(e),o=xl(e),a=Ml(e),u=Rl(e),s=kl(e),c=Is(e);return{map:function(l,f){return v(l,n(f))},ap:function(l,f){return v(l,t(f))},of:Ss(e),chain:function(l,f){return v(l,r(f))},alt:function(l,f){return v(l,i(f))},bimap:function(l,f,d){return v(l,o(f,d))},mapLeft:function(l,f){return v(l,a(f))},fold:function(l,f,d){return v(l,u(f,d))},getOrElse:function(l,f){return v(l,s(f))},orElse:function(l,f){return v(l,c(f))},swap:Al(e),rightM:Il(e),leftM:Cl(e),left:Tl(e)}}const qQ=Object.freeze(Object.defineProperty({__proto__:null,alt:El,altValidation:rp,ap:wl,bimap:xl,chain:Ts,chainNullableK:PS,fromNullable:Jv,fromNullableK:Zv,getEitherM:UQ,getOrElse:kl,left:Tl,leftF:Cl,map:Ol,mapLeft:Ml,match:ip,matchE:Rl,orElse:Is,orElseFirst:op,orLeft:ap,right:Ss,rightF:Il,swap:Al,toUnion:up},Symbol.toStringTag,{value:"Module"}));var zQ="Endomorphism",jN=function(){return{concat:function(e,t){return H(e,t)}}},LN=function(){return{concat:jN().concat,empty:q}};const KQ=Object.freeze(Object.defineProperty({__proto__:null,URI:zQ,getMonoid:LN,getSemigroup:jN},Symbol.toStringTag,{value:"Module"})),VQ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function DN(e,t){var n=t.zero,r=function(i,o){return e.equals(o,n)?i:r(o,t.mod(i,o))};return r}function HQ(e,t){var n=t.zero,r=DN(e,t);return function(i,o){return e.equals(i,n)||e.equals(o,n)?n:t.div(t.mul(i,o),r(i,o))}}var GQ={add:function(e,t){return e+t},zero:0,mul:function(e,t){return e*t},one:1,sub:function(e,t){return e-t},degree:function(e){return 1},div:function(e,t){return e/t},mod:function(e,t){return e%t}};const YQ=Object.freeze(Object.defineProperty({__proto__:null,fieldNumber:GQ,gcd:DN,lcm:HQ},Symbol.toStringTag,{value:"Module"}));function zo(e,t){return function(n){return function(r){return e.map(r,function(i){return t.filter(i,n)})}}}function Ko(e,t){return function(n){return function(r){return e.map(r,function(i){return t.filterMap(i,n)})}}}function nu(e,t){var n=zo(e,t);return function(r){var i=n(zd(r)),o=n(r);return function(a){return Ee(i(a),o(a))}}}function ru(e,t){var n=Ko(e,t);return function(r){return function(i){return Ee(v(i,n(function(o){return jv(r(o))})),v(i,n(function(o){return Kd(r(o))})))}}}function JQ(e,t){var n=Bc(e,t).map,r=Qi(e,t),i=qo(e,t,t),o=zo(e,t),a=Ko(e,t),u=nu(e,t),s=ru(e,t);return{map:n,compact:r,separate:i,filter:function(c,l){return v(c,o(l))},filterMap:function(c,l){return v(c,a(l))},partition:function(c,l){return v(c,u(l))},partitionMap:function(c,l){return v(c,s(l))}}}const ZQ=Object.freeze(Object.defineProperty({__proto__:null,filter:zo,filterMap:Ko,getFilterableComposition:JQ,partition:nu,partitionMap:ru},Symbol.toStringTag,{value:"Module"})),XQ=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function BN(e,t){return function(n,r){return function(i){return e.reduce(i,n,function(o,a){return t.reduce(a,o,r)})}}}function UN(e,t){return function(n){var r=e.foldMap(n),i=t.foldMap(n);return function(o){return function(a){return r(a,function(u){return i(u,o)})}}}}function qN(e,t){return function(n,r){return function(i){return e.reduceRight(i,n,function(o,a){return t.reduceRight(o,a,r)})}}}function QQ(e,t){return function(n,r){return function(i){return t.reduce(i,e.of(n),function(o,a){return e.chain(o,function(u){return r(u,a)})})}}}function eee(e,t){return function(n,r){var i=function(o,a){var u=o.init,s=o.acc;return u?{init:!1,acc:a}:{init:!1,acc:e.concat(e.concat(s,n),a)}};return t.reduce(r,{init:!0,acc:e.empty},i).acc}}function zN(e){return function(t){return e.reduce(t,[],function(n,r){return n.push(r),n})}}function tee(e,t){var n=function(i,o){return e.ap(e.map(i,Zn),o)},r=e.of(void 0);return function(i,o){return t.reduce(i,r,function(a,u){return n(a,o(u))})}}function nee(e,t){return function(n,r,i){return t.reduce(n,e.of(r),function(o,a){return e.chain(o,function(u){return i(u,a)})})}}var ree=zN;function WS(e,t){var n=BN(e,t),r=UN(e,t),i=qN(e,t);return{reduce:function(o,a,u){return v(o,n(a,u))},foldMap:function(o){var a=r(o);return function(u,s){return v(u,a(s))}},reduceRight:function(o,a,u){return v(o,i(a,u))}}}const iee=Object.freeze(Object.defineProperty({__proto__:null,foldM:nee,foldMap:UN,getFoldableComposition:WS,intercalate:eee,reduce:BN,reduceM:QQ,reduceRight:qN,toArray:ree,toReadonlyArray:zN,traverse_:tee},Symbol.toStringTag,{value:"Module"}));function KN(e,t){return function(n,r){return function(i){return e.reduceWithIndex(i,n,function(o,a,u){return t.reduceWithIndex(u,a,function(s,c,l){return r([o,s],c,l)})})}}}function VN(e,t){return function(n){var r=e.foldMapWithIndex(n),i=t.foldMapWithIndex(n);return function(o){return function(a){return r(a,function(u,s){return i(s,function(c,l){return o([u,c],l)})})}}}}function HN(e,t){return function(n,r){return function(i){return e.reduceRightWithIndex(i,n,function(o,a,u){return t.reduceRightWithIndex(a,u,function(s,c,l){return r([o,s],c,l)})})}}}function oee(e,t){var n=WS(e,t),r=KN(e,t),i=VN(e,t),o=HN(e,t);return{reduce:n.reduce,foldMap:n.foldMap,reduceRight:n.reduceRight,reduceWithIndex:function(a,u,s){return v(a,r(u,s))},foldMapWithIndex:function(a){var u=i(a);return function(s,c){return v(s,u(c))}},reduceRightWithIndex:function(a,u,s){return v(a,o(u,s))}}}const aee=Object.freeze(Object.defineProperty({__proto__:null,foldMapWithIndex:VN,getFoldableWithIndexComposition:oee,reduceRightWithIndex:HN,reduceWithIndex:KN},Symbol.toStringTag,{value:"Module"}));function to(e){return function(t){return H(t,e.fromIO)}}function Vo(e,t){return function(n){var r=H(n,e.fromIO);return function(i){return t.chain(i,r)}}}function Ho(e,t){var n=lt(t);return function(r){return n(H(r,e.fromIO))}}const uee=Object.freeze(Object.defineProperty({__proto__:null,chainFirstIOK:Ho,chainIOK:Vo,fromIOK:to},Symbol.toStringTag,{value:"Module"}));var GN=function(){return q},see=q,sp=function(e){return function(t){return function(n){return t(e(n))}}},cp=function(e){return function(t){return e(t)(t)}},cee=cp,Go=function(e,t){return v(e,Cs(t))},lp=function(e,t){return v(e,ZN(t))},jS=function(e,t){return v(e,XN(t))},YN=function(e,t){return v(e,eP(t))},Xv=function(e,t,n){return v(e,tP(t,n))},Cs=function(e){return function(t){return function(n){return e(t(n))}}},JN=function(e){return function(t){return function(n){return t(n)(e(n))}}},ZN=JN,no=Zn,LS=function(e){return function(t){return function(n){return e(t(n))(n)}}},XN=LS,QN=LS(q),lee=QN,eP=function(e){return function(t){return H(e,t)}},tP=function(e,t){return function(n){return function(r){return t(n(e(r)))}}},DS=function(){return q},BS=function(e){return function(t){var n=t[0],r=t[1];return[e(n),r]}},US=function(e){return function(t){var n=t[0],r=t[1];return[n,e(r)]}},qS=function(e){return AS(function(t){return Ro(e(t))},Ke)},zS=function(e){return AS(Tt,function(t){return za(e(t))})},Ur="Reader",an={URI:Ur,map:Go},fee=Ue(an),KS={URI:Ur,of:no},Yo={URI:Ur,map:Go,ap:lp},nP=Ot(Yo),dee=nP,rP=wt(Yo),pee=rP,iP={URI:Ur,map:Go,ap:lp,of:no},VS={URI:Ur,map:Go,ap:lp,chain:jS},Jo={URI:Ur,map:Go,of:no,ap:lp,chain:jS},oP=lt(VS),hee=oP,mee={URI:Ur,map:Go,promap:Xv},vee={URI:Ur,compose:YN,id:DS},gee={URI:Ur,map:Go,promap:Xv,first:BS,second:US},yee={URI:Ur,map:Go,promap:Xv,left:qS,right:zS},bee=Ct(an),aP=xt(VS),_ee=aP,$ee=no(zt),uP=Et(Yo),See=uP,sP=no(tn),Os=function(e){return function(t){return function(n){for(var r=[e(0,gr(t))(n)],i=1;i<t.length;i++)r.push(e(i,t[i])(n));return r}}},HS=function(e){var t=Os(e);return function(n){return mt(n)?t(n):sP}},Tee=HS,cP=function(e){return HS(function(t,n){return e(n)})},Iee=cP(q),Cee={URI:Ur,map:Go,of:no,ap:lp,chain:jS,promap:Xv,compose:YN,id:DS,first:BS,second:US,left:qS,right:zS},Oee=Kt(Yo),wee=Lr(iP);const Eee=Object.freeze(Object.defineProperty({__proto__:null,ApT:sP,Applicative:iP,Apply:Yo,Category:vee,Chain:VS,Choice:yee,Do:$ee,Functor:an,Monad:Jo,Pointed:KS,Profunctor:mee,Strong:gee,URI:Ur,ap:ZN,apFirst:nP,apFirstW:dee,apS:uP,apSW:See,apSecond:rP,apSecondW:pee,apW:JN,ask:GN,asks:see,asksReader:cee,asksReaderW:cp,bind:aP,bindTo:bee,bindW:_ee,chain:XN,chainFirst:oP,chainFirstW:hee,chainW:LS,compose:eP,first:BS,flap:fee,flatten:lee,flattenW:QN,getMonoid:wee,getSemigroup:Oee,id:DS,left:qS,local:sp,map:Cs,of:no,promap:tP,reader:Cee,right:zS,second:US,sequenceArray:Iee,traverseArray:cP,traverseArrayWithIndex:Tee,traverseReadonlyArrayWithIndex:HS,traverseReadonlyNonEmptyArrayWithIndex:Os},Symbol.toStringTag,{value:"Module"}));function fp(e){return function(){return e.fromReader(GN())}}function dp(e){return e.fromReader}function ws(e){return function(t){return H(t,e.fromReader)}}function pp(e,t){var n=ws(e);return function(r){return function(i){return t.chain(i,n(r))}}}function hp(e,t){return H(ws(e),lt(t))}const xee=Object.freeze(Object.defineProperty({__proto__:null,ask:fp,asks:dp,chainFirstReaderK:hp,chainReaderK:pp,fromReaderK:ws},Symbol.toStringTag,{value:"Module"}));var lP=function(){return function(e){return[e,e]}},fP=function(e){return function(){return[void 0,e]}},dP=function(e){return function(t){return[void 0,e(t)]}},pP=function(e){return function(t){return[e(t),t]}},mp=function(e,t){return v(e,mP(t))},Qv=function(e,t){return v(e,vP(t))},hP=function(e,t){return v(e,GS(t))},mP=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return[e(i),o]}}},vP=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1],a=e(o),u=a[0],s=a[1];return[i(u),s]}}},vp=function(e){return function(t){return[e,t]}},GS=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return e(i)(o)}}},Mee=GS(q),iu="State",YS={URI:iu,map:mp},Ree=Ue(YS),kee={URI:iu,of:vp},eg={URI:iu,map:mp,ap:Qv},Aee=Ot(eg),Fee=wt(eg),Nee={URI:iu,map:mp,ap:Qv,of:vp},JS={URI:iu,map:mp,ap:Qv,chain:hP},gP={URI:iu,map:mp,ap:Qv,of:vp,chain:hP},Pee=lt(JS),Wee={URI:iu,fromState:q},jee=function(e){return function(t){return t(e)[0]}},Lee=function(e){return function(t){return t(e)[1]}},Dee=Ct(YS),Bee=xt(JS),Uee=Et(eg),yP=function(e){return function(t){return function(n){for(var r=e(0,gr(t))(n),i=r[0],o=r[1],a=[i],u=o,s=1;s<t.length;s++){var c=e(s,t[s])(u),l=c[0],f=c[1];a.push(l),u=f}return[a,u]}}},ZS=function(e){var t=yP(e);return function(n){return mt(n)?t(n):vp(tn)}},qee=ZS,bP=function(e){return ZS(function(t,n){return e(n)})},zee=bP(q),Kee=function(e,t){return e(t)[0]},Vee=function(e,t){return e(t)[1]},Hee=gP;const Gee=Object.freeze(Object.defineProperty({__proto__:null,Applicative:Nee,Apply:eg,Chain:JS,FromState:Wee,Functor:YS,Monad:gP,Pointed:kee,URI:iu,ap:vP,apFirst:Aee,apS:Uee,apSecond:Fee,bind:Bee,bindTo:Dee,chain:GS,chainFirst:Pee,evalState:Kee,evaluate:jee,execState:Vee,execute:Lee,flap:Ree,flatten:Mee,get:lP,gets:pP,map:mP,modify:dP,of:vp,put:fP,sequenceArray:zee,state:Hee,traverseArray:bP,traverseArrayWithIndex:qee,traverseReadonlyArrayWithIndex:ZS,traverseReadonlyNonEmptyArrayWithIndex:yP},Symbol.toStringTag,{value:"Module"}));function _P(e){return function(){return e.fromState(lP())}}function $P(e){return function(t){return e.fromState(fP(t))}}function SP(e){return H(dP,e.fromState)}function TP(e){return H(pP,e.fromState)}function XS(e){return function(t){return H(t,e.fromState)}}function IP(e,t){var n=XS(e);return function(r){return function(i){return t.chain(i,n(r))}}}const Yee=Object.freeze(Object.defineProperty({__proto__:null,chainStateK:IP,fromStateK:XS,get:_P,gets:TP,modify:SP,put:$P},Symbol.toStringTag,{value:"Module"}));function Es(e){return function(t){return H(t,e.fromTask)}}function Fl(e,t){return function(n){var r=H(n,e.fromTask);return function(i){return t.chain(i,r)}}}function Nl(e,t){var n=lt(t);return function(r){return n(H(r,e.fromTask))}}const Jee=Object.freeze(Object.defineProperty({__proto__:null,chainFirstTaskK:Nl,chainTaskK:Fl,fromTaskK:Es},Symbol.toStringTag,{value:"Module"}));function CP(e){return function(t){return H(t,e.fromThese)}}const Zee=Object.freeze(Object.defineProperty({__proto__:null,fromTheseK:CP},Symbol.toStringTag,{value:"Module"}));function OP(e,t){return function(n){return function(r){return e.mapWithIndex(r,function(i,o){return t.mapWithIndex(o,function(a,u){return n([i,a],u)})})}}}function Xee(e,t){var n=Bc(e,t).map,r=OP(e,t);return{map:n,mapWithIndex:function(i,o){return v(i,r(o))}}}const Qee=Object.freeze(Object.defineProperty({__proto__:null,getFunctorWithIndexComposition:Xee,mapWithIndex:OP},Symbol.toStringTag,{value:"Module"})),ete=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),tte=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),nte=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var ro=function(e,t){return v(e,RP(t))},Pl=function(e,t){return v(e,kP(t))},tg=function(e,t){return v(e,nT(t))},QS=function(e,t,n){return v(e,AP(t,n))},eT=function(e){return function(t,n){return v(t,FP()(n))}},tT=function(e,t,n){return v(e,NP(t,n))},wP=function(e,t){return v(e,jP())},EP=function(e,t){return v(e,rT(t))},xP=function(e){var t=PP(e);return function(n,r){return v(n,t(r))}},MP=iS,RP=function(e){return function(t){return e(t)}},kP=function(e){return function(t){return t(e)}},Wl=q,nT=function(e){return function(t){return e(t)}},rT=function(e){return function(t){return e(t)}},iT=q,rte=rT(q),ite=nT(q),AP=function(e,t){return function(n){return t(e,n)}},FP=function(){return function(e){return function(t){return e(t)}}},NP=function(e,t){return function(n){return t(n,e)}},PP=function(e){return function(t){return function(n){return e.map(t(n),q)}}},oT=function(e){return function(t){return e.map(t,q)}},WP=function(){return q},jP=WP,Ir="Identity",ote=q,ate=q,aT={URI:Ir,map:ro},ute=Ue(aT),ste={URI:Ir,of:Wl},ng={URI:Ir,map:ro,ap:Pl},cte=Ot(ng),lte=wt(ng),fte={URI:Ir,map:ro,ap:Pl,of:Wl},uT={URI:Ir,map:ro,ap:Pl,chain:tg},dte={URI:Ir,map:ro,ap:Pl,of:Wl,chain:tg},pte=lt(uT),hte={URI:Ir,reduce:QS,foldMap:eT,reduceRight:tT},mte={URI:Ir,map:ro,reduce:QS,foldMap:eT,reduceRight:tT,traverse:xP,sequence:oT},vte={URI:Ir,map:ro,alt:wP},gte={URI:Ir,map:ro,extend:EP,extract:iT},yte={URI:Ir,map:ro,ap:Pl,chain:tg,chainRec:MP},bte=Wl(zt),_te=Ct(aT),$te=xt(uT),Ste=Et(ng),Tte={URI:Ir,map:ro,ap:Pl,of:Wl,chain:tg,reduce:QS,foldMap:eT,reduceRight:tT,traverse:xP,sequence:oT,alt:wP,extract:iT,extend:EP,chainRec:MP};const Ite=Object.freeze(Object.defineProperty({__proto__:null,Alt:vte,Applicative:fte,Apply:ng,Chain:uT,ChainRec:yte,Comonad:gte,Do:bte,Foldable:hte,Functor:aT,Monad:dte,Pointed:ste,Traversable:mte,URI:Ir,alt:jP,altW:WP,ap:kP,apFirst:cte,apS:Ste,apSecond:lte,bind:$te,bindTo:_te,chain:nT,chainFirst:pte,duplicate:rte,extend:rT,extract:iT,flap:ute,flatten:ite,foldMap:FP,getEq:ate,getShow:ote,identity:Tte,map:RP,of:Wl,reduce:AP,reduceRight:NP,sequence:oT,traverse:PP},Symbol.toStringTag,{value:"Module"})),Cte=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Zo=function(e,t){return function(){return t(e())}},ou=function(e,t){return function(){return e()(t())}},jl=function(e,t){return function(){return t(e())()}},LP=function(e,t){return function(){for(var n=t(e)();n._tag==="Left";)n=t(n.left)();return n.right}},io=function(e){return function(t){return Zo(t,e)}},Ote=function(e){return function(t){return ou(t,e)}},mi=Zn,sT=function(e){return function(t){return jl(t,e)}},wte=sT(q),vi="IO",ot={URI:vi,map:Zo},Ete=Ue(ot),oo={URI:vi,of:mi},Xo={URI:vi,map:Zo,ap:ou},xte=Ot(Xo),Mte=wt(Xo),DP={URI:vi,map:Zo,ap:ou,of:mi},rg={URI:vi,map:Zo,ap:ou,chain:jl},Qn={URI:vi,map:Zo,ap:ou,of:mi,chain:jl},Rte=lt(rg),cT=q,kte={URI:vi,map:Zo,ap:ou,of:mi,chain:jl,fromIO:cT},Ate={URI:vi,map:Zo,ap:ou,chain:jl,chainRec:LP},Fte={URI:vi,fromIO:q},Nte=mi(zt),Pte=Ct(ot),Wte=xt(rg),jte=Et(Xo),BP=mi(tn),ig=function(e){return function(t){return function(){for(var n=[e(0,gr(t))()],r=1;r<t.length;r++)n.push(e(r,t[r])());return n}}},lT=function(e){var t=ig(e);return function(n){return mt(n)?t(n):BP}},Lte=lT,UP=function(e){return lT(function(t,n){return e(n)})},Dte=UP(q),Bte={URI:vi,map:Zo,of:mi,ap:ou,chain:jl,fromIO:cT,chainRec:LP},Ute=Kt(Xo),qte=Lr(DP);const zte=Object.freeze(Object.defineProperty({__proto__:null,ApT:BP,Applicative:DP,Apply:Xo,Chain:rg,ChainRec:Ate,Do:Nte,FromIO:Fte,Functor:ot,Monad:Qn,MonadIO:kte,Pointed:oo,URI:vi,ap:Ote,apFirst:xte,apS:jte,apSecond:Mte,bind:Wte,bindTo:Pte,chain:sT,chainFirst:Rte,flap:Ete,flatten:wte,fromIO:cT,getMonoid:qte,getSemigroup:Ute,io:Bte,map:io,of:mi,sequenceArray:Dte,traverseArray:UP,traverseArrayWithIndex:Lte,traverseReadonlyArrayWithIndex:lT,traverseReadonlyNonEmptyArrayWithIndex:ig},Symbol.toStringTag,{value:"Module"}));var qP=Tl(oo),zP=Ss(oo),KP=Il(ot),Kte=Cl(ot),VP=mi,gp=KP,HP=ip(ot),Vte=HP,fT=Rl(Qn),Hte=fT,GP=fT,Gte=GP,YP=kl(Qn),Yte=YP,JP=function(e,t){return function(){return $s(e,t)}},Jte=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return JP(function(){return e.apply(void 0,n)},t)}},Zte=up(ot),ZP=Is(Qn),Xte=ZP,dT=op(Qn),Qte=dT,ene=function(e){return dT(sW(e))},tne=ap(Qn),nne=Al(ot),er=function(e,t){return v(e,mT(t))},xs=function(e,t){return v(e,vT(t))},rne=function(e,t){return v(e,og(function(n){return v(t,mT(n))}))},Ll=function(e,t){return v(e,og(t))},pT=function(e,t,n){return v(e,QP(t,n))},hT=function(e,t){return v(e,eW(t))},XP=function(e,t){return v(e,gT(t))},mT=Ol(ot),QP=xl(ot),eW=Ml(ot),vT=wl(Xo),ine=vT,qr=zP,og=Ts(Qn),ag=og,tW=ag(q),one=tW,gT=El(Qn),ane=gT,ug=qP,Pt="IOEither";function nW(e){var t=ko(Xo,Qa(e));return{URI:Pt,_E:void 0,map:er,ap:function(n,r){return v(n,t(r))},of:qr}}function rW(e){var t=rp(Qn,e);return{URI:Pt,_E:void 0,map:er,alt:function(n,r){return v(n,t(r))}}}var iW=function(e){var t=bs(e);return{URI:Pt,_E:void 0,compact:Qi(ot,t),separate:qo(ot,t,eu)}};function une(e){var t=_l(e),n=iW(e),r=zo(ot,t),i=Ko(ot,t),o=nu(ot,t),a=ru(ot,t);return{URI:Pt,_E:void 0,map:er,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}var yT={URI:Pt,map:er},sne=Ue(yT),cne={URI:Pt,of:qr},lne={URI:Pt,bimap:pT,mapLeft:hT},yp={URI:Pt,map:er,ap:xs},oW=Ot(yp),fne=oW,aW=wt(yp),dne=aW,bT={URI:Pt,map:er,ap:xs,of:qr},pne={URI:Pt,map:er,ap:rne,of:qr},Qo={URI:Pt,map:er,ap:xs,chain:Ll},hne={URI:Pt,map:er,ap:xs,of:qr,chain:Ll},uW=lt(Qo),mne=uW,vne={URI:Pt,map:er,alt:XP},gne={URI:Pt,map:er,ap:xs,of:qr,chain:Ll,fromIO:gp},yne={URI:Pt,map:er,ap:xs,of:qr,chain:Ll,throwError:ug},sg={URI:Pt,fromIO:gp},sW=to(sg),bne=Vo(sg,Qo),_ne=Ho(sg,Qo),ea={URI:Pt,fromEither:VP},$ne=Yi(ea),Sne=Ji(ea),Tne=ss(ea,Qo),cW=Po(ea,Qo),Ine=cW,lW=Wo(ea,Qo),Cne=lW,One=Ha(ea),fW=cs(ea,Qo),wne=fW,Ene=Sr(ea),xne=function(e,t,n){return dW(e,t,n)},dW=function(e,t,n){return v(e,ag(function(r){return v(t(r),sT(function(i){return v(n(r,i),ag(function(){return mi(i)}))}))}))},Mne=qr(zt),Rne=Ct(yT),pW=xt(Qo),kne=pW,hW=Et(yp),Ane=hW,_T=qr(tn),mW=function(e){return H(ig(e),io(np(Xn)))},$T=function(e){var t=mW(e);return function(n){return mt(n)?t(n):_T}},vW=function(e){return function(t){return function(){var n=e(0,gr(t))();if(qt(n))return n;for(var r=[n.right],i=1;i<t.length;i++){var o=e(i,t[i])();if(qt(o))return o;r.push(o.right)}return za(r)}}},ST=function(e){var t=vW(e);return function(n){return mt(n)?t(n):_T}},Fne=$T,gW=function(e){return $T(function(t,n){return e(n)})},Nne=gW(q),Pne=ST,yW=function(e){return ST(function(t,n){return e(n)})},Wne=yW(q),jne=bT,Lne={URI:Pt,bimap:pT,mapLeft:hT,map:er,of:qr,ap:xs,chain:Ll,alt:XP,fromIO:gp,throwError:ug},Dne=Kt(yp),Bne=Lr(bT),Une=function(e){return Kt(Xo)(Xd(e))};function qne(e){var t=nW(e),n=rW(e);return{URI:Pt,_E:void 0,map:er,ap:t.ap,of:qr,chain:Ll,bimap:pT,mapLeft:hT,alt:n.alt,fromIO:gp,throwError:ug}}const zne=Object.freeze(Object.defineProperty({__proto__:null,Alt:vne,ApT:_T,Applicative:jne,ApplicativePar:bT,ApplicativeSeq:pne,ApplyPar:yp,Bifunctor:lne,Chain:Qo,Do:Mne,FromEither:ea,FromIO:sg,Functor:yT,Monad:hne,MonadIO:gne,MonadThrow:yne,Pointed:cne,URI:Pt,alt:gT,altW:ane,ap:vT,apFirst:oW,apFirstW:fne,apS:hW,apSW:Ane,apSecond:aW,apSecondW:dne,apW:ine,bimap:QP,bind:pW,bindTo:Rne,bindW:kne,bracket:xne,bracketW:dW,chain:og,chainEitherK:cW,chainEitherKW:Ine,chainFirst:uW,chainFirstEitherK:lW,chainFirstEitherKW:Cne,chainFirstIOK:_ne,chainFirstW:mne,chainIOK:bne,chainOptionK:Tne,chainW:ag,filterOrElse:fW,filterOrElseW:wne,flap:sne,flatten:one,flattenW:tW,fold:Hte,foldW:Gte,fromEither:VP,fromEitherK:Ene,fromIO:gp,fromIOK:sW,fromOption:$ne,fromOptionK:Sne,fromPredicate:One,getAltIOValidation:rW,getApplicativeIOValidation:nW,getApplyMonoid:Bne,getApplySemigroup:Dne,getCompactable:iW,getFilterable:une,getIOValidation:qne,getOrElse:YP,getOrElseW:Yte,getSemigroup:Une,ioEither:Lne,left:qP,leftIO:Kte,map:mT,mapLeft:eW,match:HP,matchE:fT,matchEW:GP,matchW:Vte,of:qr,orElse:ZP,orElseFirst:dT,orElseFirstIOK:ene,orElseFirstW:Qte,orElseW:Xte,orLeft:tne,right:zP,rightIO:KP,sequenceArray:Nne,sequenceSeqArray:Wne,swap:nne,throwError:ug,toUnion:Zte,traverseArray:gW,traverseArrayWithIndex:Fne,traverseReadonlyArrayWithIndex:$T,traverseReadonlyArrayWithIndexSeq:ST,traverseReadonlyNonEmptyArrayWithIndex:mW,traverseReadonlyNonEmptyArrayWithIndexSeq:vW,traverseSeqArray:yW,traverseSeqArrayWithIndex:Pne,tryCatch:JP,tryCatchK:Jte},Symbol.toStringTag,{value:"Module"}));function bp(e){return H(yt,e.of)}function _p(e){return Zn(e.of(nt))}function cg(e){return function(t){return e.map(t,yt)}}function lg(e){return H(vs,e.of)}function fg(e){var t=lg(e);return function(n){return H(n,t)}}function TT(e){var t=Dl(e),n=fg(e);return function(r){return t(n(r))}}function dg(e){return function(t){return H(t,e.of)}}function IT(e){var t=Dl(e),n=dg(e);return function(r){return t(n(r))}}function CT(e){return function(t){return function(n){return e.of(Wv(t)(n))}}}function OT(e){return H(gl,e.of)}function wT(e){return function(t,n){return function(r){return e.map(r,Bo(t,n))}}}function pg(e){return function(t,n){return function(r){return e.chain(r,Bo(t,n))}}}function hg(e){return function(t){return function(n){return e.chain(n,Bo(t,e.of))}}}function mg(e){return Dc(e,pl)}function vg(e){return ko(e,hl)}function Dl(e){var t=_p(e);return function(n){return function(r){return e.chain(r,Bo(function(){return t()},n))}}}function gg(e){var t=bp(e);return function(n){return function(r){return e.chain(r,Bo(n,t))}}}function Kne(e){var t=vg(e),n=mg(e),r=Dl(e),i=gg(e),o=pg(e),a=hg(e),u=_p(e);return{map:function(s,c){return v(s,n(c))},ap:function(s,c){return v(s,t(c))},of:bp(e),chain:function(s,c){return v(s,r(c))},alt:function(s,c){return v(s,i(c))},fold:function(s,c,l){return v(s,o(c,l))},getOrElse:function(s,c){return v(s,a(c))},fromM:cg(e),none:function(){return u()}}}const Vne=Object.freeze(Object.defineProperty({__proto__:null,alt:gg,ap:vg,chain:Dl,chainNullableK:TT,chainOptionK:IT,fromEither:OT,fromF:cg,fromNullable:lg,fromNullableK:fg,fromOptionK:dg,fromPredicate:CT,getOptionM:Kne,getOrElse:hg,map:mg,match:wT,matchE:pg,some:bp,zero:_p},Symbol.toStringTag,{value:"Module"}));var bW=bp(oo),Hne=CT(oo),Gne=mi,_W=OT(oo),ET=cg(ot),Yne=io(gl),$W=wT(ot),Jne=$W,xT=pg(rg),Zne=xT,Xne=xT,SW=hg(Qn),Qne=SW,ere=io(VF),tre=io(_S),nre=lg(oo),rre=fg(oo),ire=TT(Qn),ore=dg(oo),are=IT(Qn),TW=mg(ot),IW=vg(Xo),au=bW,MT=Dl(Qn),ure=MT(q),RT=gg(Qn),sre=RT,yg=_p(oo),cre=yg(),kT=Qi(ot,ms),AT=qo(ot,ms,pl),CW=zo(ot,Do),OW=Ko(ot,Do),wW=nu(ot,Do),EW=ru(ot,Do),ta=function(e,t){return v(e,TW(t))},Bl=function(e,t){return v(e,IW(t))},FT=function(e,t){return v(e,MT(t))},xW=function(e,t){return v(e,RT(t))},lre=function(e,t){return v(e,CW(t))},fre=function(e,t){return v(e,OW(t))},dre=function(e,t){return v(e,wW(t))},pre=function(e,t){return v(e,EW(t))},tr="IOOption",NT={URI:tr,map:ta},hre=Ue(NT),MW={URI:tr,of:au},bg={URI:tr,map:ta,ap:Bl},mre=Ot(bg),vre=wt(bg),gre={URI:tr,map:ta,ap:Bl,of:au},Ms={URI:tr,map:ta,ap:Bl,chain:FT},yre=lt(Ms),bre={URI:tr,map:ta,alt:xW},RW={URI:tr,zero:yg},_re=tl(RW,MW),$re={URI:tr,map:ta,ap:Bl,of:au,alt:xW,zero:yg},Sre={URI:tr,map:ta,ap:Bl,of:au,chain:FT},Tre={URI:tr,map:ta,ap:Bl,of:au,chain:FT,fromIO:ET},Ire={URI:tr,compact:kT,separate:AT},Cre={URI:tr,map:ta,compact:kT,separate:AT,filter:lre,filterMap:fre,partition:dre,partitionMap:pre},_g={URI:tr,fromIO:ET},Ore=to(_g),wre=Vo(_g,Ms),Ere=Ho(_g,Ms),$g={URI:tr,fromEither:_W},xre=Sr($g),Mre=Po($g,Ms),Rre=Wo($g,Ms),kre=au(zt),Are=Ct(NT),Fre=xt(Ms),Nre=Et(bg),kW=au(tn),AW=function(e){return H(ig(e),io(Hv(Xn)))},Pre=function(e){var t=AW(e);return function(n){return mt(n)?t(n):kW}};const Wre=Object.freeze(Object.defineProperty({__proto__:null,Alt:bre,Alternative:$re,ApT:kW,Applicative:gre,Apply:bg,Chain:Ms,Compactable:Ire,Do:kre,Filterable:Cre,FromEither:$g,FromIO:_g,Functor:NT,Monad:Sre,MonadIO:Tre,Pointed:MW,Zero:RW,alt:RT,altW:sre,ap:IW,apFirst:mre,apS:Nre,apSecond:vre,bind:Fre,bindTo:Are,chain:MT,chainEitherK:Mre,chainFirst:yre,chainFirstEitherK:Rre,chainFirstIOK:Ere,chainIOK:wre,chainNullableK:ire,chainOptionK:are,compact:kT,filter:CW,filterMap:OW,flap:hre,flatten:ure,fold:Zne,fromEither:_W,fromEitherK:xre,fromIO:ET,fromIOEither:Yne,fromIOK:Ore,fromNullable:nre,fromNullableK:rre,fromOption:Gne,fromOptionK:ore,fromPredicate:Hne,getOrElse:SW,getOrElseW:Qne,guard:_re,map:TW,match:$W,matchE:xT,matchEW:Xne,matchW:Jne,none:cre,of:au,partition:wW,partitionMap:EW,separate:AT,some:bW,toNullable:tre,toUndefined:ere,traverseReadonlyArrayWithIndex:Pre,traverseReadonlyNonEmptyArrayWithIndex:AW,zero:yg},Symbol.toStringTag,{value:"Module"}));var FW=function(){function e(t){var n=this;this.value=t,this.read=function(){return n.value},this.write=this.write.bind(this),this.modify=this.modify.bind(this)}return e.prototype.write=function(t){var n=this;return function(){n.value=t}},e.prototype.modify=function(t){var n=this;return function(){n.value=t(n.value)}},e}();function jre(e){return function(){return new FW(e)}}const Lre=Object.freeze(Object.defineProperty({__proto__:null,IORef:FW,newIORef:jre},Symbol.toStringTag,{value:"Module"})),Dre=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Bre=function(e){return $s(function(){return JSON.parse(e)},q)},Ure=function(e){return $s(function(){var t=JSON.stringify(e);if(typeof t!="string")throw new Error("Converting unsupported structure to JSON");return t},q)};const qre=Object.freeze(Object.defineProperty({__proto__:null,parse:Bre,stringify:Ure},Symbol.toStringTag,{value:"Module"})),zre=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Kre=function(e){return new Map(e)};function Vre(e){return new Map(e)}function NW(e,t){return{show:function(n){var r=[];return n.forEach(function(i,o){r.push("[".concat(e.show(o),", ").concat(t.show(i),"]"))}),"new Map([".concat(r.sort().join(", "),"])")}}}var PW=function(e){return e.size},ao=function(e){return e.size===0};function Sg(e){var t=Rs(e);return function(n,r){if(r===void 0){var i=Sg(e);return function(o){return i(n,o)}}return gt(t(n,r))}}function PT(e){return function(t,n){if(n===void 0){var r=PT(e);return function(u){return r(t,u)}}for(var i=n.values(),o;!(o=i.next()).done;){var a=o.value;if(e.equals(t,a))return!0}return!1}}var Ul=function(e){return function(t){return Array.from(t.keys()).sort(e.compare)}},Hre=function(e){return function(t){return Array.from(t.values()).sort(e.compare)}};function WW(e){var t=Ul(e);return function(n){return function(r){for(var i=[],o=t(r),a=0,u=o;a<u.length;a++){var s=u[a];i.push(n(s,r.get(s)))}return i}}}var jW=function(e){return WW(e)(function(t,n){return[t,n]})};function Gre(e,t){var n=jW(e);return function(r){var i=n(r),o=i.length;return t.unfold(0,function(a){return a<o?fe([i[a],a+1]):ye})}}var LW=function(e){var t=na(e);return function(n,r){var i=t(n);return function(o){var a=i(o);if(Ft(a)){var u=new Map(o);return u.set(n,r),u}else if(a.value[1]!==r){var u=new Map(o);return u.set(a.value[0],r),u}return o}}},DW=function(e){var t=na(e);return function(n){return function(r){var i=t(n,r);if(gt(i)){var o=new Map(r);return o.delete(i.value[0]),o}return r}}},Yre=function(e){var t=BW(e);return function(n,r){return t(n,function(){return r})}},BW=function(e){var t=na(e);return function(n,r){return function(i){var o=t(n,i);if(Ft(o))return ye;var a=o.value,u=a[0],s=a[1],c=r(s);if(c===s)return fe(i);var l=new Map(i);return l.set(u,c),fe(l)}}};function Jre(e){var t=Rs(e),n=DW(e);return function(r){var i=n(r);return function(o){return v(t(r,o),Xi(function(a){return[a,i(o)]}))}}}function na(e){return function(t,n){if(n===void 0){var r=na(e);return function(c){return r(t,c)}}for(var i=n.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];if(e.equals(u,t))return fe([u,s])}return ye}}function Rs(e){var t=na(e);return function(n,r){if(r===void 0){var i=Rs(e);return function(o){return i(n,o)}}return v(t(n,r),Xi(function(o){o[0];var a=o[1];return a}))}}function Tg(e,t){var n=na(e);return function(r,i){if(i===void 0){var o=Tg(e,t);return function(d){return o(d,r)}}for(var a=r.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c,i);if(Ft(f)||!e.equals(c,f.value[0])||!t.equals(l,f.value[1]))return!1}return!0}}var Ig=new Map;function UW(e,t){var n=Tg(e,t);return jr(function(r,i){return n(r,i)&&n(i,r)})}function Zre(e,t){var n=na(e);return{concat:function(r,i){if(ao(r))return i;if(ao(i))return r;for(var o=new Map(r),a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c,r);gt(f)?o.set(f.value[0],t.concat(f.value[1],l)):o.set(c,l)}return o},empty:Ig}}var Xre=function(e,t){return new Map([[e,t]])};function Qre(e,t,n){return function(r){var i=na(e);return n.reduce(r,new Map,function(o,a){var u=a[0],s=a[1],c=i(u,o);return gt(c)?o.set(c.value[0],t.concat(c.value[1],s)):o.set(u,s),o})}}var ql=function(e,t){for(var n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];n.set(a,t(a,u))}return n},qW=function(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1],c=e(u,s);qt(c)?n.set(u,c.left):r.set(u,c.right)}return Ee(n,r)}};function zW(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];e(u,s)?r.set(u,s):n.set(u,s)}return Ee(n,r)}}var KW=function(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1],s=e(a,u);gt(s)&&n.set(a,s.value)}return n}};function VW(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];e(a,u)&&n.set(a,u)}return n}}var ra=function(e,t){return ql(e,function(n,r){return t(r)})},$p=function(e,t){return HW(e,function(n,r){return t(r)})},Sp=function(e,t){return GW(e,function(n,r){return t(r)})},Tp=function(e,t){return YW(e,function(n,r){return t(r)})},Ip=function(e,t){return JW(e,function(n,r){return t(r)})},HW=function(e,t){return v(e,VW(t))},GW=function(e,t){return v(e,KW(t))},YW=function(e,t){return v(e,zW(t))},JW=function(e,t){return v(e,qW(t))},zl=function(e){for(var t=new Map,n=e.entries(),r;!(r=n.next()).done;){var i=r.value,o=i[0],a=i[1];gt(a)&&t.set(o,a.value)}return t},eie=function(e){return function(t){return $p(t,e)}},tie=function(e){return function(t){return Sp(t,e)}},nie=function(e){return function(t){return ra(t,e)}},rie=function(e){return function(t){return ql(t,e)}},iie=function(e){return function(t){return Tp(t,e)}},oie=function(e){return function(t){return Ip(t,e)}},Kl=function(e){for(var t=new Map,n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];qt(u)?t.set(a,u.left):n.set(a,u.right)}return Ee(t,n)},zr="ReadonlyMap",ZW=function(e,t){var n=qT(e,t);return{concat:function(r,i){return n(i)(r)}}},aie=function(e,t){return{concat:ZW(e,t).concat,empty:Ig}},uie=function(e,t){var n=zT(e,t);return{concat:function(r,i){return n(i)(r)}}},sie=function(e){return function(){var t=KT(e);return{concat:function(n,r){return t(r)(n)}}}};function cie(){return{URI:zr,_E:void 0,map:ra,mapWithIndex:ql,compact:zl,separate:Kl,filter:$p,filterMap:Sp,partition:Tp,partitionMap:Ip,partitionMapWithIndex:JW,partitionWithIndex:YW,filterMapWithIndex:GW,filterWithIndex:HW}}var XW={URI:zr,map:ra},lie=Ue(XW),fie=function(){return{URI:zr,_E:void 0,map:ra,mapWithIndex:ql}},WT={URI:zr,compact:zl,separate:Kl},die={URI:zr,map:ra,compact:zl,separate:Kl,filter:$p,filterMap:Sp,partition:Tp,partitionMap:Ip},jT=function(e){var t=Og(e);return function(n,r){return t(n,function(i,o,a){return r(o,a)})}},LT=function(e){var t=wg(e);return function(n){var r=t(n);return function(i){return r(function(o,a){return i(a)})}}},DT=function(e){var t=Eg(e);return function(n,r){return t(n,function(i,o,a){return r(o,a)})}},Cg=function(e){var t=jT(e),n=LT(e),r=DT(e);return{URI:zr,_E:void 0,reduce:function(i,o,a){return v(i,t(o,a))},foldMap:function(i){var o=n(i);return function(a,u){return v(a,o(u))}},reduceRight:function(i,o,a){return v(i,r(o,a))}}},Og=function(e){var t=Ul(e);return function(n,r){return function(i){for(var o=n,a=0,u=t(i);a<u.length;a++){var s=u[a];o=r(s,o,i.get(s))}return o}}},wg=function(e){var t=Ul(e);return function(n){return function(r){return function(i){for(var o=n.empty,a=0,u=t(i);a<u.length;a++){var s=u[a];o=n.concat(o,r(s,i.get(s)))}return o}}}},Eg=function(e){var t=Ul(e);return function(n,r){return function(i){for(var o=n,a=t(i),u=a.length,s=u-1;s>=0;s--){var c=a[s];o=r(c,i.get(c),o)}return o}}},BT=function(e){var t=Cg(e),n=Og(e),r=wg(e),i=Eg(e);return{URI:zr,_E:void 0,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:function(o,a,u){return v(o,n(a,u))},foldMapWithIndex:function(o){var a=r(o);return function(u,s){return v(u,a(s))}},reduceRightWithIndex:function(o,a,u){return v(o,i(a,u))}}},pie=function(e){var t=UT(e),n=Cg(e);return{URI:zr,_E:void 0,map:ra,reduce:n.reduce,foldMap:n.foldMap,reduceRight:n.reduceRight,traverse:t.traverse,sequence:t.sequence}},UT=function(e){var t=BT(e),n=Ul(e),r=function(a){return function(u,s){for(var c=a.of(new Map),l=n(u),f=l.length,d=function(h){var m=l[h],g=u.get(m);c=a.ap(a.map(c,function(_){return function(S){return _.set(m,S)}}),s(m,g))},p=0;p<f;p++)d(p);return c}},i=function(a){var u=r(a);return function(s,c){return u(s,function(l,f){return c(f)})}},o=function(a){var u=r(a);return function(s){return u(s,Xn)}};return{URI:zr,_E:void 0,map:ra,mapWithIndex:ql,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverse:i,sequence:o,traverseWithIndex:r}};function hie(e){var t=UT(e);return{URI:zr,_E:void 0,map:ra,compact:zl,separate:Kl,filter:$p,filterMap:Sp,partition:Tp,partitionMap:Ip,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,traverse:t.traverse,sequence:t.sequence,mapWithIndex:ql,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverseWithIndex:t.traverseWithIndex,wilt:ci(t,WT),wither:li(t,WT)}}var qT=function(e,t){var n=Rs(e);return function(r){return function(i){if(ao(i))return r;if(ao(r))return i;for(var o=new Map,a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c)(r);gt(f)?o.set(c,t.concat(l,f.value)):o.set(c,l)}for(var d=r.entries();!(u=d.next()).done;){var p=u.value,c=p[0],l=p[1],f=n(c)(o);Ft(f)&&o.set(c,l)}return o}}},zT=function(e,t){var n=Rs(e);return function(r){return function(i){if(ao(i)||ao(r))return Ig;for(var o=new Map,a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c)(r);gt(f)&&o.set(c,t.concat(l,f.value))}return o}}},KT=function(e){var t=Sg(e);return function(n){return function(r){if(ao(r))return n;if(ao(n))return r;for(var i=new Map,o=r.entries(),a;!(a=o.next()).done;){var u=a.value,s=u[0],c=u[1];t(s)(n)||i.set(s,c)}for(var l=n.entries();!(a=l.next()).done;){var f=a.value,s=f[0],c=f[1];t(s)(r)||i.set(s,c)}return i}}},mie=LW,vie={URI:zr,map:ra,compact:zl,separate:Kl,filter:$p,filterMap:Sp,partition:Tp,partitionMap:Ip};const gie=Object.freeze(Object.defineProperty({__proto__:null,Compactable:WT,Filterable:die,Functor:XW,URI:zr,collect:WW,compact:zl,deleteAt:DW,difference:KT,elem:PT,empty:Ig,filter:eie,filterMap:tie,filterMapWithIndex:KW,filterWithIndex:VW,flap:lie,foldMap:LT,foldMapWithIndex:wg,fromFoldable:Qre,fromMap:Kre,getDifferenceMagma:sie,getEq:UW,getFilterableWithIndex:cie,getFoldable:Cg,getFoldableWithIndex:BT,getFunctorWithIndex:fie,getIntersectionSemigroup:uie,getMonoid:Zre,getShow:NW,getTraversable:pie,getTraversableWithIndex:UT,getUnionMonoid:aie,getUnionSemigroup:ZW,getWitherable:hie,insertAt:mie,intersection:zT,isEmpty:ao,isSubmap:Tg,keys:Ul,lookup:Rs,lookupWithKey:na,map:nie,mapWithIndex:rie,member:Sg,modifyAt:BW,partition:iie,partitionMap:oie,partitionMapWithIndex:qW,partitionWithIndex:zW,pop:Jre,readonlyMap:vie,reduce:jT,reduceRight:DT,reduceRightWithIndex:Eg,reduceWithIndex:Og,separate:Kl,singleton:Xre,size:PW,toMap:Vre,toReadonlyArray:jW,toUnfoldable:Gre,union:qT,updateAt:Yre,upsertAt:LW,values:Hre},Symbol.toStringTag,{value:"Module"}));var Vl=globalThis&&globalThis.__assign||function(){return Vl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Vl.apply(this,arguments)},yie=NW,bie=PW,ia=ao,_ie=Sg,$ie=PT,VT=function(e){return function(t){return Array.from(t.keys()).sort(e.compare)}},Sie=function(e){return function(t){return Array.from(t.values()).sort(e.compare)}};function QW(e){var t=VT(e);return function(n){return function(r){for(var i=[],o=t(r),a=0,u=o;a<u.length;a++){var s=u[a];i.push(n(s,r.get(s)))}return i}}}function ej(e){return QW(e)(function(t,n){return[t,n]})}function Tie(e,t){var n=ej(e);return function(r){var i=n(r),o=i.length;return t.unfold(0,function(a){return a<o?fe([i[a],a+1]):ye})}}var tj=function(e){var t=ks(e);return function(n,r){var i=t(n);return function(o){var a=i(o);if(Ft(a)){var u=new Map(o);return u.set(n,r),u}else if(a.value[1]!==r){var u=new Map(o);return u.set(a.value[0],r),u}return o}}},nj=function(e){var t=ks(e);return function(n){return function(r){var i=t(n,r);if(gt(i)){var o=new Map(r);return o.delete(i.value[0]),o}return r}}},Iie=function(e){var t=rj(e);return function(n,r){return t(n,function(){return r})}},rj=function(e){var t=ks(e);return function(n,r){return function(i){var o=t(n,i);if(Ft(o))return ye;var a=new Map(i);return a.set(o.value[0],r(o.value[1])),fe(a)}}};function Cie(e){var t=ij(e),n=nj(e);return function(r){var i=n(r);return function(o){return v(t(r,o),Xi(function(a){return[a,i(o)]}))}}}function ks(e){return function(t,n){if(n===void 0){var r=ks(e);return function(c){return r(t,c)}}for(var i=n.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];if(e.equals(u,t))return fe([u,s])}return ye}}var ij=Rs,Oie=Tg,wie=UW;function Eie(e,t){var n=ks(e);return{concat:function(r,i){if(ia(r))return i;if(ia(i))return r;for(var o=new Map(r),a=i.entries(),u;!(u=a.next()).done;){var s=u.value,c=s[0],l=s[1],f=n(c,r);gt(f)?o.set(f.value[0],t.concat(f.value[1],l)):o.set(c,l)}return o},empty:new Map}}var xie=function(e,t){return new Map([[e,t]])};function Mie(e,t,n){return function(r){var i=ks(e);return n.reduce(r,new Map,function(o,a){var u=a[0],s=a[1],c=i(u,o);return gt(c)?o.set(c.value[0],t.concat(c.value[1],s)):o.set(u,s),o})}}var Cp=function(e,t){for(var n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];n.set(a,t(a,u))}return n},oj=function(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1],c=e(u,s);qt(c)?n.set(u,c.left):r.set(u,c.right)}return Ee(n,r)}};function aj(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,u=a[0],s=a[1];e(u,s)?r.set(u,s):n.set(u,s)}return Ee(n,r)}}var uj=function(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1],s=e(a,u);gt(s)&&n.set(a,s.value)}return n}};function sj(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];e(a,u)&&n.set(a,u)}return n}}var Hl=function(e,t){return Cp(e,function(n,r){return t(r)})},xg=function(e,t){return cj(e,function(n,r){return t(r)})},Mg=function(e,t){return lj(e,function(n,r){return t(r)})},Rg=function(e,t){return fj(e,function(n,r){return t(r)})},kg=function(e,t){return dj(e,function(n,r){return t(r)})},cj=function(e,t){return v(e,sj(t))},lj=function(e,t){return v(e,uj(t))},fj=function(e,t){return v(e,aj(t))},dj=function(e,t){return v(e,oj(t))},Op=function(e){for(var t=new Map,n=e.entries(),r;!(r=n.next()).done;){var i=r.value,o=i[0],a=i[1];gt(a)&&t.set(o,a.value)}return t},Rie=function(e){return function(t){return xg(t,e)}},kie=function(e){return function(t){return Mg(t,e)}},Aie=function(e){return function(t){return Hl(t,e)}},Fie=function(e){return function(t){return Cp(t,e)}},Nie=function(e){return function(t){return Rg(t,e)}},Pie=function(e){return function(t){return kg(t,e)}},wp=function(e){for(var t=new Map,n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],u=o[1];qt(u)?t.set(a,u.left):n.set(a,u.right)}return Ee(t,n)},oa="Map",pj=function(e,t){var n=yj(e,t);return{concat:function(r,i){return n(i)(r)}}},Wie=function(e,t){return{concat:pj(e,t).concat,empty:new Map}},jie=function(e,t){var n=bj(e,t);return{concat:function(r,i){return n(i)(r)}}},Lie=function(e){return function(){var t=_j(e);return{concat:function(n,r){return t(r)(n)}}}};function Die(){return{URI:oa,_E:void 0,map:Hl,mapWithIndex:Cp,compact:Op,separate:wp,filter:xg,filterMap:Mg,partition:Rg,partitionMap:kg,partitionMapWithIndex:dj,partitionWithIndex:fj,filterMapWithIndex:lj,filterWithIndex:cj}}function Bie(e){var t=mj(e);return{URI:oa,_E:void 0,map:Hl,compact:Op,separate:wp,filter:xg,filterMap:Mg,partition:Rg,partitionMap:kg,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,traverse:t.traverse,sequence:t.sequence,mapWithIndex:Cp,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverseWithIndex:t.traverseWithIndex,wilt:ci(t,HT),wither:li(t,HT)}}var Uie=jT,qie=LT,zie=DT,Kie=function(e){return Vl(Vl({},Cg(e)),{URI:oa})},Vie=Og,Hie=wg,Gie=Eg,hj=function(e){return Vl(Vl({},BT(e)),{URI:oa})},mj=function(e){var t=hj(e),n=VT(e),r=function(a){return function(u,s){for(var c=a.of(new Map),l=n(u),f=l.length,d=function(h){var m=l[h],g=u.get(m);c=a.ap(a.map(c,function(_){return function(S){return _.set(m,S)}}),s(m,g))},p=0;p<f;p++)d(p);return c}},i=function(a){var u=r(a);return function(s,c){return u(s,function(l,f){return c(f)})}},o=function(a){var u=r(a);return function(s){return u(s,function(c,l){return l})}};return{URI:oa,_E:void 0,map:Hl,mapWithIndex:Cp,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverse:i,sequence:o,traverseWithIndex:r}},vj={URI:oa,map:Hl},Yie=Ue(vj),HT={URI:oa,compact:Op,separate:wp},gj={URI:oa,map:Hl,compact:Op,separate:wp,filter:xg,filterMap:Mg,partition:Rg,partitionMap:kg},Ag=function(e){return new Map(e)},yj=function(e,t){var n=qT(e,t);return function(r){return function(i){return ia(i)?Ag(r):ia(r)?Ag(i):n(r)(i)}}},bj=function(e,t){var n=zT(e,t);return function(r){return function(i){return ia(i)||ia(r)?new Map:n(r)(i)}}},_j=function(e){var t=KT(e);return function(n){return function(r){return ia(r)?Ag(n):ia(n)?Ag(r):t(n)(r)}}},Jie=new Map,Zie=tj,Xie=gj;const Qie=Object.freeze(Object.defineProperty({__proto__:null,Compactable:HT,Filterable:gj,Functor:vj,URI:oa,collect:QW,compact:Op,deleteAt:nj,difference:_j,elem:$ie,empty:Jie,filter:Rie,filterMap:kie,filterMapWithIndex:uj,filterWithIndex:sj,flap:Yie,foldMap:qie,foldMapWithIndex:Hie,fromFoldable:Mie,getDifferenceMagma:Lie,getEq:wie,getFilterableWithIndex:Die,getFoldable:Kie,getFoldableWithIndex:hj,getIntersectionSemigroup:jie,getMonoid:Eie,getShow:yie,getTraversableWithIndex:mj,getUnionMonoid:Wie,getUnionSemigroup:pj,getWitherable:Bie,insertAt:Zie,intersection:bj,isEmpty:ia,isSubmap:Oie,keys:VT,lookup:ij,lookupWithKey:ks,map:Aie,mapWithIndex:Fie,map_:Xie,member:_ie,modifyAt:rj,partition:Nie,partitionMap:Pie,partitionMapWithIndex:oj,partitionWithIndex:aj,pop:Cie,reduce:Uie,reduceRight:zie,reduceRightWithIndex:Gie,reduceWithIndex:Vie,separate:wp,singleton:xie,size:bie,toArray:ej,toUnfoldable:Tie,union:yj,updateAt:Iie,upsertAt:tj,values:Sie},Symbol.toStringTag,{value:"Module"})),eoe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),toe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),noe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),roe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),ioe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var $j=function(e){return{concat:Om(e).concat,empty:e.top}},Sj=function(e){return{concat:wm(e).concat,empty:e.bottom}},GT=function(e){return{concat:q_(e).concat,empty:e.empty}},Tj=function(e){var t={};for(var n in e)ct.call(e,n)&&(t[n]=e[n].empty);return{concat:z_(e).concat,empty:t}},Ij=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{concat:K_.apply(tR,e).concat,empty:e.map(function(n){return n.empty})}},Cj=function(e){return H_(e)(e.empty)},ooe={concat:YM.concat,empty:void 0},aoe=Ij,uoe=Tj,soe=GT,coe=Sj,loe=$j,foe=Cj,Oj={concat:JM.concat,empty:!0},wj={concat:ZM.concat,empty:!1},doe=$M,poe=function(){return GT(LN())},hoe={concat:XM.concat,empty:""},moe={concat:QM.concat,empty:0},voe={concat:eR.concat,empty:1};const goe=Object.freeze(Object.defineProperty({__proto__:null,concatAll:Cj,fold:foe,getDualMonoid:soe,getEndomorphismMonoid:poe,getFunctionMonoid:doe,getJoinMonoid:coe,getMeetMonoid:loe,getStructMonoid:uoe,getTupleMonoid:aoe,max:Sj,min:$j,monoidAll:Oj,monoidAny:wj,monoidProduct:voe,monoidString:hoe,monoidSum:moe,monoidVoid:ooe,reverse:GT,struct:Tj,tuple:Ij},Symbol.toStringTag,{value:"Module"})),yoe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Ej=function(e,t,n){return function(r){return r===-1?e():r===0?t():n()}},boe=Ej,xj=function(e){return e===-1?1:e===1?-1:0},Mj={equals:function(e,t){return e===t}},YT={concat:function(e,t){return e!==0?e:t}},Rj={concat:YT.concat,empty:0},_oe=function(e){return e<=-1?-1:e>=1?1:0},$oe=xj,Soe=YT,Toe=Mj,Ioe=Rj;const Coe=Object.freeze(Object.defineProperty({__proto__:null,Eq:Mj,Monoid:Rj,Semigroup:YT,eqOrdering:Toe,invert:$oe,match:boe,matchW:Ej,monoidOrdering:Ioe,reverse:xj,semigroupOrdering:Soe,sign:_oe},Symbol.toStringTag,{value:"Module"}));var Ooe=function(e){return typeof e.map=="function"},woe=function(e){return typeof e.contramap=="function"},Eoe=function(e){return typeof e.mapWithIndex=="function"},xoe=function(e){return typeof e.ap=="function"},Moe=function(e){return typeof e.chain=="function"},Roe=function(e){return typeof e.bimap=="function"},koe=function(e){return typeof e.extend=="function"},Aoe=function(e){return typeof e.reduce=="function"},Foe=function(e){return typeof e.reduceWithIndex=="function"},Noe=function(e){return typeof e.alt=="function"},Poe=function(e){return typeof e.compact=="function"},Woe=function(e){return typeof e.filter=="function"},joe=function(e){return typeof e.filterWithIndex=="function"},Loe=function(e){return typeof e.promap=="function"},Doe=function(e){return typeof e.compose=="function"},Boe=function(e){return typeof e.throwError=="function"};function Uoe(e){var t={};if(Ooe(e)){var n=function(I){return function($){return e.map($,I)}};t.map=n}if(woe(e)){var r=function(I){return function($){return e.contramap($,I)}};t.contramap=r}if(Eoe(e)){var i=function(I){return function($){return e.mapWithIndex($,I)}};t.mapWithIndex=i}if(xoe(e)){var o=function(I){return function($){return e.ap($,I)}},a=function(I){return function($){return e.ap(e.map($,function(R){return function(){return R}}),I)}};t.ap=o,t.apFirst=a,t.apSecond=function(I){return function($){return e.ap(e.map($,function(){return function(R){return R}}),I)}}}if(Moe(e)){var u=function(I){return function($){return e.chain($,I)}},s=function(I){return function($){return e.chain($,function(R){return e.map(I(R),function(){return R})})}},c=function(I){return e.chain(I,q)};t.chain=u,t.chainFirst=s,t.flatten=c}if(Roe(e)){var l=function(I,$){return function(R){return e.bimap(R,I,$)}},f=function(I){return function($){return e.mapLeft($,I)}};t.bimap=l,t.mapLeft=f}if(koe(e)){var d=function(I){return function($){return e.extend($,I)}},p=function(I){return e.extend(I,q)};t.extend=d,t.duplicate=p}if(Aoe(e)){var h=function(I,$){return function(R){return e.reduce(R,I,$)}},m=function(I){var $=e.foldMap(I);return function(R){return function(L){return $(L,R)}}},g=function(I,$){return function(R){return e.reduceRight(R,I,$)}};t.reduce=h,t.foldMap=m,t.reduceRight=g}if(Foe(e)){var _=function(I,$){return function(R){return e.reduceWithIndex(R,I,$)}},S=function(I){var $=e.foldMapWithIndex(I);return function(R){return function(L){return $(L,R)}}},C=function(I,$){return function(R){return e.reduceRightWithIndex(R,I,$)}};t.reduceWithIndex=_,t.foldMapWithIndex=S,t.reduceRightWithIndex=C}if(Noe(e)){var b=function(I){return function($){return e.alt($,I)}};t.alt=b}if(Poe(e)&&(t.compact=e.compact,t.separate=e.separate),Woe(e)){var w=function(I){return function($){return e.filter($,I)}},O=function(I){return function($){return e.filterMap($,I)}},M=function(I){return function($){return e.partition($,I)}},x=function(I){return function($){return e.partitionMap($,I)}};t.filter=w,t.filterMap=O,t.partition=M,t.partitionMap=x}if(joe(e)){var U=function(I){return function($){return e.filterWithIndex($,I)}},B=function(I){return function($){return e.filterMapWithIndex($,I)}},P=function(I){return function($){return e.partitionWithIndex($,I)}},Z=function(I){return function($){return e.partitionMapWithIndex($,I)}};t.filterWithIndex=U,t.filterMapWithIndex=B,t.partitionWithIndex=P,t.partitionMapWithIndex=Z}if(Loe(e)){var ee=function(I,$){return function(R){return e.promap(R,I,$)}};t.promap=ee}if(Doe(e)){var J=function(I){return function($){return e.compose($,I)}};t.compose=J}if(Boe(e)){var ge=function(I){return function($){return $._tag==="None"?e.throwError(I()):e.of($.value)}},Te=function(I){return I._tag==="Left"?e.throwError(I.left):e.of(I.right)},k=function(I,$){return function(R){return I(R)?e.of(R):e.throwError($(R))}},A=function(I,$){return function(R){return e.chain(R,function(L){return I(L)?e.of(L):e.throwError($(L))})}};t.fromOption=ge,t.fromEither=Te,t.fromPredicate=k,t.filterOrElse=A}return t}var le=v;const qoe=Object.freeze(Object.defineProperty({__proto__:null,pipe:le,pipeable:Uoe},Symbol.toStringTag,{value:"Module"})),zoe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Koe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Fg=function(){return Math.random()};function kj(e,t){return v(Fg,io(function(n){return Math.floor((t-e+1)*n+e)}))}function Voe(e,t){return v(Fg,io(function(n){return(t-e)*n+e}))}var Hoe=v(Fg,io(function(e){return e<.5})),Goe=function(e){return v(kj(0,e.length-1),io(function(t){return e[t]}))};const Yoe=Object.freeze(Object.defineProperty({__proto__:null,random:Fg,randomBool:Hoe,randomElem:Goe,randomInt:kj,randomRange:Voe},Symbol.toStringTag,{value:"Module"}));var JT=Tl(KS),Aj=Ss(KS),Fj=Il(an),Joe=Cl(an),Nj=no,Pj=Fj,Wj=ip(an),Zoe=Wj,ZT=Rl(Jo),Xoe=ZT,jj=ZT,Qoe=jj,Lj=kl(Jo),eae=Lj,tae=up(an),nae=sp,Dj=cp,rae=Dj,Bj=Is(Jo),iae=Bj,Uj=op(Jo),oae=Uj,aae=ap(Jo),uae=Al(an),Kr=function(e,t){return v(e,zj(t))},XT=function(e,t,n){return v(e,Kj(t,n))},QT=function(e,t){return v(e,Vj(t))},Gl=function(e,t){return v(e,eI(t))},Ep=function(e,t){return v(e,tI(t))},qj=function(e,t){return v(e,nI(t))},zj=Ol(an),Kj=xl(an),Vj=Ml(an),eI=wl(Yo),sae=eI,uo=Aj,tI=Ts(Jo),Hj=tI,Gj=Hj(q),cae=Gj,nI=El(Jo),lae=nI,rI=JT,Vt="ReaderEither",Yj=function(e){var t=bs(e);return{URI:Vt,_E:void 0,compact:Qi(an,t),separate:qo(an,t,eu)}};function fae(e){var t=_l(e),n=Yj(e),r=zo(an,t),i=Ko(an,t),o=nu(an,t),a=ru(an,t);return{URI:Vt,_E:void 0,map:Kr,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}function Jj(e){var t=ko(Yo,Qa(e));return{URI:Vt,_E:void 0,map:Kr,ap:function(n,r){return v(n,t(r))},of:uo}}function Zj(e){var t=rp(Jo,e);return{URI:Vt,_E:void 0,map:Kr,alt:function(n,r){return v(n,t(r))}}}var iI={URI:Vt,map:Kr},dae=Ue(iI),pae={URI:Vt,of:uo},xp={URI:Vt,map:Kr,ap:Gl},Xj=Ot(xp),hae=Xj,Qj=wt(xp),mae=Qj,eL={URI:Vt,map:Kr,ap:Gl,of:uo},aa={URI:Vt,map:Kr,ap:Gl,chain:Ep},vae={URI:Vt,map:Kr,ap:Gl,of:uo,chain:Ep},tL=lt(aa),gae=tL,yae={URI:Vt,bimap:XT,mapLeft:QT},bae={URI:Vt,map:Kr,alt:qj},Yl={URI:Vt,fromReader:Pj},_ae=fp(Yl),$ae=dp(Yl),Sae=ws(Yl),nL=pp(Yl,aa),Tae=nL,rL=hp(Yl,aa),Iae=rL,Cae={URI:Vt,map:Kr,ap:Gl,of:uo,chain:Ep,throwError:rI},ua={URI:Vt,fromEither:Nj},Oae=Yi(ua),wae=Ji(ua),Eae=ss(ua,aa),iL=Po(ua,aa),xae=iL,oL=Wo(ua,aa),Mae=oL,Rae=Ha(ua),aL=cs(ua,aa),kae=aL,Aae=Sr(ua),Fae=uo(zt),Nae=Ct(iI),uL=xt(aa),Pae=uL,sL=Et(xp),Wae=sL,cL=uo(tn),lL=function(e){return H(Os(e),Cs(np(Xn)))},oI=function(e){var t=lL(e);return function(n){return mt(n)?t(n):cL}},jae=oI,fL=function(e){return oI(function(t,n){return e(n)})},Lae=fL(q),Dae={URI:Vt,bimap:XT,mapLeft:QT,map:Kr,of:uo,ap:Gl,chain:Ep,alt:qj,throwError:JT},Bae=Kt(xp),Uae=Lr(eL),qae=function(e){return Kt(Yo)(Xd(e))};function zae(e){var t=Jj(e),n=Zj(e);return{URI:Vt,_E:void 0,map:Kr,ap:t.ap,of:uo,chain:Ep,bimap:XT,mapLeft:QT,alt:n.alt,throwError:rI}}const Kae=Object.freeze(Object.defineProperty({__proto__:null,Alt:bae,ApT:cL,Applicative:eL,Apply:xp,Bifunctor:yae,Chain:aa,Do:Fae,FromEither:ua,FromReader:Yl,Functor:iI,Monad:vae,MonadThrow:Cae,Pointed:pae,URI:Vt,alt:nI,altW:lae,ap:eI,apFirst:Xj,apFirstW:hae,apS:sL,apSW:Wae,apSecond:Qj,apSecondW:mae,apW:sae,ask:_ae,asks:$ae,asksReaderEither:rae,asksReaderEitherW:Dj,bimap:Kj,bind:uL,bindTo:Nae,bindW:Pae,chain:tI,chainEitherK:iL,chainEitherKW:xae,chainFirst:tL,chainFirstEitherK:oL,chainFirstEitherKW:Mae,chainFirstReaderK:rL,chainFirstReaderKW:Iae,chainFirstW:gae,chainOptionK:Eae,chainReaderK:nL,chainReaderKW:Tae,chainW:Hj,filterOrElse:aL,filterOrElseW:kae,flap:dae,flatten:cae,flattenW:Gj,fold:Xoe,foldW:Qoe,fromEither:Nj,fromEitherK:Aae,fromOption:Oae,fromOptionK:wae,fromPredicate:Rae,fromReader:Pj,fromReaderK:Sae,getAltReaderValidation:Zj,getApplicativeReaderValidation:Jj,getApplyMonoid:Uae,getApplySemigroup:Bae,getCompactable:Yj,getFilterable:fae,getOrElse:Lj,getOrElseW:eae,getReaderValidation:zae,getSemigroup:qae,left:JT,leftReader:Joe,local:nae,map:zj,mapLeft:Vj,match:Wj,matchE:ZT,matchEW:jj,matchW:Zoe,of:uo,orElse:Bj,orElseFirst:Uj,orElseFirstW:oae,orElseW:iae,orLeft:aae,readerEither:Dae,right:Aj,rightReader:Fj,sequenceArray:Lae,swap:uae,throwError:rI,toUnion:tae,traverseArray:fL,traverseArrayWithIndex:jae,traverseReadonlyArrayWithIndex:oI,traverseReadonlyNonEmptyArrayWithIndex:lL},Symbol.toStringTag,{value:"Module"}));function aI(e){return function(t){return function(){return e.of(t)}}}function uI(e){return function(t){return function(n){return function(r){return e.map(n(r),t)}}}}function sI(e){return function(t){return function(n){return function(r){return e.ap(n(r),t(r))}}}}function cI(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){return t(i)(r)})}}}}function lI(e){return function(t){return H(t,e.of)}}function Vae(e){return function(t){return H(t,e)}}function Hae(e){var t=sI(e),n=uI(e),r=cI(e);return{map:function(i,o){return v(i,n(o))},ap:function(i,o){return v(i,t(o))},of:aI(e),chain:function(i,o){return v(i,r(o))},ask:function(){return e.of},asks:function(i){return H(i,e.of)},local:function(i,o){return function(a){return i(o(a))}},fromReader:lI(e),fromM:function(i){return function(){return i}}}}const Gae=Object.freeze(Object.defineProperty({__proto__:null,ap:sI,chain:cI,fromNaturalTransformation:Vae,fromReader:lI,getReaderM:Hae,map:uI,of:aI},Symbol.toStringTag,{value:"Module"}));var Nn=function(e){return function(){return Promise.resolve().then(e)}};function Yae(e){return function(t){return function(){return new Promise(function(n){setTimeout(function(){Promise.resolve().then(t).then(n)},e)})}}}var gi=function(e,t){return v(e,uu(t))},As=function(e,t){return v(e,dL(t))},fI=function(e,t){return v(e,Mp(function(n){return v(t,uu(n))}))},Jl=function(e,t){return v(e,Mp(t))},uu=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},dL=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Sn=function(e){return function(){return Promise.resolve(e)}},Mp=function(e){return function(t){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}},Jae=Mp(q),Pn="Task";function Zae(){return{concat:function(e,t){return function(){return Promise.race([Promise.resolve().then(e),Promise.resolve().then(t)])}},empty:hL}}var Le={URI:Pn,map:gi},Xae=Ue(Le),un={URI:Pn,of:Sn},Fs={URI:Pn,map:gi,ap:As},Qae=Ot(Fs),eue=wt(Fs),Rp={URI:Pn,map:gi,ap:As,of:Sn},Ng={URI:Pn,map:gi,ap:fI},pL={URI:Pn,map:gi,ap:fI,of:Sn},Zl={URI:Pn,map:gi,ap:As,chain:Jl},Ht={URI:Pn,map:gi,of:Sn,ap:As,chain:Jl},tue={URI:Pn,map:gi,of:Sn,ap:As,chain:Jl,fromIO:Nn},kp=q,nue={URI:Pn,map:gi,of:Sn,ap:As,chain:Jl,fromIO:Nn,fromTask:kp},rue=lt(Zl),Pg={URI:Pn,fromIO:Nn},iue=to(Pg),oue=Vo(Pg,Zl),aue=Ho(Pg,Zl),uue={URI:Pn,fromIO:Nn,fromTask:kp},hL=function(){return new Promise(function(e){})},sue=Sn(zt),cue=Ct(Le),lue=xt(Zl),fue=Et(Fs),dI=Sn(tn),Xl=function(e){return function(t){return function(){return Promise.all(t.map(function(n,r){return Promise.resolve().then(function(){return e(r,n)()})}))}}},pI=function(e){var t=Xl(e);return function(n){return mt(n)?t(n):dI}},hI=function(e){return function(t){return function(){return Uc(t).reduce(function(n,r,i){return n.then(function(o){return Promise.resolve().then(e(i+1,r)).then(function(a){return o.push(a),o})})},Promise.resolve().then(e(0,gr(t))).then(dd))}}},mI=function(e){var t=hI(e);return function(n){return mt(n)?t(n):dI}},due=pI,mL=function(e){return pI(function(t,n){return e(n)})},pue=mL(q),hue=mI,vL=function(e){return mI(function(t,n){return e(n)})},mue=vL(q),vue={URI:Pn,map:gi,of:Sn,ap:As,chain:Jl,fromIO:Nn,fromTask:kp},gue={URI:Pn,map:gi,of:Sn,ap:fI,chain:Jl,fromIO:Nn,fromTask:kp},yue=Kt(Ng),bue=Lr(pL);const _ue=Object.freeze(Object.defineProperty({__proto__:null,ApT:dI,ApplicativePar:Rp,ApplicativeSeq:pL,ApplyPar:Fs,ApplySeq:Ng,Chain:Zl,Do:sue,FromIO:Pg,FromTask:uue,Functor:Le,Monad:Ht,MonadIO:tue,MonadTask:nue,Pointed:un,URI:Pn,ap:dL,apFirst:Qae,apS:fue,apSecond:eue,bind:lue,bindTo:cue,chain:Mp,chainFirst:rue,chainFirstIOK:aue,chainIOK:oue,delay:Yae,flap:Xae,flatten:Jae,fromIO:Nn,fromIOK:iue,fromTask:kp,getMonoid:bue,getRaceMonoid:Zae,getSemigroup:yue,map:uu,never:hL,of:Sn,sequenceArray:pue,sequenceSeqArray:mue,task:vue,taskSeq:gue,traverseArray:mL,traverseArrayWithIndex:due,traverseReadonlyArrayWithIndex:pI,traverseReadonlyArrayWithIndexSeq:mI,traverseReadonlyNonEmptyArrayWithIndex:Xl,traverseReadonlyNonEmptyArrayWithIndexSeq:hI,traverseSeqArray:vL,traverseSeqArrayWithIndex:hue},Symbol.toStringTag,{value:"Module"}));var gL=lI(un),Ql=no,Ns=H(Nn,Ql),$ue=sp,yL=cp,Sue=yL,yi=function(e,t){return v(e,gI(t))},Ps=function(e,t){return v(e,yI(t))},vI=function(e,t){return v(e,Wg(function(n){return v(t,gI(n))}))},ef=function(e,t){return v(e,Wg(t))},gI=uI(Le),yI=sI(Fs),Tue=yI,Vr=aI(un),Wg=cI(Ht),bL=Wg,_L=bL(q),Iue=_L,Tn="ReaderTask",sn={URI:Tn,map:yi},Cue=Ue(sn),Ap={URI:Tn,of:Vr},Fp={URI:Tn,map:yi,ap:Ps},Oue=Ot(Fp),wue=wt(Fp),Eue={URI:Tn,map:yi,ap:Ps,of:Vr},bI={URI:Tn,map:yi,ap:vI},$L={URI:Tn,map:yi,ap:vI,of:Vr},so={URI:Tn,map:yi,ap:Ps,chain:ef},sa={URI:Tn,map:yi,of:Vr,ap:Ps,chain:ef},xue={URI:Tn,map:yi,of:Vr,ap:Ps,chain:ef,fromIO:Ns},Mue={URI:Tn,map:yi,of:Vr,ap:Ps,chain:ef,fromIO:Ns,fromTask:Ql},SL=lt(so),Rue=SL,jg={URI:Tn,fromIO:Ns},kue=to(jg),Aue=Vo(jg,so),Fue=Ho(jg,so),tf={URI:Tn,fromReader:gL},Nue=fp(tf),Pue=dp(tf),Wue=ws(tf),TL=pp(tf,so),jue=TL,IL=hp(tf,so),Lue=IL,Lg={URI:Tn,fromIO:Ns,fromTask:Ql},Due=Es(Lg),Bue=Fl(Lg,so),Uue=Nl(Lg,so),que=Vr(zt),zue=Ct(sn),CL=xt(so),Kue=CL,OL=Et(Fp),Vue=OL,_I=Vr(tn),wL=function(e){return H(Os(e),Cs(Xl(Xn)))},$I=function(e){var t=wL(e);return function(n){return mt(n)?t(n):_I}},EL=function(e){return H(Os(e),Cs(hI(Xn)))},SI=function(e){var t=EL(e);return function(n){return mt(n)?t(n):_I}},Hue=$I,xL=function(e){return $I(function(t,n){return e(n)})},Gue=xL(q),Yue=SI,ML=function(e){return SI(function(t,n){return e(n)})},Jue=ML(q),Zue={URI:Tn,map:yi,of:Vr,ap:Ps,chain:ef,fromIO:Ns,fromTask:Ql},Xue={URI:Tn,map:yi,of:Vr,ap:vI,chain:ef,fromIO:Ns,fromTask:Ql},Que=Kt(bI),ese=Lr($L);function tse(e,t){return e(t)()}const nse=Object.freeze(Object.defineProperty({__proto__:null,ApT:_I,ApplicativePar:Eue,ApplicativeSeq:$L,ApplyPar:Fp,ApplySeq:bI,Chain:so,Do:que,FromIO:jg,FromReader:tf,FromTask:Lg,Functor:sn,Monad:sa,MonadIO:xue,MonadTask:Mue,Pointed:Ap,URI:Tn,ap:yI,apFirst:Oue,apS:OL,apSW:Vue,apSecond:wue,apW:Tue,ask:Nue,asks:Pue,asksReaderTask:Sue,asksReaderTaskW:yL,bind:CL,bindTo:zue,bindW:Kue,chain:Wg,chainFirst:SL,chainFirstIOK:Fue,chainFirstReaderK:IL,chainFirstReaderKW:Lue,chainFirstTaskK:Uue,chainFirstW:Rue,chainIOK:Aue,chainReaderK:TL,chainReaderKW:jue,chainTaskK:Bue,chainW:bL,flap:Cue,flatten:Iue,flattenW:_L,fromIO:Ns,fromIOK:kue,fromReader:gL,fromReaderK:Wue,fromTask:Ql,fromTaskK:Due,getMonoid:ese,getSemigroup:Que,local:$ue,map:gI,of:Vr,readerTask:Zue,readerTaskSeq:Xue,run:tse,sequenceArray:Gue,sequenceSeqArray:Jue,traverseArray:xL,traverseArrayWithIndex:Hue,traverseReadonlyArrayWithIndex:$I,traverseReadonlyArrayWithIndexSeq:SI,traverseReadonlyNonEmptyArrayWithIndex:wL,traverseReadonlyNonEmptyArrayWithIndexSeq:EL,traverseSeqArray:ML,traverseSeqArrayWithIndex:Yue},Symbol.toStringTag,{value:"Module"}));var rse=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(f){a(f)}}function s(l){try{c(r.throw(l))}catch(f){a(f)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(e,t||[])).next())})},ise=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},TI=Tl(un),II=Ss(un),Dg=Il(Le),CI=Cl(Le),OI=H(Nn,Dg),RL=H(Nn,CI),su=OI,nf=Dg,wI=Sn,EI=Nn,kL=function(e){return uu(bN(e))},AL=ip(Le),ose=AL,xI=Rl(Ht),ase=xI,FL=xI,use=FL,NL=kl(Ht),sse=NL,PL=function(e,t){return function(){return rse(void 0,void 0,void 0,function(){var n;return ise(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(za)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,Ro(t(n))];case 3:return[2]}})})}},cse=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return PL(function(){return e.apply(void 0,n)},t)}},lse=up(Le),fse=Jv(un),dse=Zv(un),pse=PS(Ht),WL=Is(Ht),hse=WL,Bg=op(Ht),mse=Bg,vse=function(e){return Bg(tD(e))},gse=function(e){return Bg(nD(e))},yse=ap(Ht),bse=Al(Le),jL=function(e){var t=kL(e);return function(n){return H(n,t)}},LL=function(e){return function(t){return function(n){return v(n,Np(jL(e)(t)))}}},_se=LL,DL=function(e){return H(e,EI)},BL=function(e){return Pp(DL(e))},$se=BL,cn=function(e,t){return v(e,kI(t))},cu=function(e,t){return v(e,AI(t))},MI=function(e,t){return v(e,Np(function(n){return v(t,kI(n))}))},lu=function(e,t){return v(e,Np(t))},Ug=function(e,t,n){return v(e,UL(t,n))},qg=function(e,t){return v(e,qL(t))},RI=function(e,t){return v(e,FI(t))},kI=Ol(Le),UL=xl(Le),qL=Ml(Le),AI=wl(Fs),Sse=AI,Np=Ts(Ht),Pp=Np,zL=Pp(q),Tse=zL,FI=El(Ht),Ise=FI,nr=II,Wp=TI,vt="TaskEither";function NI(e,t){var n=ko(e,Qa(t));return{URI:vt,_E:void 0,map:cn,ap:function(r,i){return v(r,n(i))},of:nr}}function KL(e){var t=rp(Ht,e);return{URI:vt,_E:void 0,map:cn,alt:function(n,r){return v(n,t(r))}}}var VL=function(e){var t=bs(e);return{URI:vt,_E:void 0,compact:Qi(Le,t),separate:qo(Le,t,eu)}};function Cse(e){var t=_l(e),n=VL(e),r=zo(Le,t),i=Ko(Le,t),o=nu(Le,t),a=ru(Le,t);return{URI:vt,_E:void 0,map:cn,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}var PI={URI:vt,map:cn},Ose=Ue(PI),wse={URI:vt,of:nr},zg={URI:vt,map:cn,ap:cu},HL=Ot(zg),Ese=HL,GL=wt(zg),xse=GL,Mse={URI:vt,map:cn,ap:cu,of:nr},YL={URI:vt,map:cn,ap:MI},JL={URI:vt,map:cn,ap:MI,of:nr},bi={URI:vt,map:cn,ap:cu,chain:lu},Rse={URI:vt,map:cn,ap:cu,chain:lu,of:nr},kse={URI:vt,map:cn,ap:cu,chain:lu,of:nr,fromIO:su},Ase={URI:vt,map:cn,ap:cu,chain:lu,of:nr,fromIO:su,fromTask:nf},Fse={URI:vt,map:cn,ap:cu,chain:lu,of:nr,throwError:Wp},ZL=lt(bi),Nse=ZL,Pse={URI:vt,bimap:Ug,mapLeft:qg},Wse={URI:vt,map:cn,alt:RI},ca={URI:vt,fromEither:wI},jse=Yi(ca),Lse=Ji(ca),Dse=ss(ca,bi),XL=Po(ca,bi),Bse=XL,QL=Wo(ca,bi),Use=QL,qse=Ha(ca),eD=cs(ca,bi),zse=eD,Kse=Sr(ca),Kg={URI:vt,fromIO:su},tD=to(Kg),Vse=Vo(Kg,bi),Hse=Ho(Kg,bi),Vg={URI:vt,fromIO:su,fromTask:nf},nD=Es(Vg),Gse=Fl(Vg,bi),Yse=Nl(Vg,bi);function Jse(e){return function(){var t=Array.prototype.slice.call(arguments);return function(){return new Promise(function(n){var r=function(i,o){return i!=null?n(Ro(i)):n(za(o))};e.apply(null,t.concat(r))})}}}var Zse=function(e,t,n){return WI(e,t,n)},WI=function(e,t,n){return v(e,Pp(function(r){return v(t(r),Mp(function(i){return v(n(r,i),Pp(function(){return Sn(i)}))}))}))},Xse=nr(zt),Qse=Ct(PI),rD=xt(bi),ece=rD,iD=Et(zg),tce=iD,jI=nr(tn),LI=function(e){return H(Xl(e),uu(np(Xn)))},DI=function(e){var t=LI(e);return function(n){return mt(n)?t(n):jI}},BI=function(e){return function(t){return function(){return Uc(t).reduce(function(n,r,i){return n.then(function(o){return qt(o)?n:e(i+1,r)().then(function(a){return qt(a)?a:(o.right.push(a.right),o)})})},e(0,gr(t))().then(_s(dd)))}}},UI=function(e){var t=BI(e);return function(n){return mt(n)?t(n):jI}},nce=DI,oD=function(e){return DI(function(t,n){return e(n)})},rce=oD(q),ice=UI,aD=function(e){return UI(function(t,n){return e(n)})},oce=aD(q),ace={URI:vt,bimap:Ug,mapLeft:qg,map:cn,of:nr,ap:cu,chain:lu,alt:RI,fromIO:su,fromTask:nf,throwError:Wp},uce={URI:vt,bimap:Ug,mapLeft:qg,map:cn,of:nr,ap:MI,chain:lu,alt:RI,fromIO:su,fromTask:nf,throwError:Wp},sce=Kt(YL),cce=Lr(JL),lce=function(e){return Kt(Ng)(Xd(e))};function fce(e){var t=NI(Rp,e),n=KL(e);return{URI:vt,_E:void 0,map:cn,ap:t.ap,of:nr,chain:lu,bimap:Ug,mapLeft:qg,alt:n.alt,fromIO:su,fromTask:nf,throwError:Wp}}const dce=Object.freeze(Object.defineProperty({__proto__:null,Alt:Wse,ApT:jI,ApplicativePar:Mse,ApplicativeSeq:JL,ApplyPar:zg,ApplySeq:YL,Bifunctor:Pse,Chain:bi,Do:Xse,FromEither:ca,FromIO:Kg,FromTask:Vg,Functor:PI,Monad:Rse,MonadIO:kse,MonadTask:Ase,MonadThrow:Fse,Pointed:wse,URI:vt,alt:FI,altW:Ise,ap:AI,apFirst:HL,apFirstW:Ese,apS:iD,apSW:tce,apSecond:GL,apSecondW:xse,apW:Sse,bimap:UL,bind:rD,bindTo:Qse,bindW:ece,bracket:Zse,bracketW:WI,chain:Np,chainEitherK:XL,chainEitherKW:Bse,chainFirst:ZL,chainFirstEitherK:QL,chainFirstEitherKW:Use,chainFirstIOK:Hse,chainFirstTaskK:Yse,chainFirstW:Nse,chainIOEitherK:$se,chainIOEitherKW:BL,chainIOK:Vse,chainNullableK:pse,chainOptionK:Dse,chainTaskK:Gse,chainTaskOptionK:_se,chainTaskOptionKW:LL,chainW:Pp,filterOrElse:eD,filterOrElseW:zse,flap:Ose,flatten:Tse,flattenW:zL,fold:ase,foldW:use,fromEither:wI,fromEitherK:Kse,fromIO:su,fromIOEither:EI,fromIOEitherK:DL,fromIOK:tD,fromNullable:fse,fromNullableK:dse,fromOption:jse,fromOptionK:Lse,fromPredicate:qse,fromTask:nf,fromTaskK:nD,fromTaskOption:kL,fromTaskOptionK:jL,getAltTaskValidation:KL,getApplicativeTaskValidation:NI,getApplyMonoid:cce,getApplySemigroup:sce,getCompactable:VL,getFilterable:Cse,getOrElse:NL,getOrElseW:sse,getSemigroup:lce,getTaskValidation:fce,left:TI,leftIO:RL,leftTask:CI,map:kI,mapLeft:qL,match:AL,matchE:xI,matchEW:FL,matchW:ose,of:nr,orElse:WL,orElseFirst:Bg,orElseFirstIOK:vse,orElseFirstTaskK:gse,orElseFirstW:mse,orElseW:hse,orLeft:yse,right:II,rightIO:OI,rightTask:Dg,sequenceArray:rce,sequenceSeqArray:oce,swap:bse,taskEither:ace,taskEitherSeq:uce,taskify:Jse,throwError:Wp,toUnion:lse,traverseArray:oD,traverseArrayWithIndex:nce,traverseReadonlyArrayWithIndex:DI,traverseReadonlyArrayWithIndexSeq:UI,traverseReadonlyNonEmptyArrayWithIndex:LI,traverseReadonlyNonEmptyArrayWithIndexSeq:BI,traverseSeqArray:aD,traverseSeqArrayWithIndex:ice,tryCatch:PL,tryCatchK:cse},Symbol.toStringTag,{value:"Module"}));var fu=no,Hg=Tl(Ap),qI=Ss(Ap),zI=H(Dg,fu),uD=H(CI,fu),KI=function(e){return H(e,II)},sD=function(e){return H(e,TI)},cD=Il(sn),pce=Cl(sn),VI=H(OI,fu),lD=H(RL,fu),fD=Vr,dD=KI,du=VI,rf=zI,HI=H(EI,fu),GI=function(e){return H(e,wI)},pD=ip(sn),hce=pD,YI=Rl(so),mce=YI,hD=YI,vce=hD,mD=kl(sa),gce=mD,yce=up(sn),bce=Jv(Ap),_ce=Zv(Ap),$ce=PS(sa),Sce=sp,vD=cp,Tce=vD,gD=Is(sa),Ice=gD,yD=op(sa),Cce=yD,Oce=ap(sa),wce=Al(sn),bD=function(e){return H(e,HI)},_D=function(e){return of(bD(e))},Ece=_D,JI=function(e){return H(e,fu)},$D=function(e){return of(JI(e))},xce=$D,SD=function(e){return Qg(JI(e))},Mce=SD,ZI=function(e){return H(e,GI)},TD=function(e){return of(ZI(e))},Rce=TD,ID=function(e){return Qg(ZI(e))},kce=ID,ln=function(e,t){return v(e,jp(t))},pu=function(e,t){return v(e,n1(t))},XI=function(e,t){return v(e,Jg(function(n){return v(t,jp(n))}))},hu=function(e,t){return v(e,Jg(t))},QI=function(e,t){return v(e,Zg(t))},Gg=function(e,t,n){return v(e,e1(t,n))},Yg=function(e,t){return v(e,t1(t))},jp=Ol(sn),e1=xl(sn),t1=Ml(sn),n1=wl(Fp),Ace=n1,rr=qI,Jg=Ts(sa),of=Jg,CD=of(q),Fce=CD,Zg=El(sa),OD=Zg,Lp=Hg,pt="ReaderTaskEither",wD=function(e){var t=bs(e);return{URI:pt,_E:void 0,compact:Qi(sn,t),separate:qo(sn,t,eu)}};function Nce(e){var t=_l(e),n=wD(e),r=zo(sn,t),i=Ko(sn,t),o=nu(sn,t),a=ru(sn,t);return{URI:pt,_E:void 0,map:ln,compact:n.compact,separate:n.separate,filter:function(u,s){return v(u,r(s))},filterMap:function(u,s){return v(u,i(s))},partition:function(u,s){return v(u,o(s))},partitionMap:function(u,s){return v(u,a(s))}}}function ED(e,t){var n=ko(Yo,NI(e,t));return{URI:pt,_E:void 0,map:ln,ap:function(r,i){return v(r,n(i))},of:rr}}function xD(e){var t=rp(sa,e);return{URI:pt,_E:void 0,map:ln,alt:function(n,r){return v(n,t(r))}}}var Ws={URI:pt,map:ln},Pce=Ue(Ws),r1={URI:pt,of:rr},Xg={URI:pt,map:ln,ap:pu},MD=Ot(Xg),Wce=MD,RD=wt(Xg),jce=RD,Lce={URI:pt,map:ln,ap:pu,of:rr},kD={URI:pt,map:ln,ap:XI},AD={URI:pt,map:ln,ap:XI,of:rr},Wn={URI:pt,map:ln,ap:pu,chain:hu},Dce={URI:pt,map:ln,ap:pu,chain:hu,of:rr},Bce={URI:pt,map:ln,ap:pu,chain:hu,of:rr,fromIO:du},Uce={URI:pt,map:ln,ap:pu,chain:hu,of:rr,fromIO:du,fromTask:rf},qce={URI:pt,map:ln,ap:pu,chain:hu,of:rr,throwError:Lp},FD=lt(Wn),Qg=FD,zce={URI:pt,bimap:Gg,mapLeft:Yg},Kce={URI:pt,map:ln,alt:QI},af={URI:pt,fromReader:dD},Vce=fp(af),Hce=dp(af),Gce=ws(af),ND=pp(af,Wn),Yce=ND,PD=hp(af,Wn),Jce=PD,i1=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return cD(e.apply(void 0,t))}},WD=function(e){return of(i1(e))},Zce=WD,jD=function(e){return Qg(i1(e))},Xce=jD,la={URI:pt,fromEither:fD},Qce=Yi(la),ele=Ji(la),tle=ss(la,Wn),LD=Po(la,Wn),nle=LD,DD=Wo(la,Wn),rle=DD,ile=Ha(la),BD=cs(la,Wn),ole=BD,ale=Sr(la),ey={URI:pt,fromIO:du},ule=to(ey),sle=Vo(ey,Wn),cle=Ho(ey,Wn),ty={URI:pt,fromIO:du,fromTask:rf},lle=Es(ty),fle=Fl(ty,Wn),dle=Nl(ty,Wn);function ple(e,t,n){return UD(e,t,n)}function UD(e,t,n){return function(r){return WI(e(r),function(i){return t(i)(r)},function(i,o){return n(i,o)(r)})}}var hle=rr(zt),mle=Ct(Ws),qD=xt(Wn),vle=qD,zD=Et(Xg),gle=zD,o1=rr(tn),KD=function(e){return H(Os(e),Cs(LI(Xn)))},a1=function(e){var t=KD(e);return function(n){return mt(n)?t(n):o1}},VD=function(e){return H(Os(e),Cs(BI(Xn)))},u1=function(e){var t=VD(e);return function(n){return mt(n)?t(n):o1}},yle=a1,HD=function(e){return a1(function(t,n){return e(n)})},ble=HD(q),_le=u1,GD=function(e){return u1(function(t,n){return e(n)})},$le=GD(q),Sle={URI:pt,map:ln,of:rr,ap:pu,chain:hu,alt:QI,bimap:Gg,mapLeft:Yg,fromIO:du,fromTask:rf,throwError:Lp},Tle={URI:pt,map:ln,of:rr,ap:XI,chain:hu,alt:QI,bimap:Gg,mapLeft:Yg,fromIO:du,fromTask:rf,throwError:Lp},Ile=Kt(kD),Cle=Lr(AD),Ole=function(e){return Kt(bI)(Xd(e))};function wle(e){var t=ED(Rp,e),n=xD(e);return{URI:pt,_E:void 0,map:ln,of:rr,chain:hu,bimap:Gg,mapLeft:Yg,ap:t.ap,alt:n.alt,fromIO:du,fromTask:rf,throwError:Lp}}function Ele(e,t){return e(t)()}const xle=Object.freeze(Object.defineProperty({__proto__:null,Alt:Kce,ApT:o1,ApplicativePar:Lce,ApplicativeSeq:AD,ApplyPar:Xg,ApplySeq:kD,Bifunctor:zce,Chain:Wn,Do:hle,FromEither:la,FromIO:ey,FromReader:af,FromTask:ty,Functor:Ws,Monad:Dce,MonadIO:Bce,MonadTask:Uce,MonadThrow:qce,Pointed:r1,URI:pt,alt:Zg,altW:OD,ap:n1,apFirst:MD,apFirstW:Wce,apS:zD,apSW:gle,apSecond:RD,apSecondW:jce,apW:Ace,ask:Vce,asks:Hce,asksReaderTaskEither:Tce,asksReaderTaskEitherW:vD,bimap:e1,bind:qD,bindTo:mle,bindW:vle,bracket:ple,bracketW:UD,chain:Jg,chainEitherK:LD,chainEitherKW:nle,chainFirst:FD,chainFirstEitherK:DD,chainFirstEitherKW:rle,chainFirstIOK:cle,chainFirstReaderEitherK:kce,chainFirstReaderEitherKW:ID,chainFirstReaderK:PD,chainFirstReaderKW:Jce,chainFirstReaderTaskK:Xce,chainFirstReaderTaskKW:jD,chainFirstTaskEitherK:Mce,chainFirstTaskEitherKW:SD,chainFirstTaskK:dle,chainFirstW:Qg,chainIOEitherK:Ece,chainIOEitherKW:_D,chainIOK:sle,chainNullableK:$ce,chainOptionK:tle,chainReaderEitherK:Rce,chainReaderEitherKW:TD,chainReaderK:ND,chainReaderKW:Yce,chainReaderTaskK:Zce,chainReaderTaskKW:WD,chainTaskEitherK:xce,chainTaskEitherKW:$D,chainTaskK:fle,chainW:of,filterOrElse:BD,filterOrElseW:ole,flap:Pce,flatten:Fce,flattenW:CD,fold:mce,foldW:vce,fromEither:fD,fromEitherK:ale,fromIO:du,fromIOEither:HI,fromIOEitherK:bD,fromIOK:ule,fromNullable:bce,fromNullableK:_ce,fromOption:Qce,fromOptionK:ele,fromPredicate:ile,fromReader:dD,fromReaderEither:GI,fromReaderEitherK:ZI,fromReaderK:Gce,fromReaderTaskK:i1,fromTask:rf,fromTaskEither:fu,fromTaskEitherK:JI,fromTaskK:lle,getAltReaderTaskValidation:xD,getApplicativeReaderTaskValidation:ED,getApplyMonoid:Cle,getApplySemigroup:Ile,getCompactable:wD,getFilterable:Nce,getOrElse:mD,getOrElseW:gce,getReaderTaskValidation:wle,getSemigroup:Ole,left:Hg,leftIO:lD,leftReader:sD,leftReaderTask:pce,leftTask:uD,local:Sce,map:jp,mapLeft:t1,match:pD,matchE:YI,matchEW:hD,matchW:hce,of:rr,orElse:gD,orElseFirst:yD,orElseFirstW:Cce,orElseW:Ice,orLeft:Oce,readerTaskEither:Sle,readerTaskEitherSeq:Tle,right:qI,rightIO:VI,rightReader:KI,rightReaderTask:cD,rightTask:zI,run:Ele,sequenceArray:ble,sequenceSeqArray:$le,swap:wce,throwError:Lp,toUnion:yce,traverseArray:HD,traverseArrayWithIndex:yle,traverseReadonlyArrayWithIndex:a1,traverseReadonlyArrayWithIndexSeq:u1,traverseReadonlyNonEmptyArrayWithIndex:KD,traverseReadonlyNonEmptyArrayWithIndexSeq:VD,traverseSeqArray:GD,traverseSeqArrayWithIndex:_le},Symbol.toStringTag,{value:"Module"}));var Mle=function(e){return new Set(e)},Rle=function(e){return new Set([e])},YD=function(e){return function(t){for(var n=t.length,r=new Set,i=fn(e),o=0;o<n;o++){var a=t[o];i(a,r)||r.add(a)}return r}};function kle(e){return new Set(e)}function Ale(e){var t=fn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);t(a,i)||i.add(a)}),i}}}function Fle(e){var t=fn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){n(o).forEach(function(a){t(a,i)||i.add(a)})}),i}}}function s1(e){return function(t){for(var n=t.values(),r,i=new Set;!(r=n.next()).done;){var o=r.value;e(o)&&i.add(o)}return i}}function Nle(e){return function(t){for(var n=t.values(),r,i=new Set,o=new Set;!(r=n.next()).done;){var a=r.value;e(a)?i.add(a):o.add(a)}return Ee(o,i)}}function c1(e){var t=fn(e);return function(n,r){if(r===void 0){var i=c1(e);return function(a){return i(n,a)}}if(Dp(n))return r;if(Dp(r))return n;var o=new Set(n);return r.forEach(function(a){t(a,o)||o.add(a)}),o}}function l1(e){var t=fn(e);return function(n,r){if(r===void 0){var i=l1(e);return function(a){return i(a,n)}}if(Dp(n)||Dp(r))return d1;var o=new Set;return n.forEach(function(a){t(a,r)&&o.add(a)}),o}}function Ple(e,t){return function(n){return function(r){for(var i=r.values(),o,a=new Set,u=new Set,s=fn(e),c=fn(t);!(o=i.next()).done;){var l=n(o.value);switch(l._tag){case"Left":s(l.left,a)||a.add(l.left);break;case"Right":c(l.right,u)||u.add(l.right);break}}return Ee(a,u)}}}function f1(e){var t=fn(e);return function(n,r){if(r===void 0){var i=f1(e);return function(o){return i(o,n)}}return s1(function(o){return!t(o,r)})(n)}}function JD(e){var t=ny(e);return function(n,r){return function(i){return t(i).reduce(r,n)}}}function ZD(e,t){var n=ny(e);return function(r){return function(i){return n(i).reduce(function(o,a){return t.concat(o,r(a))},t.empty)}}}var XD=function(e){var t=ny(e);return function(n,r){return function(i){return t(i).reduceRight(function(o,a){return r(a,o)},n)}}};function QD(e){var t=fn(e);return function(n){return function(r){if(t(n)(r))return r;var i=new Set(r);return i.add(n),i}}}var eB=function(e){return function(t){return function(n){return s1(function(r){return!e.equals(t,r)})(n)}}},Wle=function(e){var t=fn(e),n=eB(e),r=QD(e);return function(i){return function(o){return(t(i,o)?n:r)(i)(o)}}},jle=function(e){return tB(e)(q)};function Lle(e,t){return function(n){var r=fn(e),i=fn(t),o=new Set,a=new Set;return n.forEach(function(u){switch(u._tag){case"Left":r(u.left,o)||o.add(u.left);break;case"Right":i(u.right,a)||a.add(u.right);break}}),Ee(o,a)}}function tB(e){var t=fn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);a._tag==="Some"&&!t(a.value,i)&&i.add(a.value)}),i}}}var d1=new Set,Dp=function(e){return e.size===0},Dle=function(e){return e.size},p1=function(e){return function(t){for(var n=t.values(),r,i=!1;!i&&!(r=n.next()).done;)i=e(r.value);return i}};function h1(e){return zd(p1(zd(e)))}function Bp(e){var t=fn(e);return function(n,r){if(r===void 0){var i=Bp(e);return function(o){return i(o,n)}}return h1(function(o){return t(o,r)})(n)}}function fn(e){return function(t,n){if(n===void 0){var r=fn(e);return function(u){return r(t,u)}}for(var i=n.values(),o,a=!1;!a&&!(o=i.next()).done;)a=e.equals(t,o.value);return a}}var ny=function(e){return function(t){var n=[];return t.forEach(function(r){return n.push(r)}),n.sort(e.compare)}},Ble="ReadonlySet";function nB(e){return{show:function(t){var n=[];return t.forEach(function(r){n.push(e.show(r))}),"new Set([".concat(n.sort().join(", "),"])")}}}function rB(e){var t=Bp(e);return jr(function(n,r){return t(n,r)&&t(r,n)})}var iB=function(e){return{concat:c1(e)}},Ule=function(e){return{concat:iB(e).concat,empty:d1}},qle=function(e){return{concat:l1(e)}},zle=function(e){return{concat:f1(e)}},Kle=YD;const Vle=Object.freeze(Object.defineProperty({__proto__:null,URI:Ble,chain:Fle,compact:jle,difference:f1,elem:fn,empty:d1,every:h1,filter:s1,filterMap:tB,foldMap:ZD,fromArray:Kle,fromReadonlyArray:YD,fromSet:Mle,getDifferenceMagma:zle,getEq:rB,getIntersectionSemigroup:qle,getShow:nB,getUnionMonoid:Ule,getUnionSemigroup:iB,insert:QD,intersection:l1,isEmpty:Dp,isSubset:Bp,map:Ale,partition:Nle,partitionMap:Ple,reduce:JD,reduceRight:XD,remove:eB,separate:Lle,singleton:Rle,size:Dle,some:p1,toReadonlyArray:ny,toSet:kle,toggle:Wle,union:c1},Symbol.toStringTag,{value:"Module"}));function Gt(e){return e[0]}function In(e){return e[1]}var Hle=function(e){return[In(e),Gt(e)]};function m1(e){return{URI:Cr,_E:void 0,map:Up,ap:function(t,n){return[Gt(t)(Gt(n)),e.concat(In(t),In(n))]}}}var oB=function(e){return function(t){return[t,e.empty]}};function Gle(e){var t=m1(e);return{URI:Cr,_E:void 0,map:t.map,ap:t.ap,of:oB(e)}}function v1(e){var t=m1(e);return{URI:Cr,_E:void 0,map:t.map,ap:t.ap,chain:function(n,r){var i=r(Gt(n)),o=i[0],a=i[1];return[o,e.concat(In(n),a)]}}}function Yle(e){var t=v1(e);return{URI:Cr,_E:void 0,map:t.map,ap:t.ap,chain:t.chain,of:oB(e)}}function Jle(e){var t=function(r,i){for(var o=i(r),a=e.empty,u=Gt(o);u._tag==="Left";)a=e.concat(a,In(o)),o=i(u.left),u=Gt(o);return[u.right,e.concat(a,In(o))]},n=v1(e);return{URI:Cr,_E:void 0,map:n.map,ap:n.ap,chain:n.chain,chainRec:t}}var aB=function(e,t){return v(e,dB(t))},Up=function(e,t){return v(e,_1(t))},uB=function(e,t,n){return v(e,fB(t,n))},sB=function(e,t){return v(e,$1(t))},cB=function(e,t){return v(e,S1(t))},g1=function(e,t,n){return v(e,T1(t,n))},y1=function(e){var t=I1();return function(n,r){return v(n,t(r))}},b1=function(e,t,n){return v(e,C1(t,n))},lB=function(e){var t=pB(e);return function(n,r){return v(n,t(r))}},fB=function(e,t){return function(n){return[t(Gt(n)),e(In(n))]}},_1=function(e){return function(t){return[e(Gt(t)),In(t)]}},$1=function(e){return function(t){return[Gt(t),e(In(t))]}},dB=function(e){return function(t){return[Gt(t),In(e)]}},S1=function(e){return function(t){return[e(t),In(t)]}},ry=Gt,Zle=S1(q),T1=function(e,t){return function(n){return t(e,Gt(n))}},I1=function(){return function(e){return function(t){return e(Gt(t))}}},C1=function(e,t){return function(n){return t(Gt(n),e)}},pB=function(e){return function(t){return function(n){return e.map(t(Gt(n)),function(r){return[r,In(n)]})}}},O1=function(e){return function(t){return e.map(Gt(t),function(n){return[n,In(t)]})}},Cr="ReadonlyTuple",hB={URI:Cr,map:Up},Xle=Ue(hB),Qle={URI:Cr,bimap:uB,mapLeft:sB},efe={URI:Cr,compose:aB},tfe={URI:Cr,map:Up,extend:cB,extract:ry},nfe={URI:Cr,reduce:g1,foldMap:y1,reduceRight:b1},rfe={URI:Cr,map:Up,reduce:g1,foldMap:y1,reduceRight:b1,traverse:lB,sequence:O1},ife=_1,ofe=$1,afe={URI:Cr,compose:aB,map:Up,bimap:uB,mapLeft:sB,extract:ry,extend:cB,reduce:g1,foldMap:y1,reduceRight:b1,traverse:lB,sequence:O1};const ufe=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:Qle,Comonad:tfe,Foldable:nfe,Functor:hB,Semigroupoid:efe,Traversable:rfe,URI:Cr,bimap:fB,compose:dB,duplicate:Zle,extend:S1,extract:ry,flap:Xle,foldMap:I1,fst:Gt,getApplicative:Gle,getApply:m1,getChain:v1,getChainRec:Jle,getMonad:Yle,map:ife,mapFst:_1,mapLeft:ofe,mapSnd:$1,readonlyTuple:afe,reduce:T1,reduceRight:C1,sequence:O1,snd:In,swap:Hle,traverse:pB},Symbol.toStringTag,{value:"Module"}));var uf=globalThis&&globalThis.__assign||function(){return uf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},uf.apply(this,arguments)},sfe=kR,js=fi,w1=function(e){return function(t){return Object.keys(t).sort(e.compare)}},cfe=w1(V);function E1(e){if(typeof e=="function")return E1(V)(e);var t=w1(e);return function(n){return function(r){for(var i=[],o=0,a=t(r);o<a.length;o++){var u=a[o];i.push(n(u,r[u]))}return i}}}var x1=E1(V)(function(e,t){return[e,t]});function lfe(e){return function(t){var n=x1(t),r=n.length;return e.unfold(0,function(i){return i<r?fe([n[i],i+1]):ye})}}var mB=$0,vB=Ao;function gB(e){return function(t){if(!ct.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}var ffe=function(e,t){return yB(e,function(){return t})},yB=function(e,t){return function(n){if(!vB(e,n))return ye;var r=Object.assign({},n);return r[e]=t(n[e]),fe(r)}};function dfe(e){var t=gB(e);return function(n){var r=bB(e,n);return Ft(r)?ye:fe([r.value,t(n)])}}var pfe=Km,bB=Xu,hfe=Vm,mfe=S0;function vfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Vc(e[0]):Vc(V).apply(void 0,e)}function gfe(e){return"compare"in e?Hc(e):Hc(V)(e)}function yfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Gc(e[0]):Gc(V).apply(void 0,e)}var bfe=AR;function _fe(e){return FR(e)}function M1(e){return Hm(e)}function qp(e){return Yc(e)}var $fe=function(e){var t=M1(e);return function(n){return function(r){return e.map(v(r,t(n)),mu)}}},Sfe=function(e){var t=M1(e);return function(n){return function(r){return e.map(v(r,t(n)),vu)}}},Tfe=Gm;function Ife(e){return Ym(e)}var Cfe=Jm;function Ofe(e){return Zm(e)}function _B(e,t){return NR(e,t)}var wfe=x1,Efe=function(e){return _B(Em(),aF)(e)};function xfe(e,t){return T0(e,t)}var Mfe=PR,Rfe=WR,kfe=I0,$B=function(e){var t=C0(e);return function(n){return function(r){return js(r)?uf({},n):js(n)?uf({},r):t(n)(r)}}},SB=function(e){return function(t){return function(n){return js(n)||js(t)?{}:O0(e)(t)(n)}}},TB=function(e){return function(t){return js(t)?uf({},e):js(e)?uf({},t):w0(e)(t)}},_i=yr,zp=Qu,$i=br,Si=_r,Ti=$r,Kp=es,Vp=ts,Hp=ns,Gp=rs,Yp=is,Jp=as,Zp=us,IB=Xm,CB=Qm,OB=ev,wB=tv,sf=Gi,EB=Sd,R1=function(e){return function(t){var n=w1(e);return function(r,i){var o=n(r);if(o.length===0)return t.of({});for(var a=t.of({}),u=function(f){a=t.ap(t.map(a,function(d){return function(p){return d[f]=p,d}}),i(f,r[f]))},s=0,c=o;s<c.length;s++){var l=c[s];u(l)}return a}}},Afe=E0,Ffe=x0,Nfe=M0,Pfe=R0;function Wfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Id(e[0]):Id(V).apply(void 0,e)}function jfe(e){return"compare"in e?Cd(e):Cd(V)(e)}function Lfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Od(e[0]):Od(V).apply(void 0,e)}var mu=Fo,vu=No,dn="Record";function Dfe(e){return"compare"in e?nv(e):nv(V)(e)}var Bfe=jR,Ufe=LR,xB={URI:dn,map:_i},qfe=Ue(xB),zfe={URI:dn,map:_i,mapWithIndex:zp},Kfe=function(e){return{URI:dn,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e)}},Vfe=function(e){return{URI:dn,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),reduceWithIndex:Yp(e),foldMapWithIndex:Jp(e),reduceRightWithIndex:Zp(e)}},Xp={URI:dn,compact:mu,separate:vu},Hfe={URI:dn,map:_i,compact:mu,separate:vu,filter:Kp,filterMap:Vp,partition:Hp,partitionMap:Gp},Gfe={URI:dn,map:_i,mapWithIndex:zp,compact:mu,separate:vu,filter:Kp,filterMap:Vp,partition:Hp,partitionMap:Gp,filterMapWithIndex:OB,filterWithIndex:wB,partitionMapWithIndex:IB,partitionWithIndex:CB},MB=function(e){return{URI:dn,map:_i,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),traverse:sf(e),sequence:EB(e)}},Yfe=function(e){return{URI:dn,map:_i,mapWithIndex:zp,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),reduceWithIndex:Yp(e),foldMapWithIndex:Jp(e),reduceRightWithIndex:Zp(e),traverse:sf(e),sequence:EB(e),traverseWithIndex:R1(e)}},Jfe=function(e){var t=MB(e);return{URI:dn,map:_i,reduce:$i(e),foldMap:Si(e),reduceRight:Ti(e),traverse:t.traverse,sequence:t.sequence,compact:mu,separate:vu,filter:Kp,filterMap:Vp,partition:Hp,partitionMap:Gp,wither:li(t,Xp),wilt:ci(t,Xp)}},RB=function(e){var t=$B(e);return{concat:function(n,r){return t(r)(n)}}},Zfe=function(e){return{concat:RB(e).concat,empty:{}}},Xfe=function(e){var t=SB(e);return{concat:function(n,r){return t(r)(n)}}},Qfe=function(){return{concat:function(e,t){return TB(t)(e)}}},ede={URI:dn,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V)},tde={URI:dn,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),reduceWithIndex:Yp(V),foldMapWithIndex:Jp(V),reduceRightWithIndex:Zp(V)},k1={URI:dn,map:_i,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),traverse:sf(V),sequence:qp},nde={URI:dn,map:_i,mapWithIndex:zp,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),reduceWithIndex:Yp(V),foldMapWithIndex:Jp(V),reduceRightWithIndex:Zp(V),traverse:sf(V),sequence:qp,traverseWithIndex:R1(V)},kB=li(k1,Xp),AB=ci(k1,Xp),rde={URI:dn,map:_i,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),traverse:sf(V),sequence:qp,compact:mu,separate:vu,filter:Kp,filterMap:Vp,partition:Hp,partitionMap:Gp,wither:kB,wilt:AB},ide={},ode=mB,ade=KR,ude={URI:dn,map:_i,reduce:$i(V),foldMap:Si(V),reduceRight:Ti(V),traverse:sf(V),sequence:qp,compact:mu,separate:vu,filter:Kp,filterMap:Vp,partition:Hp,partitionMap:Gp,mapWithIndex:zp,reduceWithIndex:Yp(V),foldMapWithIndex:Jp(V),reduceRightWithIndex:Zp(V),filterMapWithIndex:OB,filterWithIndex:wB,partitionMapWithIndex:IB,partitionWithIndex:CB,traverseWithIndex:R1(V),wither:kB,wilt:AB};const sde=Object.freeze(Object.defineProperty({__proto__:null,Compactable:Xp,Filterable:Hfe,FilterableWithIndex:Gfe,Foldable:ede,FoldableWithIndex:tde,Functor:xB,FunctorWithIndex:zfe,Traversable:k1,TraversableWithIndex:nde,URI:dn,Witherable:rde,collect:E1,compact:mu,deleteAt:gB,difference:TB,elem:kfe,empty:ide,every:Mfe,filter:Afe,filterMap:Ffe,filterMapWithIndex:Cfe,filterWithIndex:Ofe,flap:qfe,foldMap:jfe,foldMapWithIndex:gfe,fromEntries:Efe,fromFoldable:_B,fromFoldableMap:xfe,getDifferenceMagma:Qfe,getEq:Bfe,getFoldable:Kfe,getFoldableWithIndex:Vfe,getIntersectionSemigroup:Xfe,getMonoid:Ufe,getShow:Dfe,getTraversable:MB,getTraversableWithIndex:Yfe,getUnionMonoid:Zfe,getUnionSemigroup:RB,getWitherable:Jfe,has:vB,hasOwnProperty:ade,insertAt:ode,intersection:SB,isEmpty:js,isSubrecord:pfe,keys:cfe,lookup:bB,map:mfe,mapWithIndex:hfe,modifyAt:yB,partition:Nfe,partitionMap:Pfe,partitionMapWithIndex:Tfe,partitionWithIndex:Ife,pop:dfe,record:ude,reduce:Wfe,reduceRight:Lfe,reduceRightWithIndex:yfe,reduceWithIndex:vfe,separate:vu,sequence:qp,singleton:bfe,size:sfe,some:Rfe,toArray:x1,toEntries:wfe,toUnfoldable:lfe,traverse:M1,traverseWithIndex:_fe,union:$B,updateAt:ffe,upsertAt:mB,wilt:Sfe,wither:$fe},Symbol.toStringTag,{value:"Module"}));var cde=function(e){return function(t){return gt(e(t))}},lde=function(e){return function(t){return N_(e(t))}},fde=function(){return function(e){return!0}},dde=function(e){return function(t){return!e(t)}},pde=function(e){return function(t){return function(n){return t(n)||e(n)}}},hde=function(e){return function(t){return function(n){return t(n)&&e(n)}}},mde=function(){return function(e){return!1}},vde=function(e){return function(t){return function(n){return t(n)&&e(n)}}};const gde=Object.freeze(Object.defineProperty({__proto__:null,and:hde,compose:vde,fromEitherK:lde,fromOptionK:cde,id:fde,not:dde,or:pde,zero:mde},Symbol.toStringTag,{value:"Module"}));var FB=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{add:function(n,r){return e.map(function(i,o){return i.add(n[o],r[o])})},zero:e.map(function(n){return n.zero}),mul:function(n,r){return e.map(function(i,o){return i.mul(n[o],r[o])})},one:e.map(function(n){return n.one}),sub:function(n,r){return e.map(function(i,o){return i.sub(n[o],r[o])})}}},yde=function(e){return function(t){return e.sub(e.zero,t)}},bde=FB,_de=SM;const $de=Object.freeze(Object.defineProperty({__proto__:null,getFunctionRing:_de,getTupleRing:bde,negate:yde,tuple:FB},Symbol.toStringTag,{value:"Module"})),Sde=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Tde=k_;const Ide=Object.freeze(Object.defineProperty({__proto__:null,getFunctionSemiring:Tde},Symbol.toStringTag,{value:"Module"}));var Cde=nB,Ode=rB;function wde(e){var t=ir(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);t(a,i)||i.add(a)}),i}}}function Ede(e){var t=ir(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){n(o).forEach(function(a){t(a,i)||i.add(a)})}),i}}}function A1(e){return function(t){for(var n=t.values(),r,i=new Set;!(r=n.next()).done;){var o=r.value;e(o)&&i.add(o)}return i}}function xde(e){return function(t){for(var n=t.values(),r,i=new Set,o=new Set;!(r=n.next()).done;){var a=r.value;e(a)?i.add(a):o.add(a)}return Ee(o,i)}}function F1(e){var t=ir(e);return function(n,r){if(r===void 0){var i=F1(e);return function(a){return i(n,a)}}if(Qp(n))return r;if(Qp(r))return n;var o=new Set(n);return r.forEach(function(a){t(a,o)||o.add(a)}),o}}function N1(e){var t=ir(e);return function(n,r){if(r===void 0){var i=N1(e);return function(a){return i(a,n)}}if(Qp(n)||Qp(r))return new Set;var o=new Set;return n.forEach(function(a){t(a,r)&&o.add(a)}),o}}function Mde(e,t){return function(n){return function(r){for(var i=r.values(),o,a=new Set,u=new Set,s=ir(e),c=ir(t);!(o=i.next()).done;){var l=n(o.value);switch(l._tag){case"Left":s(l.left,a)||a.add(l.left);break;case"Right":c(l.right,u)||u.add(l.right);break}}return Ee(a,u)}}}function P1(e){var t=ir(e);return function(n,r){if(r===void 0){var i=P1(e);return function(o){return i(o,n)}}return A1(function(o){return!t(o,r)})(n)}}var NB=function(e){return{concat:F1(e)}},Rde=function(e){return{concat:NB(e).concat,empty:new Set}},kde=function(e){return{concat:N1(e)}},Ade=function(e){return{concat:P1(e)}},Fde=JD,Nde=ZD,Pde=XD,Wde=function(e){return new Set([e])};function PB(e){var t=ir(e);return function(n){return function(r){if(t(n)(r))return r;var i=new Set(r);return i.add(n),i}}}var WB=function(e){return function(t){return function(n){return A1(function(r){return!e.equals(t,r)})(n)}}},jde=function(e){var t=ir(e),n=WB(e),r=PB(e);return function(i){return function(o){return(t(i,o)?n:r)(i)(o)}}},jB=function(e){return function(t){for(var n=t.length,r=new Set,i=ir(e),o=0;o<n;o++){var a=t[o];i(a,r)||r.add(a)}return r}},Lde=function(e){return LB(e)(q)};function Dde(e,t){return function(n){var r=ir(e),i=ir(t),o=new Set,a=new Set;return n.forEach(function(u){switch(u._tag){case"Left":r(u.left,o)||o.add(u.left);break;case"Right":i(u.right,a)||a.add(u.right);break}}),Ee(o,a)}}function LB(e){var t=ir(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);a._tag==="Some"&&!t(a.value,i)&&i.add(a.value)}),i}}}var Bde=new Set,Qp=function(e){return e.size===0},Ude=function(e){return e.size},qde=p1,DB=h1,zde=Bp,ir=fn,BB=function(e){return function(t){var n=[];return t.forEach(function(r){return n.push(r)}),n.sort(e.compare)}},Kde=Bp;const Vde=Object.freeze(Object.defineProperty({__proto__:null,chain:Ede,compact:Lde,difference:P1,elem:ir,empty:Bde,every:DB,filter:A1,filterMap:LB,foldMap:Nde,fromArray:jB,getDifferenceMagma:Ade,getEq:Ode,getIntersectionSemigroup:kde,getShow:Cde,getUnionMonoid:Rde,getUnionSemigroup:NB,insert:PB,intersection:N1,isEmpty:Qp,isSubset:zde,map:wde,partition:xde,partitionMap:Mde,reduce:Fde,reduceRight:Pde,remove:WB,separate:Dde,singleton:Wde,size:Ude,some:qde,subset:Kde,toArray:BB,toggle:jde,union:F1},Symbol.toStringTag,{value:"Module"}));var UB=function(e){return{show:function(t){var n="{";for(var r in e)ct.call(e,r)&&(n+=" ".concat(r,": ").concat(e[r].show(t[r]),","));return n.length>1&&(n=n.slice(0,-1)+" "),n+="}",n}}},qB=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{show:function(n){return"[".concat(n.map(function(r,i){return e[i].show(r)}).join(", "),"]")}}},Hde=qB,Gde=UB,Yde={show:function(e){return JSON.stringify(e)}},Jde={show:function(e){return JSON.stringify(e)}},Zde={show:function(e){return JSON.stringify(e)}};const Xde=Object.freeze(Object.defineProperty({__proto__:null,getStructShow:Gde,getTupleShow:Hde,showBoolean:Yde,showNumber:Zde,showString:Jde,struct:UB,tuple:qB},Symbol.toStringTag,{value:"Module"}));function W1(e){return function(t){return function(n){return e.of([t,n])}}}function j1(e){return function(t){return function(n){return function(r){return e.map(n(r),function(i){var o=i[0],a=i[1];return[t(o),a]})}}}}function L1(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){var o=i[0],a=i[1];return e.map(t(a),function(u){var s=u[0],c=u[1];return[o(s),c]})})}}}}function D1(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){var o=i[0],a=i[1];return t(o)(a)})}}}}function B1(e){return function(t){return function(n){return e.of(t(n))}}}function U1(e){return function(t){return function(n){return e.map(t,function(r){return[r,n]})}}}function q1(e){return function(t){return function(n){return e.map(n(t),function(r){var i=r[0];return i})}}}function z1(e){return function(t){return function(n){return e.map(n(t),In)}}}function Qde(e){var t=L1(e),n=j1(e),r=D1(e),i=q1(e),o=z1(e);return{map:function(a,u){return v(a,n(u))},ap:function(a,u){return v(a,t(u))},of:W1(e),chain:function(a,u){return v(a,r(u))},get:function(){return function(a){return e.of([a,a])}},put:function(a){return function(){return e.of([void 0,a])}},modify:function(a){return function(u){return e.of([void 0,a(u)])}},gets:function(a){return function(u){return e.of([a(u),u])}},fromState:B1(e),fromM:U1(e),evalState:function(a,u){return v(a,i(u))},execState:function(a,u){return v(a,o(u))}}}const epe=Object.freeze(Object.defineProperty({__proto__:null,ap:L1,chain:D1,evaluate:q1,execute:z1,fromF:U1,fromState:B1,getStateM:Qde,map:j1,of:W1},Symbol.toStringTag,{value:"Module"}));var K1=function(e){return function(){return Hg(e)}},V1=W1(r1);function zB(e){return Ii(zI(e))}function tpe(e){return Ii(uD(e))}function KB(e){return Ii(KI(e))}function npe(e){return Ii(sD(e))}function VB(e){return Ii(VI(e))}function rpe(e){return Ii(lD(e))}var ipe=function(e){return H(e,qI)},ope=function(e){return function(t){return Hg(e(t)[0])}},HB=tu(function(e){return K1(e)},V1),GB=KB,Ls=VB,eh=zB,YB=B1(r1),JB=function(e){return Ii(fu(e))},ZB=function(e){return Ii(HI(e))},ape=function(e){return Ii(GI(e))},Ii=U1(Ws),upe=function(e){return function(t){return H(t,sp(e))}},XB=function(e){return function(t){return function(n){return e(n)(t)(n)}}},spe=XB,QB=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return ZB(e.apply(void 0,t))}},eU=function(e){return function(t){return v(t,th(QB(e)))}},cpe=eU,tU=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return JB(e.apply(void 0,t))}},nU=function(e){return function(t){return v(t,th(tU(e)))}},lpe=nU,rU=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Ii(e.apply(void 0,t))}},iU=function(e){return function(t){return v(t,th(rU(e)))}},fpe=iU,Ci=function(e,t){return v(e,oU(t))},fa=function(e,t){return v(e,G1(t))},Ds=function(e,t){return v(e,Y1(t))},H1=function(e,t){return function(n){return v(e(n),Zg(function(){return t()(n)}))}},iy=function(e,t,n){return function(r){return v(e(r),e1(t,function(i){var o=i[0],a=i[1];return[n(o),a]}))}},oy=function(e,t){return function(n){return v(e(n),t1(t))}},oU=j1(Ws),dpe=function(e,t){return function(n){return iy(n,e,t)}},ppe=function(e){return function(t){return oy(t,e)}},G1=L1(Wn),hpe=G1,co=V1,Y1=D1(Wn),th=Y1,aU=th(q),mpe=aU,uU=function(e){return function(t){return function(n){return v(t(n),OD(function(){return e()(n)}))}}},vpe=uU,ay=K1,Dt="StateReaderTaskEither",J1={URI:Dt,map:Ci},gpe=Ue(J1),ype={URI:Dt,of:co},uy={URI:Dt,map:Ci,ap:fa},sU=Ot(uy),bpe=sU,cU=wt(uy),_pe=cU,$pe={URI:Dt,map:Ci,ap:fa,of:co},or={URI:Dt,map:Ci,ap:fa,chain:Ds},Bs={URI:Dt,fromState:YB},Spe=_P(Bs),Tpe=$P(Bs),Ipe=SP(Bs),Cpe=TP(Bs),Ope=XS(Bs),wpe=IP(Bs,or),Epe={URI:Dt,map:Ci,ap:fa,of:co,chain:Ds},xpe={URI:Dt,map:Ci,ap:fa,of:co,chain:Ds,fromIO:Ls},Mpe={URI:Dt,map:Ci,ap:fa,of:co,chain:Ds,fromIO:Ls,fromTask:eh},Rpe={URI:Dt,map:Ci,ap:fa,of:co,chain:Ds,throwError:ay},lU=lt(or),kpe=lU,Ape={URI:Dt,bimap:iy,mapLeft:oy},Fpe={URI:Dt,map:Ci,alt:H1},cf={URI:Dt,fromReader:GB},Npe=fp(cf),Ppe=dp(cf),Wpe=ws(cf),fU=pp(cf,or),jpe=fU,dU=hp(cf,or),Lpe=dU,da={URI:Dt,fromEither:HB},Dpe=Yi(da),Bpe=Ji(da),Upe=ss(da,or),pU=Po(da,or),qpe=pU,hU=Wo(da,or),zpe=hU,Kpe=Ha(da),mU=cs(da,or),Vpe=mU,Hpe=Sr(da),sy={URI:Dt,fromIO:Ls},Gpe=to(sy),Ype=Vo(sy,or),Jpe=Ho(sy,or),cy={URI:Dt,fromIO:Ls,fromTask:eh},Zpe=Es(cy),Xpe=Fl(cy,or),Qpe=Nl(cy,or),ehe=q1(Ws),the=z1(Ws),nhe=Ct(J1),vU=xt(or),rhe=vU,gU=Et(uy),ihe=gU,yU=function(e){return function(t){return function(n){return function(r){return function(){return Uc(t).reduce(function(i,o,a){return i.then(function(u){return qt(u)?i:e(a+1,o)(u.right[1])(r)().then(function(s){if(qt(s))return s;var c=s.right,l=c[0],f=c[1];return u.right[0].push(l),u.right[1]=f,u})})},e(0,gr(t))(n)(r)().then(_s(function(i){var o=i[0],a=i[1];return[[o],a]})))}}}}},Z1=function(e){var t=yU(e);return function(n){return mt(n)?t(n):co(tn)}},ohe=Z1,bU=function(e){return Z1(function(t,n){return e(n)})},ahe=bU(q),uhe={URI:Dt,map:Ci,of:co,ap:fa,chain:Ds,bimap:iy,mapLeft:oy,alt:H1,fromIO:Ls,fromTask:eh,throwError:ay},she={URI:Dt,map:Ci,of:co,ap:fa,chain:Ds,bimap:iy,mapLeft:oy,alt:H1,fromIO:Ls,fromTask:eh,throwError:ay},che=function(e,t){return v(e(t),jp(function(n){var r=n[0];return r}))},lhe=function(e,t){return v(e(t),jp(function(n){n[0];var r=n[1];return r}))};function fhe(e,t,n){return e(t)(n)()}const dhe=Object.freeze(Object.defineProperty({__proto__:null,Alt:Fpe,Applicative:$pe,Apply:uy,Bifunctor:Ape,Chain:or,FromEither:da,FromIO:sy,FromReader:cf,FromState:Bs,FromTask:cy,Functor:J1,Monad:Epe,MonadIO:xpe,MonadTask:Mpe,MonadThrow:Rpe,Pointed:ype,URI:Dt,alt:vpe,altW:uU,ap:G1,apFirst:sU,apFirstW:bpe,apS:gU,apSW:ihe,apSecond:cU,apSecondW:_pe,apW:hpe,ask:Npe,asks:Ppe,asksStateReaderTaskEither:spe,asksStateReaderTaskEitherW:XB,bimap:dpe,bind:vU,bindTo:nhe,bindW:rhe,chain:Y1,chainEitherK:pU,chainEitherKW:qpe,chainFirst:lU,chainFirstEitherK:hU,chainFirstEitherKW:zpe,chainFirstIOK:Jpe,chainFirstReaderK:dU,chainFirstReaderKW:Lpe,chainFirstTaskK:Qpe,chainFirstW:kpe,chainIOEitherK:cpe,chainIOEitherKW:eU,chainIOK:Ype,chainOptionK:Upe,chainReaderK:fU,chainReaderKW:jpe,chainReaderTaskEitherK:fpe,chainReaderTaskEitherKW:iU,chainStateK:wpe,chainTaskEitherK:lpe,chainTaskEitherKW:nU,chainTaskK:Xpe,chainW:th,evalState:che,evaluate:ehe,execState:lhe,execute:the,filterOrElse:mU,filterOrElseW:Vpe,flap:gpe,flatten:mpe,flattenW:aU,fromEither:HB,fromEitherK:Hpe,fromIO:Ls,fromIOEither:ZB,fromIOEitherK:QB,fromIOK:Gpe,fromOption:Dpe,fromOptionK:Bpe,fromPredicate:Kpe,fromReader:GB,fromReaderEither:ape,fromReaderK:Wpe,fromReaderTaskEither:Ii,fromReaderTaskEitherK:rU,fromState:YB,fromStateK:Ope,fromTask:eh,fromTaskEither:JB,fromTaskEitherK:tU,fromTaskK:Zpe,get:Spe,gets:Cpe,left:K1,leftIO:rpe,leftReader:npe,leftState:ope,leftTask:tpe,local:upe,map:oU,mapLeft:ppe,modify:Ipe,of:co,put:Tpe,right:V1,rightIO:VB,rightReader:KB,rightState:ipe,rightTask:zB,run:fhe,sequenceArray:ahe,stateReaderTaskEither:uhe,stateReaderTaskEitherSeq:she,throwError:ay,traverseArray:bU,traverseArrayWithIndex:ohe,traverseReadonlyArrayWithIndex:Z1,traverseReadonlyNonEmptyArrayWithIndex:yU},Symbol.toStringTag,{value:"Module"}));function phe(e){return function(t){return{peek:t.peek,pos:e}}}function hhe(e){return function(t){return{peek:t.peek,pos:e(t.pos)}}}function mhe(e){return function(t){return t.peek(e(t.pos))}}function vhe(e){return function(t){return function(n){return e.map(t(n.pos),function(r){return n.peek(r)})}}}var _U=function(e,t){return v(e,SU(t))},ghe=function(e,t){return v(e,X1(t))},X1=function(e){return function(t){return{peek:function(n){return e({peek:t.peek,pos:n})},pos:t.pos}}},$U=function(e){return e.peek(e.pos)},yhe=X1(q),SU=function(e){return function(t){return{peek:function(n){return e(t.peek(n))},pos:t.pos}}},Q1="Store",TU={URI:Q1,map:_U},bhe=Ue(TU),IU={URI:Q1,map:_U,extend:ghe,extract:$U},_he=IU;const $he=Object.freeze(Object.defineProperty({__proto__:null,Comonad:IU,Functor:TU,URI:Q1,duplicate:yhe,experiment:vhe,extend:X1,extract:$U,flap:bhe,map:SU,peeks:mhe,seek:phe,seeks:hhe,store:_he},Symbol.toStringTag,{value:"Module"}));function eC(e,t){return function(n,r){return t.compose(e.second(r),e.first(n))}}function CU(e,t){var n=eC(e,t);return function(r,i){return t.compose(n(r,i),e.promap(t.id(),q,function(o){return[o,o]}))}}function She(e){return eC(e,e)}function The(e){return CU(e,e)}const Ihe=Object.freeze(Object.defineProperty({__proto__:null,fanOut:CU,fanout:The,split:eC,splitStrong:She},Symbol.toStringTag,{value:"Module"}));var Che=function(){return{concat:function(e,t){return Object.assign({},e,t)}}},Ohe=function(e){return function(t){var n={};for(var r in t)ct.call(t,r)&&(n[r]=e[r](t[r]));return n}};const whe=Object.freeze(Object.defineProperty({__proto__:null,evolve:Ohe,getAssignSemigroup:Che},Symbol.toStringTag,{value:"Module"}));var Ehe=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(f){a(f)}}function s(l){try{c(r.throw(l))}catch(f){a(f)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(e,t||[])).next())})},xhe=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},OU=bp(un),Mhe=CT(un),Rhe=Sn,wU=OT(un),nh=function(e){return ly(Nn(e))},ly=cg(Le),khe=uu(gl),EU=wT(Le),Ahe=EU,tC=pg(Zl),Fhe=tC,xU=tC,Nhe=xU,MU=hg(Ht),Phe=MU,Whe=lg(un),RU=function(e){return function(){return Ehe(void 0,void 0,void 0,function(){return xhe(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e().then(fe)];case 1:return[2,t.sent()];case 2:return t.sent(),[2,ye];case 3:return[2]}})})}},jhe=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return RU(function(){return e.apply(void 0,t)})}},Lhe=fg(un),Dhe=TT(Ht),Bhe=dg(un),Uhe=IT(Ht),nC=mg(Le),kU=vg(Fs),lo=OU,fy=Dl(Ht),qhe=fy(q),rC=gg(Ht),zhe=rC,dy=_p(un),Khe=dy(),iC=Qi(Le,ms),oC=qo(Le,ms,pl),AU=zo(Le,Do),FU=Ko(Le,Do),NU=nu(Le,Do),PU=ru(Le,Do),Hr=function(e,t){return v(e,nC(t))},Us=function(e,t){return v(e,kU(t))},py=function(e,t){return v(e,fy(t))},WU=function(e,t){return v(e,rC(t))},Vhe=function(e,t){return v(e,AU(t))},Hhe=function(e,t){return v(e,FU(t))},Ghe=function(e,t){return v(e,NU(t))},Yhe=function(e,t){return v(e,PU(t))},Yt="TaskOption",aC={URI:Yt,map:Hr},Jhe=Ue(aC),jU={URI:Yt,of:lo},hy={URI:Yt,map:Hr,ap:Us},Zhe=Ot(hy),Xhe=wt(hy),Qhe={URI:Yt,map:Hr,ap:Us,of:lo},LU=function(e,t){return v(e,fy(function(n){return v(t,nC(n))}))},eme={URI:Yt,map:Hr,ap:LU},tme={URI:Yt,map:Hr,ap:LU,of:lo},pa={URI:Yt,map:Hr,ap:Us,chain:py},nme=lt(pa),rme={URI:Yt,map:Hr,alt:WU},DU={URI:Yt,zero:dy},ime=tl(DU,jU),ome={URI:Yt,map:Hr,ap:Us,of:lo,alt:WU,zero:dy},ame={URI:Yt,map:Hr,ap:Us,of:lo,chain:py},ume={URI:Yt,map:Hr,ap:Us,of:lo,chain:py,fromIO:nh},sme={URI:Yt,map:Hr,ap:Us,of:lo,chain:py,fromIO:nh,fromTask:ly},cme={URI:Yt,compact:iC,separate:oC},lme={URI:Yt,map:Hr,compact:iC,separate:oC,filter:Vhe,filterMap:Hhe,partition:Ghe,partitionMap:Yhe},my={URI:Yt,fromIO:nh},fme=to(my),dme=Vo(my,pa),pme=Ho(my,pa),vy={URI:Yt,fromEither:wU},hme=Sr(vy),mme=Po(vy,pa),vme=Wo(vy,pa),gy={URI:Yt,fromIO:nh,fromTask:ly},gme=Es(gy),yme=Fl(gy,pa),bme=Nl(gy,pa),_me=lo(zt),$me=Ct(aC),Sme=xt(pa),Tme=Et(hy),uC=lo(tn),BU=function(e){return H(Xl(e),uu(Hv(Xn)))},sC=function(e){var t=BU(e);return function(n){return mt(n)?t(n):uC}},UU=function(e){return function(t){return function(){return Uc(t).reduce(function(n,r,i){return n.then(function(o){return Ft(o)?n:e(i+1,r)().then(function(a){return Ft(a)?a:(o.value.push(a.value),o)})})},e(0,gr(t))().then(Xi(dd)))}}},cC=function(e){var t=UU(e);return function(n){return mt(n)?t(n):uC}},Ime=sC,qU=function(e){return sC(function(t,n){return e(n)})},Cme=qU(q),Ome=cC,zU=function(e){return cC(function(t,n){return e(n)})},wme=zU(q);const Eme=Object.freeze(Object.defineProperty({__proto__:null,Alt:rme,Alternative:ome,ApT:uC,ApplicativePar:Qhe,ApplicativeSeq:tme,ApplyPar:hy,ApplySeq:eme,Chain:pa,Compactable:cme,Do:_me,Filterable:lme,FromEither:vy,FromIO:my,FromTask:gy,Functor:aC,Monad:ame,MonadIO:ume,MonadTask:sme,Pointed:jU,Zero:DU,alt:rC,altW:zhe,ap:kU,apFirst:Zhe,apS:Tme,apSecond:Xhe,bind:Sme,bindTo:$me,chain:fy,chainEitherK:mme,chainFirst:nme,chainFirstEitherK:vme,chainFirstIOK:pme,chainFirstTaskK:bme,chainIOK:dme,chainNullableK:Dhe,chainOptionK:Uhe,chainTaskK:yme,compact:iC,filter:AU,filterMap:FU,flap:Jhe,flatten:qhe,fold:Fhe,foldW:Nhe,fromEither:wU,fromEitherK:hme,fromIO:nh,fromIOK:fme,fromNullable:Whe,fromNullableK:Lhe,fromOption:Rhe,fromOptionK:Bhe,fromPredicate:Mhe,fromTask:ly,fromTaskEither:khe,fromTaskK:gme,getOrElse:MU,getOrElseW:Phe,guard:ime,map:nC,match:EU,matchE:tC,matchEW:xU,matchW:Ahe,none:Khe,of:lo,partition:NU,partitionMap:PU,separate:oC,sequenceArray:Cme,sequenceSeqArray:wme,some:OU,traverseArray:qU,traverseArrayWithIndex:Ime,traverseReadonlyArrayWithIndex:sC,traverseReadonlyArrayWithIndexSeq:cC,traverseReadonlyNonEmptyArrayWithIndex:BU,traverseReadonlyNonEmptyArrayWithIndexSeq:UU,traverseSeqArray:zU,traverseSeqArrayWithIndex:Ome,tryCatch:RU,tryCatchK:jhe,zero:dy},Symbol.toStringTag,{value:"Module"}));var Ge=function(e){return e._tag==="Left"},Rt=function(e){return e._tag==="Right"};function qs(e){return e._tag==="Both"}function pn(e){return{_tag:"Left",left:e}}function ar(e){return{_tag:"Right",right:e}}function et(e,t){return{_tag:"Both",left:e,right:t}}var lC=function(e,t,n){return function(r){switch(r._tag){case"Left":return e(r.left);case"Right":return t(r.right);case"Both":return n(r.left,r.right)}}},xme=lC,gu=lC,Mme=gu,KU=gu(ar,pn,function(e,t){return et(t,e)});function Rme(e,t){return{show:gu(function(n){return"left(".concat(e.show(n),")")},function(n){return"right(".concat(t.show(n),")")},function(n,r){return"both(".concat(e.show(n),", ").concat(t.show(r),")")})}}function kme(e,t){return jr(function(n,r){return Ge(n)?Ge(r)&&e.equals(n.left,r.left):Rt(n)?Rt(r)&&t.equals(n.right,r.right):qs(r)&&e.equals(n.left,r.left)&&t.equals(n.right,r.right)})}function VU(e,t){return{concat:function(n,r){return Ge(n)?Ge(r)?pn(e.concat(n.left,r.left)):Rt(r)?et(n.left,r.right):et(e.concat(n.left,r.left),r.right):Rt(n)?Ge(r)?et(r.left,n.right):Rt(r)?ar(t.concat(n.right,r.right)):et(r.left,t.concat(n.right,r.right)):Ge(r)?et(e.concat(n.left,r.left),n.right):Rt(r)?et(n.left,t.concat(n.right,r.right)):et(e.concat(n.left,r.left),t.concat(n.right,r.right))}}}var yy=function(e){return{URI:Or,_E:void 0,map:zs,ap:function(t,n){return Ge(t)?Ge(n)?pn(e.concat(t.left,n.left)):Rt(n)?pn(t.left):pn(e.concat(t.left,n.left)):Rt(t)?Ge(n)?pn(n.left):Rt(n)?ar(t.right(n.right)):et(n.left,t.right(n.right)):Ge(n)?pn(e.concat(t.left,n.left)):Rt(n)?et(t.left,t.right(n.right)):et(e.concat(t.left,n.left),t.right(n.right))}}};function Ame(e){var t=yy(e);return{URI:Or,_E:void 0,map:zs,ap:t.ap,of:rh}}function HU(e){var t=yy(e),n=function(r,i){if(Ge(r))return r;if(Rt(r))return i(r.right);var o=i(r.right);return Ge(o)?pn(e.concat(r.left,o.left)):Rt(o)?et(r.left,o.right):et(e.concat(r.left,o.left),o.right)};return{URI:Or,_E:void 0,map:zs,ap:t.ap,chain:n}}function Fme(e){var t=HU(e);return{URI:Or,_E:void 0,map:zs,of:rh,ap:t.ap,chain:t.chain,throwError:pn}}function Nme(e){return Ge(e)?fe(e.left):Rt(e)?ye:fe(e.left)}function Pme(e){return Ge(e)?ye:(Rt(e),fe(e.right))}function Wme(e){return function(t){return Ft(t)?pn(e):et(e,t.value)}}function jme(e){return function(t){return Ft(t)?ar(e):et(t.value,e)}}function Lme(e){return Ge(e)?fe(e.left):ye}function Dme(e){return Rt(e)?fe(e.right):ye}var Bme=function(e,t){return Ft(e)?Ft(t)?ye:fe(ar(t.value)):Ft(t)?fe(pn(e.value)):fe(et(e.value,t.value))},zs=function(e,t){return v(e,vC(t))},GU=function(e,t,n){return v(e,hC(t,n))},YU=function(e,t){return v(e,mC(t))},fC=function(e,t,n){return v(e,ZU(t,n))},dC=function(e){var t=XU(e);return function(n,r){return v(n,t(r))}},pC=function(e,t,n){return v(e,QU(t,n))},JU=function(e){var t=e2(e);return function(n,r){return v(n,t(r))}},hC=function(e,t){return function(n){return Ge(n)?pn(e(n.left)):Rt(n)?ar(t(n.right)):et(e(n.left),t(n.right))}},mC=function(e){return function(t){return Ge(t)?pn(e(t.left)):qs(t)?et(e(t.left),t.right):t}},vC=function(e){return function(t){return Ge(t)?t:Rt(t)?ar(e(t.right)):et(t.left,e(t.right))}},ZU=function(e,t){return function(n){return Ge(n)?e:t(e,n.right)}},XU=function(e){return function(t){return function(n){return Ge(n)?e.empty:t(n.right)}}},QU=function(e,t){return function(n){return Ge(n)?e:t(n.right,e)}},e2=function(e){return function(t){return function(n){return Ge(n)?e.of(n):Rt(n)?e.map(t(n.right),ar):e.map(t(n.right),function(r){return et(n.left,r)})}}},gC=function(e){return function(t){return Ge(t)?e.of(t):Rt(t)?e.map(t.right,ar):e.map(t.right,function(n){return et(t.left,n)})}},rh=ar,Or="These",yC={URI:Or,map:zs},Ume=Ue(yC),qme={URI:Or,of:rh},zme={URI:Or,bimap:GU,mapLeft:YU},Kme={URI:Or,fromThese:q},Vme={URI:Or,reduce:fC,foldMap:dC,reduceRight:pC},Hme={URI:Or,map:zs,reduce:fC,foldMap:dC,reduceRight:pC,traverse:JU,sequence:gC},bC={URI:Or,fromEither:q},Gme=Yi(bC),Yme=Ji(bC),Jme=function(e){return function(t){return function(n){return Ge(n)?!1:e.equals(t,n.right)}}},Zme=function(e){return function(t){return Ge(t)?!1:e(t.right)}},_C=function(e,t){return function(n){return Ge(n)?[n.left,t()]:Rt(n)?[e(),n.right]:[n.left,n.right]}},Xme=function(e,t){return _C(function(){return e},function(){return t})},t2=rh(tn),$C=function(e){return function(t){return function(n){var r=ye,i=t(0,gr(n));if(Ge(i))return i;qs(i)&&(r=fe(i.left));for(var o=[i.right],a=1;a<n.length;a++){var u=t(a,n[a]);if(Ge(u))return u;qs(u)&&(r=Ft(r)?fe(u.left):fe(e.concat(r.value,u.left))),o.push(u.right)}return Ft(r)?ar(o):et(r.value,o)}}},Qme=function(e){return function(t){var n=$C(e)(t);return function(r){return mt(r)?n(r):t2}}},eve={URI:Or,map:zs,bimap:GU,mapLeft:YU,reduce:fC,foldMap:dC,reduceRight:pC,traverse:JU,sequence:gC};const tve=Object.freeze(Object.defineProperty({__proto__:null,ApT:t2,Bifunctor:zme,Foldable:Vme,FromEither:bC,FromThese:Kme,Functor:yC,Pointed:qme,Traversable:Hme,URI:Or,bimap:hC,both:et,elem:Jme,exists:Zme,flap:Ume,fold:Mme,foldMap:XU,foldW:xme,fromOption:Gme,fromOptionK:Yme,fromOptions:Bme,getApplicative:Ame,getApply:yy,getChain:HU,getEq:kme,getLeft:Nme,getLeftOnly:Lme,getMonad:Fme,getRight:Pme,getRightOnly:Dme,getSemigroup:VU,getShow:Rme,isBoth:qs,isLeft:Ge,isRight:Rt,left:pn,leftOrBoth:Wme,map:vC,mapLeft:mC,match:gu,matchW:lC,of:rh,reduce:ZU,reduceRight:QU,right:ar,rightOrBoth:jme,sequence:gC,swap:KU,these:eve,toTuple:Xme,toTuple2:_C,traverse:e2,traverseReadonlyArrayWithIndex:Qme,traverseReadonlyNonEmptyArrayWithIndex:$C},Symbol.toStringTag,{value:"Module"}));function by(e){return H(ar,e.of)}function _y(e){return H(pn,e.of)}function SC(e){return H(et,e.of)}function TC(e){return function(t){return e.map(t,ar)}}function IC(e){return function(t){return e.map(t,pn)}}function CC(e){return Dc(e,yC)}function OC(e,t){return ko(e,yy(t))}function wC(e,t){var n=_y(e);return function(r){return function(i){return e.chain(i,gu(n,r,function(o,a){return e.map(r(a),gu(function(u){return pn(t.concat(o,u))},function(u){return et(o,u)},function(u,s){return et(t.concat(o,u),s)}))}))}}}function EC(e){return function(t,n){return function(r){return e.map(r,hC(t,n))}}}function xC(e){return function(t){return function(n){return e.map(n,mC(t))}}}function n2(e){return function(t,n,r){return function(i){return e.map(i,gu(t,n,r))}}}function MC(e){return function(t,n,r){return function(i){return e.chain(i,gu(t,n,r))}}}function RC(e){return function(t){return e.map(t,KU)}}function kC(e){return function(t,n){return function(r){return e.map(r,_C(t,n))}}}function nve(e){var t=CC(e),n=EC(e),r=xC(e),i=MC(e),o=kC(e),a=by(e),u=function(s,c){return v(s,t(c))};return{map:u,bimap:function(s,c,l){return v(s,n(c,l))},mapLeft:function(s,c){return v(s,r(c))},fold:function(s,c,l,f){return v(s,i(c,l,f))},swap:RC(e),rightM:TC(e),leftM:IC(e),left:_y(e),right:by(e),both:SC(e),toTuple:function(s,c,l){return v(s,o(function(){return c},function(){return l}))},getMonad:function(s){var c=OC(e,s),l=wC(e,s);return{_E:void 0,map:u,of:a,ap:function(f,d){return v(f,c(d))},chain:function(f,d){return v(f,l(d))}}}}}const rve=Object.freeze(Object.defineProperty({__proto__:null,ap:OC,bimap:EC,both:SC,chain:wC,getTheseM:nve,left:_y,leftF:IC,map:CC,mapLeft:xC,match:n2,matchE:MC,right:by,rightF:TC,swap:RC,toTuple2:kC},Symbol.toStringTag,{value:"Module"}));var ive=_y(un),r2=by(un),ove=SC(un),AC=TC(Le),i2=IC(Le),o2=H(Nn,AC),ave=H(Nn,i2),a2=Sn,u2=Sn,$y=o2,uve=Nn,FC=AC,s2=n2(Le),sve=s2,c2=MC(Ht),l2=c2,f2=l2,cve=f2,lve=RC(Le),Ks=function(e,t){return v(e,d2(t))},NC=function(e,t,n){return v(e,p2(t,n))},PC=function(e,t){return v(e,h2(t))},d2=CC(Le),p2=EC(Le),h2=xC(Le),ih=r2,jn="TaskThese",WC=function(e,t){var n=OC(e,t);return{URI:jn,_E:void 0,map:Ks,ap:function(r,i){return v(r,n(i))}}};function m2(e,t){var n=WC(e,t).ap;return{URI:jn,_E:void 0,map:Ks,ap:n,of:ih}}function v2(e){var t=WC(Rp,e),n=wC(Ht,e);return{URI:jn,_E:void 0,map:Ks,ap:t.ap,chain:function(r,i){return v(r,n(i))}}}function fve(e){var t=m2(Rp,e),n=v2(e);return{URI:jn,_E:void 0,map:Ks,ap:t.ap,of:ih,chain:n.chain,fromIO:$y,fromTask:FC}}var g2={URI:jn,map:Ks},dve=Ue(g2),pve={URI:jn,of:ih},hve={URI:jn,bimap:NC,mapLeft:PC},Sy={URI:jn,fromEither:a2},mve=Yi(Sy),vve=Ji(Sy),gve=Ha(Sy),y2={URI:jn,fromThese:u2},yve=CP(y2),b2={URI:jn,fromIO:$y},bve=to(b2),_2={URI:jn,fromIO:$y,fromTask:FC},_ve=Es(_2),$2=kC(Le),jC=ih(tn),S2=function(e){var t=$C(e);return function(n){return H(Xl(n),uu(t(Xn)))}},$ve=function(e){return function(t){var n=S2(e)(t);return function(r){return mt(r)?n(r):jC}}},T2=function(e){return function(t){return function(n){return function(){return Uc(n).reduce(function(r,i,o){return r.then(function(a){return Ge(a)?r:t(o+1,i)().then(function(u){if(Ge(u))return u;if(qs(u)){var s=a.right;return s.push(u.right),qs(a)?et(e.concat(a.left,u.left),s):et(u.left,s)}return a.right.push(u.right),a})})},t(0,gr(n))().then(vC(dd)))}}}},Sve=function(e){return function(t){var n=T2(e)(t);return function(r){return mt(r)?n(r):jC}}},Tve={URI:jn,map:Ks},Ive={URI:jn,bimap:NC,mapLeft:PC},Cve=function(e,t){return $2(function(){return e},function(){return t})},Ove={URI:jn,map:Ks,bimap:NC,mapLeft:PC},wve=function(e,t){return Kt(Ng)(VU(e,t))};const Eve=Object.freeze(Object.defineProperty({__proto__:null,ApT:jC,Bifunctor:hve,FromEither:Sy,FromIO:b2,FromTask:_2,FromThese:y2,Functor:g2,Pointed:pve,URI:jn,bifunctorTaskThese:Ive,bimap:p2,both:ove,flap:dve,fold:l2,foldW:cve,fromEither:a2,fromIO:$y,fromIOEither:uve,fromIOK:bve,fromOption:mve,fromOptionK:vve,fromPredicate:gve,fromTask:FC,fromTaskK:_ve,fromThese:u2,fromTheseK:yve,functorTaskThese:Tve,getApplicative:m2,getApply:WC,getChain:v2,getMonad:fve,getSemigroup:wve,left:ive,leftIO:ave,leftTask:i2,map:d2,mapLeft:h2,match:s2,matchE:c2,matchEW:f2,matchW:sve,of:ih,right:r2,rightIO:o2,rightTask:AC,swap:lve,taskThese:Ove,toTuple:Cve,toTuple2:$2,traverseReadonlyArrayWithIndex:$ve,traverseReadonlyArrayWithIndexSeq:Sve,traverseReadonlyNonEmptyArrayWithIndex:S2,traverseReadonlyNonEmptyArrayWithIndexSeq:T2},Symbol.toStringTag,{value:"Module"}));function xve(e,t){return function(n){return n(t(n(e.empty)))}}function Mve(e){return function(t){return[e(t),t]}}function Rve(e){return function(t){return function(n){return[t(n),e(n)]}}}function kve(e){return function(t){return function(n){return t(e(n))}}}function Ave(e){function t(r,i){return function(o){return i(function(a){return r(e.concat(o,a))})}}function n(r){return r(e.empty)}return{URI:LC,_E:void 0,map:I2,extend:t,extract:n}}var I2=function(e,t){return v(e,C2(t))},C2=function(e){return function(t){return function(n){return e(t(n))}}},LC="Traced",DC={URI:LC,map:I2},Fve=Ue(DC),Nve=DC;const Pve=Object.freeze(Object.defineProperty({__proto__:null,Functor:DC,URI:LC,censor:kve,flap:Fve,getComonad:Ave,listen:Mve,listens:Rve,map:C2,traced:Nve,tracks:xve},Symbol.toStringTag,{value:"Module"}));function O2(e,t){return function(n){var r=e.traverse(n),i=t.traverse(n);return function(o){return function(a){return r(a,function(u){return i(u,o)})}}}}function w2(e,t){return function(n){var r=e.sequence(n),i=t.sequence(n);return function(o){return r(e.map(o,i))}}}function Wve(e,t){var n=Bc(e,t).map,r=WS(e,t),i=O2(e,t),o=w2(e,t);return{map:n,reduce:r.reduce,foldMap:r.foldMap,reduceRight:r.reduceRight,traverse:function(a){var u=i(a);return function(s,c){return v(s,u(c))}},sequence:function(a){var u=o(a);return function(s){return v(s,u)}}}}const jve=Object.freeze(Object.defineProperty({__proto__:null,getTraversableComposition:Wve,sequence:w2,traverse:O2},Symbol.toStringTag,{value:"Module"})),Lve=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function E2(e,t){return t===void 0&&(t=[]),{value:e,forest:t}}function Dve(e){var t=function(n){return Ja(n.forest)?"make(".concat(e.show(n.value),")"):"make(".concat(e.show(n.value),", [").concat(n.forest.map(t).join(", "),"])")};return{show:t}}function Bve(e){var t,n=jr(function(r,i){return e.equals(r.value,i.value)&&t.equals(r.forest,i.forest)});return t=nF(n),n}var x2=function(e,t){for(var n="",r=t.length,i,o=0;o<r;o++){i=t[o];var a=o===r-1;n+=e+(a?"└":"├")+"─ "+i.value,n+=x2(e+(r>1&&!a?"│ ":" "),i.forest)}return n};function M2(e){return x2(`
28
+ `,e)}function Uve(e){return e.value+M2(e.forest)}function R2(e,t){var n=t(e),r=n[0],i=n[1];return{value:r,forest:k2(i,t)}}function k2(e,t){return e.map(function(n){return R2(n,t)})}function A2(e){var t=F2(e);return function(n,r){return e.chain(r(n),function(i){var o=i[0],a=i[1];return e.map(t(a,r),function(u){return{value:o,forest:u}})})}}function F2(e){var t=Nv(e);return function(n,r){return v(n,t(function(i){return A2(e)(i,r)}))}}function qve(e){var t=function(n){return e(n.value,n.forest.map(t))};return t}var yu=function(e,t){return v(e,Iy(t))},lf=function(e,t){return v(e,oh(function(n){return v(t,Iy(n))}))},BC=function(e,t){return v(e,oh(t))},UC=function(e,t,n){return v(e,Cy(t,n))},qC=function(e){var t=W2(e);return function(n,r){return v(n,t(r))}},zC=function(e,t,n){return v(e,KC(t,n))},N2=function(e,t){return v(e,Ty(t))},P2=function(e){var t=HC(e);return function(n,r){return v(n,t(r))}},zve=function(e){return function(t){return lf(t,e)}},oh=function(e){return function(t){var n=e(t.value),r=n.value,i=n.forest,o=Z$().concat;return{value:r,forest:o(i,t.forest.map(oh(e)))}}},Ty=function(e){return function(t){return{value:e(t),forest:t.forest.map(Ty(e))}}},Kve=Ty(q),Vve=oh(q),Iy=function(e){return function(t){return{value:e(t.value),forest:t.forest.map(Iy(e))}}},Cy=function(e,t){return function(n){for(var r=t(e,n.value),i=n.forest.length,o=0;o<i;o++)r=v(n.forest[o],Cy(r,t));return r}},W2=function(e){return function(t){return Cy(e.empty,function(n,r){return e.concat(n,t(r))})}},KC=function(e,t){return function(n){for(var r=e,i=n.forest.length,o=i-1;o>=0;o--)r=v(n.forest[o],KC(r,t));return t(n.value,r)}},VC=function(e){return e.value},HC=function(e){var t=Nv(e),n=function(r){return function(i){return e.ap(e.map(r(i.value),function(o){return function(a){return{value:o,forest:a}}}),v(i.forest,t(n(r))))}};return n},GC=function(e){return HC(e)(q)},ff=function(e){return E2(e)},Oi="Tree",YC={URI:Oi,map:yu},Hve=Ue(YC),Gve={URI:Oi,of:ff},Oy={URI:Oi,map:yu,ap:lf},Yve=Ot(Oy),Jve=wt(Oy),Zve={URI:Oi,map:yu,ap:lf,of:ff},JC={URI:Oi,map:yu,ap:lf,chain:BC},Xve={URI:Oi,map:yu,ap:lf,of:ff,chain:BC},Qve=lt(JC),ege={URI:Oi,reduce:UC,foldMap:qC,reduceRight:zC},tge={URI:Oi,map:yu,reduce:UC,foldMap:qC,reduceRight:zC,traverse:P2,sequence:GC},nge={URI:Oi,map:yu,extend:N2,extract:VC},rge=ff(zt),ige=Ct(YC),oge=xt(JC),age=Et(Oy);function uge(e){var t=function(n,r){return e.equals(n,r.value)||r.forest.some(function(i){return t(n,i)})};return t}var j2=function(e){return function(t){return e(t.value)||t.forest.some(j2(e))}},sge={URI:Oi,map:yu,of:ff,ap:lf,chain:BC,reduce:UC,foldMap:qC,reduceRight:zC,traverse:P2,sequence:GC,extract:VC,extend:N2};const cge=Object.freeze(Object.defineProperty({__proto__:null,Applicative:Zve,Apply:Oy,Chain:JC,Comonad:nge,Do:rge,Foldable:ege,Functor:YC,Monad:Xve,Pointed:Gve,Traversable:tge,URI:Oi,ap:zve,apFirst:Yve,apS:age,apSecond:Jve,bind:oge,bindTo:ige,chain:oh,chainFirst:Qve,drawForest:M2,drawTree:Uve,duplicate:Kve,elem:uge,exists:j2,extend:Ty,extract:VC,flap:Hve,flatten:Vve,fold:qve,foldMap:W2,getEq:Bve,getShow:Dve,make:E2,map:Iy,of:ff,reduce:Cy,reduceRight:KC,sequence:GC,traverse:HC,tree:sge,unfoldForest:k2,unfoldForestM:F2,unfoldTree:R2,unfoldTreeM:A2},Symbol.toStringTag,{value:"Module"}));var wr=Gt,ur=In,lge=function(e){return[ur(e),wr(e)]};function ZC(e){return{URI:Er,_E:void 0,map:ah,ap:function(t,n){return[wr(t)(wr(n)),e.concat(ur(t),ur(n))]}}}var L2=function(e){return function(t){return[t,e.empty]}};function fge(e){var t=ZC(e);return{URI:Er,_E:void 0,map:t.map,ap:t.ap,of:L2(e)}}function XC(e){var t=ZC(e);return{URI:Er,_E:void 0,map:t.map,ap:t.ap,chain:function(n,r){var i=r(wr(n)),o=i[0],a=i[1];return[o,e.concat(ur(n),a)]}}}function dge(e){var t=XC(e);return{URI:Er,_E:void 0,map:t.map,ap:t.ap,chain:t.chain,of:L2(e)}}function pge(e){var t=function(r,i){for(var o=i(r),a=e.empty,u=wr(o);u._tag==="Left";)a=e.concat(a,ur(o)),o=i(u.left),u=wr(o);return[u.right,e.concat(a,ur(o))]},n=XC(e);return{URI:Er,_E:void 0,map:n.map,ap:n.ap,chain:n.chain,chainRec:t}}var D2=function(e,t){return v(e,V2(t))},ah=function(e,t){return v(e,nO(t))},B2=function(e,t,n){return v(e,K2(t,n))},U2=function(e,t){return v(e,rO(t))},q2=function(e,t){return v(e,iO(t))},QC=function(e,t,n){return v(e,G2(t,n))},eO=function(e){var t=H2();return function(n,r){return v(n,t(r))}},tO=function(e,t,n){return v(e,Y2(t,n))};function z2(e){var t=J2(e);return function(n,r){return v(n,t(r))}}var K2=function(e,t){return function(n){return[t(wr(n)),e(ur(n))]}},nO=function(e){return function(t){return[e(wr(t)),ur(t)]}},rO=function(e){return function(t){return[wr(t),e(ur(t))]}},V2=function(e){return function(t){return[wr(t),ur(e)]}},iO=function(e){return function(t){return[e(t),ur(t)]}},hge=iO(q),oO=ry,H2=I1,G2=T1,Y2=C1,J2=function(e){return function(t){return function(n){return e.map(t(wr(n)),function(r){return[r,ur(n)]})}}},aO=function(e){return function(t){return e.map(wr(t),function(n){return[n,ur(t)]})}},Er="Tuple",Z2={URI:Er,map:ah},mge=Ue(Z2),vge={URI:Er,bimap:B2,mapLeft:U2},gge={URI:Er,compose:D2},yge={URI:Er,map:ah,extend:q2,extract:oO},bge={URI:Er,reduce:QC,foldMap:eO,reduceRight:tO},_ge={URI:Er,map:ah,reduce:QC,foldMap:eO,reduceRight:tO,traverse:z2,sequence:aO},$ge=nO,Sge=rO,Tge={URI:Er,compose:D2,map:ah,bimap:B2,mapLeft:U2,extract:oO,extend:q2,reduce:QC,foldMap:eO,reduceRight:tO,traverse:z2,sequence:aO};const Ige=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:vge,Comonad:yge,Foldable:bge,Functor:Z2,Semigroupoid:gge,Traversable:_ge,URI:Er,bimap:K2,compose:V2,duplicate:hge,extend:iO,extract:oO,flap:mge,foldMap:H2,fst:wr,getApplicative:fge,getApply:ZC,getChain:XC,getChainRec:pge,getMonad:dge,map:$ge,mapFst:nO,mapLeft:Sge,mapSnd:rO,reduce:G2,reduceRight:Y2,sequence:aO,snd:ur,swap:lge,traverse:J2,tuple:Tge},Symbol.toStringTag,{value:"Module"})),Cge=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Oge(e,t){var n=HR(t,Qa(e));return{map:n.map,ap:n.ap,of:n.of,chain:function(r,i){return t.chain(r,function(o){return qt(o)?t.of(Ro(o.left)):i(o.right)})},alt:function(r,i){return t.chain(r,function(o){return N_(o)?t.of(o):t.map(i(),function(a){return qt(a)?Ro(e.concat(o.left,a.left)):a})})}}}const wge=Object.freeze(Object.defineProperty({__proto__:null,getValidationM:Oge},Symbol.toStringTag,{value:"Module"}));var X2=U_(void 0),Ege={concat:X2.concat,empty:void 0};const xge=Object.freeze(Object.defineProperty({__proto__:null,Monoid:Ege,Semigroup:X2},Symbol.toStringTag,{value:"Module"}));var Mge=function(e){return function(){return[void 0,e]}},Rge=function(e){return function(){var t=e(),n=t[0],r=t[1];return[[n,r],r]}},kge=function(e){return function(){var t=e(),n=t[0],r=n[0],i=n[1],o=t[1];return[r,i(o)]}},Age=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[[r,e(i)],i]}}},Fge=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[r,e(i)]}}},uh=function(e,t){return v(e,Q2(t))},Q2=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[e(r),i]}}},Vs="Writer",eq=function(e){return{URI:Vs,_E:void 0,of:function(t){return function(){return[t,e.empty]}}}},uO=function(e){return{URI:Vs,_E:void 0,map:uh,ap:function(t,n){return function(){var r=t(),i=r[0],o=r[1],a=n(),u=a[0],s=a[1];return[i(u),e.concat(o,s)]}}}},tq=function(e){var t=uO(e),n=eq(e);return{URI:Vs,_E:void 0,map:uh,ap:t.ap,of:n.of}};function nq(e){var t=uO(e);return{URI:Vs,_E:void 0,map:uh,ap:t.ap,chain:function(n,r){return function(){var i=n(),o=i[0],a=i[1],u=r(o)(),s=u[0],c=u[1];return[s,e.concat(a,c)]}}}}function Nge(e){var t=tq(e),n=nq(e);return{URI:Vs,_E:void 0,map:uh,ap:t.ap,of:t.of,chain:n.chain}}var sO={URI:Vs,map:uh},Pge=Ue(sO),Wge=function(e){return e()[0]},jge=function(e){return e()[1]},Lge=function(e){return e()[0]},Dge=function(e){return e()[1]},Bge=sO;const Uge=Object.freeze(Object.defineProperty({__proto__:null,Functor:sO,URI:Vs,censor:Fge,evalWriter:Lge,evaluate:Wge,execWriter:Dge,execute:jge,flap:Pge,getApplicative:tq,getApply:uO,getChain:nq,getMonad:Nge,getPointed:eq,listen:Rge,listens:Age,map:Q2,pass:kge,tell:Mge,writer:Bge},Symbol.toStringTag,{value:"Module"}));function qge(e){var t=function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[r(o),a]})}};return{map:t,evalWriter:function(n){return e.map(n(),function(r){var i=r[0];return i})},execWriter:function(n){return e.map(n(),function(r){r[0];var i=r[1];return i})},tell:function(n){return function(){return e.of([void 0,n])}},listen:function(n){return function(){return e.map(n(),function(r){var i=r[0],o=r[1];return[[i,o],o]})}},pass:function(n){return function(){return e.map(n(),function(r){var i=r[0],o=i[0],a=i[1],u=r[1];return[o,a(u)]})}},listens:function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[[o,r(a)],a]})}},censor:function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[o,r(a)]})}},getMonad:function(n){return{_E:void 0,map:t,of:function(r){return function(){return e.of([r,n.empty])}},ap:function(r,i){return function(){return e.chain(r(),function(o){var a=o[0],u=o[1];return e.map(i(),function(s){var c=s[0],l=s[1];return[a(c),n.concat(u,l)]})})}},chain:function(r,i){return function(){return e.chain(r(),function(o){var a=o[0],u=o[1];return e.map(i(a)(),function(s){var c=s[0],l=s[1];return[c,n.concat(u,l)]})})}}}}}}const ht=Wc(Object.freeze(Object.defineProperty({__proto__:null,alt:zG,alternative:VG,applicative:HG,apply:A6,array:oZ,bifunctor:aZ,boolean:hZ,booleanAlgebra:bZ,bounded:TZ,boundedDistributiveLattice:OZ,boundedJoinSemilattice:wZ,boundedLattice:EZ,boundedMeetSemilattice:xZ,category:MZ,chain:F6,chainRec:RZ,choice:FZ,comonad:NZ,compactable:OX,console:RX,const:VX,contravariant:HX,date:tQ,distributiveLattice:IZ,either:WN,eitherT:qQ,endomorphism:KQ,eq:_6,extend:VQ,field:YQ,filterable:ZQ,filterableWithIndex:XQ,foldable:iee,foldableWithIndex:aee,fromEither:GG,fromIO:uee,fromReader:xee,fromState:Yee,fromTask:Jee,fromThese:Zee,function:wM,functor:$6,functorWithIndex:Qee,group:ete,heytingAlgebra:tte,hkt:nte,identity:Ite,invariant:Cte,io:zte,ioEither:zne,ioOption:Wre,ioRef:Lre,joinSemilattice:Dre,json:qre,lattice:zre,magma:X6,map:Qie,meetSemilattice:eoe,monad:toe,monadIO:noe,monadTask:roe,monadThrow:ioe,monoid:goe,naturalTransformation:yoe,nonEmptyArray:DY,number:HY,option:IX,optionT:Vne,ord:G6,ordering:Coe,pipeable:qoe,pointed:zoe,predicate:DZ,profunctor:Koe,random:Yoe,reader:Eee,readerEither:Kae,readerT:Gae,readerTask:nse,readerTaskEither:xle,readonlyArray:_J,readonlyMap:gie,readonlyNonEmptyArray:J9,readonlyRecord:UG,readonlySet:Vle,readonlyTuple:ufe,record:sde,refinement:gde,ring:$de,semigroup:tR,semigroupoid:Sde,semiring:Ide,separated:E6,set:Vde,show:Xde,state:Gee,stateReaderTaskEither:dhe,stateT:epe,store:$he,string:pG,strong:Ihe,struct:whe,task:_ue,taskEither:dce,taskOption:Eme,taskThese:Eve,these:tve,theseT:rve,traced:Pve,traversable:jve,traversableWithIndex:Lve,tree:cge,tuple:Ige,unfoldable:Cge,validationT:wge,void:xge,witherable:hG,writer:Uge,writerT:Object.freeze(Object.defineProperty({__proto__:null,getWriterM:qge},Symbol.toStringTag,{value:"Module"})),zero:GY},Symbol.toStringTag,{value:"Module"})));var Cn={},df={},hn={},Ye={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getEndomorphismMonoid=e.not=e.SK=e.hole=e.pipe=e.untupled=e.tupled=e.absurd=e.decrement=e.increment=e.tuple=e.flow=e.flip=e.constVoid=e.constUndefined=e.constNull=e.constFalse=e.constTrue=e.constant=e.unsafeCoerce=e.identity=e.apply=e.getRing=e.getSemiring=e.getMonoid=e.getSemigroup=e.getBooleanAlgebra=void 0;var t=function(w){return function(){return{meet:function(O,M){return function(x){return w.meet(O(x),M(x))}},join:function(O,M){return function(x){return w.join(O(x),M(x))}},zero:function(){return w.zero},one:function(){return w.one},implies:function(O,M){return function(x){return w.implies(O(x),M(x))}},not:function(O){return function(M){return w.not(O(M))}}}}};e.getBooleanAlgebra=t;var n=function(w){return function(){return{concat:function(O,M){return function(x){return w.concat(O(x),M(x))}}}}};e.getSemigroup=n;var r=function(w){var O=(0,e.getSemigroup)(w);return function(){return{concat:O().concat,empty:function(){return w.empty}}}};e.getMonoid=r;var i=function(w){return{add:function(O,M){return function(x){return w.add(O(x),M(x))}},zero:function(){return w.zero},mul:function(O,M){return function(x){return w.mul(O(x),M(x))}},one:function(){return w.one}}};e.getSemiring=i;var o=function(w){var O=(0,e.getSemiring)(w);return{add:O.add,mul:O.mul,one:O.one,zero:O.zero,sub:function(M,x){return function(U){return w.sub(M(U),x(U))}}}};e.getRing=o;var a=function(w){return function(O){return O(w)}};e.apply=a;function u(w){return w}e.identity=u,e.unsafeCoerce=u;function s(w){return function(){return w}}e.constant=s,e.constTrue=s(!0),e.constFalse=s(!1),e.constNull=s(null),e.constUndefined=s(void 0),e.constVoid=e.constUndefined;function c(w){return function(O,M){return w(M,O)}}e.flip=c;function l(w,O,M,x,U,B,P,Z,ee){switch(arguments.length){case 1:return w;case 2:return function(){return O(w.apply(this,arguments))};case 3:return function(){return M(O(w.apply(this,arguments)))};case 4:return function(){return x(M(O(w.apply(this,arguments))))};case 5:return function(){return U(x(M(O(w.apply(this,arguments)))))};case 6:return function(){return B(U(x(M(O(w.apply(this,arguments))))))};case 7:return function(){return P(B(U(x(M(O(w.apply(this,arguments)))))))};case 8:return function(){return Z(P(B(U(x(M(O(w.apply(this,arguments))))))))};case 9:return function(){return ee(Z(P(B(U(x(M(O(w.apply(this,arguments)))))))))}}}e.flow=l;function f(){for(var w=[],O=0;O<arguments.length;O++)w[O]=arguments[O];return w}e.tuple=f;function d(w){return w+1}e.increment=d;function p(w){return w-1}e.decrement=p;function h(w){throw new Error("Called `absurd` function which should be uncallable")}e.absurd=h;function m(w){return function(O){return w.apply(void 0,O)}}e.tupled=m;function g(w){return function(){for(var O=[],M=0;M<arguments.length;M++)O[M]=arguments[M];return w(O)}}e.untupled=g;function _(w,O,M,x,U,B,P,Z,ee){switch(arguments.length){case 1:return w;case 2:return O(w);case 3:return M(O(w));case 4:return x(M(O(w)));case 5:return U(x(M(O(w))));case 6:return B(U(x(M(O(w)))));case 7:return P(B(U(x(M(O(w))))));case 8:return Z(P(B(U(x(M(O(w)))))));case 9:return ee(Z(P(B(U(x(M(O(w))))))));default:{for(var J=arguments[0],ge=1;ge<arguments.length;ge++)J=arguments[ge](J);return J}}}e.pipe=_,e.hole=h;var S=function(w,O){return O};e.SK=S;function C(w){return function(O){return!w(O)}}e.not=C;var b=function(){return{concat:function(w,O){return l(w,O)},empty:u}};e.getEndomorphismMonoid=b})(Ye);var Ae={},zge=de&&de.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.fromReadonlyNonEmptyArray=Ae.has=Ae.emptyRecord=Ae.emptyReadonlyArray=Ae.tail=Ae.head=Ae.isNonEmpty=Ae.singleton=Ae.right=Ae.left=Ae.isRight=Ae.isLeft=Ae.some=Ae.none=Ae.isSome=Ae.isNone=void 0;var Kge=function(e){return e._tag==="None"};Ae.isNone=Kge;var Vge=function(e){return e._tag==="Some"};Ae.isSome=Vge,Ae.none={_tag:"None"};var Hge=function(e){return{_tag:"Some",value:e}};Ae.some=Hge;var Gge=function(e){return e._tag==="Left"};Ae.isLeft=Gge;var Yge=function(e){return e._tag==="Right"};Ae.isRight=Yge;var Jge=function(e){return{_tag:"Left",left:e}};Ae.left=Jge;var Zge=function(e){return{_tag:"Right",right:e}};Ae.right=Zge;var Xge=function(e){return[e]};Ae.singleton=Xge;var Qge=function(e){return e.length>0};Ae.isNonEmpty=Qge;var eye=function(e){return e[0]};Ae.head=eye;var tye=function(e){return e.slice(1)};Ae.tail=tye,Ae.emptyReadonlyArray=[],Ae.emptyRecord={},Ae.has=Object.prototype.hasOwnProperty;var nye=function(e){return zge([e[0]],e.slice(1),!0)};Ae.fromReadonlyNonEmptyArray=nye;var rye=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),iye=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),oye=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&rye(t,e,n);return iye(t,e),t};Object.defineProperty(hn,"__esModule",{value:!0}),hn.sequenceS=hn.sequenceT=hn.getApplySemigroup=hn.apS=hn.apSecond=hn.apFirst=hn.ap=void 0;var aye=Ye,uye=oye(Ae);function sye(e,t){return function(n){return function(r){return e.ap(e.map(r,function(i){return function(o){return t.ap(i,o)}}),n)}}}hn.ap=sye;function cye(e){return function(t){return function(n){return e.ap(e.map(n,function(r){return function(){return r}}),t)}}}hn.apFirst=cye;function lye(e){return function(t){return function(n){return e.ap(e.map(n,function(){return function(r){return r}}),t)}}}hn.apSecond=lye;function fye(e){return function(t,n){return function(r){return e.ap(e.map(r,function(i){return function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))}}),n)}}}hn.apS=fye;function dye(e){return function(t){return{concat:function(n,r){return e.ap(e.map(n,function(i){return function(o){return t.concat(i,o)}}),r)}}}}hn.getApplySemigroup=dye;function cO(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,t===0?e.apply(null,i):cO(e,t-1,i)}}var lO={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function pye(e){return uye.has.call(lO,e)||(lO[e]=cO(aye.tuple,e-1,[])),lO[e]}function hye(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=pye(r),o=e.map(t[0],i),a=1;a<r;a++)o=e.ap(o,t[a]);return o}}hn.sequenceT=hye;function mye(e){var t=e.length;switch(t){case 1:return function(n){var r;return r={},r[e[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[e[0]]=n,i[e[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[e[0]]=n,o[e[1]]=r,o[e[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[e[0]]=n,a[e[1]]=r,a[e[2]]=i,a[e[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[e[0]]=n,u[e[1]]=r,u[e[2]]=i,u[e[3]]=o,u[e[4]]=a,u}}}}};default:return cO(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i},t-1,[])}}function vye(e){return function(t){for(var n=Object.keys(t),r=n.length,i=mye(n),o=e.map(t[n[0]],i),a=1;a<r;a++)o=e.ap(o,t[n[a]]);return o}}hn.sequenceS=vye;var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.getFunctorComposition=Gr.bindTo=Gr.flap=Gr.map=void 0;var gye=Ye;function rq(e,t){return function(n){return function(r){return e.map(r,function(i){return t.map(i,n)})}}}Gr.map=rq;function yye(e){return function(t){return function(n){return e.map(n,function(r){return r(t)})}}}Gr.flap=yye;function bye(e){return function(t){return function(n){return e.map(n,function(r){var i;return i={},i[t]=r,i})}}}Gr.bindTo=bye;function _ye(e,t){var n=rq(e,t);return{map:function(r,i){return(0,gye.pipe)(r,n(i))}}}Gr.getFunctorComposition=_ye,Object.defineProperty(df,"__esModule",{value:!0}),df.getApplicativeComposition=df.getApplicativeMonoid=void 0;var iq=hn,$ye=Ye,Sye=Gr;function Tye(e){var t=(0,iq.getApplySemigroup)(e);return function(n){return{concat:t(n).concat,empty:e.of(n.empty)}}}df.getApplicativeMonoid=Tye;function Iye(e,t){var n=(0,Sye.getFunctorComposition)(e,t).map,r=(0,iq.ap)(e,t);return{map:n,of:function(i){return e.of(t.of(i))},ap:function(i,o){return(0,$ye.pipe)(i,r(o))}}}df.getApplicativeComposition=Iye;var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.bind=Hs.chainFirst=void 0;function Cye(e){return function(t){return function(n){return e.chain(n,function(r){return e.map(t(r),function(){return r})})}}}Hs.chainFirst=Cye;function Oye(e){return function(t,n){return function(r){return e.chain(r,function(i){return e.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))})})}}}Hs.bind=Oye;var wy={};Object.defineProperty(wy,"__esModule",{value:!0}),wy.tailRec=void 0;var wye=function(e,t){for(var n=t(e);n._tag==="Left";)n=t(n.left);return n.right};wy.tailRec=wye;var Jt={},Eye=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),xye=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Mye=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Eye(t,e,n);return xye(t,e),t};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.filterOrElse=Jt.chainFirstEitherK=Jt.chainEitherK=Jt.fromEitherK=Jt.chainOptionK=Jt.fromOptionK=Jt.fromPredicate=Jt.fromOption=void 0;var Rye=Hs,fO=Ye,Gs=Mye(Ae);function oq(e){return function(t){return function(n){return e.fromEither(Gs.isNone(n)?Gs.left(t()):Gs.right(n.value))}}}Jt.fromOption=oq;function kye(e){return function(t,n){return function(r){return e.fromEither(t(r)?Gs.right(r):Gs.left(n(r)))}}}Jt.fromPredicate=kye;function aq(e){var t=oq(e);return function(n){var r=t(n);return function(i){return(0,fO.flow)(i,r)}}}Jt.fromOptionK=aq;function Aye(e,t){var n=aq(e);return function(r){var i=n(r);return function(o){return function(a){return t.chain(a,i(o))}}}}Jt.chainOptionK=Aye;function dO(e){return function(t){return(0,fO.flow)(t,e.fromEither)}}Jt.fromEitherK=dO;function Fye(e,t){var n=dO(e);return function(r){return function(i){return t.chain(i,n(r))}}}Jt.chainEitherK=Fye;function Nye(e,t){return(0,fO.flow)(dO(e),(0,Rye.chainFirst)(t))}Jt.chainFirstEitherK=Nye;function Pye(e,t){return function(n,r){return function(i){return t.chain(i,function(o){return e.fromEither(n(o)?Gs.right(o):Gs.left(r(o)))})}}}Jt.filterOrElse=Pye;var uq={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.right=e.left=e.flap=e.Functor=e.Bifunctor=e.URI=e.bimap=e.mapLeft=e.map=e.separated=void 0;var t=Ye,n=Gr,r=function(d,p){return{left:d,right:p}};e.separated=r;var i=function(d,p){return(0,t.pipe)(d,(0,e.map)(p))},o=function(d,p){return(0,t.pipe)(d,(0,e.mapLeft)(p))},a=function(d,p,h){return(0,t.pipe)(d,(0,e.bimap)(p,h))},u=function(d){return function(p){return(0,e.separated)((0,e.left)(p),d((0,e.right)(p)))}};e.map=u;var s=function(d){return function(p){return(0,e.separated)(d((0,e.left)(p)),(0,e.right)(p))}};e.mapLeft=s;var c=function(d,p){return function(h){return(0,e.separated)(d((0,e.left)(h)),p((0,e.right)(h)))}};e.bimap=c,e.URI="Separated",e.Bifunctor={URI:e.URI,mapLeft:o,bimap:a},e.Functor={URI:e.URI,map:i},e.flap=(0,n.flap)(e.Functor);var l=function(d){return d.left};e.left=l;var f=function(d){return d.right};e.right=f})(uq);var bu={},Wye=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),jye=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Lye=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Wye(t,e,n);return jye(t,e),t};Object.defineProperty(bu,"__esModule",{value:!0}),bu.filterE=bu.witherDefault=bu.wiltDefault=void 0;var sq=Lye(Ae);function Dye(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.separate)}}}bu.wiltDefault=Dye;function Bye(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.compact)}}}bu.witherDefault=Bye;function Uye(e){return function(t){var n=e.wither(t);return function(r){return function(i){return n(i,function(o){return t.map(r(o),function(a){return a?sq.some(o):sq.none})})}}}}bu.filterE=Uye,function(e){var t=de&&de.__createBinding||(Object.create?function(W,N,D,Ne){Ne===void 0&&(Ne=D);var j=Object.getOwnPropertyDescriptor(N,D);(!j||("get"in j?!N.__esModule:j.writable||j.configurable))&&(j={enumerable:!0,get:function(){return N[D]}}),Object.defineProperty(W,Ne,j)}:function(W,N,D,Ne){Ne===void 0&&(Ne=D),W[Ne]=N[D]}),n=de&&de.__setModuleDefault||(Object.create?function(W,N){Object.defineProperty(W,"default",{enumerable:!0,value:N})}:function(W,N){W.default=N}),r=de&&de.__importStar||function(W){if(W&&W.__esModule)return W;var N={};if(W!=null)for(var D in W)D!=="default"&&Object.prototype.hasOwnProperty.call(W,D)&&t(N,W,D);return n(N,W),N};Object.defineProperty(e,"__esModule",{value:!0}),e.fold=e.match=e.foldW=e.matchW=e.isRight=e.isLeft=e.fromOption=e.fromPredicate=e.FromEither=e.MonadThrow=e.throwError=e.ChainRec=e.Extend=e.extend=e.Alt=e.alt=e.altW=e.Bifunctor=e.mapLeft=e.bimap=e.Traversable=e.sequence=e.traverse=e.Foldable=e.reduceRight=e.foldMap=e.reduce=e.Monad=e.Chain=e.chain=e.chainW=e.Applicative=e.Apply=e.ap=e.apW=e.Pointed=e.of=e.Functor=e.map=e.getAltValidation=e.getApplicativeValidation=e.getWitherable=e.getFilterable=e.getCompactable=e.getSemigroup=e.getEq=e.getShow=e.URI=e.right=e.left=void 0,e.getValidation=e.getValidationMonoid=e.getValidationSemigroup=e.getApplyMonoid=e.getApplySemigroup=e.either=e.stringifyJSON=e.parseJSON=e.sequenceArray=e.traverseArray=e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex=e.traverseReadonlyNonEmptyArrayWithIndex=e.ApT=e.apSW=e.apS=e.bindW=e.bind=e.bindTo=e.Do=e.exists=e.elem=e.toError=e.toUnion=e.chainNullableK=e.fromNullableK=e.tryCatchK=e.tryCatch=e.fromNullable=e.orElse=e.orElseW=e.swap=e.filterOrElseW=e.filterOrElse=e.chainOptionK=e.fromOptionK=e.duplicate=e.flatten=e.flattenW=e.chainFirstW=e.chainFirst=e.apSecondW=e.apSecond=e.apFirstW=e.apFirst=e.flap=e.getOrElse=e.getOrElseW=void 0;var i=df,o=hn,a=Hs,u=wy,s=Jt,c=Ye,l=Gr,f=r(Ae),d=uq,p=bu;e.left=f.left,e.right=f.right;var h=function(W,N){return(0,c.pipe)(W,(0,e.map)(N))},m=function(W,N){return(0,c.pipe)(W,(0,e.ap)(N))},g=function(W,N){return(0,c.pipe)(W,(0,e.chain)(N))},_=function(W,N,D){return(0,c.pipe)(W,(0,e.reduce)(N,D))},S=function(W){return function(N,D){var Ne=(0,e.foldMap)(W);return(0,c.pipe)(N,Ne(D))}},C=function(W,N,D){return(0,c.pipe)(W,(0,e.reduceRight)(N,D))},b=function(W){var N=(0,e.traverse)(W);return function(D,Ne){return(0,c.pipe)(D,N(Ne))}},w=function(W,N,D){return(0,c.pipe)(W,(0,e.bimap)(N,D))},O=function(W,N){return(0,c.pipe)(W,(0,e.mapLeft)(N))},M=function(W,N){return(0,c.pipe)(W,(0,e.alt)(N))},x=function(W,N){return(0,c.pipe)(W,(0,e.extend)(N))},U=function(W,N){return(0,u.tailRec)(N(W),function(D){return(0,e.isLeft)(D)?(0,e.right)((0,e.left)(D.left)):(0,e.isLeft)(D.right)?(0,e.left)(N(D.right.left)):(0,e.right)((0,e.right)(D.right.right))})};e.URI="Either";var B=function(W,N){return{show:function(D){return(0,e.isLeft)(D)?"left(".concat(W.show(D.left),")"):"right(".concat(N.show(D.right),")")}}};e.getShow=B;var P=function(W,N){return{equals:function(D,Ne){return D===Ne||((0,e.isLeft)(D)?(0,e.isLeft)(Ne)&&W.equals(D.left,Ne.left):(0,e.isRight)(Ne)&&N.equals(D.right,Ne.right))}}};e.getEq=P;var Z=function(W){return{concat:function(N,D){return(0,e.isLeft)(D)?N:(0,e.isLeft)(N)?D:(0,e.right)(W.concat(N.right,D.right))}}};e.getSemigroup=Z;var ee=function(W){var N=(0,e.left)(W.empty);return{URI:e.URI,_E:void 0,compact:function(D){return(0,e.isLeft)(D)?D:D.right._tag==="None"?N:(0,e.right)(D.right.value)},separate:function(D){return(0,e.isLeft)(D)?(0,d.separated)(D,D):(0,e.isLeft)(D.right)?(0,d.separated)((0,e.right)(D.right.left),N):(0,d.separated)(N,(0,e.right)(D.right.right))}}};e.getCompactable=ee;var J=function(W){var N=(0,e.left)(W.empty),D=(0,e.getCompactable)(W),Ne=D.compact,j=D.separate,ie=function(he,Ie){return(0,e.isLeft)(he)||Ie(he.right)?he:N},me=function(he,Ie){return(0,e.isLeft)(he)?(0,d.separated)(he,he):Ie(he.right)?(0,d.separated)(N,(0,e.right)(he.right)):(0,d.separated)((0,e.right)(he.right),N)};return{URI:e.URI,_E:void 0,map:h,compact:Ne,separate:j,filter:ie,filterMap:function(he,Ie){if((0,e.isLeft)(he))return he;var st=Ie(he.right);return st._tag==="None"?N:(0,e.right)(st.value)},partition:me,partitionMap:function(he,Ie){if((0,e.isLeft)(he))return(0,d.separated)(he,he);var st=Ie(he.right);return(0,e.isLeft)(st)?(0,d.separated)((0,e.right)(st.left),N):(0,d.separated)(N,(0,e.right)(st.right))}}};e.getFilterable=J;var ge=function(W){var N=(0,e.getFilterable)(W),D=(0,e.getCompactable)(W);return{URI:e.URI,_E:void 0,map:h,compact:N.compact,separate:N.separate,filter:N.filter,filterMap:N.filterMap,partition:N.partition,partitionMap:N.partitionMap,traverse:b,sequence:e.sequence,reduce:_,foldMap:S,reduceRight:C,wither:(0,p.witherDefault)(e.Traversable,D),wilt:(0,p.wiltDefault)(e.Traversable,D)}};e.getWitherable=ge;var Te=function(W){return{URI:e.URI,_E:void 0,map:h,ap:function(N,D){return(0,e.isLeft)(N)?(0,e.isLeft)(D)?(0,e.left)(W.concat(N.left,D.left)):N:(0,e.isLeft)(D)?D:(0,e.right)(N.right(D.right))},of:e.of}};e.getApplicativeValidation=Te;var k=function(W){return{URI:e.URI,_E:void 0,map:h,alt:function(N,D){if((0,e.isRight)(N))return N;var Ne=D();return(0,e.isLeft)(Ne)?(0,e.left)(W.concat(N.left,Ne.left)):Ne}}};e.getAltValidation=k;var A=function(W){return function(N){return(0,e.isLeft)(N)?N:(0,e.right)(W(N.right))}};e.map=A,e.Functor={URI:e.URI,map:h},e.of=e.right,e.Pointed={URI:e.URI,of:e.of};var I=function(W){return function(N){return(0,e.isLeft)(N)?N:(0,e.isLeft)(W)?W:(0,e.right)(N.right(W.right))}};e.apW=I,e.ap=e.apW,e.Apply={URI:e.URI,map:h,ap:m},e.Applicative={URI:e.URI,map:h,ap:m,of:e.of};var $=function(W){return function(N){return(0,e.isLeft)(N)?N:W(N.right)}};e.chainW=$,e.chain=e.chainW,e.Chain={URI:e.URI,map:h,ap:m,chain:g},e.Monad={URI:e.URI,map:h,ap:m,of:e.of,chain:g};var R=function(W,N){return function(D){return(0,e.isLeft)(D)?W:N(W,D.right)}};e.reduce=R;var L=function(W){return function(N){return function(D){return(0,e.isLeft)(D)?W.empty:N(D.right)}}};e.foldMap=L;var X=function(W,N){return function(D){return(0,e.isLeft)(D)?W:N(D.right,W)}};e.reduceRight=X,e.Foldable={URI:e.URI,reduce:_,foldMap:S,reduceRight:C};var ne=function(W){return function(N){return function(D){return(0,e.isLeft)(D)?W.of((0,e.left)(D.left)):W.map(N(D.right),e.right)}}};e.traverse=ne;var ke=function(W){return function(N){return(0,e.isLeft)(N)?W.of((0,e.left)(N.left)):W.map(N.right,e.right)}};e.sequence=ke,e.Traversable={URI:e.URI,map:h,reduce:_,foldMap:S,reduceRight:C,traverse:b,sequence:e.sequence};var se=function(W,N){return function(D){return(0,e.isLeft)(D)?(0,e.left)(W(D.left)):(0,e.right)(N(D.right))}};e.bimap=se;var Fe=function(W){return function(N){return(0,e.isLeft)(N)?(0,e.left)(W(N.left)):N}};e.mapLeft=Fe,e.Bifunctor={URI:e.URI,bimap:w,mapLeft:O};var ze=function(W){return function(N){return(0,e.isLeft)(N)?W():N}};e.altW=ze,e.alt=e.altW,e.Alt={URI:e.URI,map:h,alt:M};var He=function(W){return function(N){return(0,e.isLeft)(N)?N:(0,e.right)(W(N))}};e.extend=He,e.Extend={URI:e.URI,map:h,extend:x},e.ChainRec={URI:e.URI,map:h,ap:m,chain:g,chainRec:U},e.throwError=e.left,e.MonadThrow={URI:e.URI,map:h,ap:m,of:e.of,chain:g,throwError:e.throwError},e.FromEither={URI:e.URI,fromEither:c.identity},e.fromPredicate=(0,s.fromPredicate)(e.FromEither),e.fromOption=(0,s.fromOption)(e.FromEither),e.isLeft=f.isLeft,e.isRight=f.isRight;var ut=function(W,N){return function(D){return(0,e.isLeft)(D)?W(D.left):N(D.right)}};e.matchW=ut,e.foldW=e.matchW,e.match=e.matchW,e.fold=e.match;var Ut=function(W){return function(N){return(0,e.isLeft)(N)?W(N.left):N.right}};e.getOrElseW=Ut,e.getOrElse=e.getOrElseW,e.flap=(0,l.flap)(e.Functor),e.apFirst=(0,o.apFirst)(e.Apply),e.apFirstW=e.apFirst,e.apSecond=(0,o.apSecond)(e.Apply),e.apSecondW=e.apSecond,e.chainFirst=(0,a.chainFirst)(e.Chain),e.chainFirstW=e.chainFirst,e.flattenW=(0,e.chainW)(c.identity),e.flatten=e.flattenW,e.duplicate=(0,e.extend)(c.identity),e.fromOptionK=(0,s.fromOptionK)(e.FromEither),e.chainOptionK=(0,s.chainOptionK)(e.FromEither,e.Chain),e.filterOrElse=(0,s.filterOrElse)(e.FromEither,e.Chain),e.filterOrElseW=e.filterOrElse;var en=function(W){return(0,e.isLeft)(W)?(0,e.right)(W.left):(0,e.left)(W.right)};e.swap=en;var yn=function(W){return function(N){return(0,e.isLeft)(N)?W(N.left):N}};e.orElseW=yn,e.orElse=e.orElseW;var mr=function(W){return function(N){return N==null?(0,e.left)(W):(0,e.right)(N)}};e.fromNullable=mr;var Ui=function(W,N){try{return(0,e.right)(W())}catch(D){return(0,e.left)(N(D))}};e.tryCatch=Ui;var ri=function(W,N){return function(){for(var D=[],Ne=0;Ne<arguments.length;Ne++)D[Ne]=arguments[Ne];return(0,e.tryCatch)(function(){return W.apply(void 0,D)},N)}};e.tryCatchK=ri;var Mo=function(W){var N=(0,e.fromNullable)(W);return function(D){return(0,c.flow)(D,N)}};e.fromNullableK=Mo;var Wa=function(W){var N=(0,e.fromNullableK)(W);return function(D){return(0,e.chain)(N(D))}};e.chainNullableK=Wa,e.toUnion=(0,e.foldW)(c.identity,c.identity);function qi(W){return W instanceof Error?W:new Error(String(W))}e.toError=qi;function vr(W){return function(N,D){if(D===void 0){var Ne=vr(W);return function(j){return Ne(N,j)}}return(0,e.isLeft)(D)?!1:W.equals(N,D.right)}}e.elem=vr;var ii=function(W){return function(N){return(0,e.isLeft)(N)?!1:W(N.right)}};e.exists=ii,e.Do=(0,e.of)(f.emptyRecord),e.bindTo=(0,l.bindTo)(e.Functor),e.bind=(0,a.bind)(e.Chain),e.bindW=e.bind,e.apS=(0,o.apS)(e.Apply),e.apSW=e.apS,e.ApT=(0,e.of)(f.emptyReadonlyArray);var zi=function(W){return function(N){var D=W(0,f.head(N));if((0,e.isLeft)(D))return D;for(var Ne=[D.right],j=1;j<N.length;j++){var ie=W(j,N[j]);if((0,e.isLeft)(ie))return ie;Ne.push(ie.right)}return(0,e.right)(Ne)}};e.traverseReadonlyNonEmptyArrayWithIndex=zi;var Ki=function(W){var N=(0,e.traverseReadonlyNonEmptyArrayWithIndex)(W);return function(D){return f.isNonEmpty(D)?N(D):e.ApT}};e.traverseReadonlyArrayWithIndex=Ki,e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex;var ja=function(W){return(0,e.traverseReadonlyArrayWithIndex)(function(N,D){return W(D)})};e.traverseArray=ja,e.sequenceArray=(0,e.traverseArray)(c.identity);function La(W,N){return(0,e.tryCatch)(function(){return JSON.parse(W)},N)}e.parseJSON=La;var Da=function(W,N){return(0,e.tryCatch)(function(){var D=JSON.stringify(W);if(typeof D!="string")throw new Error("Converting unsupported structure to JSON");return D},N)};e.stringifyJSON=Da,e.either={URI:e.URI,map:h,of:e.of,ap:m,chain:g,reduce:_,foldMap:S,reduceRight:C,traverse:b,sequence:e.sequence,bimap:w,mapLeft:O,alt:M,extend:x,chainRec:U,throwError:e.throwError},e.getApplySemigroup=(0,o.getApplySemigroup)(e.Apply),e.getApplyMonoid=(0,i.getApplicativeMonoid)(e.Applicative);var oi=function(W,N){return(0,o.getApplySemigroup)((0,e.getApplicativeValidation)(W))(N)};e.getValidationSemigroup=oi;var Ju=function(W,N){return(0,i.getApplicativeMonoid)((0,e.getApplicativeValidation)(W))(N)};e.getValidationMonoid=Ju;function id(W){var N=(0,e.getApplicativeValidation)(W).ap,D=(0,e.getAltValidation)(W).alt;return{URI:e.URI,_E:void 0,map:h,of:e.of,chain:g,bimap:w,mapLeft:O,reduce:_,foldMap:S,reduceRight:C,extend:x,traverse:b,sequence:e.sequence,chainRec:U,throwError:e.throwError,ap:N,alt:D}}e.getValidation=id}(Cn);var Ze=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),pf=globalThis&&globalThis.__assign||function(){return pf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},pf.apply(this,arguments)},qye=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},fo=Tt,Xe=function(e,t,n){return fo([{value:e,context:t,message:n}])},Oe=Ke,_e=function(){function e(t,n,r,i){this.name=t,this.is=n,this.validate=r,this.encode=i,this.decode=this.decode.bind(this)}return e.prototype.pipe=function(t,n){var r=this;return n===void 0&&(n="pipe(".concat(this.name,", ").concat(t.name,")")),new e(n,t.is,function(i,o){var a=r.validate(i,o);return ue(a)?a:t.validate(a.right,o)},this.encode===De&&t.encode===De?De:function(i){return r.encode(t.encode(i))})},e.prototype.asDecoder=function(){return this},e.prototype.asEncoder=function(){return this},e.prototype.decode=function(t){return this.validate(t,[{key:"",type:this,actual:t}])},e}(),De=function(e){return e};function cq(e){return e.displayName||e.name||"<function".concat(e.length,">")}function zye(e,t){return{key:e,type:t}}function wi(e,t,n,r){for(var i=e.length,o=Array(i+1),a=0;a<i;a++)o[a]=e[a];return o[i]={key:t,type:n,actual:r},o}function ha(e,t){for(var n=t.length,r=0;r<n;r++)e.push(t[r])}var Ys=Object.prototype.hasOwnProperty;function pO(e){return Object.keys(e).map(function(t){return"".concat(t,": ").concat(e[t].name)}).join(", ")}function sh(e){for(var t=0;t<e.length;t++)if(e[t].encode!==De)return!1;return!0}function lq(e){return"{ ".concat(pO(e)," }")}function fq(e){return"Partial<".concat(e,">")}function Kye(e,t,n,r){r===void 0&&(r="{ [K in ".concat(t.name,"]: ").concat(n.name," }"));var i=e.length;return new SO(r,function(o){return Ln.is(o)&&e.every(function(a){return n.is(o[a])})},function(o,a){var u=Ln.validate(o,a);if(ue(u))return u;for(var s=u.right,c={},l=[],f=!1,d=0;d<i;d++){var p=e[d],h=s[p],m=n.validate(h,wi(a,p,n,h));if(ue(m))ha(l,m.left);else{var g=m.right;f=f||g!==h,c[p]=g}}return l.length>0?fo(l):Oe(f||Object.keys(s).length!==i?c:s)},n.encode===De?De:function(o){for(var a={},u=0;u<i;u++){var s=e[u];a[s]=n.encode(o[s])}return a},t,n)}function hO(e){var t;if(vq(e)){var n=e.value;if(Ei.is(n))return t={},t[n]=null,t}else{if(Zye(e))return e.keys;if(yq(e)){var r=e.types.map(function(i){return hO(i)});return r.some(Ey.is)?void 0:Object.assign.apply(Object,qye([{}],r,!1))}}}function Vye(e,t,n){return n===void 0&&(n="{ [K in ".concat(e.name,"]: ").concat(t.name," }")),new SO(n,function(r){return Ln.is(r)?Object.keys(r).every(function(i){return e.is(i)&&t.is(r[i])}):mq(t)&&Array.isArray(r)},function(r,i){if(Ln.is(r)){for(var o={},a=[],u=Object.keys(r),s=u.length,c=!1,l=0;l<s;l++){var f=u[l],d=r[f],p=e.validate(f,wi(i,f,e,f));if(ue(p))ha(a,p.left);else{var h=p.right;c=c||h!==f,f=h;var m=t.validate(d,wi(i,f,t,d));if(ue(m))ha(a,m.left);else{var g=m.right;c=c||g!==d,o[f]=g}}}return a.length>0?fo(a):Oe(c?o:r)}return mq(t)&&Array.isArray(r)?Oe(r):Xe(r,i)},e.encode===De&&t.encode===De?De:function(r){for(var i={},o=Object.keys(r),a=o.length,u=0;u<a;u++){var s=o[u];i[String(e.encode(s))]=t.encode(r[s])}return i},e,t)}function dq(e){return"("+e.map(function(t){return t.name}).join(" | ")+")"}function mO(e,t){for(var n=!0,r=!0,i=!Ln.is(e),o=0,a=t;o<a.length;o++){var u=a[o];u!==e&&(n=!1),Ln.is(u)&&(r=!1)}if(n)return e;if(r)return t[t.length-1];for(var s={},c=0,l=t;c<l.length;c++){var u=l[c];for(var f in u)(!Ys.call(s,f)||i||u[f]!==e[f])&&(s[f]=u[f])}return s}function vO(e){switch(e._tag){case"RefinementType":case"ReadonlyType":return vO(e.type);case"InterfaceType":case"StrictType":case"PartialType":return e.props;case"IntersectionType":return e.types.reduce(function(t,n){return Object.assign(t,vO(n))},{})}}function pq(e,t){for(var n=Object.getOwnPropertyNames(e),r=!1,i={},o=0;o<n.length;o++){var a=n[o];Ys.call(t,a)?i[a]=e[a]:r=!0}return r?i:e}function Hye(e){return gq(e)?"{| ".concat(pO(e.props)," |}"):Xye(e)?fq("{| ".concat(pO(e.props)," |}")):"Exact<".concat(e.name,">")}function Gye(e){return e.length>0}var sr={};function hq(e,t){for(var n=[],r=0,i=e;r<i.length;r++){var o=i[r];t.indexOf(o)!==-1&&n.push(o)}return n}function Yye(e,t){if(e===sr)return t;if(t===sr)return e;var n=Object.assign({},e);for(var r in t)if(Ys.call(e,r)){var i=hq(e[r],t[r]);if(Gye(i))n[r]=i;else{n=sr;break}}else n[r]=t[r];return n}function Jye(e,t){if(e===sr||t===sr)return sr;var n=sr;for(var r in e)if(Ys.call(t,r)){var i=hq(e[r],t[r]);i.length===0&&(n===sr&&(n={}),n[r]=e[r].concat(t[r]))}return n}function mq(e){return e._tag==="AnyType"}function vq(e){return e._tag==="LiteralType"}function Zye(e){return e._tag==="KeyofType"}function gq(e){return e._tag==="InterfaceType"}function Xye(e){return e._tag==="PartialType"}function Qye(e){return e._tag==="StrictType"}function ebe(e){return e._tag==="ExactType"}function tbe(e){return e._tag==="RefinementType"}function nbe(e){return e._tag==="IntersectionType"}function yq(e){return e._tag==="UnionType"}function rbe(e){return e._tag==="RecursiveType"}var gO=[];function _u(e){if(gO.indexOf(e)!==-1)return sr;if(gq(e)||Qye(e)){var t=sr;for(var n in e.props){var r=e.props[n];vq(r)&&(t===sr&&(t={}),t[n]=[r.value])}return t}else{if(ebe(e)||tbe(e))return _u(e.type);if(nbe(e))return e.types.reduce(function(o,a){return Yye(o,_u(a))},sr);if(yq(e))return e.types.slice(1).reduce(function(o,a){return Jye(o,_u(a))},_u(e.types[0]));if(rbe(e)){gO.push(e);var i=_u(e.type);return gO.pop(),i}}return sr}function bq(e){var t=_u(e[0]),n=Object.keys(t),r=e.length,i=function(c){for(var l=t[c].slice(),f=[t[c]],d=1;d<r;d++){var p=e[d],h=_u(p),m=h[c];if(m===void 0)return"continue-keys";if(m.some(function(g){return l.indexOf(g)!==-1}))return"continue-keys";l.push.apply(l,m),f.push(m)}return{value:[c,f]}};e:for(var o=0,a=n;o<a.length;o++){var u=a[o],s=i(u);if(typeof s=="object")return s.value;switch(s){case"continue-keys":continue e}}}var _q=function(e){Ze(t,e);function t(){var n=e.call(this,"null",function(r){return r===null},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="NullType",n}return t}(_e),yO=new _q,$q=function(e){Ze(t,e);function t(){var n=e.call(this,"undefined",function(r){return r===void 0},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="UndefinedType",n}return t}(_e),Ey=new $q,Sq=function(e){Ze(t,e);function t(){var n=e.call(this,"void",Ey.is,Ey.validate,De)||this;return n._tag="VoidType",n}return t}(_e),Tq=new Sq,Iq=function(e){Ze(t,e);function t(){var n=e.call(this,"unknown",function(r){return!0},Oe,De)||this;return n._tag="UnknownType",n}return t}(_e),ibe=new Iq,Cq=function(e){Ze(t,e);function t(){var n=e.call(this,"string",function(r){return typeof r=="string"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="StringType",n}return t}(_e),Ei=new Cq,Oq=function(e){Ze(t,e);function t(){var n=e.call(this,"number",function(r){return typeof r=="number"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="NumberType",n}return t}(_e),Js=new Oq,wq=function(e){Ze(t,e);function t(){var n=e.call(this,"bigint",function(r){return typeof r=="bigint"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="BigIntType",n}return t}(_e),obe=new wq,Eq=function(e){Ze(t,e);function t(){var n=e.call(this,"boolean",function(r){return typeof r=="boolean"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="BooleanType",n}return t}(_e),xy=new Eq,xq=function(e){Ze(t,e);function t(){var n=e.call(this,"UnknownArray",Array.isArray,function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="AnyArrayType",n}return t}(_e),hf=new xq,Mq=function(e){Ze(t,e);function t(){var n=e.call(this,"UnknownRecord",function(r){var i=Object.prototype.toString.call(r);return i==="[object Object]"||i==="[object Window]"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="AnyDictionaryType",n}return t}(_e),Ln=new Mq,Rq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.value=a,u._tag="LiteralType",u}return t}(_e);function ch(e,t){t===void 0&&(t=JSON.stringify(e));var n=function(r){return r===e};return new Rq(t,n,function(r,i){return n(r)?Oe(e):Xe(r,i)},De,e)}var kq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.keys=a,u._tag="KeyofType",u}return t}(_e);function abe(e,t){t===void 0&&(t=Object.keys(e).map(function(r){return JSON.stringify(r)}).join(" | "));var n=function(r){return Ei.is(r)&&Ys.call(e,r)};return new kq(t,n,function(r,i){return n(r)?Oe(r):Xe(r,i)},De,e)}var Aq=function(e){Ze(t,e);function t(n,r,i,o,a,u){var s=e.call(this,n,r,i,o)||this;return s.type=a,s.predicate=u,s._tag="RefinementType",s}return t}(_e);function My(e,t,n){return CO(e,t,n)}var Ry=My(Js,function(e){return Number.isInteger(e)},"Int"),bO=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.runDefinition=a,u._tag="RecursiveType",u}return t}(_e);Object.defineProperty(bO.prototype,"type",{get:function(){return this.runDefinition()},enumerable:!0,configurable:!0});function _O(e,t){var n,r=function(){return n||(n=t(i),n.name=e),n},i=new bO(e,function(o){return r().is(o)},function(o,a){return r().validate(o,a)},function(o){return r().encode(o)},r);return i}var Fq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ArrayType",u}return t}(_e);function ky(e,t){return t===void 0&&(t="Array<".concat(e.name,">")),new Fq(t,function(n){return hf.is(n)&&n.every(e.is)},function(n,r){var i=hf.validate(n,r);if(ue(i))return i;for(var o=i.right,a=o.length,u=o,s=[],c=0;c<a;c++){var l=o[c],f=e.validate(l,wi(r,String(c),e,l));if(ue(f))ha(s,f.left);else{var d=f.right;d!==l&&(u===o&&(u=o.slice()),u[c]=d)}}return s.length>0?fo(s):Oe(u)},e.encode===De?De:function(n){return n.map(e.encode)},e)}var Nq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.props=a,u._tag="InterfaceType",u}return t}(_e);function $O(e,t){t===void 0&&(t=lq(e));var n=Object.keys(e),r=n.map(function(o){return e[o]}),i=n.length;return new Nq(t,function(o){if(Ln.is(o)){for(var a=0;a<i;a++){var u=n[a],s=o[u];if(s===void 0&&!Ys.call(o,u)||!r[a].is(s))return!1}return!0}return!1},function(o,a){var u=Ln.validate(o,a);if(ue(u))return u;for(var s=u.right,c=s,l=[],f=0;f<i;f++){var d=n[f],p=c[d],h=r[f],m=h.validate(p,wi(a,d,h,p));if(ue(m))ha(l,m.left);else{var g=m.right;(g!==p||g===void 0&&!Ys.call(c,d))&&(c===s&&(c=pf({},s)),c[d]=g)}}return l.length>0?fo(l):Oe(c)},sh(r)?De:function(o){for(var a=pf({},o),u=0;u<i;u++){var s=n[u],c=r[u].encode;c!==De&&(a[s]=c(o[s]))}return a},e)}var Pq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.props=a,u._tag="PartialType",u}return t}(_e);function ube(e,t){t===void 0&&(t=fq(lq(e)));var n=Object.keys(e),r=n.map(function(o){return e[o]}),i=n.length;return new Pq(t,function(o){if(Ln.is(o)){for(var a=0;a<i;a++){var u=n[a],s=o[u];if(s!==void 0&&!e[u].is(s))return!1}return!0}return!1},function(o,a){var u=Ln.validate(o,a);if(ue(u))return u;for(var s=u.right,c=s,l=[],f=0;f<i;f++){var d=n[f],p=c[d],h=e[d],m=h.validate(p,wi(a,d,h,p));if(ue(m))p!==void 0&&ha(l,m.left);else{var g=m.right;g!==p&&(c===s&&(c=pf({},s)),c[d]=g)}}return l.length>0?fo(l):Oe(c)},sh(r)?De:function(o){for(var a=pf({},o),u=0;u<i;u++){var s=n[u],c=o[s];c!==void 0&&(a[s]=r[u].encode(c))}return a},e)}var SO=function(e){Ze(t,e);function t(n,r,i,o,a,u){var s=e.call(this,n,r,i,o)||this;return s.domain=a,s.codomain=u,s._tag="DictionaryType",s}return t}(_e);function TO(e,t,n){var r=hO(e);return r?Kye(Object.keys(r),e,t,n):Vye(e,t,n)}var IO=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.types=a,u._tag="UnionType",u}return t}(_e);function lh(e,t){t===void 0&&(t=dq(e));var n=bq(e);if(n!==void 0&&e.length>0){var r=n[0],i=n[1],o=i.length,a=function(u){for(var s=0;s<o;s++)if(i[s].indexOf(u)!==-1)return s};return new Ay(t,function(u){if(Ln.is(u)){var s=a(u[r]);return s!==void 0?e[s].is(u):!1}return!1},function(u,s){var c=Ln.validate(u,s);if(ue(c))return c;var l=c.right,f=a(l[r]);if(f===void 0)return Xe(u,s);var d=e[f];return d.validate(l,wi(s,String(f),d,l))},sh(e)?De:function(u){var s=a(u[r]);if(s===void 0)throw new Error("no codec found to encode value in union codec ".concat(t));return e[s].encode(u)},e,r)}else return new IO(t,function(u){return e.some(function(s){return s.is(u)})},function(u,s){for(var c=[],l=0;l<e.length;l++){var f=e[l],d=f.validate(u,wi(s,String(l),f,u));if(ue(d))ha(c,d.left);else return Oe(d.right)}return fo(c)},sh(e)?De:function(u){for(var s=0,c=e;s<c.length;s++){var l=c[s];if(l.is(u))return l.encode(u)}throw new Error("no codec found to encode value in union type ".concat(t))},e)}var Wq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.types=a,u._tag="IntersectionType",u}return t}(_e);function sbe(e,t){t===void 0&&(t="(".concat(e.map(function(r){return r.name}).join(" & "),")"));var n=e.length;return new Wq(t,function(r){return e.every(function(i){return i.is(r)})},e.length===0?Oe:function(r,i){for(var o=[],a=[],u=0;u<n;u++){var s=e[u],c=s.validate(r,wi(i,String(u),s,r));ue(c)?ha(a,c.left):o.push(c.right)}return a.length>0?fo(a):Oe(mO(r,o))},e.length===0?De:function(r){return mO(r,e.map(function(i){return i.encode(r)}))},e)}var jq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.types=a,u._tag="TupleType",u}return t}(_e);function cbe(e,t){t===void 0&&(t="[".concat(e.map(function(r){return r.name}).join(", "),"]"));var n=e.length;return new jq(t,function(r){return hf.is(r)&&r.length===n&&e.every(function(i,o){return i.is(r[o])})},function(r,i){var o=hf.validate(r,i);if(ue(o))return o;for(var a=o.right,u=a.length>n?a.slice(0,n):a,s=[],c=0;c<n;c++){var l=a[c],f=e[c],d=f.validate(l,wi(i,String(c),f,l));if(ue(d))ha(s,d.left);else{var p=d.right;p!==l&&(u===a&&(u=a.slice()),u[c]=p)}}return s.length>0?fo(s):Oe(u)},sh(e)?De:function(r){return e.map(function(i,o){return i.encode(r[o])})},e)}var Lq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ReadonlyType",u}return t}(_e);function lbe(e,t){return t===void 0&&(t="Readonly<".concat(e.name,">")),new Lq(t,e.is,e.validate,e.encode,e)}var Dq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ReadonlyArrayType",u}return t}(_e);function Bq(e,t){t===void 0&&(t="ReadonlyArray<".concat(e.name,">"));var n=ky(e);return new Dq(t,n.is,n.validate,n.encode,e)}var fh=function(e,t){return qq($O(e),t)},Uq=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.type=a,u._tag="ExactType",u}return t}(_e);function qq(e,t){t===void 0&&(t=Hye(e));var n=vO(e);return new Uq(t,e.is,function(r,i){var o=Ln.validate(r,i);if(ue(o))return o;var a=e.validate(r,i);return ue(a)?a:Ke(pq(a.right,n))},function(r){return e.encode(pq(r,n))},e)}var zq=function(e){Ze(t,e);function t(){var n=e.call(this,"Function",function(r){return typeof r=="function"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="FunctionType",n}return t}(_e),fbe=new zq,Ay=function(e){Ze(t,e);function t(n,r,i,o,a,u){var s=e.call(this,n,r,i,o,a)||this;return s.tag=u,s}return t}(IO),dbe=function(e,t,n){n===void 0&&(n=dq(t));var r=lh(t,n);return r instanceof Ay?r:(console.warn("[io-ts] Cannot build a tagged union for ".concat(n,", returning a de-optimized union")),new Ay(n,r.is,r.validate,r.encode,t,e))},pbe=function(e,t){return{value:e,context:t}},Kq=function(e){return[{key:"",type:e}]},Vq=function(e){Ze(t,e);function t(){var n=e.call(this,"never",function(r){return!1},function(r,i){return Xe(r,i)},function(){throw new Error("cannot encode never")})||this;return n._tag="NeverType",n}return t}(_e),hbe=new Vq,Hq=function(e){Ze(t,e);function t(){var n=e.call(this,"any",function(r){return!0},Oe,De)||this;return n._tag="AnyType",n}return t}(_e),mbe=new Hq,vbe=Ln,Gq=function(e){Ze(t,e);function t(){var n=e.call(this,"object",function(r){return r!==null&&typeof r=="object"},function(r,i){return n.is(r)?Oe(r):Xe(r,i)},De)||this;return n._tag="ObjectType",n}return t}(_e),gbe=new Gq;function CO(e,t,n){return n===void 0&&(n="(".concat(e.name," | ").concat(cq(t),")")),new Aq(n,function(r){return e.is(r)&&t(r)},function(r,i){var o=e.validate(r,i);if(ue(o))return o;var a=o.right;return t(a)?Oe(a):Xe(a,i)},e.encode,e,t)}var ybe=CO(Js,Number.isInteger,"Integer"),bbe=TO,_be=function(e){Ze(t,e);function t(n,r,i,o,a){var u=e.call(this,n,r,i,o)||this;return u.props=a,u._tag="StrictType",u}return t}(_e);function $be(e){return e}function Sbe(e){return function(){return e}}const Q=Wc(Object.freeze(Object.defineProperty({__proto__:null,AnyArrayType:xq,AnyDictionaryType:Mq,AnyType:Hq,Array:hf,ArrayType:Fq,BigIntType:wq,BooleanType:Eq,Dictionary:vbe,DictionaryType:SO,ExactType:Uq,Function:fbe,FunctionType:zq,Int:Ry,Integer:ybe,InterfaceType:Nq,IntersectionType:Wq,KeyofType:kq,LiteralType:Rq,NeverType:Vq,NullType:_q,NumberType:Oq,ObjectType:Gq,PartialType:Pq,ReadonlyArrayType:Dq,ReadonlyType:Lq,RecursiveType:bO,RefinementType:Aq,StrictType:_be,StringType:Cq,TaggedUnionType:Ay,TupleType:jq,Type:_e,UndefinedType:$q,UnionType:IO,UnknownArray:hf,UnknownRecord:Ln,UnknownType:Iq,VoidType:Sq,alias:Sbe,any:mbe,appendContext:wi,array:ky,bigint:obe,boolean:xy,brand:My,clean:$be,dictionary:bbe,emptyTags:sr,exact:qq,failure:Xe,failures:fo,getContextEntry:zye,getDefaultContext:Kq,getDomainKeys:hO,getFunctionName:cq,getIndex:bq,getTags:_u,getValidationError:pbe,identity:De,interface:$O,intersection:sbe,keyof:abe,literal:ch,mergeAll:mO,never:hbe,null:yO,nullType:yO,number:Js,object:gbe,partial:ube,readonly:lbe,readonlyArray:Bq,record:TO,recursion:_O,refinement:CO,strict:fh,string:Ei,success:Oe,taggedUnion:dbe,tuple:cbe,type:$O,undefined:Ey,union:lh,unknown:ibe,void:Tq,voidType:Tq},Symbol.toStringTag,{value:"Module"})));var Zs={},Fy={},rt={};const xi=Wc(wM);function Yq(e,t,n){return n===void 0&&(n=e.name),new _e(n,e.is,e.validate,function(r){return t(e.encode(r))})}const Tbe=Wc(Object.freeze(Object.defineProperty({__proto__:null,mapOutput:Yq},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(rt,"__esModule",{value:!0}),rt.addType=rt.isEmpty=rt.objectToMap=rt.grouped=rt.formatDate=rt.formatDateTime=rt.filterDouble=rt.refineType=rt.nullable=void 0;const Ibe=G,Cbe=ht,Obe=xi,mf=(0,Ibe.__importStar)(Q),wbe=Tbe;function Ebe(e){return mf.union([e,mf.null,mf.undefined])}rt.nullable=Ebe;function xbe(e,t,n){return new mf.Type(t,e.is,(r,i)=>(0,Obe.pipe)(e.validate(r,i),Cbe.either.chain(o=>n(o)?mf.success(o):mf.failure(r,i))),e.encode)}rt.refineType=xbe;function Mbe(e){if(e==="")return null;const t=Number(e);return Number.isNaN(t)?null:t}rt.filterDouble=Mbe;function Rbe(e){return e.toISOString().replace(/\.\d{3}Z$/,"+0000")}rt.formatDateTime=Rbe;function kbe(e){return e.toISOString().replace(/T.*/,"")}rt.formatDate=kbe;function Abe(e,t){return e.reduce((n,r,i)=>(i%t===0?n.push([r]):n[Math.floor(i/t)].push(r),n),new Array)}rt.grouped=Abe;function Fbe(e){return new Map(Object.entries(e))}rt.objectToMap=Fbe;function Nbe(e){for(const t in e)return!1;return!0}rt.isEmpty=Nbe;function Pbe(e,t){return(0,wbe.mapOutput)(e,n=>({...n,__TYPE__:t}))}rt.addType=Pbe,Object.defineProperty(Fy,"__esModule",{value:!0}),Fy.WidgetKey=void 0;const Wbe=(0,G.__importStar)(Q),jbe=rt,Lbe=new RegExp("^[^<>]+$");Fy.WidgetKey=(0,jbe.refineType)(Wbe.string,"WidgetKey",e=>e.length===0||Lbe.test(e)),function(e){Object.defineProperty(e,"__esModule",{value:!0}),(0,G.__exportStar)(Fy,e)}(Zs);var OO={},wO={},Xs={},Jq;function kt(){if(Jq)return Xs;Jq=1,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.hasContentType=Xs.hasFieldContentType=void 0;const e=Cn,t=Qw();function n(i){var o;return r(i)&&i.__TYPE__===t.FieldContentType&&((o=i)===null||o===void 0?void 0:o.type)!==void 0&&typeof i.type=="string"&&(0,e.isRight)(t.FieldType.decode(i.type))}Xs.hasFieldContentType=n;function r(i){return typeof i=="object"&&i!==null&&"__TYPE__"in i}return Xs.hasContentType=r,Xs}var Zq;function Xq(){return Zq||(Zq=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmptyContent=e.EmptyLegacy=e.isEmptyContent=e.EmptyContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.EmptyContentType="EmptyContent";const a=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.EmptyContentType;e.isEmptyContent=a;const u=i.union([i.null,i.type({value:i.null})]),s=c=>new i.Type("EmptyLegacy",e.isEmptyContent,l=>(0,r.pipe)(u.decode(l),n.either.map(()=>({type:c,__TYPE__:e.EmptyContentType}))),()=>null);e.EmptyLegacy=s,e.EmptyContent=i.strict({type:i.string,__TYPE__:i.literal(e.EmptyContentType)})}(wO)),wO}var EO={},Dn={},po={},Ny={},at={},xO={};const ma=Wc(WN);Object.defineProperty(xO,"__esModule",{value:!0});const Dbe=G,Bbe=ma,Ube=xi,Py=(0,Dbe.__importStar)(Q);xO.default=new Py.Type("dateFromString",e=>e instanceof Date,(e,t)=>(0,Ube.pipe)(Py.string.validate(e,t),(0,Bbe.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?Py.failure(e,t):Py.success(r)})),e=>e.toISOString());var MO={};Object.defineProperty(MO,"__esModule",{value:!0});const qbe=G,zbe=ma,Kbe=xi,vf=(0,qbe.__importStar)(Q);MO.default=new vf.Type("dateFromStringOrNumber",e=>e instanceof Date,(e,t)=>(0,Kbe.pipe)(vf.union([vf.number,vf.string]).validate(e,t),(0,zbe.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?vf.failure(e,t):vf.success(r)})),e=>e);var RO={};Object.defineProperty(RO,"__esModule",{value:!0});const Vbe=G,Hbe=ma,Gbe=xi,Wy=(0,Vbe.__importStar)(Q);RO.default=new Wy.Type("dateFromTsMs",e=>e instanceof Date,(e,t)=>(0,Gbe.pipe)(Wy.number.validate(e,t),(0,Hbe.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?Wy.failure(e,t):Wy.success(r)})),e=>e.getTime());var kO={};Object.defineProperty(kO,"__esModule",{value:!0});const Ybe=G,Jbe=ma,Zbe=xi,Qs=(0,Ybe.__importStar)(Q);kO.default=new Qs.Type("IntFromNumber",Qs.Int.is,(e,t)=>(0,Zbe.pipe)(Qs.number.validate(e,t),(0,Jbe.chain)(n=>Qs.Int.is(n)?Qs.success(n):Qs.success(Math.round(n)))),Qs.Int.encode);var AO={};Object.defineProperty(AO,"__esModule",{value:!0});const Xbe=G,Qbe=ma,e_e=xi,gf=(0,Xbe.__importStar)(Q),t_e=/^([0-9]+)px$/;AO.default=new gf.Type("IntFromPixels",gf.Int.is,(e,t)=>(0,e_e.pipe)(gf.string.validate(e,t),(0,Qbe.chain)(n=>{try{const r=n.match(t_e);if(!r)return gf.failure(e,t);const i=parseInt(r[1]);return gf.success(i)}catch{return gf.failure(e,t)}})),String);var FO={};Object.defineProperty(FO,"__esModule",{value:!0});const n_e=(0,G.__importStar)(Q),r_e=rt;FO.default=(0,r_e.refineType)(n_e.string,"nonEmptyString",e=>e.trim().length>0);var NO={},jy={};Object.defineProperty(jy,"__esModule",{value:!0});const i_e=(0,G.__importStar)(Q),o_e=rt;jy.default=(0,o_e.nullable)(i_e.string),Object.defineProperty(NO,"__esModule",{value:!0});const a_e=G,u_e=ma,s_e=xi,PO=Q,c_e=(0,a_e.__importDefault)(jy);NO.default=new PO.Type("nonEmptyStringOrNull",e=>typeof e=="string"||e===null,(e,t)=>(0,s_e.pipe)(c_e.default.validate(e,t),(0,u_e.chain)(n=>typeof n=="string"&&n.length>0?(0,PO.success)(n):(0,PO.success)(null))),e=>e);var WO={};Object.defineProperty(WO,"__esModule",{value:!0});const l_e=(0,G.__importStar)(Q),f_e=rt;WO.default=(0,f_e.nullable)(l_e.number);var jO={};Object.defineProperty(jO,"__esModule",{value:!0});const d_e=G,p_e=ma,h_e=xi,Ly=(0,d_e.__importStar)(Q);jO.default=new Ly.Type("StringFromInt",Ly.string.is,(e,t)=>(0,h_e.pipe)(Ly.boolean.validate(e,t),(0,p_e.chain)(n=>Ly.success(n.toString()))),e=>e);var LO={};Object.defineProperty(LO,"__esModule",{value:!0});const m_e=G,v_e=ma,g_e=xi,Dy=(0,m_e.__importStar)(Q);LO.default=new Dy.Type("StringFromInt",Dy.string.is,(e,t)=>(0,g_e.pipe)(Dy.number.validate(e,t),(0,v_e.chain)(n=>Dy.success(n.toString()))),e=>e),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StringOrNull=e.StringFromNumber=e.StringFromBoolean=e.NumberOrNull=e.NonEmptyStringOrNull=e.NonEmptyString=e.IntFromPixels=e.IntFromNumber=e.Function=e.DateFromTsMs=e.DateFromStringOrNumber=e.DateFromString=void 0;const t=G;var n=xO;Object.defineProperty(e,"DateFromString",{enumerable:!0,get:function(){return(0,t.__importDefault)(n).default}});var r=MO;Object.defineProperty(e,"DateFromStringOrNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(r).default}});var i=RO;Object.defineProperty(e,"DateFromTsMs",{enumerable:!0,get:function(){return(0,t.__importDefault)(i).default}}),e.Function=(0,t.__importStar)(rt);var o=kO;Object.defineProperty(e,"IntFromNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(o).default}});var a=AO;Object.defineProperty(e,"IntFromPixels",{enumerable:!0,get:function(){return(0,t.__importDefault)(a).default}});var u=FO;Object.defineProperty(e,"NonEmptyString",{enumerable:!0,get:function(){return(0,t.__importDefault)(u).default}});var s=NO;Object.defineProperty(e,"NonEmptyStringOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(s).default}});var c=WO;Object.defineProperty(e,"NumberOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(c).default}});var l=jO;Object.defineProperty(e,"StringFromBoolean",{enumerable:!0,get:function(){return(0,t.__importDefault)(l).default}});var f=LO;Object.defineProperty(e,"StringFromNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(f).default}});var d=jy;Object.defineProperty(e,"StringOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(d).default}})}(at);var va={},DO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BooleanField=e.BooleanConfig=e.BooleanFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.BooleanFieldType="Boolean",e.BooleanConfig=n.exact(n.partial({label:r.StringOrNull,default_value:n.boolean,placeholder_true:n.string,placeholder_false:n.string})),e.BooleanField=n.exact(n.intersection([n.type({type:n.literal(e.BooleanFieldType)}),n.partial({config:e.BooleanConfig})]))})(DO);var BO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Color=e.ColorConfig=e.ColorFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.ColorFieldType="Color",e.ColorConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string})),e.Color=n.exact(n.intersection([n.type({type:n.literal(e.ColorFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.ColorConfig})]))})(BO);var UO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Date=e.DateConfig=e.DateFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.DateFieldType="Date",e.DateConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),e.Date=n.exact(n.intersection([n.type({type:n.literal(e.DateFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.DateConfig})]))})(UO);var qO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Embed=e.EmbedConfig=e.EmbedFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.EmbedFieldType="Embed",e.EmbedConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,useAsTitle:n.boolean})),e.Embed=n.exact(n.intersection([n.type({type:n.literal(e.EmbedFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.EmbedConfig})]))})(qO);var zO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GeoPoint=e.GeoPointConfig=e.GeoPointFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.GeoPointFieldType="GeoPoint",e.GeoPointConfig=n.exact(n.partial({label:r.StringOrNull})),e.GeoPoint=n.exact(n.intersection([n.type({type:n.literal(e.GeoPointFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.GeoPointConfig})]))})(zO);var KO={},dh={},By={},yf={},ec={};Object.defineProperty(ec,"__esModule",{value:!0}),ec.pipe=ec.pipeable=void 0;var VO=Ye,y_e=function(e){return typeof e.map=="function"},b_e=function(e){return typeof e.contramap=="function"},__e=function(e){return typeof e.mapWithIndex=="function"},$_e=function(e){return typeof e.ap=="function"},S_e=function(e){return typeof e.chain=="function"},T_e=function(e){return typeof e.bimap=="function"},I_e=function(e){return typeof e.extend=="function"},C_e=function(e){return typeof e.reduce=="function"},O_e=function(e){return typeof e.reduceWithIndex=="function"},w_e=function(e){return typeof e.alt=="function"},E_e=function(e){return typeof e.compact=="function"},x_e=function(e){return typeof e.filter=="function"},M_e=function(e){return typeof e.filterWithIndex=="function"},R_e=function(e){return typeof e.promap=="function"},k_e=function(e){return typeof e.compose=="function"},A_e=function(e){return typeof e.throwError=="function"};function F_e(e){var t={};if(y_e(e)){var n=function(I){return function($){return e.map($,I)}};t.map=n}if(b_e(e)){var r=function(I){return function($){return e.contramap($,I)}};t.contramap=r}if(__e(e)){var i=function(I){return function($){return e.mapWithIndex($,I)}};t.mapWithIndex=i}if($_e(e)){var o=function(I){return function($){return e.ap($,I)}},a=function(I){return function($){return e.ap(e.map($,function(R){return function(){return R}}),I)}};t.ap=o,t.apFirst=a,t.apSecond=function(I){return function($){return e.ap(e.map($,function(){return function(R){return R}}),I)}}}if(S_e(e)){var u=function(I){return function($){return e.chain($,I)}},s=function(I){return function($){return e.chain($,function(R){return e.map(I(R),function(){return R})})}},c=function(I){return e.chain(I,VO.identity)};t.chain=u,t.chainFirst=s,t.flatten=c}if(T_e(e)){var l=function(I,$){return function(R){return e.bimap(R,I,$)}},f=function(I){return function($){return e.mapLeft($,I)}};t.bimap=l,t.mapLeft=f}if(I_e(e)){var d=function(I){return function($){return e.extend($,I)}},p=function(I){return e.extend(I,VO.identity)};t.extend=d,t.duplicate=p}if(C_e(e)){var h=function(I,$){return function(R){return e.reduce(R,I,$)}},m=function(I){var $=e.foldMap(I);return function(R){return function(L){return $(L,R)}}},g=function(I,$){return function(R){return e.reduceRight(R,I,$)}};t.reduce=h,t.foldMap=m,t.reduceRight=g}if(O_e(e)){var _=function(I,$){return function(R){return e.reduceWithIndex(R,I,$)}},S=function(I){var $=e.foldMapWithIndex(I);return function(R){return function(L){return $(L,R)}}},C=function(I,$){return function(R){return e.reduceRightWithIndex(R,I,$)}};t.reduceWithIndex=_,t.foldMapWithIndex=S,t.reduceRightWithIndex=C}if(w_e(e)){var b=function(I){return function($){return e.alt($,I)}};t.alt=b}if(E_e(e)&&(t.compact=e.compact,t.separate=e.separate),x_e(e)){var w=function(I){return function($){return e.filter($,I)}},O=function(I){return function($){return e.filterMap($,I)}},M=function(I){return function($){return e.partition($,I)}},x=function(I){return function($){return e.partitionMap($,I)}};t.filter=w,t.filterMap=O,t.partition=M,t.partitionMap=x}if(M_e(e)){var U=function(I){return function($){return e.filterWithIndex($,I)}},B=function(I){return function($){return e.filterMapWithIndex($,I)}},P=function(I){return function($){return e.partitionWithIndex($,I)}},Z=function(I){return function($){return e.partitionMapWithIndex($,I)}};t.filterWithIndex=U,t.filterMapWithIndex=B,t.partitionWithIndex=P,t.partitionMapWithIndex=Z}if(R_e(e)){var ee=function(I,$){return function(R){return e.promap(R,I,$)}};t.promap=ee}if(k_e(e)){var J=function(I){return function($){return e.compose($,I)}};t.compose=J}if(A_e(e)){var ge=function(I){return function($){return $._tag==="None"?e.throwError(I()):e.of($.value)}},Te=function(I){return I._tag==="Left"?e.throwError(I.left):e.of(I.right)},k=function(I,$){return function(R){return I(R)?e.of(R):e.throwError($(R))}},A=function(I,$){return function(R){return e.chain(R,function(L){return I(L)?e.of(L):e.throwError($(L))})}};t.fromOption=ge,t.fromEither=Te,t.fromPredicate=k,t.filterOrElse=A}return t}ec.pipeable=F_e,ec.pipe=VO.pipe;var N_e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),P_e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),W_e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&N_e(t,e,n);return P_e(t,e),t};Object.defineProperty(yf,"__esModule",{value:!0}),yf.NumberFromString=void 0;var ph=W_e(Q),j_e=ec,L_e=Cn;yf.NumberFromString=new ph.Type("NumberFromString",ph.number.is,function(e,t){return j_e.pipe(ph.string.validate(e,t),L_e.chain(function(n){var r=+n;return isNaN(r)||n.trim()===""?ph.failure(e,t):ph.success(r)}))},String);var D_e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),B_e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),U_e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&D_e(t,e,n);return B_e(t,e),t};Object.defineProperty(By,"__esModule",{value:!0}),By.IntFromString=void 0;var hh=U_e(Q),Qq=yf,q_e=ec,z_e=Cn;By.IntFromString=new hh.Type("IntFromString",hh.Int.is,function(e,t){return q_e.pipe(Qq.NumberFromString.validate(e,t),z_e.chain(function(n){return hh.Int.is(n)?hh.success(n):hh.failure(e,t)}))},Qq.NumberFromString.encode),Object.defineProperty(dh,"__esModule",{value:!0});const K_e=G,V_e=Cn,ga=(0,K_e.__importStar)(Q),H_e=By,ez=at,tz=new ga.Type("SideConstraints",e=>!e||typeof e=="number",(e,t)=>V_e.either.chain(ga.union([ga.literal("auto"),ga.literal(""),ga.Int,H_e.IntFromString,ez.IntFromNumber,ez.IntFromPixels,ga.null]).validate(e,t),n=>n==="auto"||n===""?ga.success(null):ga.success(n)),e=>e),G_e=ga.partial({width:tz,height:tz});dh.default=G_e,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Image=e.ImageConfig=e.Thumbnail=e.ImageFieldType=void 0;const t=G,n=(0,t.__importStar)(Q),r=at,i=(0,t.__importDefault)(dh);e.ImageFieldType="Image",e.Thumbnail=n.exact(n.intersection([n.type({name:n.string}),i.default])),e.ImageConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,constraint:i.default,thumbnails:n.readonlyArray(e.Thumbnail)})),e.Image=n.exact(n.intersection([n.type({type:n.literal(e.ImageFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.ImageConfig})]))}(KO);var HO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationField=e.IntegrationFieldConfig=e.IntegrationFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.IntegrationFieldType="IntegrationFields",e.IntegrationFieldConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,catalog:n.string})),e.IntegrationField=n.exact(n.intersection([n.type({type:n.literal(e.IntegrationFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.IntegrationFieldConfig})]))})(HO);var GO={},bf={},Uy={},qy={};Object.defineProperty(qy,"__esModule",{value:!0}),qy.clone=void 0;function Y_e(e){var t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t}qy.clone=Y_e;var J_e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Z_e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),X_e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&J_e(t,e,n);return Z_e(t,e),t};Object.defineProperty(Uy,"__esModule",{value:!0}),Uy.withValidate=void 0;var Q_e=X_e(Q),e0e=qy;function t0e(e,t,n){n===void 0&&(n=e.name);var r=e0e.clone(e);return r.validate=t,r.decode=function(i){return t(i,Q_e.getDefaultContext(r))},r.name=n,r}Uy.withValidate=t0e;var n0e=de&&de.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),r0e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i0e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&n0e(t,e,n);return r0e(t,e),t};Object.defineProperty(bf,"__esModule",{value:!0}),bf.withFallback=void 0;var o0e=i0e(Q),a0e=Uy,u0e=Cn;function s0e(e,t,n){return n===void 0&&(n="withFallback("+e.name+")"),a0e.withValidate(e,function(r,i){return u0e.orElse(function(){return o0e.success(t)})(e.validate(r,i))},n)}bf.withFallback=s0e,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Link=e.LinkConfig=e.LinkFieldType=void 0;const t=G,n=Cn,r=(0,t.__importStar)(Q),i=bf,o=at,a=c=>{if(c instanceof Array&&c.reduce((f,d)=>f&&typeof d=="string",!0))return r.success(c)},u=c=>{if(typeof c=="string")return r.success([c])},s=new r.Type("MasksArrayString",c=>c instanceof Array,(c,l)=>n.either.chain(r.union([r.array(r.string),r.string]).validate(c,l),f=>a(f)||u(f)||r.failure(c,l)),c=>c);e.LinkFieldType="Link",e.LinkConfig=r.exact(r.partial({label:o.StringOrNull,useAsTitle:r.boolean,placeholder:r.string,select:(0,i.withFallback)(r.union([r.literal("media"),r.literal("document"),r.literal("web"),r.null]),null),customtypes:r.readonlyArray(r.string),masks:s,tags:s,allowTargetBlank:r.boolean})),e.Link=r.exact(r.intersection([r.type({type:r.literal(e.LinkFieldType)}),r.partial({fieldset:o.StringOrNull,config:e.LinkConfig})]))}(GO);var YO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Number=e.NumberConfig=e.NumberFieldType=void 0;const n=(0,G.__importStar)(Q),r=yf,i=at;e.NumberFieldType="Number",e.NumberConfig=n.exact(n.partial({label:i.StringOrNull,placeholder:n.string,min:n.union([n.number,r.NumberFromString]),max:n.union([n.number,r.NumberFromString]),step:n.union([n.number,r.NumberFromString])})),e.Number=n.exact(n.intersection([n.type({type:n.literal(e.NumberFieldType)}),n.partial({fieldset:i.StringOrNull,config:e.NumberConfig})]))})(YO);var JO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Range=e.RangeConfig=e.RangeFieldType=void 0;const n=(0,G.__importStar)(Q),r=yf,i=at;e.RangeFieldType="Range",e.RangeConfig=n.exact(n.partial({label:i.StringOrNull,placeholder:n.string,min:n.union([n.number,r.NumberFromString]),max:n.union([n.number,r.NumberFromString]),step:n.union([n.number,r.NumberFromString])})),e.Range=n.exact(n.intersection([n.type({type:n.literal(e.RangeFieldType)}),n.partial({fieldset:i.StringOrNull,config:e.RangeConfig})]))})(JO);var ZO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RichText=e.RichTextConfig=e.RichTextNodeTypeCodec=e.RichTextNodeType=e.DEFAULT_OPTION=e.RichTextFieldType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=at,u=(0,t.__importDefault)(dh);e.RichTextFieldType="StructuredText",e.DEFAULT_OPTION="paragraph",e.RichTextNodeType={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",strong:"strong",em:"em",preformatted:"preformatted",hyperlink:"hyperlink",image:"image",embed:"embed",list:"list-item",orderedList:"o-list-item",rtl:"rtl"},e.RichTextNodeTypeCodec=o.keyof({[e.RichTextNodeType.heading1]:null,[e.RichTextNodeType.heading2]:null,[e.RichTextNodeType.heading3]:null,[e.RichTextNodeType.heading4]:null,[e.RichTextNodeType.heading5]:null,[e.RichTextNodeType.heading6]:null,[e.RichTextNodeType.paragraph]:null,[e.RichTextNodeType.strong]:null,[e.RichTextNodeType.em]:null,[e.RichTextNodeType.preformatted]:null,[e.RichTextNodeType.hyperlink]:null,[e.RichTextNodeType.image]:null,[e.RichTextNodeType.embed]:null,[e.RichTextNodeType.list]:null,[e.RichTextNodeType.orderedList]:null,[e.RichTextNodeType.rtl]:null});const s=new o.Type("RichTextOptions",h=>typeof h=="string",h=>(0,i.pipe)(o.union([o.string,o.null]).decode(h),n.either.map(m=>{if(!m)return e.DEFAULT_OPTION;const _=m.split(",").map(S=>S.trim()).filter(S=>(0,r.getOrElseW)(()=>{})(e.RichTextNodeTypeCodec.decode(S)));return _.length?_.join(","):e.DEFAULT_OPTION})),h=>h),c=h=>{if(!h)return o.success([])},l=h=>{if(h instanceof Object){const m=h;if(!Object.entries(m).length)return o.success([]);if(m[""])return o.success(m[""].map(_=>_.name));const g=Object.entries(m).reduce((_,[,S])=>_.concat(S.map(C=>C.name)),[]).filter(Boolean);return o.success(g)}},f=h=>{if(h instanceof Array&&h.reduce((g,_)=>g&&typeof _=="string",!0))return o.success(h)},d=h=>{if(typeof h=="string")return o.success([h])},p=new o.Type("RichTextLabels",h=>h instanceof Array,(h,m)=>{const g=o.record(o.string,o.readonlyArray(o.record(o.literal("name"),o.string))),_=o.readonlyArray(o.string);return(0,i.pipe)(o.union([g,_,o.string,o.null]).decode(h),n.either.chain(S=>c(S)||f(S)||l(S)||d(S)||o.failure(h,m)))},h=>h);e.RichTextConfig=o.exact(o.partial({label:a.StringOrNull,placeholder:o.string,useAsTitle:o.boolean,single:s,multi:s,imageConstraint:u.default,labels:p,allowTargetBlank:o.boolean})),e.RichText=o.exact(o.intersection([o.type({type:o.literal(e.RichTextFieldType)}),o.partial({fieldset:a.StringOrNull,config:e.RichTextConfig})]))})(ZO);var XO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Select=e.SelectConfig=e.SelectFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.SelectFieldType="Select",e.SelectConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default_value:n.string,options:n.readonlyArray(n.union([n.string,r.StringFromNumber,r.StringFromBoolean]))})),e.Select=n.exact(n.intersection([n.type({type:n.literal(e.SelectFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.SelectConfig})]))})(XO);var QO={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Separator=e.SeparatorConfig=e.SeparatorFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.SeparatorFieldType="Separator",e.SeparatorConfig=n.exact(n.partial({label:r.StringOrNull})),e.Separator=n.exact(n.intersection([n.type({type:n.literal(e.SeparatorFieldType)}),n.partial({config:e.SeparatorConfig})]))})(QO);var ew={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Text=e.TextConfig=e.TextFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.TextFieldType="Text",e.TextConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),e.Text=n.exact(n.intersection([n.type({type:n.literal(e.TextFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.TextConfig})]))})(ew);var tw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.TimestampConfig=e.TimestampFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.TimestampFieldType="Timestamp",e.TimestampConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),e.Timestamp=n.exact(n.intersection([n.type({type:n.literal(e.TimestampFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.TimestampConfig})]))})(tw),Object.defineProperty(va,"__esModule",{value:!0}),va.NestableWidget=void 0;const c0e=(0,G.__importStar)(Q),l0e=DO,f0e=BO,d0e=UO,p0e=qO,h0e=zO,m0e=KO,v0e=HO,g0e=GO,y0e=YO,b0e=JO,_0e=ZO,$0e=XO,S0e=QO,T0e=ew,I0e=tw;va.NestableWidget=c0e.union([f0e.Color,l0e.BooleanField,p0e.Embed,h0e.GeoPoint,d0e.Date,y0e.Number,b0e.Range,_0e.RichText,$0e.Select,S0e.Separator,T0e.Text,I0e.Timestamp,g0e.Link,m0e.Image,v0e.IntegrationField]),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Group=e.GroupConfig=e.GroupFieldType=void 0;const n=(0,G.__importStar)(Q),r=Zs,i=at,o=va;e.GroupFieldType="Group",e.GroupConfig=n.exact(n.partial({label:i.StringOrNull,repeat:n.boolean,fields:n.record(r.WidgetKey,o.NestableWidget)})),e.Group=n.exact(n.intersection([n.type({type:n.literal(e.GroupFieldType)}),n.partial({fieldset:i.StringOrNull,icon:n.string,description:n.string,config:e.GroupConfig})]))}(Ny);var zy={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(DO,e),(0,t.__exportStar)(BO,e),(0,t.__exportStar)(UO,e),(0,t.__exportStar)(qO,e),(0,t.__exportStar)(zO,e),(0,t.__exportStar)(KO,e),(0,t.__exportStar)(HO,e),(0,t.__exportStar)(GO,e),(0,t.__exportStar)(va,e),(0,t.__exportStar)(YO,e),(0,t.__exportStar)(JO,e),(0,t.__exportStar)(ZO,e),(0,t.__exportStar)(XO,e),(0,t.__exportStar)(QO,e),(0,t.__exportStar)(ew,e),(0,t.__exportStar)(tw,e)})(zy);var nz={};(function(e){var t=de&&de.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageConstraint=void 0;var n=dh;Object.defineProperty(e,"ImageConstraint",{enumerable:!0,get:function(){return t(n).default}})})(nz);var rz={},Ky={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CompositeSlice=e.CompositeSliceConfig=e.CompositeSliceType=void 0;const n=(0,G.__importStar)(Q),r=Zs,i=at,o=va;e.CompositeSliceType="Slice",e.CompositeSliceConfig=n.exact(n.partial({label:i.StringOrNull})),e.CompositeSlice=n.exact(n.intersection([n.type({type:n.literal(e.CompositeSliceType)}),n.partial({fieldset:i.StringOrNull,description:n.string,icon:n.string,display:n.string,"non-repeat":n.record(r.WidgetKey,o.NestableWidget),repeat:n.record(r.WidgetKey,o.NestableWidget),config:e.CompositeSliceConfig})]))})(Ky);var mh={};Object.defineProperty(mh,"__esModule",{value:!0}),mh.LegacySlice=void 0;const C0e=(0,G.__importStar)(Q),O0e=Ny,w0e=va;mh.LegacySlice=C0e.union([w0e.NestableWidget,O0e.Group]);var vh={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SharedSlice=e.SharedSliceType=e.Variation=void 0;const n=(0,G.__importStar)(Q),r=bf,i=Zs,o=va,a="https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format";e.Variation=n.exact(n.intersection([n.type({id:n.string,name:n.string,description:n.string,imageUrl:(0,r.withFallback)(n.string,a),docURL:n.string,version:n.string}),n.partial({display:n.string,primary:n.record(i.WidgetKey,o.NestableWidget),items:n.record(i.WidgetKey,o.NestableWidget)})])),e.SharedSliceType="SharedSlice",e.SharedSlice=n.exact(n.intersection([n.type({id:n.string,type:n.literal(e.SharedSliceType),name:n.string,variations:n.readonlyArray(e.Variation)}),n.partial({description:n.string})]))})(vh);var gh={};Object.defineProperty(gh,"__esModule",{value:!0}),gh.SharedSliceRef=void 0;const nw=(0,G.__importStar)(Q),E0e=vh;gh.SharedSliceRef=nw.exact(nw.type({type:nw.literal(E0e.SharedSliceType)}));var iz={};Object.defineProperty(iz,"__esModule",{value:!0});var rw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Slices=e.DynamicSlices=e.StaticSlices=e.slicesReader=e.DynamicSlicesConfig=e.StaticSlicesConfig=e.slicesConfigReader=e.SlicesLabels=e.SlicesFieldType=e.LegacySlicesFieldType=void 0;const n=(0,G.__importStar)(Q),r=Zs,i=at,o=Ky,a=mh,u=vh,s=gh;e.LegacySlicesFieldType="Choice",e.SlicesFieldType="Slices",e.SlicesLabels=n.union([n.record(n.string,n.readonlyArray(n.exact(n.intersection([n.type({name:n.string}),n.partial({display:n.string})])))),n.null]);function c(d){return n.exact(n.partial({label:i.StringOrNull,labels:e.SlicesLabels,choices:n.record(r.WidgetKey,n.union([a.LegacySlice,o.CompositeSlice,d]))}))}e.slicesConfigReader=c,e.StaticSlicesConfig=c(u.SharedSlice),e.DynamicSlicesConfig=c(s.SharedSliceRef);const l={toStatic(d,p){const h=Object.entries(d.choices||{}).reduce((m,[g,_])=>{if(_.type==="SharedSlice"){const S=p.get(g);return S?{...m,[g]:S}:m}else return{...m,[g]:_}},{});return{...d,choices:h}}};function f(d){return n.exact(n.intersection([n.type({type:n.keyof({[e.SlicesFieldType]:null,[e.LegacySlicesFieldType]:null})}),n.partial({fieldset:i.StringOrNull,config:d})]))}e.slicesReader=f,e.StaticSlices=f(e.StaticSlicesConfig),e.DynamicSlices=f(e.DynamicSlicesConfig),e.Slices={toStatic(d,p){return d.config?{...d,config:l.toStatic(d.config,p)}:d}}})(rw);var Vy={};Object.defineProperty(Vy,"__esModule",{value:!0}),Vy.SlicesTypes=void 0;const x0e=(0,G.__importStar)(Q),M0e=Ky,R0e=vh;Vy.SlicesTypes=x0e.keyof({[M0e.CompositeSliceType]:null,[R0e.SharedSliceType]:null}),function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Ky,e),(0,t.__exportStar)(mh,e),(0,t.__exportStar)(vh,e),(0,t.__exportStar)(gh,e),(0,t.__exportStar)(iz,e),(0,t.__exportStar)(rw,e),(0,t.__exportStar)(Vy,e)}(rz);var iw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UID=e.UIDConfig=e.UIDFieldType=void 0;const n=(0,G.__importStar)(Q),r=at;e.UIDFieldType="UID",e.UIDConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),e.UID=n.exact(n.intersection([n.type({type:n.literal(e.UIDFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.UIDConfig})]))})(iw);var xr={};Object.defineProperty(xr,"__esModule",{value:!0}),xr.Widgets=xr.FieldType=xr.DynamicWidget=xr.StaticWidget=xr.widgetReader=void 0;const oz=(0,G.__importStar)(Q),az=Ny,Bn=zy,k0e=va,yh=rw,uz=iw;function ow(e){return oz.union([uz.UID,k0e.NestableWidget,az.Group,e])}xr.widgetReader=ow,xr.StaticWidget=ow(yh.StaticSlices),xr.DynamicWidget=ow(yh.DynamicSlices),xr.FieldType=oz.keyof({[Bn.ColorFieldType]:null,[Bn.BooleanFieldType]:null,[Bn.NumberFieldType]:null,[Bn.EmbedFieldType]:null,[Bn.GeoPointFieldType]:null,[Bn.DateFieldType]:null,[Bn.RangeFieldType]:null,[Bn.RichTextFieldType]:null,[Bn.SelectFieldType]:null,[Bn.SeparatorFieldType]:null,[Bn.TextFieldType]:null,[Bn.TimestampFieldType]:null,[Bn.LinkFieldType]:null,[Bn.ImageFieldType]:null,[Bn.IntegrationFieldType]:null,[uz.UIDFieldType]:null,[az.GroupFieldType]:null,[yh.SlicesFieldType]:null,[yh.LegacySlicesFieldType]:null}),xr.Widgets={toStatic(e,t){switch(e.type){case"Choice":case"Slices":return yh.Slices.toStatic(e,t);default:return e}}},function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Ny,e),(0,t.__exportStar)(zy,e),(0,t.__exportStar)(nz,e),(0,t.__exportStar)(rz,e),(0,t.__exportStar)(iw,e),(0,t.__exportStar)(xr,e)}(po),Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.defaultCtx=Dn.getFieldCtx=Dn.LegacyContentCtx=Dn.FieldOrSliceType=void 0;const A0e=(0,G.__importStar)(Q),sz=po;Dn.FieldOrSliceType=A0e.union([sz.FieldType,sz.SlicesTypes]);class aw{constructor(t,n,r){Object.defineProperty(this,"fieldKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prefixedKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fieldKey=t,this.fieldPath=n||[],this.allTypes=r||new Map;const i=Array.of(this.fieldPath,[this.fieldKey]).flat().join(".");this.prefixedKey=i,this.keyOfType=`${i}_TYPE`,this.fieldType=this.allTypes.get(this.prefixedKey)}}Dn.LegacyContentCtx=aw;function F0e(e,t,n){return new aw(e,[...t.fieldPath,t.fieldKey,...n||[]],t.allTypes)}Dn.getFieldCtx=F0e;function N0e(e,t=new Map){return new aw(e,[],t)}Dn.defaultCtx=N0e;var uw={},sw={},cz;function lz(){return cz||(cz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BooleanContent=e.BooleanLegacy=e.isBooleanContent=e.BooleanContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.BooleanContentType="BooleanContent";const a=s=>(0,o.hasContentType)(s)&&s.__TYPE__===e.BooleanContentType;e.isBooleanContent=a;const u=s=>new i.Type("BooleanLegacy",e.isBooleanContent,c=>(0,r.pipe)(i.boolean.decode(c),n.either.map(l=>e.BooleanContent.encode({value:l,__TYPE__:e.BooleanContentType}))),c=>({content:c.value,types:{[s.keyOfType]:"Boolean"}}));e.BooleanLegacy=u,e.BooleanContent=i.strict({__TYPE__:i.literal(e.BooleanContentType),value:i.boolean})}(sw)),sw}var cw={},fz;function lw(){return fz||(fz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedContent=e.EmbedLegacy=e.EmbedContentLegacy=e.isEmbedContent=e.EmbedContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=at,a=kt();e.EmbedContentType="EmbedContent";const u=c=>(0,a.hasContentType)(c)&&c.__TYPE__===e.EmbedContentType;e.isEmbedContent=u,e.EmbedContentLegacy=i.exact(i.intersection([i.type({embed_url:i.string,type:i.string}),i.partial({version:i.union([i.string,i.number,i.null]),title:o.StringOrNull,author_name:o.StringOrNull,author_url:o.StringOrNull,provider_name:o.StringOrNull,provider_url:o.StringOrNull,cache_age:i.union([i.string,i.number,i.null]),thumbnail_url:o.StringOrNull,thumbnail_width:o.NumberOrNull,thumbnail_height:o.NumberOrNull,html:o.StringOrNull})]));const s=c=>new i.Type("EmbedLegacy",e.isEmbedContent,l=>(0,r.pipe)(e.EmbedContentLegacy.decode(l),n.either.map(f=>({...f,all:l,__TYPE__:e.EmbedContentType}))),l=>({content:l.all,types:{[c.keyOfType]:"Embed"}}));e.EmbedLegacy=s,e.EmbedContent=i.intersection([e.EmbedContentLegacy,i.strict({__TYPE__:i.literal(e.EmbedContentType),all:i.unknown})])}(cw)),cw}var fw={},dw={},ya={};Object.defineProperty(ya,"__esModule",{value:!0});const P0e=G,W0e=ma,j0e=xi,Hy=(0,P0e.__importStar)(Q);function L0e(e){let t=0;for(;t<e.length&&e[t]<=" ";)t++;let n=e.length;for(;t<n&&e[n-1]<=" ";)n--;return e.substring(t,n)}ya.default=new Hy.Type("TrimmedString",Hy.string.is,(e,t)=>(0,j0e.pipe)(Hy.string.validate(e,t),(0,W0e.chain)(n=>Hy.success(L0e(n)))),e=>e);var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.FieldContentType=void 0,Yr.FieldContentType="FieldContent";var dz;function pz(){return dz||(dz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorContent=e.ColorLegacy=e.isColorContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=po,a=(0,t.__importDefault)(ya),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Color";e.isColorContent=c;const l=f=>new i.Type("ColorLegacy",e.isColorContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.ColorContent.encode({value:p,type:o.ColorFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.ColorFieldType}}));e.ColorLegacy=l,e.ColorContent=i.strict({type:i.literal(o.ColorFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(dw)),dw}var pw={},hz;function mz(){return hz||(hz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DateContent=e.DateLegacy=e.isDateContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=po,a=(0,t.__importDefault)(ya),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Date";e.isDateContent=c;const l=f=>new i.Type("DateLegacy",e.isDateContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.DateContent.encode({value:p,type:o.DateFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.DateFieldType}}));e.DateLegacy=l,e.DateContent=i.strict({type:i.literal(o.DateFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(pw)),pw}var hw={},vz;function gz(){return vz||(vz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NumberContent=e.NumberLegacy=e.isNumberContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=po,a=(0,t.__importDefault)(ya),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Number";e.isNumberContent=c;const l=f=>new i.Type("NumberLegacy",e.isNumberContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.NumberContent.encode({value:p,type:o.NumberFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.NumberFieldType}}));e.NumberLegacy=l,e.NumberContent=i.strict({type:i.literal(o.NumberFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(hw)),hw}var mw={},yz;function bz(){return yz||(yz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RangeContent=e.RangeLegacy=e.isRangeContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=po,a=(0,t.__importDefault)(ya),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Range";e.isRangeContent=c;const l=f=>new i.Type("RangeLegacy",e.isRangeContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.RangeContent.encode({value:p,type:o.RangeFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.RangeFieldType}}));e.RangeLegacy=l,e.RangeContent=i.strict({type:i.literal(o.RangeFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(mw)),mw}var vw={},_z;function $z(){return _z||(_z=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SelectContent=e.SelectLegacy=e.isSelectContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=po,a=(0,t.__importDefault)(ya),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Select";e.isSelectContent=c;const l=f=>new i.Type("SelectLegacy",e.isSelectContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.SelectContent.encode({value:p,type:o.SelectFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.SelectFieldType}}));e.SelectLegacy=l,e.SelectContent=i.strict({type:i.literal(o.SelectFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(vw)),vw}var gw={},Sz;function Tz(){return Sz||(Sz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TextContent=e.TextLegacy=e.isTextContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=po,a=(0,t.__importDefault)(ya),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Text";e.isTextContent=c;const l=f=>new i.Type("TextLegacy",e.isTextContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.TextContent.encode({value:p,type:o.TextFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.TextFieldType}}));e.TextLegacy=l,e.TextContent=i.strict({type:i.literal(o.TextFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(gw)),gw}var yw={},Iz;function Cz(){return Iz||(Iz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TimestampContent=e.TimestampLegacy=e.isTimestampContent=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=po,a=(0,t.__importDefault)(ya),u=kt(),s=Yr,c=f=>(0,u.hasContentType)(f)&&f.__TYPE__===s.FieldContentType&&(0,u.hasFieldContentType)(f)&&f.type==="Timestamp";e.isTimestampContent=c;const l=f=>new i.Type("TimestampLegacy",e.isTimestampContent,d=>(0,r.pipe)(a.default.decode(d),n.either.map(p=>e.TimestampContent.encode({value:p,type:o.TimestampFieldType,__TYPE__:s.FieldContentType}))),d=>({content:d.value,types:{[f.keyOfType]:o.TimestampFieldType}}));e.TimestampLegacy=l,e.TimestampContent=i.strict({type:i.literal(o.TimestampFieldType),value:a.default,__TYPE__:i.literal(s.FieldContentType)})}(yw)),yw}var Oz;function wz(){return Oz||(Oz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FieldContent=e.FieldType=void 0;const t=G,n=(0,t.__importStar)(Q),r=pz(),i=mz(),o=gz(),a=bz(),u=$z(),s=Tz(),c=Cz();e.FieldType=n.keyof({Text:null,Date:null,Timestamp:null,Color:null,Number:null,Range:null,Select:null}),e.FieldContent=n.union([i.DateContent,r.ColorContent,o.NumberContent,a.RangeContent,u.SelectContent,s.TextContent,c.TimestampContent]),(0,t.__exportStar)(pz(),e),(0,t.__exportStar)(Yr,e),(0,t.__exportStar)(mz(),e),(0,t.__exportStar)(gz(),e),(0,t.__exportStar)(bz(),e),(0,t.__exportStar)($z(),e),(0,t.__exportStar)(Tz(),e),(0,t.__exportStar)(Cz(),e)}(fw)),fw}var bw={},Ez;function xz(){return Ez||(Ez=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GeoPointContent=e.GeoPointLegacy=e.isGeoPointContent=e.GeoPointContentType=void 0;const t=G,n=ht,r=xi,i=(0,t.__importStar)(Q),o=kt();e.GeoPointContentType="GeoPointContent";const a=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.GeoPointContentType;e.isGeoPointContent=a;const u=i.strict({position:i.strict({lat:i.number,lng:i.number})}),s=c=>new i.Type("GeoPointLegacy",e.isGeoPointContent,l=>(0,r.pipe)(u.decode(l),n.either.map(f=>e.GeoPointContent.encode({...f,__TYPE__:e.GeoPointContentType}))),l=>({content:{position:l.position},types:{[c.keyOfType]:"GeoPoint"}}));e.GeoPointLegacy=s,e.GeoPointContent=i.intersection([u,i.strict({__TYPE__:i.literal(e.GeoPointContentType)})])}(bw)),bw}var _w={},ba={};Object.defineProperty(ba,"__esModule",{value:!0}),ba.withOptionals=ba.isNotEmpty=ba.zipObjects=void 0;function D0e(e,t){return[...new Set(Object.keys(e||{}).concat(Object.keys(t||{})))].reduce((r,i)=>{const o=e==null?void 0:e[i],a=t==null?void 0:t[i];return{...r,[i]:{left:o,right:a}}},{})}ba.zipObjects=D0e;function B0e(e){return Boolean(Object.keys(e).length)}ba.isNotEmpty=B0e;function U0e(e,t){return{...e,...t.reduce((n,[r,i])=>i?{...n,[r]:i}:n,{})}}ba.withOptionals=U0e;var Mz;function $w(){return Mz||(Mz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImageContent=e.ImageLegacy=e.ImageContentView=e.isImageContent=e.ImageContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=ba,a=at,u=kt();e.ImageContentType="ImageContent";const s=d=>(0,u.hasContentType)(d)&&d.__TYPE__===e.ImageContentType;e.isImageContent=s;const c=i.exact(i.type({id:i.string,url:i.string,width:i.number,height:i.number}));e.ImageContentView=i.exact(i.intersection([i.type({origin:c,width:i.number,height:i.number,edit:i.type({zoom:i.number,crop:i.type({x:i.number,y:i.number}),background:i.string})}),i.partial({url:i.string,credits:a.NonEmptyStringOrNull,alt:a.NonEmptyStringOrNull,provider:a.StringOrNull})]));const l=i.intersection([e.ImageContentView,i.partial({thumbnails:i.record(i.string,e.ImageContentView)})]),f=d=>new i.Type("ImageLegacy",e.isImageContent,p=>(0,r.pipe)(l.decode(p),n.either.map(h=>e.ImageContent.encode({...h,__TYPE__:e.ImageContentType}))),p=>({content:(0,o.withOptionals)({edit:p.edit,height:p.height,origin:p.origin,width:p.width},[["alt",p.alt],["credits",p.credits],["provider",p.provider],["thumbnails",p.thumbnails],["url",p.url]]),types:{[d.keyOfType]:"Image"}}));e.ImageLegacy=f,e.ImageContent=i.intersection([l,i.strict({__TYPE__:i.literal(e.ImageContentType)})])}(_w)),_w}var Sw={},Rz;function kz(){return Rz||(Rz=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationFieldContent=e.IntegrationFieldLegacy=e.isIntegrationFieldContent=e.IntegrationFieldContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.IntegrationFieldContentType="IntegrationFieldsContent";const a=s=>(0,o.hasContentType)(s)&&s.__TYPE__===e.IntegrationFieldContentType;e.isIntegrationFieldContent=a;const u=s=>new i.Type("IntegrationFieldLegacy",e.isIntegrationFieldContent,c=>(0,r.pipe)(i.string.decode(c),n.either.map(l=>e.IntegrationFieldContent.encode({value:l,__TYPE__:e.IntegrationFieldContentType}))),c=>({content:c.value,types:{[s.keyOfType]:"IntegrationFields"}}));e.IntegrationFieldLegacy=u,e.IntegrationFieldContent=i.strict({__TYPE__:i.literal(e.IntegrationFieldContentType),value:i.string})}(Sw)),Sw}var Tw={},Az=My(Ei,function(e){return e.length>0},"NonEmptyString");function Fz(e,t){t===void 0&&(t="NonEmptyArray<"+e.name+">");var n=ky(e);return new _e(t,function(r){return n.is(r)&&Nt(r)},function(r,i){return le(n.validate(r,i),Br(function(o){var a=U0(o);return je(a)?Xe(r,i):Oe(a.value)}))},function(r){return n.encode(r)})}function Nz(e,t,n){n===void 0&&(n="Set<"+e.name+">");var r=ky(e),i=BB(t),o=jB(t);return new _e(n,function(a){return a instanceof Set&&DB(e.is)(a)},function(a,u){return le(r.validate(a,u),Br(function(s){var c=o(s);return c.size!==s.length?Xe(a,u):Oe(c)}))},function(a){return r.encode(i(a))})}function q0e(e,t,n){return n===void 0&&(n="ReadonlySet<"+e.name+">"),Nz(e,t,n)}function Iw(e,t){return new _e(e,t,function(n,r){return t(n)?Oe(n):Xe(n,r)},De)}var z0e=function(e){return e instanceof Date},K0e=Iw("Date",z0e),V0e=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},H0e=function(e,t){return{get:e,reverseGet:t}},Pz=function(e){return $u(e.get,H(e.reverseGet,Zn))},G0e=function(e){return tc(H(e.get,yt),e.reverseGet)},Y0e=function(e){return _a(H(e.get,yt),H(e.reverseGet,Zn))},J0e=function(e){return _f(function(t){return function(n){return function(r){return t.map(n(e.get(r)),function(i){return e.reverseGet(i)})}}})},$u=function(e,t){return{get:e,set:t}},Cw=function(e){return _a(H(e.get,yt),e.set)},Z0e=function(e){return _f(function(t){return function(n){return function(r){return t.map(n(e.get(r)),function(i){return e.set(i)(r)})}}})},Wz=function(e){return function(t){return $u(function(n){return e.get(t.get(n))},function(n){return function(r){return t.set(e.set(n)(t.get(r)))(r)}})}},X0e=function(e){return function(t){return tc(H(t.getOption,Hd(e.getOption)),H(e.reverseGet,t.reverseGet))}},Q0e=function(e){return function(t){return nc(Ow(e))(Cw(t))}},e$e=function(){return $u(q,Zn)},t$e=function(e){return function(t){return $u(function(n){return t.get(n)[e]},function(n){return function(r){var i,o=t.get(r);return n===o[e]?r:t.set(Object.assign({},o,(i={},i[e]=n,i)))(r)}})}},n$e=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(n){return $u(function(r){for(var i=n.get(r),o={},a=0,u=e;a<u.length;a++){var s=u[a];o[s]=i[s]}return o},function(r){return function(i){for(var o=n.get(i),a=0,u=e;a<u.length;a++){var s=u[a];if(r[s]!==o[s])return n.set(Object.assign({},o,r))(i)}return i}})}},r$e=function(e){return function(t){return $u(function(n){return t.get(n)[e]},function(n){return function(r){var i=t.get(r);if(n===i[e])return r;var o=i.slice();return o[e]=n,t.set(o)(r)}})}},i$e=function(e){return function(t){return le(t,Wz(O$e().at(e)))}},tc=function(e,t){return{getOption:e,reverseGet:t}},Ow=function(e){return _a(e.getOption,function(t){return Lz(t)(e)})},jz=function(e){return _f(function(t){return function(n){return function(r){return le(e.getOption(r),Uo(function(){return t.of(r)},function(i){return t.map(n(i),function(o){return Lz(o)(e)(r)})}))}}})},o$e=function(e){return function(t){return function(n){return le(t.getOption(n),Xi(function(r){var i=e(r);return i===r?n:t.reverseGet(i)}))}}},a$e=function(e){return function(t){var n=o$e(e)(t);return function(r){return le(n(r),bS(function(){return r}))}}},Lz=function(e){return a$e(function(){return e})},u$e=function(e){return function(t){return nc(Cw(e))(Ow(t))}},s$e=function(){return tc(vs,q)},ww=function(e){return tc(Wv(e),q)},c$e=function(){return tc(q,yt)},l$e=function(){return tc(gl,Ke)},f$e=function(){return tc(function(e){return ue(e)?yt(e.left):nt},Tt)},_a=function(e,t){return{getOption:e,set:t}},d$e=function(e){return _f(function(t){return function(n){return function(r){return le(e.getOption(r),Uo(function(){return t.of(r)},function(i){return t.map(n(i),function(o){return e.set(o)(r)})}))}}})},Dz=function(e){return function(t){return function(n){return le(t.getOption(n),Xi(function(r){var i=e(r);return i===r?n:t.set(i)(n)}))}}},Bz=function(e){return function(t){var n=Dz(e)(t);return function(r){return le(n(r),bS(function(){return r}))}}},nc=function(e){return function(t){return _a(H(t.getOption,Hd(e.getOption)),function(n){return Bz(e.set(n))(t)})}},p$e=function(e){return function(t){return le(t,nc(S$e().index(e)))}},h$e=function(e){return function(t){return le(t,nc(T$e().index(e)))}},m$e=function(e){return function(t){return le(t,nc(I$e().index(e)))}},v$e=function(e){return _a(mv(e),function(t){return function(n){return le(hv(e)(n),Uo(function(){return n},function(r){return wv(r,t,n)}))}})},Uz=function(e,t,n){if(n[e]===t)return n;var r=V0e([n[0]],n.slice(1),!0);return r[e]=t,r},g$e=function(e){return _a(mv(e),function(t){return function(n){return le(hv(e)(n),Uo(function(){return n},function(r){return Uz(r,t,n)}))}})},_f=function(e){return{modifyF:e}};function Ew(e){return function(t){return _f(function(n){return function(r){return t.modifyF(n)(e.modifyF(n)(r))}})}}var y$e={URI:"Identity",map:function(e,t){return t(e)},of:q,ap:function(e,t){return e(t)}},b$e=function(e){return e.URI==="Identity"};function _$e(e){return function(){return _f(function(t){var n=b$e(t)?e.map:e.traverse(t);return function(r){return function(i){return n(i,r)}}})}}function $$e(e){return Ew(_$e(e)())}var xw=function(e){return{index:e}},S$e=function(){return xw(function(e){return _a(function(t){return ls(e,t)},function(t){return function(n){return le(ls(e,n),Uo(function(){return n},function(){return wv(e,t,n)}))}})})},T$e=function(){return xw(function(e){return _a(function(t){return ls(e,t)},function(t){return function(n){return le(ls(e,n),Uo(function(){return n},function(){return Uz(e,t,n)}))}})})},I$e=function(){return xw(function(e){return _a(function(t){return Xu(e,t)},function(t){return function(n){return n[e]===t||je(Xu(e,n))?n:A0(e,t)(n)}})})},C$e=function(e){return{at:e}};function O$e(){return C$e(function(e){return $u(function(t){return Xu(e,t)},Uo(function(){return zm(e)},function(t){return A0(e,t)}))})}var qz=H0e,Mw=Pz,Rw=G0e,kw=Y0e,Aw=J0e,w$e=function(e){return function(t){return qz(H(t.get,e.get),H(e.reverseGet,t.reverseGet))}},E$e=function(e){return qz(e.reverseGet,e.get)},x$e=function(e){return function(t){return function(n){return t.reverseGet(e(t.get(n)))}}},zz=$u,Gy=e$e,Su=Cw,$f=Z0e,rc=Wz,M$e=rc,R$e=H(Pz,rc),ic=Q0e,Fw=function(e){return H(Su,nc(e))},k$e=function(e){return H($f,Ew(e))},Kz=function(e){return function(t){return function(n){var r=t.get(n),i=e(r);return r===i?n:t.set(i)(n)}}};function A$e(e){return function(t){return function(n){return function(r){return le(n.get(r),t,function(i){return e.map(i,function(o){return n.set(o)(r)})})}}}}var F$e=function(e){return ic(s$e())(e)};function N$e(e){return ic(ww(e))}var Vz=t$e,Hz=n$e,P$e=r$e,W$e=function(e){return H(Su,p$e(e))},j$e=function(e){return H(Su,h$e(e))},L$e=function(e){return H(Su,m$e(e))},D$e=i$e,B$e=ic(c$e()),U$e=ic(l$e()),q$e=ic(f$e());function z$e(e){return H($f,$$e(e))}function K$e(e){return Fw(v$e(e))}function V$e(e){return Fw(g$e(e))}var H$e=function(e,t){return function(n){return Gz(n,e,t)}},Gz=function(e,t,n){return zz(H(e.get,t),H(n,e.set))},Yy="monocle-ts/Lens",G$e={URI:Yy,imap:Gz},Yz={URI:Yy,compose:function(e,t){return rc(e)(t)}},Y$e={URI:Yy,compose:Yz.compose,id:Gy};const J$e=Object.freeze(Object.defineProperty({__proto__:null,Category:Y$e,Invariant:G$e,Semigroupoid:Yz,URI:Yy,asOptional:Su,asTraversal:$f,atKey:D$e,component:P$e,compose:rc,composeIso:R$e,composeLens:M$e,composeOptional:Fw,composePrism:ic,composeTraversal:k$e,filter:N$e,findFirst:K$e,findFirstNonEmpty:V$e,fromNullable:F$e,id:Gy,imap:H$e,index:W$e,indexNonEmpty:j$e,key:L$e,left:q$e,lens:zz,modify:Kz,modifyF:A$e,prop:Vz,props:Hz,right:U$e,some:B$e,traverse:z$e},Symbol.toStringTag,{value:"Module"}));var Jz=d$e,oc=nc,Z$e=Dz,X$e=Bz,Q$e=ww,Nw=Ow,Pw=jz,Ww=X0e,eSe=u$e,$a=Ew,Zz=function(e){return function(t){return t.modifyF(y$e)(e)}},tSe=function(e){return Zz(function(){return e})};function nSe(e){return $a(jz(ww(e)))}var Xz=function(e){return new eK(e.get,e.reverseGet)},Sf=function(e){return new jw(e.get,e.set)},bh=function(e){return new tK(e.getOption,e.reverseGet)},Jr=function(e){return new rSe(e.getOption,e.set)},Mr=function(e){return new iSe(e.modifyF)},Qz=function(e,t,n){var r;return n===e[t]?e:Object.assign({},e,(r={},r[t]=n,r))},eK=function(){function e(t,n){this.get=t,this.reverseGet=n,this._tag="Iso",this.unwrap=this.get,this.to=this.get,this.wrap=this.reverseGet,this.from=this.reverseGet}return e.prototype.reverse=function(){return Xz(E$e(this))},e.prototype.modify=function(t){return x$e(t)(this)},e.prototype.asLens=function(){return Sf(Mw(this))},e.prototype.asPrism=function(){return bh(Rw(this))},e.prototype.asOptional=function(){return Jr(kw(this))},e.prototype.asTraversal=function(){return Mr(Aw(this))},e.prototype.asFold=function(){var t=this;return new Tf(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.asGetter=function(){var t=this;return new rK(function(n){return t.get(n)})},e.prototype.asSetter=function(){var t=this;return new _h(function(n){return t.modify(n)})},e.prototype.compose=function(t){return Xz(w$e(t)(this))},e.prototype.composeIso=function(t){return this.compose(t)},e.prototype.composeLens=function(t){return Sf(le(this,Mw,rc(t)))},e.prototype.composePrism=function(t){return bh(le(this,Rw,Ww(t)))},e.prototype.composeOptional=function(t){return Jr(le(this,kw,oc(t)))},e.prototype.composeTraversal=function(t){return Mr(le(this,Aw,$a(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeGetter=function(t){return this.asGetter().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e}(),jw=function(){function e(t,n){this.get=t,this.set=n,this._tag="Lens"}return e.fromPath=function(){var t=e.fromProp();return function(n){var r=t(n[0]);return n.slice(1).reduce(function(i,o){return i.compose(t(o))},r)}},e.fromProp=function(){return function(t){return Sf(le(Gy(),Vz(t)))}},e.fromProps=function(){return function(t){return Sf(le(Gy(),Hz.apply(J$e,t)))}},e.fromNullableProp=function(){return function(t,n){return new e(function(r){var i=vs(r[t]);return je(i)?n:i.value},function(r){return function(i){return Qz(i,t,r)}})}},e.prototype.modify=function(t){return Kz(t)(this)},e.prototype.asOptional=function(){return Jr(Su(this))},e.prototype.asTraversal=function(){return Mr($f(this))},e.prototype.asSetter=function(){var t=this;return new _h(function(n){return t.modify(n)})},e.prototype.asGetter=function(){var t=this;return new rK(function(n){return t.get(n)})},e.prototype.asFold=function(){var t=this;return new Tf(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.compose=function(t){return Sf(rc(t)(this))},e.prototype.composeLens=function(t){return this.compose(t)},e.prototype.composeGetter=function(t){return this.asGetter().compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeOptional=function(t){return Jr(le(this,Su,oc(t)))},e.prototype.composeTraversal=function(t){return Mr(le(this,$f,$a(t)))},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeIso=function(t){return Sf(le(this,rc(le(t,Mw))))},e.prototype.composePrism=function(t){return Jr(ic(t)(this))},e}(),tK=function(){function e(t,n){this.getOption=t,this.reverseGet=n,this._tag="Prism"}return e.fromPredicate=function(t){return bh(Q$e(t))},e.some=function(){return nK},e.prototype.modify=function(t){var n=this;return function(r){var i=n.modifyOption(t)(r);return je(i)?r:i.value}},e.prototype.modifyOption=function(t){var n=this;return function(r){return JF.map(n.getOption(r),function(i){var o=t(i);return o===i?r:n.reverseGet(o)})}},e.prototype.set=function(t){return this.modify(function(){return t})},e.prototype.asOptional=function(){return Jr(Nw(this))},e.prototype.asTraversal=function(){return Mr(Pw(this))},e.prototype.asSetter=function(){var t=this;return new _h(function(n){return t.modify(n)})},e.prototype.asFold=function(){var t=this;return new Tf(function(n){return function(r){return function(i){var o=t.getOption(i);return je(o)?n.empty:r(o.value)}}})},e.prototype.compose=function(t){return bh(Ww(t)(this))},e.prototype.composePrism=function(t){return this.compose(t)},e.prototype.composeOptional=function(t){return Jr(le(this,Nw,oc(t)))},e.prototype.composeTraversal=function(t){return Mr(le(this,Pw,$a(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeIso=function(t){return bh(le(this,Ww(le(t,Rw))))},e.prototype.composeLens=function(t){return Jr(eSe(t)(this))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),nK=new tK(q,yt),rSe=function(){function e(t,n){this.getOption=t,this.set=n,this._tag="Optional"}return e.fromPath=function(){var t=e.fromNullableProp();return function(n){var r=t(n[0]);return n.slice(1).reduce(function(i,o){return i.compose(t(o))},r)}},e.fromNullableProp=function(){return function(t){return new e(function(n){return vs(n[t])},function(n){return function(r){return r[t]==null?r:Qz(r,t,n)}})}},e.fromOptionProp=function(){var t=jw.fromProp();return function(n){return t(n).composePrism(nK)}},e.prototype.modify=function(t){return X$e(t)(this)},e.prototype.modifyOption=function(t){return Z$e(t)(this)},e.prototype.asTraversal=function(){return Mr(Jz(this))},e.prototype.asFold=function(){var t=this;return new Tf(function(n){return function(r){return function(i){var o=t.getOption(i);return je(o)?n.empty:r(o.value)}}})},e.prototype.asSetter=function(){var t=this;return new _h(function(n){return t.modify(n)})},e.prototype.compose=function(t){return Jr(oc(t)(this))},e.prototype.composeOptional=function(t){return this.compose(t)},e.prototype.composeTraversal=function(t){return Mr(le(this,Jz,$a(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeLens=function(t){return Jr(le(this,oc(le(t,Su))))},e.prototype.composePrism=function(t){return Jr(le(this,oc(le(t,Nw))))},e.prototype.composeIso=function(t){return Jr(le(this,oc(le(t,kw))))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),iSe=function(){function e(t){this.modifyF=t,this._tag="Traversal"}return e.prototype.modify=function(t){return Zz(t)(this)},e.prototype.set=function(t){return tSe(t)(this)},e.prototype.filter=function(t){return Mr(nSe(t)(this))},e.prototype.asFold=function(){var t=this;return new Tf(function(n){return function(r){return t.modifyF(QF(n))(function(i){return yl(r(i))})}})},e.prototype.asSetter=function(){var t=this;return new _h(function(n){return t.modify(n)})},e.prototype.compose=function(t){return Mr($a(t)(this))},e.prototype.composeTraversal=function(t){return this.compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeOptional=function(t){return this.compose(t.asTraversal())},e.prototype.composeLens=function(t){return Mr(le(this,$a(le(t,$f))))},e.prototype.composePrism=function(t){return Mr(le(this,$a(le(t,Pw))))},e.prototype.composeIso=function(t){return Mr(le(this,$a(le(t,Aw))))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),rK=function(){function e(t){this.get=t,this._tag="Getter"}return e.prototype.asFold=function(){var t=this;return new Tf(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.compose=function(t){var n=this;return new e(function(r){return t.get(n.get(r))})},e.prototype.composeGetter=function(t){return this.compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeLens=function(t){return this.compose(t.asGetter())},e.prototype.composeIso=function(t){return this.compose(t.asGetter())},e.prototype.composeTraversal=function(t){return this.asFold().compose(t.asFold())},e.prototype.composeOptional=function(t){return this.asFold().compose(t.asFold())},e.prototype.composePrism=function(t){return this.asFold().compose(t.asFold())},e}(),Tf=function(){function e(t){this.foldMap=t,this._tag="Fold",this.getAll=t(Z$())(Xa),this.exist=t(wj),this.all=t(Oj),this.foldMapFirst=t(ZF())}return e.prototype.compose=function(t){var n=this;return new e(function(r){return function(i){return n.foldMap(r)(t.foldMap(r)(i))}})},e.prototype.composeFold=function(t){return this.compose(t)},e.prototype.composeGetter=function(t){return this.compose(t.asFold())},e.prototype.composeTraversal=function(t){return this.compose(t.asFold())},e.prototype.composeOptional=function(t){return this.compose(t.asFold())},e.prototype.composeLens=function(t){return this.compose(t.asFold())},e.prototype.composePrism=function(t){return this.compose(t.asFold())},e.prototype.composeIso=function(t){return this.compose(t.asFold())},e.prototype.find=function(t){return this.foldMapFirst(Wv(t))},e.prototype.headOption=function(t){return this.find(function(){return!0})(t)},e}(),_h=function(){function e(t){this.modify=t,this._tag="Setter"}return e.prototype.set=function(t){return this.modify(Zn(t))},e.prototype.compose=function(t){var n=this;return new e(function(r){return n.modify(t.modify(r))})},e.prototype.composeSetter=function(t){return this.compose(t)},e.prototype.composeTraversal=function(t){return this.compose(t.asSetter())},e.prototype.composeOptional=function(t){return this.compose(t.asSetter())},e.prototype.composeLens=function(t){return this.compose(t.asSetter())},e.prototype.composePrism=function(t){return this.compose(t.asSetter())},e.prototype.composeIso=function(t){return this.compose(t.asSetter())},e}(),oSe=new eK(jc,jc);function aSe(){return oSe}function uSe(e,t){t===void 0&&(t="fromNewtype("+e.name+")");var n=aSe();return new _e(t,function(r){return e.is(r)},function(r,i){return le(e.validate(r,i),_s(n.wrap))},function(r){return e.encode(n.unwrap(r))})}var sSe=fh({_tag:ch("None")}),cSe=ch("Some");function iK(e,t){return t===void 0&&(t="Option<"+e.name+">"),lh([sSe,fh({_tag:cSe,value:e},"Some<"+e.name+">")],t)}function lSe(e,t){return t===void 0&&(t="Option<"+e.name+">"),new _e(t,iK(e).is,function(n,r){return n==null?Oe(nt):le(e.validate(n,r),_s(yt))},function(n){return _S(le(n,Xi(e.encode)))})}var fSe=new _e("DateFromISOString",function(e){return e instanceof Date},function(e,t){return le(Ei.validate(e,t),Br(function(n){var r=new Date(n);return isNaN(r.getTime())?Xe(e,t):Oe(r)}))},function(e){return e.toISOString()});function dSe(e,t){return t===void 0&&(t="ReadonlyNonEmptyArray<"+e.name+">"),Fz(e,t)}function oK(e){var t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t}var pSe=new _e("DateFromNumber",function(e){return e instanceof Date},function(e,t){return le(Js.validate(e,t),Br(function(n){var r=new Date(n);return isNaN(r.getTime())?Xe(e,t):Oe(r)}))},function(e){return e.getTime()});function Jy(e,t,n){n===void 0&&(n=e.name);var r=oK(e);return r.validate=t,r.decode=function(i){return t(i,Kq(r))},r.name=n,r}function hSe(e,t,n){return n===void 0&&(n="withFallback("+e.name+")"),Jy(e,function(r,i){return xN(function(){return Oe(t)})(e.validate(r,i))},n)}var mSe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vSe=My(Ei,function(e){return mSe.test(e)},"UUID");function gSe(e,t,n){return n===void 0&&(n="fromNullable("+e.name+")"),Jy(e,function(r,i){return r==null?Oe(t):e.validate(r,i)},n)}var ySe=new _e("BooleanFromString",xy.is,function(e,t){return le(Ei.validate(e,t),Br(function(n){return n==="true"?Oe(!0):n==="false"?Oe(!1):Xe(e,t)}))},String);function bSe(e,t){return Jy(e,function(n,r){return tp(function(){return[{value:n,context:r,message:t(n,r),actual:n}]})(e.validate(n,r))})}function aK(e){switch(e._tag){case"InterfaceType":return e.props;case"ExactType":return aK(e.type)}}var _Se=jw.fromProp();function $Se(e){var t={};for(var n in aK(e))t[n]=_Se(n);return t}var SSe=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},TSe=Iw("RegExp",SSe),ISe=new _e("DateFromUnixTime",function(e){return e instanceof Date},function(e,t){return le(Ry.validate(e,t),Br(function(n){var r=new Date(n*1e3);return isNaN(r.getTime())?Xe(e,t):Oe(r)}))},function(e){return Math.floor(e.getTime()/1e3)}),Lw=new _e("NumberFromString",Js.is,function(e,t){return le(Ei.validate(e,t),Br(function(n){var r=+n;return isNaN(r)||n.trim()===""?Xe(e,t):Oe(r)}))},String),CSe=new _e("IntFromString",Ry.is,function(e,t){return le(Lw.validate(e,t),Br(function(n){return Ry.is(n)?Oe(n):Xe(e,t)}))},Lw.encode),uK=_O("JsonArray",function(){return Bq(Zy)}),sK=_O("JsonRecord",function(){return TO(Ei,Zy)}),Zy=lh([xy,Js,Ei,yO,uK,sK],"Json"),OSe=new _e("JsonFromString",Zy.is,function(e,t){try{return Oe(JSON.parse(e))}catch{return Xe(e,t)}},function(e){return JSON.stringify(e)}),wSe=ch("Left"),ESe=ch("Right");function xSe(e,t,n){return n===void 0&&(n="Either<"+e.name+", "+t.name+">"),lh([fh({_tag:wSe,left:e},"Left<"+e.name+">"),fh({_tag:ESe,right:t},"Right<"+e.name+">")],n)}var MSe=new _e("BigIntFromString",function(e){return typeof e=="bigint"},function(e,t){return le(Ei.validate(e,t),Br(function(n){if(!Az.is(n.trim()))return Xe(e,t);try{return Oe(BigInt(n))}catch{return Xe(e,t)}}))},String);function RSe(e,t,n){return n===void 0&&(n=e.name),new _e(n,e.is,e.validate,t)}var kSe=new _e("BooleanFromNumber",xy.is,function(e,t){return le(Js.validate(e,t),_s(function(n){return n!==0}))},Number);const cK=Wc(Object.freeze(Object.defineProperty({__proto__:null,BigIntFromString:MSe,BooleanFromNumber:kSe,BooleanFromString:ySe,DateFromISOString:fSe,DateFromNumber:pSe,DateFromUnixTime:ISe,IntFromString:CSe,Json:Zy,JsonArray:uK,JsonFromString:OSe,JsonRecord:sK,NonEmptyString:Az,NumberFromString:Lw,UUID:vSe,clone:oK,date:K0e,either:xSe,fromNewtype:uSe,fromNullable:gSe,fromRefinement:Iw,getLenses:$Se,mapOutput:Yq,nonEmptyArray:Fz,option:iK,optionFromNullable:lSe,readonlyNonEmptyArray:dSe,readonlySetFromArray:q0e,regexp:TSe,setFromArray:Nz,withEncode:RSe,withFallback:hSe,withMessage:bSe,withValidate:Jy},Symbol.toStringTag,{value:"Module"})));var lK;function Dw(){return lK||(lK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LinkContent=e.Link=e.LinkContentLegacy=e.LinkLegacy=e.isLinkContent=e.LinkContentType=e.ExternalLinkContent=e.ExternalLinkType=e.DocumentLinkContent=e.DocumentLinkType=e.FileLinkContent=e.FileLinkType=e.ImageLinkContent=e.ImageLinkType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=cK,a=at,u=rt,s=kt();e.ImageLinkType="ImageLink";const c=i.exact(i.intersection([i.type({id:i.string,url:i.string,height:i.string,width:i.string,size:i.string,name:i.string,kind:i.string}),i.partial({date:a.StringOrNull})])),l=new i.Type("ImageLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.ImageLinkType,C=>(0,r.pipe)(c.decode(C),n.either.map(b=>e.ImageLinkContent.encode({...b,__TYPE__:e.ImageLinkType}))),C=>c.encode(C));e.ImageLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ImageLinkType)}),c]),e.FileLinkType="FileLink";const f=i.exact(i.intersection([i.type({id:i.string,url:i.string,name:i.string,kind:i.string,size:(0,o.withFallback)(i.string,"0")}),i.partial({date:(0,u.nullable)(i.string)})])),d=new i.Type("FileLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.FileLinkType,C=>(0,r.pipe)(f.decode(C),n.either.map(b=>e.FileLinkContent.encode({...b,__TYPE__:e.FileLinkType}))),C=>f.encode(C));e.FileLinkContent=i.intersection([f,i.exact(i.intersection([i.type({__TYPE__:i.literal(e.FileLinkType)}),i.partial({size:(0,o.withFallback)(i.string,"0")})]))]),e.DocumentLinkType="DocumentLink";const p=i.strict({id:a.NonEmptyString}),h=new i.Type("DocumentLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.DocumentLinkType,C=>(0,r.pipe)(p.decode(C),n.either.map(b=>e.DocumentLinkContent.encode({...b,__TYPE__:e.DocumentLinkType}))),C=>p.encode(C));e.DocumentLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.DocumentLinkType)}),p]),e.ExternalLinkType="ExternalLink";const m=i.exact(i.intersection([i.type({url:i.string}),i.partial({kind:i.literal("web"),target:a.StringOrNull,preview:(0,u.nullable)(i.partial({title:i.string}))})])),g=new i.Type("ExternalLink",C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.ExternalLinkType,C=>(0,r.pipe)(m.decode(C),n.either.map(b=>e.ExternalLinkContent.encode({...b,__TYPE__:e.ExternalLinkType}))),C=>m.encode(C));e.ExternalLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ExternalLinkType)}),m]),e.LinkContentType="LinkContent";const _=C=>(0,s.hasContentType)(C)&&C.__TYPE__===e.LinkContentType;e.isLinkContent=_,e.LinkLegacy=i.union([l,d,h,g]);const S=C=>new i.Type("LinkLegacy",e.isLinkContent,b=>(0,r.pipe)(e.LinkLegacy.decode(b),n.either.map(w=>e.LinkContent.encode({value:w,__TYPE__:e.LinkContentType}))),b=>({content:e.LinkLegacy.encode(b.value),types:{[C.keyOfType]:"Link"}}));e.LinkContentLegacy=S,e.Link=i.union([e.ImageLinkContent,e.FileLinkContent,e.DocumentLinkContent,e.ExternalLinkContent]),e.LinkContent=i.strict({__TYPE__:i.literal(e.LinkContentType),value:e.Link})}(Tw)),Tw}var Sa={},Bw={},Uw={},fK;function dK(){return fK||(fK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Block=e.BlockLegacy=e.TextBlock=e.checkEmbedBlock=e.EmbedBlock=e.checkImageBlock=e.ImageBlock=e.ValidatedMetas=e.Span=e.Meta=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=zy,u=at,s=rt,c=lw(),l=$w(),f=Dw();e.Meta=o.exact(o.intersection([o.partial({data:o.unknown}),o.type({start:o.number,end:o.number,type:o.union([a.RichTextNodeTypeCodec,o.literal("label")])})])),e.Span=e.Meta;const d=O=>new o.Type("ValidatedMetas",M=>Array.isArray(M)&&M.every(e.Meta.is),(M,x)=>{if(Array.isArray(M)){const U=M.reduce((B,P)=>{const Z=e.Meta.decode(P);if((0,r.isRight)(Z)){const ee=Z.right;if(ee.data&&ee.type==="hyperlink"){const J=O.decode(ee.data);return(0,r.isLeft)(J)?B:[...B,{...ee,data:J.right}]}else if(ee.type!=="hyperlink")return[...B,ee]}return B},[]).sort((B,P)=>B.start-P.start);return o.success(U)}else return o.failure(M,x)},M=>M.reduce((x,U)=>{if(U.type==="hyperlink"&&U.data){const B=O.decode(U.data);return(0,r.isLeft)(B)?x:[...x,{...U,data:O.encode(B.right)}]}return[...x,e.Meta.encode(U)]},[]));e.ValidatedMetas=d;const p=O=>o.exact(o.intersection([o.type({type:o.literal(a.RichTextNodeType.image),data:o.intersection([l.ImageContentView,o.partial({linkTo:(0,s.nullable)(O)})])}),o.partial({label:u.StringOrNull,direction:u.StringOrNull})]));e.ImageBlock=p(f.Link);const h=p(f.LinkLegacy);function m(O){return O.type===a.RichTextNodeType.image}e.checkImageBlock=m;const g=o.exact(o.intersection([o.type({type:o.literal(a.RichTextNodeType.embed),data:o.unknown}),o.partial({label:u.StringOrNull,direction:u.StringOrNull})])),_=new o.Type("EmbedBlockLegacy",O=>O.type==="embed",O=>(0,i.pipe)(g.decode(O),n.either.chain(M=>n.either.map(x=>[M,x])(c.EmbedContentLegacy.decode(M.data))),n.either.map(([M,x])=>e.EmbedBlock.encode({...M,data:{...x,__TYPE__:c.EmbedContentType,all:M.data}}))),O=>({...g.encode(O),data:c.EmbedContentLegacy.encode(O.data)}));e.EmbedBlock=o.exact(o.intersection([o.type({type:o.literal(a.RichTextNodeType.embed),data:c.EmbedContent}),o.partial({label:u.StringOrNull,direction:u.StringOrNull})]));function S(O){return O.type===a.RichTextNodeType.embed}e.checkEmbedBlock=S;const C=O=>o.exact(o.intersection([o.type({type:(0,s.refineType)(a.RichTextNodeTypeCodec,`string which isn't ${a.RichTextNodeType.image} ${a.RichTextNodeType.embed}`,M=>M!==a.RichTextNodeType.image&&M!==a.RichTextNodeType.embed),content:o.intersection([o.type({text:o.string}),o.partial({spans:(0,e.ValidatedMetas)(O)})])}),o.partial({label:o.string,direction:o.string})]));e.TextBlock=C(f.Link);const b=C(f.LinkLegacy),w=o.union([_,h,b]);e.BlockLegacy=new o.Type("BlockLegacy",O=>_.is(O)||h.is(O)||b.is(O),O=>w.decode(O),O=>(()=>e.ImageBlock.is(O)?h.encode(O):e.EmbedBlock.is(O)?_.encode(O):b.encode(O))()),e.Block=o.union([e.ImageBlock,e.EmbedBlock,e.TextBlock])}(Uw)),Uw}var pK;function hK(){return pK||(pK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RichTextLegacy=e.RichTextContent=e.isRichTextContent=e.RichTextContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt(),a=dK();e.RichTextContentType="StructuredTextContent";const u=l=>(0,o.hasContentType)(l)&&l.__TYPE__===e.RichTextContentType;e.isRichTextContent=u;const s=i.array(a.BlockLegacy);e.RichTextContent=i.strict({__TYPE__:i.literal(e.RichTextContentType),value:i.array(a.Block)}),(0,t.__exportStar)(dK(),e);const c=l=>new i.Type("RichTextLegacy",e.isRichTextContent,f=>(0,r.pipe)(s.decode(f),n.either.map(d=>({value:d,__TYPE__:e.RichTextContentType}))),f=>({content:s.encode(f.value),types:{[l.keyOfType]:"StructuredText"}}));e.RichTextLegacy=c}(Bw)),Bw}var qw={},mK;function vK(){return mK||(mK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SeparatorContent=e.SeparatorLegacy=e.isSeparatorContent=e.SeparatorContentType=void 0;const n=(0,G.__importStar)(Q),r=kt();e.SeparatorContentType="SeparatorContent";const i=a=>(0,r.hasContentType)(a)&&a.__TYPE__===e.SeparatorContentType;e.isSeparatorContent=i;const o=a=>new n.Type("SeparatorLegacy",e.isSeparatorContent,()=>n.success(e.SeparatorContent.encode({__TYPE__:e.SeparatorContentType})),()=>({content:{},types:{[a.keyOfType]:"Separator"}}));e.SeparatorLegacy=o,e.SeparatorContent=n.strict({__TYPE__:n.literal(e.SeparatorContentType)})}(qw)),qw}var gK;function ASe(){if(gK)return Sa;gK=1,Object.defineProperty(Sa,"__esModule",{value:!0}),Sa.NestableLegacy=Sa.isNestableContent=Sa.NestableContent=void 0;const e=G,t=Cn,n=(0,e.__importStar)(Q),r=Xq(),i=lz(),o=lw(),a=wz(),u=Yr,s=xz(),c=$w(),l=kz(),f=Dw(),d=hK(),p=vK();Sa.NestableContent=n.union([r.EmptyContent,i.BooleanContent,o.EmbedContent,a.TextContent,a.TimestampContent,a.SelectContent,a.RangeContent,a.NumberContent,a.DateContent,a.ColorContent,s.GeoPointContent,c.ImageContent,l.IntegrationFieldContent,f.LinkContent,d.RichTextContent,p.SeparatorContent]);const h=g=>(0,a.isTextContent)(g)||(0,a.isColorContent)(g)||(0,a.isDateContent)(g)||(0,a.isTimestampContent)(g)||(0,a.isNumberContent)(g)||(0,a.isRangeContent)(g)||(0,a.isSelectContent)(g)||(0,s.isGeoPointContent)(g)||(0,d.isRichTextContent)(g)||(0,i.isBooleanContent)(g)||(0,o.isEmbedContent)(g)||(0,c.isImageContent)(g)||(0,l.isIntegrationFieldContent)(g)||(0,f.isLinkContent)(g)||(0,p.isSeparatorContent)(g)||(0,r.isEmptyContent)(g);Sa.isNestableContent=h;const m=g=>({decode(_){if(!g.fieldType)return;const S=(0,r.EmptyLegacy)(g.fieldType).decode(_);if((0,t.isRight)(S))return S;const C=(()=>{switch(g.fieldType){case"Text":return(0,a.TextLegacy)(g);case"Color":return(0,a.ColorLegacy)(g);case"Date":return(0,a.DateLegacy)(g);case"Timestamp":return(0,a.TimestampLegacy)(g);case"Number":return(0,a.NumberLegacy)(g);case"Range":return(0,a.RangeLegacy)(g);case"Select":return(0,a.SelectLegacy)(g);case"GeoPoint":return(0,s.GeoPointLegacy)(g);case"StructuredText":return(0,d.RichTextLegacy)(g);case"Boolean":return(0,i.BooleanLegacy)(g);case"Embed":return(0,o.EmbedLegacy)(g);case"Image":return(0,c.ImageLegacy)(g);case"IntegrationFields":return(0,l.IntegrationFieldLegacy)(g);case"Link":return(0,f.LinkContentLegacy)(g);case"Separator":return(0,p.SeparatorLegacy)(g);default:return}})();if(C)return C.decode(_)},encode(_){switch(_.__TYPE__){case u.FieldContentType:return _.type==="Text"?(0,a.TextLegacy)(g).encode(_):_.type==="Color"?(0,a.ColorLegacy)(g).encode(_):_.type==="Range"?(0,a.RangeLegacy)(g).encode(_):_.type==="Date"?(0,a.DateLegacy)(g).encode(_):_.type==="Number"?(0,a.NumberLegacy)(g).encode(_):_.type==="Timestamp"?(0,a.TimestampLegacy)(g).encode(_):_.type==="Select"?(0,a.SelectLegacy)(g).encode(_):void 0;case s.GeoPointContentType:return(0,s.GeoPointLegacy)(g).encode(_);case d.RichTextContentType:return(0,d.RichTextLegacy)(g).encode(_);case o.EmbedContentType:return(0,o.EmbedLegacy)(g).encode(_);case i.BooleanContentType:return(0,i.BooleanLegacy)(g).encode(_);case c.ImageContentType:return(0,c.ImageLegacy)(g).encode(_);case l.IntegrationFieldContentType:return(0,l.IntegrationFieldLegacy)(g).encode(_);case f.LinkContentType:return(0,f.LinkContentLegacy)(g).encode(_);case p.SeparatorContentType:return(0,p.SeparatorLegacy)(g).encode(_);default:return}}});return Sa.NestableLegacy=m,Sa}var yK;function ac(){return yK||(yK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(lz(),e),(0,t.__exportStar)(lw(),e),(0,t.__exportStar)(wz(),e),(0,t.__exportStar)(xz(),e),(0,t.__exportStar)($w(),e),(0,t.__exportStar)(kz(),e),(0,t.__exportStar)(Dw(),e),(0,t.__exportStar)(ASe(),e),(0,t.__exportStar)(hK(),e),(0,t.__exportStar)(vK(),e)}(uw)),uw}var bK;function Xy(){return bK||(bK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GroupContent=e.isGroupContent=e.GroupContentType=e.GroupLegacy=e.GroupItemLegacy=e.GroupItemContent=e.GroupItemContentType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=Dn,u=kt(),s=ac();e.GroupItemContentType="GroupItemContent",e.GroupItemContent=o.strict({__TYPE__:o.literal(e.GroupItemContentType),value:o.array(o.tuple([o.string,s.NestableContent]))});const c=o.record(o.string,o.unknown),l=p=>new o.Type("GroupItemLegacy",h=>(0,u.hasContentType)(h)&&h.__TYPE__===e.GroupItemContentType,h=>(0,i.pipe)(c.decode(h),n.either.map(g=>({value:Object.entries(g).reduce((S,[C,b])=>{const w=(0,a.getFieldCtx)(C,p),O=(0,s.NestableLegacy)(w).decode(b);return!O||(0,r.isLeft)(O)?S:[...S,[C,O.right]]},[]),__TYPE__:e.GroupItemContentType}))),h=>h.value.reduce((m,[g,_])=>{const S=(0,a.getFieldCtx)(g,p),C=(0,s.NestableLegacy)(S).encode(_);return C?{content:{...m.content,[g]:C.content},types:{...m.types,...C.types}}:m},{content:{},types:{}}));e.GroupItemLegacy=l;const f=p=>{const h=o.array(o.union([o.null,(0,e.GroupItemLegacy)(p)])),m=o.array((0,e.GroupItemLegacy)(p));return new o.Type("GroupLegacy",e.isGroupContent,g=>(0,i.pipe)(h.decode(g),n.either.map(_=>({value:_.map(S=>S===null?{__TYPE__:e.GroupItemContentType,value:[]}:S),__TYPE__:e.GroupContentType}))),g=>{const _=m.encode(g.value);return{content:_.map(S=>S.content),types:_.reduce((S,C)=>({...S,...C.types}),{[p.keyOfType]:"Group"})}})};e.GroupLegacy=f,e.GroupContentType="GroupContentType";const d=p=>(0,u.hasContentType)(p)&&p.__TYPE__===e.GroupContentType;e.isGroupContent=d,e.GroupContent=o.strict({__TYPE__:o.literal(e.GroupContentType),value:o.array(e.GroupItemContent)})}(EO)),EO}var zw={},Kw={},Vw={},uc={},_K;function $K(){if(_K)return uc;_K=1,Object.defineProperty(uc,"__esModule",{value:!0}),uc.RepeatableWidgets=uc.RepeatableWidgetsLegacy=void 0;const t=(0,G.__importStar)(Q),n=Xy(),r=ac(),i=u=>t.array((0,n.GroupItemLegacy)(u));uc.RepeatableWidgetsLegacy=i;const o=t.tuple([t.string,r.NestableContent]),a=t.strict({__TYPE__:t.literal(n.GroupItemContentType),value:t.array(o)});return t.array(o),uc.RepeatableWidgets=t.array(a),uc}var SK;function Hw(){return SK||(SK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CompositeSliceContent=e.CompositeSliceLegacy=e.isCompositeSliceContent=e.CompositeSliceContentType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=Dn,u=kt(),s=ac(),c=$K();e.CompositeSliceContentType="CompositeSliceContent";const l=p=>(0,u.hasContentType)(p)&&p.__TYPE__===e.CompositeSliceContentType;e.isCompositeSliceContent=l;const f=o.exact(o.partial({repeat:o.array(o.unknown),"non-repeat":o.UnknownRecord})),d=p=>new o.Type("CompositeSliceLegacy",e.isCompositeSliceContent,h=>(0,i.pipe)(f.decode(h),n.either.map(m=>{const g=(()=>{const S=(0,a.getFieldCtx)("repeat",p),C=(0,c.RepeatableWidgetsLegacy)(S).decode(m.repeat);if(!(!C||(0,r.isLeft)(C)))return C.right})()||[];return{nonRepeat:Object.entries(m["non-repeat"]||{}).reduce((S,[C,b])=>{const w=(0,a.getFieldCtx)(C,p,["non-repeat"]);if(!w)return S;const O=(0,s.NestableLegacy)(w).decode(b);return!O||(0,r.isLeft)(O)?S:{...S,[C]:O.right}},{}),repeat:g,__TYPE__:e.CompositeSliceContentType}})),h=>{const m=Object.entries(h.nonRepeat).reduce((_,[S,C])=>{const b=(0,a.getFieldCtx)(S,p,["non-repeat"]),w=(0,s.NestableLegacy)(b).encode(C);return w?{content:{..._.content,[S]:w.content},types:{..._.types,...w.types}}:_},{content:{},types:{}}),g=(()=>{const _=(0,a.getFieldCtx)("repeat",p);return(0,c.RepeatableWidgetsLegacy)(_).encode(h.repeat)})()||[];return{content:{"non-repeat":m.content,repeat:g.map(_=>_.content)},types:{[p.keyOfType]:"Slice",...m.types,...g.reduce((_,S)=>({..._,...S.types}),{})}}});e.CompositeSliceLegacy=d,e.CompositeSliceContent=o.strict({__TYPE__:o.literal(e.CompositeSliceContentType),nonRepeat:o.record(o.string,s.NestableContent),repeat:c.RepeatableWidgets})}(Vw)),Vw}var Gw={},TK;function Yw(){return TK||(TK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SharedSliceContent=e.SharedSliceLegacy=e.isSharedSliceContent=e.SharedSliceContentType=void 0;const t=G,n=ht,r=Cn,i=Ye,o=(0,t.__importStar)(Q),a=cK,u=Dn,s=kt(),c=ac(),l=$K();e.SharedSliceContentType="SharedSliceContent";const f=h=>(0,s.hasContentType)(h)&&h.__TYPE__===e.SharedSliceContentType;e.isSharedSliceContent=f;const d=o.exact(o.type({variation:o.string,items:(0,a.withFallback)(o.array(o.unknown),[]),primary:(0,a.withFallback)(o.UnknownRecord,{})})),p=h=>new o.Type("SharedSliceLegacy",e.isSharedSliceContent,m=>(0,i.pipe)(d.decode(m),n.either.map(g=>{const _=(()=>{const C=(0,u.getFieldCtx)("items",h,["variations",g.variation]),b=(0,l.RepeatableWidgetsLegacy)(C).decode(g.items);if(!(!b||(0,r.isLeft)(b)))return b.right})()||[],S=Object.entries(g.primary).reduce((C,[b,w])=>{const O=(0,u.getFieldCtx)(b,h,["variations",g.variation,"primary"]),M=(0,c.NestableLegacy)(O).decode(w);return!M||(0,r.isLeft)(M)?C:{...C,[b]:M.right}},{});return{variation:g.variation,primary:S,items:_,__TYPE__:e.SharedSliceContentType}})),m=>{const g=Object.entries(m.primary).reduce((S,[C,b])=>{const w=(0,u.getFieldCtx)(C,h,["variations",m.variation,"primary"]),O=(0,c.NestableLegacy)(w).encode(b);return O?{content:{...S.content,[C]:O.content},types:{...S.types,...O.types}}:S},{content:{},types:{}}),_=(()=>{const S=(0,u.getFieldCtx)("items",h,["variations",m.variation]);return(0,l.RepeatableWidgetsLegacy)(S).encode(m.items)})()||[];return{content:{primary:g.content,items:_.map(S=>S.content),variation:m.variation},types:{[h.keyOfType]:"SharedSlice",...g.types,..._.reduce((S,C)=>({...S,...C.types}),{})}}});e.SharedSliceLegacy=p,e.SharedSliceContent=o.strict({__TYPE__:o.literal(e.SharedSliceContentType),variation:o.string,primary:o.record(o.string,c.NestableContent),items:l.RepeatableWidgets})}(Gw)),Gw}var Ta={},IK;function Jw(){if(IK)return Ta;IK=1,Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.SimpleSliceLegacy=Ta.isSimpleSliceContent=Ta.SimpleSliceContent=void 0;const t=(0,G.__importStar)(Q),n=Xy(),r=ac();Ta.SimpleSliceContent=t.union([r.NestableContent,n.GroupContent]);const i=a=>(0,r.isNestableContent)(a)||(0,n.isGroupContent)(a);Ta.isSimpleSliceContent=i;const o=a=>({decode:(()=>a.fieldType==="Group"?(0,n.GroupLegacy)(a).decode.bind(null):(0,r.NestableLegacy)(a).decode.bind(null))(),encode:u=>{switch(u.__TYPE__){case"GroupContentType":return(0,n.GroupLegacy)(a).encode(u);default:return(0,r.NestableLegacy)(a).encode(u)}}});return Ta.SimpleSliceLegacy=o,Ta}var CK;function OK(){return CK||(CK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SliceContent=e.SliceLegacy=void 0;const t=G,n=(0,t.__importStar)(Q),r=Hw(),i=Yw(),o=Jw(),a=u=>({decode:s=>(()=>{switch(u.fieldType){case"Slice":return(0,r.CompositeSliceLegacy)(u);case"SharedSlice":return(0,i.SharedSliceLegacy)(u);default:return(0,o.SimpleSliceLegacy)(u)}})().decode(s),encode:s=>{switch(s.__TYPE__){case"SharedSliceContent":return(0,i.SharedSliceLegacy)(u).encode(s);case"CompositeSliceContent":return(0,r.CompositeSliceLegacy)(u).encode(s);default:return(0,o.SimpleSliceLegacy)(u).encode(s)}}});e.SliceLegacy=a,e.SliceContent=n.union([r.CompositeSliceContent,i.SharedSliceContent,o.SimpleSliceContent]),(0,t.__exportStar)(Hw(),e),(0,t.__exportStar)(Yw(),e),(0,t.__exportStar)(Jw(),e)}(Kw)),Kw}var sc={},wK;function EK(){if(wK)return sc;wK=1,Object.defineProperty(sc,"__esModule",{value:!0}),sc.SlicesItemLegacy=sc.SliceItemContent=void 0;const e=G,t=ht,n=Cn,r=Ye,i=(0,e.__importStar)(Q),o=rt,a=Dn,u=OK(),s=Hw(),c=Yw(),l=Jw();sc.SliceItemContent=i.type({key:i.string,name:i.string,maybeLabel:i.union([i.string,i.undefined]),widget:u.SliceContent});const f=i.exact(i.intersection([i.type({key:i.string,value:i.unknown}),i.partial({label:(0,o.nullable)(i.string)})])),d=p=>new i.Type("SlicesItemLegacy",h=>((0,c.isSharedSliceContent)(h.widget),(0,s.isCompositeSliceContent)(h.widget),(0,l.isSimpleSliceContent)(h.widget)),(h,m)=>(0,r.pipe)(f.decode(h),t.either.chain(g=>{var _;const S=g.key.indexOf("$"),C=g.key.substring(0,S>0?S:void 0),b=(0,a.getFieldCtx)(C,p),w=(0,u.SliceLegacy)(b).decode(g.value);return!w||(0,n.isLeft)(w)?i.failure(h,m):i.success({key:g.key,name:C,maybeLabel:(_=g.label)!==null&&_!==void 0?_:void 0,widget:w.right})})),h=>{const m=(0,a.getFieldCtx)(h.name,p),g=(0,u.SliceLegacy)(m).encode(h.widget);return{content:{key:h.key,label:h.maybeLabel,value:(g==null?void 0:g.content)||{}},types:(g==null?void 0:g.types)||{}}});return sc.SlicesItemLegacy=d,sc}var Zw={},xK;function FSe(){return xK||(xK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SlicesContent=e.SlicesLegacy=e.isSlicesContent=e.SlicesContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt(),a=EK();e.SlicesContentType="SliceContentType";const u=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.SlicesContentType;e.isSlicesContent=u;const s=c=>{const l=i.array((0,a.SlicesItemLegacy)(c));return new i.Type("SlicesLegacy",e.isSlicesContent,f=>(0,r.pipe)(l.decode(f),n.either.map(d=>({__TYPE__:e.SlicesContentType,value:d}))),f=>{const d=l.encode(f.value);return{content:d.map(p=>p.content),types:d.reduce((p,h)=>({...p,...h.types}),{[c.keyOfType]:"Slices"})}})};e.SlicesLegacy=s,e.SlicesContent=i.type({__TYPE__:i.literal(e.SlicesContentType),value:i.array(a.SliceItemContent)})}(Zw)),Zw}var MK;function RK(){return MK||(MK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(OK(),e),(0,t.__exportStar)(EK(),e),(0,t.__exportStar)(FSe(),e)}(zw)),zw}var Xw={},kK;function AK(){return kK||(kK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UIDContent=e.UIDLegacy=e.isUIDContent=e.UIDContentType=void 0;const t=G,n=ht,r=Ye,i=(0,t.__importStar)(Q),o=kt();e.UIDContentType="UIDContent";const a=s=>(0,o.hasContentType)(s)&&s.__TYPE__===e.UIDContentType;e.isUIDContent=a;const u=s=>new i.Type("UIDLegacy",e.isUIDContent,c=>(0,r.pipe)(i.string.decode(c),n.either.map(l=>e.UIDContent.encode({value:l,__TYPE__:e.UIDContentType}))),c=>({content:c.value,types:{[s.keyOfType]:"UID"}}));e.UIDLegacy=u,e.UIDContent=i.type({__TYPE__:i.literal(e.UIDContentType),value:i.string})}(Xw)),Xw}var Ia={},FK;function NSe(){if(FK)return Ia;FK=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.WidgetLegacy=Ia.isWidgetContent=Ia.WidgetContent=void 0;const t=(0,G.__importStar)(Q),n=Xy(),r=ac(),i=RK(),o=AK();Ia.WidgetContent=t.union([n.GroupContent,r.NestableContent,o.UIDContent,i.SlicesContent]);const a=s=>(0,n.isGroupContent)(s)||(0,r.isNestableContent)(s)||(0,o.isUIDContent)(s)||(0,i.isSlicesContent)(s);Ia.isWidgetContent=a;const u=s=>({decode(c){if(!s.fieldType)return;const l=(()=>{switch(s.fieldType){case"UID":return(0,o.UIDLegacy)(s);case"Group":return(0,n.GroupLegacy)(s);case"Choice":case"Slices":return(0,i.SlicesLegacy)(s);default:return(0,r.NestableLegacy)(s)}})();if(l)return l.decode(c)},encode(c){switch(c.__TYPE__){case o.UIDContentType:return(0,o.UIDLegacy)(s).encode(c);case n.GroupContentType:return(0,n.GroupLegacy)(s).encode(c);case i.SlicesContentType:return(0,i.SlicesLegacy)(s).encode(c);default:return(0,r.NestableLegacy)(s).encode(c)}}});return Ia.WidgetLegacy=u,Ia}var NK;function Qw(){return NK||(NK=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Xq(),e),(0,t.__exportStar)(Xy(),e),(0,t.__exportStar)(ac(),e),(0,t.__exportStar)(RK(),e),(0,t.__exportStar)(AK(),e),(0,t.__exportStar)(NSe(),e)}(OO)),OO}Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.DocumentLegacy=Jc.Document=void 0;const PSe=G,PK=ht,eE=Cn,WK=Ye,If=(0,PSe.__importStar)(Q),tE=Zs,nE=Qw(),rE=Dn;Jc.Document=If.record(tE.WidgetKey,nE.WidgetContent);const WSe=If.record(tE.WidgetKey,If.unknown),iE=e=>new If.Type("Document",t=>!!t&&typeof t=="object",t=>(0,WK.pipe)(WSe.decode(t),PK.either.map(n=>Object.entries(n).reduce((r,[i,o])=>{const a=(0,rE.defaultCtx)(i,e),u=(0,nE.WidgetLegacy)(a).decode(o);return!u||(0,eE.isLeft)(u)?r:{...r,[i]:u.right}},{}))),t=>Object.entries(t).reduce((n,[r,i])=>{const o=(0,rE.defaultCtx)(r,e),a=(0,nE.WidgetLegacy)(o).encode(i);return a?{content:{...n.content,[r]:a.content},types:{...n.types,...a.types}}:n},{content:{},types:{}}));function jK(e){const t=Object.entries(e),{types:n,widgets:r}=t.reduce((a,[u,s])=>{if(u.endsWith("_TYPE")){const c=rE.FieldOrSliceType.decode(s);if((0,eE.isRight)(c))return{...a,types:a.types.set(u.substring(0,u.length-5),c.right)}}return!u.endsWith("_POSITION")&&!u.endsWith("_TYPE")?{...a,widgets:{...a.widgets,[u]:s}}:a},{types:new Map,widgets:{}}),i=e.slugs_INTERNAL||[],o=e.uid;return{widgets:r,types:n,uid:o,slugs:i}}function jSe(e){const t=(0,WK.pipe)(If.record(tE.WidgetKey,If.unknown).decode(e),PK.either.chain(n=>{const{types:r,widgets:i}=jK(n);return iE(r).decode(i)}));return(0,eE.isLeft)(t)?void 0:t.right}function LSe(e){const t=iE().encode(e);return{...t.content,...t.types}}Jc.DocumentLegacy={_codec:iE,extractMetadata:jK,parse:jSe,encode:LSe},function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(Jc,e),(0,t.__exportStar)(Qw(),e),(0,t.__exportStar)(Dn,e)}(Qe);function Qy(e){const t=F.useRef(e);return F.useLayoutEffect(()=>{t.current=e}),F.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function LK(){const[e,t]=F.useState({});return F.useCallback(()=>t({}),[])}function Tu(e,t,n){F.useEffect(()=>{const r=setTimeout(()=>n(e),t);return()=>clearTimeout(r)},[n,t,e])}function Un(e){var t;return((t=e.config)==null?void 0:t.label)??(e.type==="Boolean"||e.type==="Separator"?void 0:e.fieldset)??e.type}const oE="...";function Ca(e,t){var n,r,i;return e.type==="Boolean"?(t?(n=e.config)==null?void 0:n.placeholder_true:(r=e.config)==null?void 0:r.placeholder_false)??oE:((i=e.config)==null?void 0:i.placeholder)??oE}const DSe=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var a;const o=(e==null?void 0:e.value)??((a=t.config)==null?void 0:a.default_value)??!1;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"toggleOff"})}),y.jsx(T.FieldLabel,{htmlFor:n,children:Un(t)}),y.jsxs(T.FieldControl,{children:[y.jsx(T.Text,{children:Ca(t,o)}),y.jsx(T.Switch,{checked:o,id:n,onCheckedChange:u=>{i||r(BSe(u))}})]})]})};function BSe(e){return{__TYPE__:"BooleanContent",value:e}}const USe=e=>e===void 0?void 0:{__TYPE__:"FieldContent",type:"Color",value:e},qSe=({id:e,field:t,content:n,onContentChange:r})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"colorLens"})}),y.jsx(T.FieldLabel,{id:e,children:Un(t)}),y.jsx(T.FieldControl,{children:y.jsx(y.Fragment,{children:y.jsx(T.Box,{padding:{left:4},alignItems:"center",children:y.jsx(T.ColorInput,{onValueChange:i=>r(USe(i)),value:n==null?void 0:n.value,"aria-labelledby":e,placeholder:Ca(t)})})})})]}),zSe=e=>e===void 0?void 0:{__TYPE__:"FieldContent",type:"Date",value:e},KSe=({id:e,readOnly:t,field:n,content:r,onContentChange:i})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"dateRange"})}),y.jsx(T.FieldLabel,{id:e,children:Un(n)}),y.jsx(T.FieldControl,{children:y.jsx(y.Fragment,{children:y.jsx(T.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:y.jsx(T.DateInput,{mode:"date","aria-labelledby":e,readOnly:t,value:r==null?void 0:r.value,onValueChange:o=>i(zSe(o))})})})})]});function cc(e){try{return new URL(e)}catch{return}}function ho(e){return e!=null}async function Cf(e,t){const{okType:n,signal:r,headers:i,body:o,timeout:a=1e4,...u}=t,s=new Headers(i);s.has("Content-Type")||s.set("Content-Type","application/json"),s.get("Content-Type")==="multipart/form-data"&&s.delete("Content-Type");const c=YSe();c&&s.set("Authorization",`Bearer ${c}`);const l=s.get("Content-Type")==="application/json"?JSON.stringify(o):o;let f=!1;try{const d=new AbortController,p=HSe([d.signal,r].filter(ho));setTimeout(()=>{f=!0,d.abort()},a);const h=await fetch(e,{...u,body:l,headers:s,signal:p}),{status:m}=h,g=h.clone(),_=await h.json().catch(S=>g.text());if(h.ok){const S=n.safeParse(_);if(!S.success)throw new $h({type:"validation",status:m,cause:S.error});return S.data}else throw new $h({type:"http",status:m,body:_})}catch(d){throw VSe(d)?d:GSe(d)?new $h({type:f?"timeout":"abort"}):new $h({type:"unknown",cause:d})}}class $h extends Error{constructor(t){super(JSON.stringify(t,null,2)),this.detail=t,this.name="RequestError"}}function VSe(e){return e instanceof $h}function HSe(e){const t=new AbortController;function n(){t.abort();for(const r of e)r.removeEventListener("abort",n)}for(const r of e){if(r.aborted){n();break}r.addEventListener("abort",n)}return t.signal}function GSe(e){return e instanceof DOMException&&e.name==="AbortError"}let YSe=()=>"";function eb(e){return e==="dev"?"same-origin":"include"}function Sh(e,t){QSe(e,t),XSe(e,t),ZSe(e,t);const n=mo.get(e,t);if(!n){const r=e(...t);throw mo.set(e,t,{state:"fetching",promise:r}),DK(e,t,r).catch(i=>console.error(i)),r}if(n.state==="fetching")throw n.promise;if(n.ok)return n.body;throw n.error}function JSe(e,t,n,r){const{notify:i=!0}=r??{};mo.set(e,t,{state:"fetched",ok:!0,body:n}),i&&tb.forEach(o=>o(e,t))}function ZSe(e,t){const n=F.useContext(tTe);if(!n){console.warn("It is not recommended to use editor-support->Suspense without a editor-ui->ErrorBoundary above it.");return}n.registerRequest(e,t)}function XSe(e,t){const n=LK(),r=Th(e,t);F.useEffect(()=>{function i(o,a){if(e!==o)return;const u=Th(e,a);r===u&&n()}return tb.push(i),()=>{const o=tb.indexOf(i);tb.splice(o,1)}},[e,n,r])}function QSe(e,t){const n=LK();F.useEffect(()=>{const r=mo.getFetcherConfig(e).revalidationStrategy;if((r==null?void 0:r.type)==="never"||!(r!=null&&r.onFocus))return;function i(){if(document.visibilityState==="hidden")return;const o=mo.get(e,t);if(!o||o.state!=="fetched")return;const a=e(...t);o.ok?mo.set(e,t,{state:"revalidating",promise:a,ok:!0,body:o.body}):mo.set(e,t,{state:"revalidating",promise:a,ok:!1,error:o.error}),DK(e,t,a).then(n).catch(u=>console.error(u))}return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)})}function DK(e,t,n){return n.then(r=>mo.set(e,t,{state:"fetched",ok:!0,body:r})).catch(r=>mo.set(e,t,{state:"fetched",ok:!1,error:r}))}const mo=eTe(),aE=mo;function eTe(){const e=new Map,t=new Map,n={cacheCapacity:500,revalidationStrategy:{type:"swr",onFocus:!0}};function r(i){return e.get(i)??n}return{get(i,o){const a=Th(i,o),u=t.get(i);if(!u||!u.has(a))return;const s=u.get(a);return u.delete(a),s!==void 0&&u.set(a,s),s},set(i,o,a){let u=t.get(i);u||(u=new Map,t.set(i,u));const s=r(i),c=Th(i,o);u.size===s.cacheCapacity&&!u.has(c)&&u.delete(u.keys().next().value),u.set(c,a)},getFetcherConfig:r,registerFetcherConfig(i,o){e.set(i,o)},clear(i,o){const a=t.get(i);if(!a)return;const u=Th(i,o);a.delete(u)},clearAll(){t.clear()}}}function Th(e,t){const n=e.length-t.length;if(n===0)return t.join(`
29
29
  `);const r=[...t];for(let i=0;i<n;i++)r.push(void 0);return r.join(`
30
- `)}const nb=[],GSe=N.createContext(void 0);function cc(e){try{return new URL(e)}catch{return}}var Ve;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),a={};for(const u of o)a[u]=i[u];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Ve||(Ve={}));var lE;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(lE||(lE={}));const re=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Iu=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}},Y=Ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),YSe=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Mi extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let u=r,s=0;for(;s<a.path.length;){const c=a.path[s];s===a.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(n(a))):u[c]=u[c]||{_errors:[]},u=u[c],s++}}};return i(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Mi.create=e=>new Mi(e);const Oh=(e,t)=>{let n;switch(e.code){case Y.invalid_type:e.received===re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ve.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ve.joinValues(e.keys,", ")}`;break;case Y.invalid_union:n="Invalid input";break;case Y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ve.joinValues(e.options)}`;break;case Y.invalid_enum_value:n=`Invalid enum value. Expected ${Ve.joinValues(e.options)}, received '${e.received}'`;break;case Y.invalid_arguments:n="Invalid function arguments";break;case Y.invalid_return_type:n="Invalid function return type";break;case Y.invalid_date:n="Invalid date";break;case Y.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ve.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Y.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Y.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Y.custom:n="Invalid input";break;case Y.invalid_intersection_types:n="Intersection results could not be merged";break;case Y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Y.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ve.assertNever(e)}return{message:n}};let BK=Oh;function JSe(e){BK=e}function rb(){return BK}const ib=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let u="";const s=r.filter(c=>!!c).slice().reverse();for(const c of s)u=c(a,{data:t,defaultError:u}).message;return{...i,path:o,message:i.message||u}},ZSe=[];function oe(e,t){const n=ib({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,rb(),Oh].filter(r=>!!r)});e.common.issues.push(n)}class On{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Te;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return On.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return Te;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const Te=Object.freeze({status:"aborted"}),UK=e=>({status:"dirty",value:e}),Un=e=>({status:"valid",value:e}),fE=e=>e.status==="aborted",dE=e=>e.status==="dirty",ob=e=>e.status==="valid",ab=e=>typeof Promise<"u"&&e instanceof Promise;var pe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(pe||(pe={}));class go{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const qK=(e,t)=>{if(ob(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Mi(e.common.issues);return this._error=n,this._error}}};function we(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,u)=>a.code!=="invalid_type"?{message:u.defaultError}:typeof u.data>"u"?{message:r??u.defaultError}:{message:n??u.defaultError},description:i}}class xe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Iu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Iu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new On,ctx:{common:t.parent.common,data:t.data,parsedType:Iu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ab(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Iu(t)},o=this._parseSync({data:t,path:i.path,parent:i});return qK(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Iu(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(ab(i)?i:Promise.resolve(i));return qK(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),u=()=>o.addIssue({code:Y.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(s=>s?!0:(u(),!1)):a?!0:(u(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Ai({schema:this,typeName:be.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return wa.create(this,this._def)}nullable(){return pc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ki.create(this,this._def)}promise(){return Mf.create(this,this._def)}or(t){return Mh.create([this,t],this._def)}and(t){return Rh.create(this,t,this._def)}transform(t){return new Ai({...we(this._def),schema:this,typeName:be.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ph({...we(this._def),innerType:this,defaultValue:n,typeName:be.ZodDefault})}brand(){return new KK({typeName:be.ZodBranded,type:this,...we(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new db({...we(this._def),innerType:this,catchValue:n,typeName:be.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Wh.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const XSe=/^c[^\s-]{8,}$/i,QSe=/^[a-z][a-z0-9]*$/,eTe=/[0-9A-HJKMNP-TV-Z]{26}/,tTe=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,nTe=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,rTe=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,iTe=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,oTe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,aTe=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function uTe(e,t){return!!((t==="v4"||!t)&&iTe.test(e)||(t==="v6"||!t)&&oTe.test(e))}class Ri extends xe{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:Y.invalid_string,...pe.errToObj(r)}),this.nonempty=t=>this.min(1,pe.errToObj(t)),this.trim=()=>new Ri({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Ri({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Ri({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.string,received:o.parsedType}),Te}const r=new On;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,u=t.data.length<o.value;(a||u)&&(i=this._getOrReturnCtx(t,i),a?oe(i,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):u&&oe(i,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")nTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"email",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")rTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"emoji",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")tTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"uuid",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")XSe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"cuid",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")QSe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"cuid2",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")eTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"ulid",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),oe(i,{validation:"url",code:Y.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"regex",code:Y.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?aTe(o).test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="ip"?uTe(t.data,o.version)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"ip",code:Y.invalid_string,message:o.message}),r.dirty()):Ve.assertNever(o);return{status:r.value,value:t.data}}_addCheck(t){return new Ri({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...pe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...pe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...pe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...pe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...pe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...pe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...pe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...pe.errToObj(t)})}datetime(t){var n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...pe.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...pe.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...pe.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...pe.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...pe.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...pe.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...pe.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...pe.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ri.create=e=>{var t;return new Ri({checks:[],typeName:be.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...we(e)})};function sTe(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class Cu extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==re.number){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.number,received:o.parsedType}),Te}let r;const i=new On;for(const o of this._def.checks)o.kind==="int"?Ve.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?sTe(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.not_finite,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,i){return new Cu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(i)}]})}_addCheck(t){return new Cu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:pe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:pe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ve.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Cu.create=e=>new Cu({checks:[],typeName:be.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...we(e)});class Ou extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==re.bigint){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.bigint,received:o.parsedType}),Te}let r;const i=new On;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,i){return new Ou({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(i)}]})}_addCheck(t){return new Ou({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ou.create=e=>{var t;return new Ou({checks:[],typeName:be.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...we(e)})};class wh extends xe{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==re.boolean){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.boolean,received:r.parsedType}),Te}return Un(t.data)}}wh.create=e=>new wh({typeName:be.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...we(e)});class lc extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.date,received:o.parsedType}),Te}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_date}),Te}const r=new On;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Ve.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new lc({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:pe.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:pe.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}lc.create=e=>new lc({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:be.ZodDate,...we(e)});class ub extends xe{_parse(t){if(this._getType(t)!==re.symbol){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.symbol,received:r.parsedType}),Te}return Un(t.data)}}ub.create=e=>new ub({typeName:be.ZodSymbol,...we(e)});class Eh extends xe{_parse(t){if(this._getType(t)!==re.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.undefined,received:r.parsedType}),Te}return Un(t.data)}}Eh.create=e=>new Eh({typeName:be.ZodUndefined,...we(e)});class xh extends xe{_parse(t){if(this._getType(t)!==re.null){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.null,received:r.parsedType}),Te}return Un(t.data)}}xh.create=e=>new xh({typeName:be.ZodNull,...we(e)});class wf extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return Un(t.data)}}wf.create=e=>new wf({typeName:be.ZodAny,...we(e)});class fc extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Un(t.data)}}fc.create=e=>new fc({typeName:be.ZodUnknown,...we(e)});class Oa extends xe{_parse(t){const n=this._getOrReturnCtx(t);return oe(n,{code:Y.invalid_type,expected:re.never,received:n.parsedType}),Te}}Oa.create=e=>new Oa({typeName:be.ZodNever,...we(e)});class sb extends xe{_parse(t){if(this._getType(t)!==re.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.void,received:r.parsedType}),Te}return Un(t.data)}}sb.create=e=>new sb({typeName:be.ZodVoid,...we(e)});class ki extends xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==re.array)return oe(n,{code:Y.invalid_type,expected:re.array,received:n.parsedType}),Te;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,u=n.data.length<i.exactLength.value;(a||u)&&(oe(n,{code:a?Y.too_big:Y.too_small,minimum:u?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(oe(n,{code:Y.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(oe(n,{code:Y.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,u)=>i.type._parseAsync(new go(n,a,n.path,u)))).then(a=>On.mergeArray(r,a));const o=[...n.data].map((a,u)=>i.type._parseSync(new go(n,a,n.path,u)));return On.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new ki({...this._def,minLength:{value:t,message:pe.toString(n)}})}max(t,n){return new ki({...this._def,maxLength:{value:t,message:pe.toString(n)}})}length(t,n){return new ki({...this._def,exactLength:{value:t,message:pe.toString(n)}})}nonempty(t){return this.min(1,t)}}ki.create=(e,t)=>new ki({type:e,minLength:null,maxLength:null,exactLength:null,typeName:be.ZodArray,...we(t)});function Ef(e){if(e instanceof bt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=wa.create(Ef(r))}return new bt({...e._def,shape:()=>t})}else return e instanceof ki?new ki({...e._def,type:Ef(e.element)}):e instanceof wa?wa.create(Ef(e.unwrap())):e instanceof pc?pc.create(Ef(e.unwrap())):e instanceof yo?yo.create(e.items.map(t=>Ef(t))):e}class bt extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ve.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==re.object){const c=this._getOrReturnCtx(t);return oe(c,{code:Y.invalid_type,expected:re.object,received:c.parsedType}),Te}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof Oa&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||u.push(c);const s=[];for(const c of a){const l=o[c],f=i.data[c];s.push({key:{status:"valid",value:c},value:l._parse(new go(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Oa){const c=this._def.unknownKeys;if(c==="passthrough")for(const l of u)s.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")u.length>0&&(oe(i,{code:Y.unrecognized_keys,keys:u}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const l of u){const f=i.data[l];s.push({key:{status:"valid",value:l},value:c._parse(new go(i,f,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const l of s){const f=await l.key;c.push({key:f,value:await l.value,alwaysSet:l.alwaysSet})}return c}).then(c=>On.mergeObjectSync(r,c)):On.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(t){return pe.errToObj,new bt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,u;const s=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(u=pe.errToObj(t).message)!==null&&u!==void 0?u:s}:{message:s}}}:{}})}strip(){return new bt({...this._def,unknownKeys:"strip"})}passthrough(){return new bt({...this._def,unknownKeys:"passthrough"})}extend(t){return new bt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new bt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:be.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new bt({...this._def,catchall:t})}pick(t){const n={};return Ve.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new bt({...this._def,shape:()=>n})}omit(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new bt({...this._def,shape:()=>n})}deepPartial(){return Ef(this)}partial(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new bt({...this._def,shape:()=>n})}required(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof wa;)o=o._def.innerType;n[r]=o}}),new bt({...this._def,shape:()=>n})}keyof(){return zK(Ve.objectKeys(this.shape))}}bt.create=(e,t)=>new bt({shape:()=>e,unknownKeys:"strip",catchall:Oa.create(),typeName:be.ZodObject,...we(t)}),bt.strictCreate=(e,t)=>new bt({shape:()=>e,unknownKeys:"strict",catchall:Oa.create(),typeName:be.ZodObject,...we(t)}),bt.lazycreate=(e,t)=>new bt({shape:e,unknownKeys:"strip",catchall:Oa.create(),typeName:be.ZodObject,...we(t)});class Mh extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const u of o)if(u.result.status==="valid")return u.result;for(const u of o)if(u.result.status==="dirty")return n.common.issues.push(...u.ctx.common.issues),u.result;const a=o.map(u=>new Mi(u.ctx.common.issues));return oe(n,{code:Y.invalid_union,unionErrors:a}),Te}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const s of r){const c={...n,common:{...n.common,issues:[]},parent:null},l=s._parseSync({data:n.data,path:n.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const u=a.map(s=>new Mi(s));return oe(n,{code:Y.invalid_union,unionErrors:u}),Te}}get options(){return this._def.options}}Mh.create=(e,t)=>new Mh({options:e,typeName:be.ZodUnion,...we(t)});const cb=e=>e instanceof Ah?cb(e.schema):e instanceof Ai?cb(e.innerType()):e instanceof Fh?[e.value]:e instanceof wu?e.options:e instanceof Nh?Object.keys(e.enum):e instanceof Ph?cb(e._def.innerType):e instanceof Eh?[void 0]:e instanceof xh?[null]:null;class lb extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.object)return oe(n,{code:Y.invalid_type,expected:re.object,received:n.parsedType}),Te;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(oe(n,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=cb(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const u of a){if(i.has(u))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(u)}`);i.set(u,o)}}return new lb({typeName:be.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...we(r)})}}function pE(e,t){const n=Iu(e),r=Iu(t);if(e===t)return{valid:!0,data:e};if(n===re.object&&r===re.object){const i=Ve.objectKeys(t),o=Ve.objectKeys(e).filter(u=>i.indexOf(u)!==-1),a={...e,...t};for(const u of o){const s=pE(e[u],t[u]);if(!s.valid)return{valid:!1};a[u]=s.data}return{valid:!0,data:a}}else if(n===re.array&&r===re.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o<e.length;o++){const a=e[o],u=t[o],s=pE(a,u);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}else return n===re.date&&r===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Rh extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(o,a)=>{if(fE(o)||fE(a))return Te;const u=pE(o.value,a.value);return u.valid?((dE(o)||dE(a))&&n.dirty(),{status:n.value,value:u.data}):(oe(r,{code:Y.invalid_intersection_types}),Te)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Rh.create=(e,t,n)=>new Rh({left:e,right:t,typeName:be.ZodIntersection,...we(n)});class yo extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.array)return oe(r,{code:Y.invalid_type,expected:re.array,received:r.parsedType}),Te;if(r.data.length<this._def.items.length)return oe(r,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Te;!this._def.rest&&r.data.length>this._def.items.length&&(oe(r,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,u)=>{const s=this._def.items[u]||this._def.rest;return s?s._parse(new go(r,a,r.path,u)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>On.mergeArray(n,a)):On.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new yo({...this._def,rest:t})}}yo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yo({items:e,typeName:be.ZodTuple,rest:null,...we(t)})};class kh extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return oe(r,{code:Y.invalid_type,expected:re.object,received:r.parsedType}),Te;const i=[],o=this._def.keyType,a=this._def.valueType;for(const u in r.data)i.push({key:o._parse(new go(r,u,r.path,u)),value:a._parse(new go(r,r.data[u],r.path,u))});return r.common.async?On.mergeObjectAsync(n,i):On.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof xe?new kh({keyType:t,valueType:n,typeName:be.ZodRecord,...we(r)}):new kh({keyType:Ri.create(),valueType:t,typeName:be.ZodRecord,...we(n)})}}class fb extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.map)return oe(r,{code:Y.invalid_type,expected:re.map,received:r.parsedType}),Te;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([u,s],c)=>({key:i._parse(new go(r,u,r.path,[c,"key"])),value:o._parse(new go(r,s,r.path,[c,"value"]))}));if(r.common.async){const u=new Map;return Promise.resolve().then(async()=>{for(const s of a){const c=await s.key,l=await s.value;if(c.status==="aborted"||l.status==="aborted")return Te;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),u.set(c.value,l.value)}return{status:n.value,value:u}})}else{const u=new Map;for(const s of a){const c=s.key,l=s.value;if(c.status==="aborted"||l.status==="aborted")return Te;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),u.set(c.value,l.value)}return{status:n.value,value:u}}}}fb.create=(e,t,n)=>new fb({valueType:t,keyType:e,typeName:be.ZodMap,...we(n)});class dc extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.set)return oe(r,{code:Y.invalid_type,expected:re.set,received:r.parsedType}),Te;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(oe(r,{code:Y.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(oe(r,{code:Y.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(s){const c=new Set;for(const l of s){if(l.status==="aborted")return Te;l.status==="dirty"&&n.dirty(),c.add(l.value)}return{status:n.value,value:c}}const u=[...r.data.values()].map((s,c)=>o._parse(new go(r,s,r.path,c)));return r.common.async?Promise.all(u).then(s=>a(s)):a(u)}min(t,n){return new dc({...this._def,minSize:{value:t,message:pe.toString(n)}})}max(t,n){return new dc({...this._def,maxSize:{value:t,message:pe.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}dc.create=(e,t)=>new dc({valueType:e,minSize:null,maxSize:null,typeName:be.ZodSet,...we(t)});class xf extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.function)return oe(n,{code:Y.invalid_type,expected:re.function,received:n.parsedType}),Te;function r(u,s){return ib({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,rb(),Oh].filter(c=>!!c),issueData:{code:Y.invalid_arguments,argumentsError:s}})}function i(u,s){return ib({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,rb(),Oh].filter(c=>!!c),issueData:{code:Y.invalid_return_type,returnTypeError:s}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;return this._def.returns instanceof Mf?Un(async(...u)=>{const s=new Mi([]),c=await this._def.args.parseAsync(u,o).catch(d=>{throw s.addIssue(r(u,d)),s}),l=await a(...c);return await this._def.returns._def.type.parseAsync(l,o).catch(d=>{throw s.addIssue(i(l,d)),s})}):Un((...u)=>{const s=this._def.args.safeParse(u,o);if(!s.success)throw new Mi([r(u,s.error)]);const c=a(...s.data),l=this._def.returns.safeParse(c,o);if(!l.success)throw new Mi([i(c,l.error)]);return l.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new xf({...this._def,args:yo.create(t).rest(fc.create())})}returns(t){return new xf({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new xf({args:t||yo.create([]).rest(fc.create()),returns:n||fc.create(),typeName:be.ZodFunction,...we(r)})}}class Ah extends xe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Ah.create=(e,t)=>new Ah({getter:e,typeName:be.ZodLazy,...we(t)});class Fh extends xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return oe(n,{received:n.data,code:Y.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:t.data}}get value(){return this._def.value}}Fh.create=(e,t)=>new Fh({value:e,typeName:be.ZodLiteral,...we(t)});function zK(e,t){return new wu({values:e,typeName:be.ZodEnum,...we(t)})}class wu extends xe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{expected:Ve.joinValues(r),received:n.parsedType,code:Y.invalid_type}),Te}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{received:n.data,code:Y.invalid_enum_value,options:r}),Te}return Un(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return wu.create(t)}exclude(t){return wu.create(this.options.filter(n=>!t.includes(n)))}}wu.create=zK;class Nh extends xe{_parse(t){const n=Ve.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==re.string&&r.parsedType!==re.number){const i=Ve.objectValues(n);return oe(r,{expected:Ve.joinValues(i),received:r.parsedType,code:Y.invalid_type}),Te}if(n.indexOf(t.data)===-1){const i=Ve.objectValues(n);return oe(r,{received:r.data,code:Y.invalid_enum_value,options:i}),Te}return Un(t.data)}get enum(){return this._def.values}}Nh.create=(e,t)=>new Nh({values:e,typeName:be.ZodNativeEnum,...we(t)});class Mf extends xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.promise&&n.common.async===!1)return oe(n,{code:Y.invalid_type,expected:re.promise,received:n.parsedType}),Te;const r=n.parsedType===re.promise?n.data:Promise.resolve(n.data);return Un(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Mf.create=(e,t)=>new Mf({type:e,typeName:be.ZodPromise,...we(t)});class Ai extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===be.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null;if(i.type==="preprocess"){const a=i.transform(r.data);return r.common.async?Promise.resolve(a).then(u=>this._def.schema._parseAsync({data:u,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}const o={addIssue:a=>{oe(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="refinement"){const a=u=>{const s=i.refinement(u,o);if(r.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){const u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?Te:(u.status==="dirty"&&n.dirty(),a(u.value),{status:n.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?Te:(u.status==="dirty"&&n.dirty(),a(u.value).then(()=>({status:n.value,value:u.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ob(a))return a;const u=i.transform(a.value,o);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>ob(a)?Promise.resolve(i.transform(a.value,o)).then(u=>({status:n.value,value:u})):a);Ve.assertNever(i)}}Ai.create=(e,t,n)=>new Ai({schema:e,typeName:be.ZodEffects,effect:t,...we(n)}),Ai.createWithPreprocess=(e,t,n)=>new Ai({schema:t,effect:{type:"preprocess",transform:e},typeName:be.ZodEffects,...we(n)});class wa extends xe{_parse(t){return this._getType(t)===re.undefined?Un(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wa.create=(e,t)=>new wa({innerType:e,typeName:be.ZodOptional,...we(t)});class pc extends xe{_parse(t){return this._getType(t)===re.null?Un(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:be.ZodNullable,...we(t)});class Ph extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ph.create=(e,t)=>new Ph({innerType:e,typeName:be.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...we(t)});class db extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ab(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}db.create=(e,t)=>new db({innerType:e,typeName:be.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...we(t)});class pb extends xe{_parse(t){if(this._getType(t)!==re.nan){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.nan,received:r.parsedType}),Te}return{status:"valid",value:t.data}}}pb.create=e=>new pb({typeName:be.ZodNaN,...we(e)});const cTe=Symbol("zod_brand");class KK extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Wh extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Te:o.status==="dirty"?(n.dirty(),UK(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Te:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Wh({in:t,out:n,typeName:be.ZodPipeline})}}const VK=(e,t={},n)=>e?wf.create().superRefine((r,i)=>{var o,a;if(!e(r)){const u=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,s=(a=(o=u.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,c=typeof u=="string"?{message:u}:u;i.addIssue({code:"custom",...c,fatal:s})}}):wf.create(),lTe={object:bt.lazycreate};var be;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(be||(be={}));const fTe=(e,t={message:`Input not instance of ${e.name}`})=>VK(n=>n instanceof e,t),_t=Ri.create,Ea=Cu.create,dTe=pb.create,pTe=Ou.create,HK=wh.create,hTe=lc.create,mTe=ub.create,vTe=Eh.create,gTe=xh.create,yTe=wf.create,bTe=fc.create,_Te=Oa.create,$Te=sb.create,Rf=ki.create,sr=bt.create,STe=bt.strictCreate,TTe=Mh.create,GK=lb.create,ITe=Rh.create,CTe=yo.create,OTe=kh.create,wTe=fb.create,ETe=dc.create,xTe=xf.create,MTe=Ah.create,jh=Fh.create,RTe=wu.create,kTe=Nh.create,ATe=Mf.create,YK=Ai.create,FTe=wa.create,NTe=pc.create,PTe=Ai.createWithPreprocess,WTe=Wh.create;var qn=Object.freeze({__proto__:null,defaultErrorMap:Oh,setErrorMap:JSe,getErrorMap:rb,makeIssue:ib,EMPTY_PATH:ZSe,addIssueToContext:oe,ParseStatus:On,INVALID:Te,DIRTY:UK,OK:Un,isAborted:fE,isDirty:dE,isValid:ob,isAsync:ab,get util(){return Ve},get objectUtil(){return lE},ZodParsedType:re,getParsedType:Iu,ZodType:xe,ZodString:Ri,ZodNumber:Cu,ZodBigInt:Ou,ZodBoolean:wh,ZodDate:lc,ZodSymbol:ub,ZodUndefined:Eh,ZodNull:xh,ZodAny:wf,ZodUnknown:fc,ZodNever:Oa,ZodVoid:sb,ZodArray:ki,ZodObject:bt,ZodUnion:Mh,ZodDiscriminatedUnion:lb,ZodIntersection:Rh,ZodTuple:yo,ZodRecord:kh,ZodMap:fb,ZodSet:dc,ZodFunction:xf,ZodLazy:Ah,ZodLiteral:Fh,ZodEnum:wu,ZodNativeEnum:Nh,ZodPromise:Mf,ZodEffects:Ai,ZodTransformer:Ai,ZodOptional:wa,ZodNullable:pc,ZodDefault:Ph,ZodCatch:db,ZodNaN:pb,BRAND:cTe,ZodBranded:KK,ZodPipeline:Wh,custom:VK,Schema:xe,ZodSchema:xe,late:lTe,get ZodFirstPartyTypeKind(){return be},coerce:{string:e=>Ri.create({...e,coerce:!0}),number:e=>Cu.create({...e,coerce:!0}),boolean:e=>wh.create({...e,coerce:!0}),bigint:e=>Ou.create({...e,coerce:!0}),date:e=>lc.create({...e,coerce:!0})},any:yTe,array:Rf,bigint:pTe,boolean:HK,date:hTe,discriminatedUnion:GK,effect:YK,enum:RTe,function:xTe,instanceof:fTe,intersection:ITe,lazy:MTe,literal:jh,map:wTe,nan:dTe,nativeEnum:kTe,never:_Te,null:gTe,nullable:NTe,number:Ea,object:sr,oboolean:()=>HK().optional(),onumber:()=>Ea().optional(),optional:FTe,ostring:()=>_t().optional(),pipeline:WTe,preprocess:PTe,promise:ATe,record:OTe,set:ETe,strictObject:STe,string:_t,symbol:mTe,transformer:YK,tuple:CTe,undefined:vTe,union:TTe,unknown:bTe,void:$Te,NEVER:Te,ZodIssueCode:Y,quotelessJson:YSe,ZodError:Mi});function jTe(e){const{id:t,readOnly:n,field:r,content:i,onContentChange:o}=e,[a,u]=N.useState((i==null?void 0:i.embed_url)??"");function s(d){u(d),cc(d)||o(void 0)}const[c,l]=N.useState(a),f=N.useCallback(d=>N.startTransition(()=>l(d)),[]);return Su(a,300,f),y.jsxs(T.Field,{footer:cc(a)&&y.jsx(T.FieldFooter,{children:y.jsx(JK,{debouncedUrl:c,content:i,onContentChange:o})}),children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"cloud"})}),y.jsx(T.FieldLabel,{htmlFor:t,children:Bn(r)}),y.jsx(T.FieldControl,{children:y.jsx(T.TextInput,{id:t,readOnly:n,placeholder:mo(r),value:a,onValueChange:s,variant:cc(a)?"link":"normal",endAdornment:y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"close"}),variant:"secondary",size:"small",disabled:!a,onClick:()=>s("")})})})]})}function JK(e){const{debouncedUrl:t,content:n,onContentChange:r}=e,i=N.useRef(null),[o,a]=N.useState(!1),[u,s]=N.useState(t);u!==t&&c();function c(){var f;s(t),o&&(a(!1),(f=i.current)==null||f.reset())}function l(){a(!0),r(void 0)}return t===(n==null?void 0:n.embed_url)?y.jsx(hE,{content:n}):y.jsx(T.ErrorBoundary,{ref:i,renderError:LTe,onError:l,children:y.jsx(N.Suspense,{fallback:n&&y.jsx(hE,{content:n}),children:y.jsx(DTe,{url:t,onContentChange:r})})})}function LTe(){return y.jsx(T.EmptyEmbed,{title:"There is no embed data available."})}function hE(e){const{content:t}=e;return y.jsx(T.EmbedPreview,{...zTe(t)})}function DTe(e){const{url:t,onContentChange:n}=e,r=BTe({url:t,onContentChange:n});return y.jsx(hE,{content:r})}function BTe(e){const{url:t,onContentChange:n}=e,{embeds:r}=Gi(),i=Ih(UTe,[t,r.url]),o=eb(n);return N.useEffect(()=>{const a=setTimeout(()=>o(i));return()=>{clearTimeout(a)}},[i,o]),i}function UTe(e,t){const n=new URL(t);return n.search=new URLSearchParams({url:e}).toString(),Of(n.toString(),{okType:qTe(e)})}function qTe(e){return qn.object({type:qn.string(),version:qn.string().or(qn.number()).nullish(),title:qn.string().nullish(),author_name:qn.string().nullish(),author_url:qn.string().nullish(),provider_name:qn.string().nullish(),provider_url:qn.string().nullish(),cache_age:qn.string().or(qn.number()).nullish(),thumbnail_url:qn.string().nullish(),thumbnail_width:qn.number().nullish(),thumbnail_height:qn.number().nullish(),html:qn.string().nullish()}).passthrough().transform(t=>{const n={embed_url:e};return{...n,__TYPE__:"EmbedContent",type:t.type,version:t.version,title:t.title,author_name:t.author_name,author_url:t.author_url,provider_name:t.provider_name,provider_url:t.provider_url,cache_age:t.cache_age,thumbnail_url:t.thumbnail_url,thumbnail_width:t.thumbnail_width,thumbnail_height:t.thumbnail_height,html:t.html,all:{...n,...t}}})}function zTe(e){let t="";switch(e.type){case"video":t=e.title??"";break;case"photo":t="View this post"+(e.provider_name?` on ${e.provider_name}`:"");break;default:t="Open"+(e.provider_name?` on ${e.provider_name}`:"")}return{url:e.embed_url,thumbnail:{url:e.thumbnail_url??"",aspectRatio:e.type==="video"?"16:9":"1:1"},provider:e.provider_name??"",author:e.author_name??"",subtitle:t}}function KTe(e){const{content:t,field:n,id:r}=e,[i,o]=N.useState(!1),[a,u]=N.useState(!1);return Su(i,300,()=>u(i)),y.jsxs(T.Field,{onMouseOverChange:o,children:[y.jsx(T.Tooltip,{title:"Coming soon",content:"This feature is currently in development and will be available soon. Stay tuned for updates!",side:"bottom",open:a,children:y.jsx(VTe,{})}),y.jsx(T.FieldIcon,{disabled:!0,children:y.jsx(T.Icon,{name:"notes"})}),y.jsx(T.FieldLabel,{htmlFor:r,children:Bn(n)}),y.jsx(T.FieldControl,{disabled:!0,children:y.jsx(T.TextArea,{id:r,onChange:()=>{},placeholder:mo(n),readOnly:!0,value:t!=null&&t.position?`${t.position.lat}, ${t.position.lng}`:""})})]})}const VTe=N.forwardRef(function(t,n){return y.jsx("div",{ref:n,style:{width:50,position:"absolute",top:40,left:30}})}),Lh="__MAIN_THUMBNAIL__";function ZK(e,t,n){const r=e.name===Lh?void 0:e.name;let i;return t?Tu(n)?i=[n.width,n.height]:Tu(e.width)||Tu(e.height)?i=[e.width??void 0,e.height??void 0]:i=[t.origin.width,t.origin.height]:i=void 0,[r,i?`${i[0]??"auto"}x${i[1]??"auto"}px`:void 0]}function HTe(e){var t,n;return[{...(t=e.config)==null?void 0:t.constraint,name:Lh}].concat(((n=e.config)==null?void 0:n.thumbnails)??[])}function GTe(e,t){var a,u;const{__TYPE__:n,thumbnails:r,...i}=t,o=(u=(a=e.config)==null?void 0:a.thumbnails)==null?void 0:u.map(({name:s})=>r==null?void 0:r[s]);return[i,...o??[]]}function YTe(e,t,n,r){const i=r.length===0?void 0:r;return e===Lh?{...t,alt:i}:{...t,thumbnails:{...t.thumbnails,[e]:{...n,alt:i}}}}function XK(e,t){const{width:n,height:r}=t??{};return n&&r?[n,r]:n?[n,Math.round(e.height*(n/e.width))]:r?[Math.round(e.width*(r/e.height)),r]:[e.width,e.height]}function QK(e,t,n,r,i){const o=new URL(e);if(i){const{x:a,y:u,width:s,height:c}=t;o.searchParams.set("rect",[a,u,s,c].join(",")),o.searchParams.set("w",n.toString()),o.searchParams.set("h",r.toString())}return o.toString()}function eV(e){const t=new URL(e);return t.searchParams.delete("q"),t.searchParams.set("w","800"),t.searchParams.set("h","800"),t.searchParams.set("auto","compress,format"),t.searchParams.set("fit","max"),t.toString()}function tV(e){const t=new URL(e);return t.searchParams.delete("q"),t.searchParams.delete("fm"),t.searchParams.set("w","300"),t.searchParams.set("auto","compress,format"),t.toString()}const nV=({contentView:e,constraints:t,croppedImage:n})=>{const[r,i]=XK(e.origin,t),o=QK(e.origin.url,n,r,i,!0);return{...e,width:r,height:i,url:o,edit:{...e.edit,zoom:n.zoom,crop:{x:n.x,y:n.y}}}},JTe=({field:e,content:t,thumbnail:n,croppedImage:r})=>{var u,s,c,l;if(n===Lh){const f=nV({contentView:t,constraints:(u=e.config)==null?void 0:u.constraint,croppedImage:r});return f.url===t.url?t:{...t,...f}}const i=(c=(s=e.config)==null?void 0:s.thumbnails)==null?void 0:c.find(f=>f.name===n),o=(l=t.thumbnails)==null?void 0:l[n];if(!i||!o)return t;const a=nV({contentView:o,constraints:i,croppedImage:r});return a.url===o.url?t:{...t,thumbnails:{...t.thumbnails,[n]:a}}},ZTe=({initialSize:e,constraints:t})=>{const n=t!=null&&t.width&&(t!=null&&t.height)?t.width/t.height:e.width/e.height,[r,i]=e.width<e.height?[e.width,Math.round(e.width/n)]:[Math.round(e.height*n),e.height],o=Math.max(r/e.width,i/e.height,1);return{width:Math.round(r/o),height:Math.round(i/o)}},XTe=({contentView:e,constraints:t})=>{const n=ZTe({initialSize:e.origin,constraints:t}),r=e.edit.zoom??1,i=Math.round(n.width/r),o=Math.round(n.height/r);return{...e.edit.crop,width:i,height:o,zoom:r}},rV={x:0,y:0,width:0,height:0,zoom:1},QTe=({selectedImage:{thumbnail:e,contentView:t}})=>e.width&&e.height?e.width/e.height:t?t.origin.width/t.origin.height:1,eIe=({trigger:e,initialImages:t,initialOption:n,onClose:r})=>{var O;const[i,o]=_e.useState({}),[a,u]=_e.useState({}),[s,c]=_e.useState(!1),[l,f]=_e.useState(!1),[d,p]=_e.useState(n),h=t[d],m=M=>{if(!h)return;const x=h.thumbnail.name,U=i[x]??rV;o({...i,[x]:{...U,zoom:M}})},g=M=>{if(!h)return;const x=h.thumbnail.name,U=i[x]??rV;o({...i,[x]:{...U,...M}})},_=M=>{if(!h)return;const x=h.thumbnail.name,U=a[x];u({...a,[x]:{...U,crop:M}})},S=M=>{if(!h)return;const x=h.thumbnail.name,U=a[x]??{};u({...a,[x]:{...U,aspectRatio:M}})},C=i[(h==null?void 0:h.thumbnail.name)??""],b=s?C??((h==null?void 0:h.contentView)&&XTe({contentView:h.contentView,constraints:h.thumbnail})):void 0,w=a[(h==null?void 0:h.thumbnail.name)??""];return y.jsxs(T.Dialog,{trigger:e,onAnimationEnd:()=>f(!0),open:s,onOpenChange:M=>{M?(p(n),o({}),u({})):(f(!1),r({option:d,croppedImages:i})),c(M)},children:[y.jsx(T.DialogHeader,{icon:"photo",title:"Image editor"}),y.jsx(T.DialogOptions,{value:String(d),onValueChange:M=>p(Number(M)),children:t.map((M,x)=>y.jsx(T.DialogOptionsItem,{value:String(x),icon:"photo",title:M.labels[0]??"Main",subtitle:M.labels[1]??""},M.thumbnail.name))}),h&&y.jsx(T.DialogContent,{children:l&&y.jsx(T.CropperControls,{image:((O=h.contentView)==null?void 0:O.origin.url)??"",crop:(w==null?void 0:w.crop)??{x:0,y:0},onCropChange:_,zoom:(C==null?void 0:C.zoom)??1,onZoomChange:m,aspectRatio:QTe({selectedImage:h,cropper:w}),onAspectRatioChange:S,initialCroppedArea:b,onCropAreaChange:g},h.thumbnail.name)})]})},tIe=" https://prismic.io/docs/guides/manage-images#maximum-file-size",nIe=" https://prismic.io/docs/guides/manage-images#supported-media",iV=sr({id:_t(),kind:_t(),extension:_t(),filename:_t(),width:Ea().optional(),height:Ea().optional(),last_modified:Ea(),url:_t()}),rIe=sr({total:Ea(),cursor:_t().optional(),items:Rf(iV)}),oV=30;function mE(e,t,n,r){const i=new URLSearchParams({assetType:"image",limit:`${oV}`,...r&&{cursor:r}});return Of(`${e}?${i.toString()}`,{headers:{repository:t},credentials:tb(n),okType:rIe})}cE.registerFetcherConfig(mE,{cacheCapacity:100,revalidationStrategy:{type:"never"}});function iIe(){const{env:e,assets:t}=Gi(),[n,r]=N.useState(),[i,o]=N.useState([]),[a,u]=N.useState(i);if(!t)throw new Error("Missing EditorConfig.assets");const{url:s,repository:c}=t,l=Ih(mE,[s,c,e,n]);a!==l.items&&(u(l.items),o(p=>[...p,...l.items]));function f(){l.total!==0&&r(l.cursor)}function d(p){const h=[...p,...i];o([]),qSe(mE,[s,c,e,n],{total:h.length,items:h,cursor:void 0})}return{media:i,limit:oV,onHasReachedBottom:f,response:l,updateMedia:d}}function oIe(e){const{onFilesSelected:t}=e,[n,r]=N.useTransition(),[i,o]=N.useState(!1);return Su(n,100,()=>o(n)),y.jsx(T.ErrorBoundary,{renderError:fIe,children:y.jsx(N.Suspense,{children:y.jsxs(T.FileDropZone,{onFilesSelected:t,overlay:y.jsx(sIe,{}),children:[y.jsx(aIe,{...e,startTransition:r}),y.jsx(T.Box,{position:"relative",width:"100%",justifyContent:"center",children:y.jsx(T.Toast,{anchor:y.jsx(T.Box,{position:"fixed",bottom:72}),loadingIndicator:!0,open:i,title:"Loading media ...",seconds:1})})]})})})}function aIe(e){const{uploadingFiles:t,onFilesSelected:n,onSuccessFiles:r,onFailedFiles:i,onTryAgain:o,onMediaSelected:a,startTransition:u}=e,{media:s,limit:c,onHasReachedBottom:l,response:f,updateMedia:d}=iIe();return N.useEffect(()=>{const p=t.filter(m=>m.status==="success").map(m=>m.response),h=t.filter(m=>m.status==="failed");p.length>0&&(d(p),r()),h.length>0&&i(h)},[i,r,d,t]),s.length===0?y.jsx(uIe,{onFilesSelected:n}):y.jsxs(cIe,{onScrollToBottom:()=>{f.total===c&&u(l)},children:[y.jsx(T.Box,{flexDirection:"column",gap:6,children:t.map((p,h)=>y.jsx(T.UploadProgress,{file:p.file,failed:p.status==="failed",onTryAgain:()=>o(p)},`${p.file.name}${h}`))}),y.jsx(T.Masonry,{items:s,getItemInfo:lIe,children:p=>y.jsx(N.Suspense,{fallback:y.jsx(T.Skeleton,{width:"100%",height:"100%"}),children:y.jsx(T.MasonryMedia,{url:tV(p.url),onClick:()=>a({...p,width:p.width??2e3,height:p.height??2e3})})})})]})}function uIe(e){const{onFilesSelected:t}=e;return y.jsx(T.Box,{justifyContent:"center",flexDirection:"column",height:"100%",padding:24,children:y.jsx(T.Box,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:"grey2",borderRadius:4,padding:{inline:80},children:y.jsxs(T.BlankSlate,{children:[y.jsx(T.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple10",backgroundColor:"purple12"}),y.jsx(T.BlankSlateTitle,{size:"big",children:"Drop files here or"}),y.jsx(T.BlankSlateDescription,{children:y.jsxs(T.Text,{color:"grey11",align:"center",variant:"normal",children:["Explore our documentation to find out the"," ",y.jsx(T.TextLink,{underline:!0,color:"grey11",href:tIe,children:"maximum size"})," ","and"," ",y.jsx(T.TextLink,{underline:!0,color:"grey11",href:nIe,children:"supported image formats"})," ","for uploads in the media library."]})}),y.jsx(T.BlankSlateActions,{children:y.jsx(T.FileUploadTrigger,{title:"Upload Media",onFilesSelected:t})})]})})})}function sIe(){return y.jsx(T.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:y.jsxs(T.BlankSlate,{children:[y.jsx(T.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple10",backgroundColor:"purple12"}),y.jsx(T.BlankSlateTitle,{size:"big",children:"Drop files here"}),y.jsx(T.BlankSlateDescription,{children:"Drop your files to upload them instantly to your media library"})]})})}function cIe(e){const{children:t,onScrollToBottom:n}=e;return y.jsx(T.ScrollArea,{style:{height:"100%",paddingInline:T.tokens.space[24],paddingBlock:T.tokens.space[16],gap:T.tokens.space[16]},onScrollToBottom:n,children:t})}function lIe(e){return{key:e.id,aspectRatio:(e.width??2e3)/(e.height??2e3)}}function fIe(){return y.jsx(T.Box,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:y.jsx(T.DefaultErrorMessage,{title:"Request failed",description:"An error occurred while searching for your image.",errorImageSrc:T.dialogErrorImage})})}let hb;const dIe=new Uint8Array(16);function pIe(){if(!hb&&(hb=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hb))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hb(dIe)}const mn=[];for(let e=0;e<256;++e)mn.push((e+256).toString(16).slice(1));function hIe(e,t=0){return(mn[e[t+0]]+mn[e[t+1]]+mn[e[t+2]]+mn[e[t+3]]+"-"+mn[e[t+4]]+mn[e[t+5]]+"-"+mn[e[t+6]]+mn[e[t+7]]+"-"+mn[e[t+8]]+mn[e[t+9]]+"-"+mn[e[t+10]]+mn[e[t+11]]+mn[e[t+12]]+mn[e[t+13]]+mn[e[t+14]]+mn[e[t+15]]).toLowerCase()}const aV={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function mIe(e,t,n){if(aV.randomUUID&&!t&&!e)return aV.randomUUID();e=e||{};const r=e.random||(e.rng||pIe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return hIe(r)}function vIe(e){const{file:t,url:n,repository:r,env:i}=e,o=new FormData;return o.append(t.name,t),Of(n,{headers:{repository:r,"Content-Type":"multipart/form-data"},method:"POST",body:o,credentials:tb(i),okType:iV})}function gIe(){const[e,t]=N.useState([]),n=Gi();function r(s){s.forEach(c=>{var l,f;return vIe({file:c.file,url:((l=n.assets)==null?void 0:l.url)??"",repository:((f=n.assets)==null?void 0:f.repository)??"",env:n.env}).then(d=>{t(p=>p.map(h=>h.id===c.id?{...h,status:"success",response:d}:h))}).catch(()=>{t(d=>d.map(p=>p.id===c.id?{...p,status:"failed"}:p))})})}const{onFailedFiles:i,onTryAgain:o}=yIe({setUploadingFiles:t,tryPostMedia:r});function a(s){const c=s.map(l=>({id:mIe(),file:l,status:"loading"}));t(l=>[...l,...c]),r(c)}function u(){t(s=>s.filter(c=>c.status!=="success"))}return{onFilesSelected:a,uploadingFiles:e,onSuccessFiles:u,onFailedFiles:i,onTryAgain:o}}function yIe(e){const{setUploadingFiles:t,tryPostMedia:n}=e,r=N.useRef();function i(a){const u=()=>t(s=>s.filter(c=>!a.includes(c)));r.current=window.setTimeout(u,3e3)}function o(a){clearTimeout(r.current),t(u=>u.map(s=>s.id===a.id?{...a,status:"loading"}:s)),n([a])}return{onTryAgain:o,onFailedFiles:i}}const bIe=sr({id:_t(),width:Ea(),height:Ea(),urls:sr({full:_t(),small:_t().transform(tV)})}),_Ie=sr({results:Rf(bIe)}).transform(e=>e.results);function uV(e,t){const n=new URLSearchParams({page:"1",per_page:"30",query:t});return Of(`${e}/search/photos?${n.toString()}`,{okType:_Ie})}cE.registerFetcherConfig(uV,{cacheCapacity:5,revalidationStrategy:{type:"never"}});function $Ie(e,t){return Ih(uV,[e,t])}const SIe=e=>{const{onMediaSelected:t}=e,[n,r]=N.useState(""),[i,o]=N.useState(n),[a,u]=N.useTransition(),s=N.useCallback(c=>u(()=>o(c)),[]);return Su(n,200,s),y.jsxs(y.Fragment,{children:[y.jsx(T.Box,{padding:{inline:24,top:16},flexDirection:"column",children:y.jsx(T.SearchInput,{value:n,placeholder:"Search on Unsplash.com",onValueChange:r})}),y.jsx(CIe,{children:y.jsx(T.ErrorBoundary,{renderError:wIe,children:y.jsx(N.Suspense,{fallback:y.jsx(T.MasonrySkeleton,{}),children:y.jsx(TIe,{term:i,isUpdating:a,onMediaSelected:t})})})})]})},TIe=e=>{const{term:t,isUpdating:n,onMediaSelected:r}=e,i=Gi(),o=$Ie(i.unsplash.url,t||"fruit"),a=IIe(n);return o.length?y.jsx(T.Masonry,{items:o,getItemInfo:OIe,style:a,children:u=>y.jsx(T.MasonryMedia,{url:u.urls.small,onClick:()=>r({id:u.id,url:u.urls.full,width:u.width,height:u.height})})}):y.jsxs(T.BlankSlate,{style:{marginTop:"auto",marginBottom:"auto",...a},children:[y.jsx(T.BlankSlateImage,{children:y.jsx("img",{src:T.dialogErrorImage,alt:"No results"})}),y.jsx(T.BlankSlateTitle,{size:"big",children:"Oh no ..."}),y.jsx(T.BlankSlateDescription,{children:"The search returned no result."})]})};function IIe(e){return{opacity:e?.4:1,transitionProperty:e?"opacity":"none",transitionDuration:T.tokens.transitionDuration[300],transitionTimingFunction:T.tokens.transitionTimingFunction.easeInOut}}const CIe=({children:e})=>y.jsx(T.ScrollArea,{style:{height:"100%",paddingInline:T.tokens.space[24],paddingTop:T.tokens.space[4]},children:e});function OIe(e){return{key:e.id,aspectRatio:e.width/e.height}}function wIe(){return y.jsx(T.Box,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:y.jsx(T.DefaultErrorMessage,{title:"Request failed",description:"An error occurred while searching for your image.",errorImageSrc:T.dialogErrorImage})})}function sV(e){const{trigger:t,onMediaSelected:n}=e,r=Gi(),{onFilesSelected:i,uploadingFiles:o,onSuccessFiles:a,onFailedFiles:u,onTryAgain:s}=gIe(),[c,l]=N.useState(!1),[f,d]=N.useState(r.assets?"media":"unsplash"),p=h=>{if(h!=="media"&&h!=="unsplash")throw new Error(`Invalid option ${h}.`);d(h)};return y.jsxs(T.Dialog,{trigger:t,open:c,onOpenChange:l,children:[y.jsx(T.DialogHeader,{icon:"folder",title:"Add an image"}),y.jsxs(T.DialogOptions,{value:f,onValueChange:p,children:[r.assets&&y.jsx(T.DialogOptionsItem,{value:"media",title:"Media library",subtitle:"From Prismic",icon:"photo"}),y.jsx(T.DialogOptionsItem,{value:"unsplash",title:"Unsplash",subtitle:"Source of free images",icon:"unsplash"}),r.assets&&y.jsx(T.Box,{flexDirection:"column",justifyContent:"end",flexGrow:1,animation:"fadeIn",children:y.jsx(T.FileUploadTrigger,{startIcon:y.jsx(T.Icon,{name:"cloudUpload"}),title:"Upload media",onFilesSelected:i})})]}),y.jsx(T.DialogContent,{children:y.jsx(EIe,{option:f,uploadingFiles:o,onSuccessFiles:a,onFailedFiles:u,onFilesSelected:i,onTryAgain:s,onMediaSelected:h=>{l(!1),n==null||n(h)}})})]})}function EIe(e){const{option:t,onMediaSelected:n,...r}=e,i=Gi();switch(t){case"media":return i.assets?y.jsx(oIe,{onMediaSelected:n,...r}):null;case"unsplash":return y.jsx(SIe,{onMediaSelected:n})}}function xIe(e,t){const n={};for(const r in e)n[r]=t(e[r],r);return n}function MIe(e,t,n,r){var u,s,c,l,f,d;if(!n){const p=(u=t.config)==null?void 0:u.thumbnails,h=p&&Object.fromEntries(p.map(m=>[m.name,mb(r,m)]));return{__TYPE__:"ImageContent",...mb(r,(s=t.config)==null?void 0:s.constraint),thumbnails:h}}if(e===Lh){const p=mb(r,(c=t.config)==null?void 0:c.constraint);return p.url===n.url?n:{...n,...p}}const i=(f=(l=t.config)==null?void 0:l.thumbnails)==null?void 0:f.find(p=>p.name===e);if(!i)return n;const o=(d=n.thumbnails)==null?void 0:d[e],a=mb(r,i);return a.url===(o==null?void 0:o.url)?n:{...n,thumbnails:xIe(n.thumbnails??{},(p,h)=>h===e?a:p)}}function mb(e,t){const{width:n,height:r,rect:i}=RIe(e,t),o=Boolean((t==null?void 0:t.width)||(t==null?void 0:t.height));return{url:QK(e.url,i,n,r,o),origin:{id:e.id,url:e.url,width:e.width,height:e.height},width:n,height:r,edit:{background:"transparent",zoom:1,crop:{x:i.x,y:i.y}}}}function RIe(e,t){const[n,r]=XK(e,t),i=Math.max(n/e.width,r/e.height),o=Math.round((e.width-n/i)/2),a=Math.round((e.height-r/i)/2),u=Math.round(n/i),s=Math.round(r/i);return{width:n,height:r,rect:{x:o,y:a,width:u,height:s}}}const kIe=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var w,O;const[o,a]=N.useState(0),[u,s]=N.useTransition(),c=AIe(t),l=c[o],f=e?GTe(t,e):void 0,d=f==null?void 0:f[o],p=Bn(t),h=l?ZK(l,e,d).filter(Tu):[],m=e&&!i?"visible":"hidden";function g(M){if(!l)return;const x=MIe(l.name,t,e,M);x!==e&&s(()=>r(x))}function _(M){s(()=>a(M))}const S=c.map((M,x)=>{const U=f==null?void 0:f[x];return{thumbnail:M,contentView:U,labels:ZK(M,e,U)}}),C=({option:M,croppedImages:x})=>{if(a(M),!e)return;const U=Object.entries(x).reduce((B,[P,Z])=>JTe({field:t,content:B,thumbnail:P,croppedImage:Z}),e);U!==e&&s(()=>r(U))},b=((O=(w=d==null?void 0:d.url)==null?void 0:w.split("?")[0])==null?void 0:O.slice(-4))===".svg";return y.jsxs(T.Card,{color:"grey2",variant:"dashed",children:[y.jsxs(T.CardHeader,{children:[y.jsxs(T.CardHeaderTitle,{children:[p,h.length!==0&&y.jsx(T.Text,{color:"grey11",component:"span",children:` • ${h.join(" • ")}`})]}),y.jsxs(T.CardHeaderActions,{style:{visibility:m},children:[y.jsx(eIe,{trigger:y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"crop"}),disabled:b,children:"Crop & Resize"}),initialImages:S,initialOption:o,onClose:C}),y.jsx(sV,{trigger:y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"imageSearch"}),children:"Replace"}),onMediaSelected:g}),y.jsx(T.Button,{onClick:()=>{a(0),r(void 0)},startIcon:y.jsx(T.Icon,{name:"delete"}),children:"Clear"})]})]}),y.jsx(N.Suspense,{fallback:y.jsx("div",{style:{height:466}}),children:l&&e&&f?y.jsx(FIe,{allContentViews:f,content:e,contentView:d,id:n,onContentChange:r,onPageChange:_,page:o,readOnly:i,thumbnailName:l.name,isUpdating:u}):y.jsx(NIe,{onMediaSelected:g,readOnly:i,isUpdating:u})})]})};function AIe(e){return N.useMemo(()=>HTe(e),[e])}const FIe=e=>{const{allContentViews:t,content:n,contentView:r,id:i,onContentChange:o,onPageChange:a,page:u,readOnly:s,thumbnailName:c,isUpdating:l}=e;return y.jsxs(T.CardContent,{children:[y.jsx(T.Carousel,{getItemSource:PIe,items:t,onPageChange:a,page:u,style:{height:400},children:f=>(f==null?void 0:f.url)&&y.jsx(T.CarouselItem,{src:eV(f.url),alt:f.alt??void 0,isUpdating:l},`${c}_${f.url}`)}),y.jsxs(T.Field,{labelPosition:"side",children:[y.jsx(T.FieldLabel,{htmlFor:i,children:"Alt text"}),y.jsx(T.FieldControl,{children:y.jsx(T.TextInput,{id:i,onValueChange:f=>{r&&o(YTe(c,n,r,f))},placeholder:"Short description for the visually impaired",readOnly:s||!r,value:(r==null?void 0:r.alt)??""})})]})]})},NIe=({onMediaSelected:e,readOnly:t,isUpdating:n})=>y.jsx(T.CardContent,{children:y.jsx(T.Card,{color:"grey3",variant:"outlined",children:y.jsx(T.CardContent,{style:{paddingBlock:parseFloat(T.tokens.space[48])},children:y.jsxs(T.BlankSlate,{children:[y.jsx(T.BlankSlateIcon,{name:"cloudUpload"}),y.jsx(T.BlankSlateTitle,{children:n?"Preparing your image...":"You haven't selected an image"}),!t&&y.jsx(T.BlankSlateActions,{children:y.jsx(sV,{trigger:y.jsx(T.Button,{disabled:n,children:"Select image"}),onMediaSelected:e})})]})})})});function PIe(e){return e!=null&&e.url?eV(e.url):void 0}function WIe(e){const{content:t,field:n,id:r,onContentChange:i,readOnly:o}=e;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"notes"})}),y.jsx(T.FieldLabel,{htmlFor:r,children:Bn(n)}),y.jsx(T.FieldControl,{children:y.jsx(T.TextArea,{id:r,placeholder:mo(n),readOnly:o,value:(t==null?void 0:t.value)??"",onChange:a=>{i(jIe(a))}})})]})}function jIe(e){return e.length===0?void 0:{__TYPE__:"FieldContent",type:"Text",value:e}}function LIe(e){return e.charAt(0).toUpperCase()+e.slice(1)}const DIe={unclassified:["unclassified","published"],archived:["unclassified","published"],release:["release","published"],published:["published"]};function BIe(e){var _,S;const{searchTerm:t,tagsFilter:n,typesFilter:r}=e,{documents:i,env:o,status:a}=Gi(),[u,s]=N.useState(""),[c,l]=N.useState([]),[f,d]=N.useState(""),p=[{name:"tags",values:n},{name:"customTypes",values:r},{name:"status",values:DIe[a]},{name:"term",values:[t]}],h=new URLSearchParams(VIe(p)).toString(),m=Ih(cV,[i==null?void 0:i.url,h===f?u:"",o,h]);h!==f?(d(h),s(""),l(m.results)):m.results.length>0&&((_=c.at(-1))==null?void 0:_.id)!==((S=m.results.at(-1))==null?void 0:S.id)&&l(C=>C.concat(m.results));function g(){m.cursor&&s(m.cursor)}return{documents:c,onHasReachedBottom:g,response:m}}cE.registerFetcherConfig(cV,{cacheCapacity:500,revalidationStrategy:{type:"never"}});const UIe=GK("status",[sr({status:jh("unclassified")}),sr({status:jh("published")}),sr({status:jh("release"),release_id:_t()}),sr({status:jh("archived")})]).and(sr({version_id:_t(),tags:Rf(_t()),custom_type_label:_t(),preview_summary:_t().optional(),preview_image:_t().optional()})),qIe=sr({id:_t(),custom_type_id:_t(),title:_t(),versions:Rf(UIe)}),zIe=sr({total:Ea(),cursor:_t().optional(),results:Rf(qIe)}),KIe=30;function cV(e,t,n,r){if(!e)throw new Error("Missing EditorConfig.documents");const i=new URLSearchParams({limit:KIe.toString(),...t&&{cursor:t}});return Of(`${e}?${i.toString()}&${r}`,{credentials:tb(n),okType:zIe})}function VIe(e){return e.reduce((t,n)=>{const r=n.values.map(i=>[n.name,i]);return t.concat(r)},[])}function HIe(e){const{onSelectDocument:t,...n}=e,{documents:r}=Gi(),[i,o]=N.useState(""),[a,u]=N.useState("");Su(i,300,()=>u(i));const[s,c]=N.useTransition(),[l,f]=N.useState(!1);return Su(s,100,()=>f(s)),y.jsx(T.Dialog,{size:{height:727,width:656},hasClose:!1,...n,children:y.jsx(T.DialogContent,{children:y.jsxs(T.Box,{flexDirection:"column",height:"100%",children:[y.jsxs(T.Box,{padding:16,flexDirection:"column",gap:12,children:[y.jsx(T.FormInput,{value:i,onValueChange:o,placeholder:"Search a page",icon:"search"}),y.jsx(T.Text,{variant:"smallBold",color:"grey11",children:"Link to a document"})]}),r?y.jsx(T.ErrorBoundary,{renderError:GIe,children:y.jsx(N.Suspense,{children:y.jsx(YIe,{searchTerm:a,tagsFilter:[],typesFilter:[],startTransition:c,onSelectDocument:t})})}):y.jsx(lV,{message:"You can't select a document. No mock data can be rendered for this field."}),y.jsx(T.Toast,{anchor:y.jsx(T.Box,{position:"relative",width:"100%",justifyContent:"center",bottom:72}),loadingIndicator:!0,open:l,title:"Loading more results ...",seconds:1})]})})})}function GIe(){return y.jsx(T.Box,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:y.jsx(T.DefaultErrorMessage,{title:"Request failed",description:"An error occurred while fetching documents.",errorImageSrc:T.dialogErrorImage})})}function YIe(e){const{searchTerm:t,tagsFilter:n,typesFilter:r,startTransition:i,onSelectDocument:o}=e,{documents:a,onHasReachedBottom:u}=BIe({searchTerm:t,tagsFilter:n,typesFilter:r});return y.jsx(T.ScrollArea,{onScrollToBottom:()=>i(u),style:{height:"100%",gap:T.tokens.space[16],padding:T.tokens.space[16]},children:y.jsxs(T.Box,{flexDirection:"column",gap:12,children:[a.length===0&&y.jsx(lV,{}),a.map(s=>{var c,l,f,d,p,h;return y.jsx(T.DocumentCard,{documentType:((c=s.versions[0])==null?void 0:c.custom_type_label)??"",description:(l=s.versions[0])==null?void 0:l.preview_summary,tags:((f=s.versions[0])==null?void 0:f.tags)??[],title:s.title,previewImageUrl:(d=s.versions[0])==null?void 0:d.preview_image,onSelect:()=>o(s.id),status:(p=s.versions[0])==null?void 0:p.status},`${s.id}-${((h=s.versions[0])==null?void 0:h.status)??""}`)})]})})}function lV(e){const{message:t="There are no versions matching this request"}=e;return y.jsxs(T.Box,{justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16,children:[y.jsx(T.Box,{height:56,width:56,backgroundColor:"purple12",alignItems:"center",justifyContent:"center",borderRadius:"100%",children:y.jsx(T.Icon,{name:"close",size:"large",color:"purple10"})}),y.jsx(T.Box,{maxWidth:204,children:y.jsx(T.Text,{color:"grey11",align:"center",children:t})})]})}function fV(e){const{hasLink:t,onUnlink:n,selectEnabled:r,selectedType:i,onValueChange:o}=e;return y.jsxs(y.Fragment,{children:[y.jsxs(T.Select,{value:i,variant:"secondary",size:"small",icon:JIe(i),disabled:!r,onValueChange:o,placeholder:"Choose link type",children:[y.jsx(T.SelectItem,{value:"web",icon:"public",children:"Link to web page"}),y.jsx(T.SelectItem,{value:"document",icon:"description",children:"Link to Prismic page"})]}),y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"close"}),variant:"secondary",size:"small",disabled:!t,onClick:n})]})}function JIe(e){if(e)switch(e){case"document":return"description";case"web":return"public";case"media":return"image"}}function ZIe(e){var x,U;const{field:t,content:n,onContentChange:r}=e,i=g(),[o,a]=N.useState(()=>m()),[u,s]=N.useState(!1),[c,l]=N.useState(i),f=N.useRef(null);c!==i&&O();const d=o?XIe[o]:void 0,p=(n==null?void 0:n.value.__TYPE__)&&["FileLink","ImageLink"].includes(n==null?void 0:n.value.__TYPE__),h=((x=t.config)==null?void 0:x.select)&&t.config.select==="media";function m(){var B,P;return(B=t.config)!=null&&B.select?dV[(P=t.config)==null?void 0:P.select]:n==null?void 0:n.value.__TYPE__}function g(){return n?n.value.__TYPE__==="DocumentLink"?n.value.id:n.value.__TYPE__==="ExternalLink"?n.value.url:n.value.name:""}function _(B){if(!B)return r(void 0);switch(o){case"ExternalLink":return r({__TYPE__:"LinkContent",value:{__TYPE__:"ExternalLink",url:B}});case"DocumentLink":return r({__TYPE__:"LinkContent",value:{__TYPE__:"DocumentLink",id:B}});default:return r(void 0)}}function S(B){_(B)}function C(B){a(dV[B]),S("")}function b(B){_(B)}function w(){s(!0)}function O(){var B;l(i),u&&(s(!1),(B=f.current)==null||B.reset())}const M=!((U=t.config)!=null&&U.select);return{contentType:o,selectType:d,isUnsupportedField:h||p,fieldValue:i,onValueChange:S,onTypeChange:C,placeholder:mo(t),isTypeSelectEnabled:M,onDocumentSelected:b,onError:w,errorBoundaryRef:f}}const XIe={DocumentLink:"document",ExternalLink:"web",FileLink:"media",ImageLink:"media"},dV={document:"DocumentLink",web:"ExternalLink",media:"FileLink"};function QIe(e){const{env:t,documents:n}=Gi();return Ih(t1e,[n==null?void 0:n.url,t,e]).title}const e1e=sr({id:_t(),title:_t()});function t1e(e,t,n){if(!e)throw new Error("Missing EditorConfig.documents");return Of(`${e}/${n}`,{credentials:tb(t),okType:e1e})}function n1e(e){const{content:t,field:n,id:r,onContentChange:i,readOnly:o}=e,[a,u]=N.useState(!1),[s,c]=N.useState(!1),[l,f]=N.useState(!1),{contentType:d,selectType:p,isUnsupportedField:h,fieldValue:m,onValueChange:g,onTypeChange:_,placeholder:S,errorBoundaryRef:C,isTypeSelectEnabled:b,onDocumentSelected:w,onError:O}=ZIe({content:t,field:n,onContentChange:i});if(h)return y.jsx(a1e,{id:r,field:n,content:t});const M=cc(m),x=(a||s)&&Boolean(M),U=o||!d,B=d==="DocumentLink"&&m!=="",P={id:r,contentType:d,isTypeSelectEnabled:b,onBlur:()=>u(!1),onFocus:()=>{u(!0),d==="DocumentLink"&&f(!0)},onTypeChange:_,onValueChange:g,readOnly:U,textType:M?"link":"normal",value:m,placeholder:S,selectType:p};return y.jsxs(y.Fragment,{children:[y.jsx(T.LinkDescriptionPopover,{url:M,title:M?o1e(M):"",open:x,align:"start",sideOffset:-3,openDelay:100,closeDelay:200,onMouseOverChange:c,anchor:y.jsxs(T.Field,{onMouseOverChange:u,children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"link"})}),y.jsx(T.FieldLabel,{htmlFor:r,children:Bn(n)}),y.jsx(T.FieldControl,{children:B?y.jsx(N.Suspense,{fallback:y.jsx(vE,{...P,value:"..."}),children:y.jsx(T.ErrorBoundary,{ref:C,onError:O,renderError:()=>r1e(P),children:y.jsx(i1e,{...P,documentId:m,openDocumentListModal:()=>f(!0)})})}):y.jsx(vE,{...P})})]})}),y.jsx(HIe,{open:l,onOpenChange:f,onSelectDocument:Z=>{f(!1),w(Z)}})]})}function r1e(e){return y.jsx(vE,{...e,textType:"link"})}function vE(e){const{id:t,onValueChange:n,placeholder:r,readOnly:i,value:o,textType:a,onFocus:u,onBlur:s,contentType:c,isTypeSelectEnabled:l,selectType:f,onTypeChange:d}=e;return y.jsx(T.TextInput,{id:t,onValueChange:n,placeholder:r,readOnly:i||c==="DocumentLink",value:o,variant:a,onFocus:u,onBlur:s,cursor:c==="DocumentLink"?"pointer":"text",endAdornment:y.jsx(fV,{hasLink:Boolean(o),onUnlink:()=>n(""),selectEnabled:l,selectedType:f,onValueChange:d})})}function i1e(e){const{id:t,documentId:n,openDocumentListModal:r,onValueChange:i,isTypeSelectEnabled:o,selectType:a,onTypeChange:u}=e,s=QIe(n);return y.jsx(T.TextInput,{id:t,readOnly:!0,value:s,variant:"link",onFocus:r,cursor:"pointer",endAdornment:y.jsx(fV,{hasLink:!0,onUnlink:()=>i(""),selectEnabled:o,selectedType:a,onValueChange:u})})}function o1e(e){return e.host.split(".").slice(0,-1).filter(t=>t!=="www").map(LIe).join("")}function a1e({id:e,field:t,content:n}){const[r,i]=N.useState(!1),[o,a]=N.useState(!1);Su(r,300,()=>a(r));const u=(n==null?void 0:n.value.__TYPE__)==="DocumentLink"?n==null?void 0:n.value.id:n==null?void 0:n.value.url;return y.jsxs(T.Field,{onMouseOverChange:i,children:[y.jsx(T.Tooltip,{title:"Coming soon",content:"This feature is currently in development and will be available soon. Stay tuned for updates!",side:"bottom",open:o,children:y.jsx(u1e,{})}),y.jsx(T.FieldIcon,{disabled:!0,children:y.jsx(T.Icon,{name:"link"})}),y.jsx(T.FieldLabel,{htmlFor:e,children:Bn(t)}),y.jsx(T.FieldControl,{disabled:!0,children:y.jsx(T.TextArea,{id:e,onChange:()=>{},placeholder:mo(t),readOnly:!0,value:u})})]})}const u1e=N.forwardRef(function(t,n){return y.jsx("div",{ref:n,style:{width:50,position:"absolute",top:40,left:30}})}),s1e=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var u,s;const o=Number(e==null?void 0:e.value),a=Number.isFinite(o)?o:void 0;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"pin"})}),y.jsx(T.FieldLabel,{htmlFor:n,children:Bn(t)}),y.jsx(T.FieldControl,{children:y.jsx(T.NumberInput,{id:n,value:a,min:(u=t.config)==null?void 0:u.min,max:(s=t.config)==null?void 0:s.max,placeholder:mo(t),readOnly:i,onValueChange:c=>r(c1e(c))})})]})};function c1e(e){return e===void 0?void 0:{__TYPE__:"FieldContent",type:"Number",value:String(e)}}function vn(e){this.content=e}vn.prototype={constructor:vn,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return i==-1?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new vn(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new vn(n)},addToStart:function(e,t){return new vn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new vn(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(o==-1?i.length:o,0,t,n),new vn(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=vn.from(e),e.size?new vn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=vn.from(e),e.size?new vn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=vn.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},vn.from=function(e){if(e instanceof vn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new vn(t)};function pV(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),o=t.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)n++;return n}if(i.content.size||o.content.size){let a=pV(i.content,o.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function hV(e,t,n,r){for(let i=e.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let a=e.child(--i),u=t.child(--o),s=a.nodeSize;if(a==u){n-=s,r-=s;continue}if(!a.sameMarkup(u))return{a:n,b:r};if(a.isText&&a.text!=u.text){let c=0,l=Math.min(a.text.length,u.text.length);for(;c<l&&a.text[a.text.length-c-1]==u.text[u.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(a.content.size||u.content.size){let c=hV(a.content,u.content,n-1,r-1);if(c)return c}n-=s,r-=s}}class K{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,i=0,o){for(let a=0,u=0;u<n;a++){let s=this.content[a],c=u+s.nodeSize;if(c>t&&r(s,i+u,o||null,a)!==!1&&s.content.size){let l=u+1;s.nodesBetween(Math.max(0,t-l),Math.min(s.content.size,n-l),r,i+l)}u=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let o="",a=!0;return this.nodesBetween(t,n,(u,s)=>{u.isText?(o+=u.text.slice(Math.max(t,s)-s,n-s),a=!r):u.isLeaf?(i?o+=typeof i=="function"?i(u):i:u.type.spec.leafText&&(o+=u.type.spec.leafText(u)),a=!r):!a&&u.isBlock&&(o+=r,a=!0)},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new K(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let o=0,a=0;a<n;o++){let u=this.content[o],s=a+u.nodeSize;s>t&&((a<t||s>n)&&(u.isText?u=u.cut(Math.max(0,t-a),Math.min(u.text.length,n-a)):u=u.cut(Math.max(0,t-a-1),Math.min(u.content.size,n-a-1))),r.push(u),i+=u.nodeSize),a=s}return new K(r,i)}cutByIndex(t,n){return t==n?K.empty:t==0&&n==this.content.length?this:new K(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new K(i,o)}addToStart(t){return new K([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new K(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];t(i,r,n),r+=i.nodeSize}}findDiffStart(t,n=0){return pV(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return hV(this,t,n,r)}findIndex(t,n=-1){if(t==0)return vb(0,t);if(t==this.size)return vb(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=t)return a==t||n>0?vb(r+1,a):vb(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return K.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new K(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return K.empty;let n,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new K(n||t,r)}static from(t){if(!t)return K.empty;if(t instanceof K)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new K([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}K.empty=new K([],0);const gE={index:0,offset:0};function vb(e,t){return gE.index=e,gE.offset=t,gE}function gb(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!gb(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!gb(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let tt=class mM{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&gb(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return mM.none;if(t instanceof mM)return[t];let n=t.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};tt.none=[];class yb extends Error{}class ae{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=vV(this.content,t+this.openStart,n);return r&&new ae(r,this.openStart,this.openEnd)}removeBetween(t,n){return new ae(mV(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return ae.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 ae(K.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new ae(t,r,i)}}ae.empty=new ae(K.empty,0,0);function mV(e,t,n){let{index:r,offset:i}=e.findIndex(t),o=e.maybeChild(r),{index:a,offset:u}=e.findIndex(n);if(i==t||o.isText){if(u!=n&&!e.child(a).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return e.replaceChild(r,o.copy(mV(o.content,t-i-1,n-i-1)))}function vV(e,t,n,r){let{index:i,offset:o}=e.findIndex(t),a=e.maybeChild(i);if(o==t||a.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let u=vV(a.content,t-o-1,n);return u&&e.replaceChild(i,a.copy(u))}function l1e(e,t,n){if(n.openStart>e.depth)throw new yb("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new yb("Inconsistent open depths");return gV(e,t,n,0)}function gV(e,t,n,r){let i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let a=gV(e,t,n,r+1);return o.copy(o.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let a=e.parent,u=a.content;return mc(a,u.cut(0,e.parentOffset).append(n.content).append(u.cut(t.parentOffset)))}else{let{start:a,end:u}=f1e(n,e);return mc(o,bV(e,a,u,t,r))}else return mc(o,bb(e,t,r))}function yV(e,t){if(!t.type.compatibleContent(e.type))throw new yb("Cannot join "+t.type.name+" onto "+e.type.name)}function yE(e,t,n){let r=e.node(n);return yV(r,t.node(n)),r}function hc(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Dh(e,t,n,r){let i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(hc(e.nodeAfter,r),o++));for(let u=o;u<a;u++)hc(i.child(u),r);t&&t.depth==n&&t.textOffset&&hc(t.nodeBefore,r)}function mc(e,t){return e.type.checkContent(t),e.copy(t)}function bV(e,t,n,r,i){let o=e.depth>i&&yE(e,t,i+1),a=r.depth>i&&yE(n,r,i+1),u=[];return Dh(null,e,i,u),o&&a&&t.index(i)==n.index(i)?(yV(o,a),hc(mc(o,bV(e,t,n,r,i+1)),u)):(o&&hc(mc(o,bb(e,t,i+1)),u),Dh(t,n,i,u),a&&hc(mc(a,bb(n,r,i+1)),u)),Dh(r,null,i,u),new K(u)}function bb(e,t,n){let r=[];if(Dh(null,e,n,r),e.depth>n){let i=yE(e,t,n+1);hc(mc(i,bb(e,t,n+1)),r)}return Dh(t,null,n,r),new K(r)}function f1e(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)i=t.node(o).copy(K.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}class Bh{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return tt.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),i=t.maybeChild(n);if(!r){let u=r;r=i,i=u}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new _b(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let a=t;;){let{index:u,offset:s}=a.content.findIndex(o),c=o-s;if(r.push(a,u,i+s),!c||(a=a.child(u),a.isText))break;o=c-1,i+=s+1}return new Bh(n,r,o)}static resolveCached(t,n){for(let i=0;i<bE.length;i++){let o=bE[i];if(o.pos==n&&o.doc==t)return o}let r=bE[_E]=Bh.resolve(t,n);return _E=(_E+1)%d1e,r}}let bE=[],_E=0,d1e=12;class _b{constructor(t,n,r){this.$from=t,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 p1e=Object.create(null);let vc=class vM{constructor(t,n,r,i=tt.none){this.type=t,this.attrs=n,this.marks=i,this.content=r||K.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,i=0){this.content.nodesBetween(t,n,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,i){return this.content.textBetween(t,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&gb(this.attrs,n||t.defaultAttrs||p1e)&&tt.sameSet(this.marks,r||tt.none)}copy(t=null){return t==this.content?this:new vM(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new vM(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return ae.empty;let i=this.resolve(t),o=this.resolve(n),a=r?0:i.sharedDepth(n),u=i.start(a),c=i.node(a).content.cut(i.pos-u,o.pos-u);return new ae(c,i.depth-a,o.depth-a)}replace(t,n,r){return l1e(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(i==t||n.isText)return n;t-=i+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)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(t){return Bh.resolveCached(this,t)}resolveNoCache(t){return Bh.resolve(this,t)}rangeHasMark(t,n,r){let i=!1;return n>t&&this.nodesBetween(t,n,o=>(r.isInSet(o.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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),_V(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=K.empty,i=0,o=r.childCount){let a=this.contentMatchAt(t).matchFragment(r,i,o),u=a&&a.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let s=i;s<o;s++)if(!this.type.allowsMarks(r.child(s).marks))return!1;return!0}canReplaceWith(t,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),a=o&&o.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=tt.none;for(let n=0;n<this.marks.length;n++)t=this.marks[n].addToSet(t);if(!tt.sameSet(t,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 t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=K.fromJSON(t,n.content);return t.nodeType(n.type).create(n.attrs,i,r)}};vc.prototype.text=void 0;class $b extends vc{constructor(t,n,r,i){if(super(t,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):_V(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new $b(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new $b(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function _V(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class gc{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new h1e(t,n);if(r.next==null)return gc.empty;let i=$V(r);r.next&&r.err("Unexpected trailing text");let o=$1e(_1e(i));return S1e(o,r),o}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let i=[this];function o(a,u){let s=a.matchFragment(t,r);if(s&&(!n||s.validEnd))return K.from(u.map(c=>c.createAndFill()));for(let c=0;c<a.next.length;c++){let{type:l,next:f}=a.next[c];if(!(l.isText||l.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=o(f,u.concat(l));if(d)return d}}return null}return o(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:u,next:s}=o.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in n)&&(!i.type||s.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),n[u.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),t.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+t.indexOf(r.next[a].next);return o}).join(`
31
- `)}}gc.empty=new gc(!0);class h1e{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function $V(e){let t=[];do t.push(m1e(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function m1e(e){let t=[];do t.push(v1e(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function v1e(e){let t=b1e(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=g1e(e,t);else break;return t}function SV(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function g1e(e,t){let n=SV(e),r=n;return e.eat(",")&&(e.next!="}"?r=SV(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function y1e(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let o in n){let a=n[o];a.groups.indexOf(t)>-1&&i.push(a)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function b1e(e){if(e.eat("(")){let t=$V(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=y1e(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function _1e(e){let t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function r(a,u,s){let c={term:s,to:u};return t[a].push(c),c}function i(a,u){a.forEach(s=>s.to=u)}function o(a,u){if(a.type=="choice")return a.exprs.reduce((s,c)=>s.concat(o(c,u)),[]);if(a.type=="seq")for(let s=0;;s++){let c=o(a.exprs[s],u);if(s==a.exprs.length-1)return c;i(c,u=n())}else if(a.type=="star"){let s=n();return r(u,s),i(o(a.expr,s),s),[r(s)]}else if(a.type=="plus"){let s=n();return i(o(a.expr,u),s),i(o(a.expr,s),s),[r(s)]}else{if(a.type=="opt")return[r(u)].concat(o(a.expr,u));if(a.type=="range"){let s=u;for(let c=0;c<a.min;c++){let l=n();i(o(a.expr,s),l),s=l}if(a.max==-1)i(o(a.expr,s),s);else for(let c=a.min;c<a.max;c++){let l=n();r(s,l),i(o(a.expr,s),l),s=l}return[r(s)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function TV(e,t){return t-e}function IV(e,t){let n=[];return r(t),n.sort(TV);function r(i){let o=e[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let a=0;a<o.length;a++){let{term:u,to:s}=o[a];!u&&n.indexOf(s)==-1&&r(s)}}}function $1e(e){let t=Object.create(null);return n(IV(e,0));function n(r){let i=[];r.forEach(a=>{e[a].forEach(({term:u,to:s})=>{if(!u)return;let c;for(let l=0;l<i.length;l++)i[l][0]==u&&(c=i[l][1]);IV(e,s).forEach(l=>{c||i.push([u,c=[]]),c.indexOf(l)==-1&&c.push(l)})})});let o=t[r.join(",")]=new gc(r.indexOf(e.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(TV);o.next.push({type:i[a][0],next:t[u.join(",")]||n(u)})}return o}}function S1e(e,t){for(let n=0,r=[e];n<r.length;n++){let i=r[n],o=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:s,next:c}=i.next[u];a.push(s.name),o&&!(s.isText||s.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function CV(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function OV(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let o=e[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function wV(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new T1e(e[n]);return t}let EV=class UH{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=wV(r.attrs),this.defaultAttrs=CV(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==gc.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:OV(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new vc(this,this.computeAttrs(t),K.from(n),tt.setFrom(r))}createChecked(t=null,n,r){return n=K.from(n),this.checkContent(n),new vc(this,this.computeAttrs(t),n,tt.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=K.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(K.empty,!0);return o?new vc(this,t,n.append(o),tt.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:tt.none:t}static compile(t,n){let r=Object.create(null);t.forEach((o,a)=>r[o]=new UH(o,n,a));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 o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class T1e{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class Sb{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=wV(i.attrs),this.excluded=null;let o=CV(this.attrs);this.instance=o?new tt(this,o):null}create(t=null){return!t&&this.instance?this.instance:new tt(this,OV(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((o,a)=>r[o]=new Sb(o,i++,n,a)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}excludes(t){return this.excluded.indexOf(t)>-1}}class I1e{constructor(t){this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=vn.from(t.nodes),n.marks=vn.from(t.marks||{}),this.nodes=EV.compile(this.spec.nodes,this),this.marks=Sb.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 o=this.nodes[i],a=o.spec.content||"",u=o.spec.marks;o.contentMatch=r[a]||(r[a]=gc.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet=u=="_"?null:u?xV(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:xV(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof EV){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,i)}text(t,n){let r=this.nodes.text;return new $b(r,r.defaultAttrs,t,tt.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return vc.fromJSON(this,t)}markFromJSON(t){return tt.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function xV(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(let u in e.marks){let s=e.marks[u];(i=="_"||s.spec.group&&s.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=s)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class kf{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=t.nodes[r.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new AV(this,n,!1);return r.addAll(t,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new AV(this,n,!0);return r.addAll(t,n.from,n.to),ae.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(w1e(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(t,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],u=a.style;if(!(u.indexOf(t)!=0||a.context&&!r.matchesContext(a.context)||u.length>t.length&&(u.charCodeAt(t.length)!=61||u.slice(t.length+1)!=n))){if(a.getAttrs){let s=a.getAttrs(n);if(s===!1)continue;a.attrs=s||void 0}return a}}}static schemaRules(t){let n=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<n.length;a++){let u=n[a];if((u.priority==null?50:u.priority)<o)break}n.splice(a,0,i)}for(let i in t.marks){let o=t.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=FV(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=FV(a)),a.node||a.ignore||a.mark||(a.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new kf(t,kf.schemaRules(t)))}}const MV={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},C1e={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},RV={ol:!0,ul:!0},Tb=1,Ib=2,Uh=4;function kV(e,t,n){return t!=null?(t?Tb:0)|(t==="full"?Ib:0):e&&e.whitespace=="pre"?Tb|Ib:n&~Uh}class Cb{constructor(t,n,r,i,o,a,u){this.type=t,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=u,this.content=[],this.activeMarks=tt.none,this.stashMarks=[],this.match=a||(u&Uh?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(K.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Tb)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=K.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(t){for(let n=this.stashMarks.length-1;n>=0;n--)if(t.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(t){for(let n=0,r=this.pendingMarks;n<r.length;n++){let i=r[n];(this.type?this.type.allowsMarkType(i.type):x1e(i.type,t))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!MV.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class AV{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,a=kV(null,n.preserveWhitespace,0)|(r?Uh:0);i?o=new Cb(i.type,i.attrs,tt.none,tt.none,!0,n.topMatch||i.type.contentMatch,a):r?o=new Cb(null,null,tt.none,tt.none,!0,null,a):o=new Cb(t.schema.topNodeType,null,tt.none,tt.none,!0,null,a),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){if(t.nodeType==3)this.addTextNode(t);else if(t.nodeType==1){let n=t.getAttribute("style");if(!n)this.addElement(t);else{let r=this.readStyles(E1e(n));if(!r)return;let[i,o]=r,a=this.top;for(let u=0;u<o.length;u++)this.removePendingMark(o[u],a);for(let u=0;u<i.length;u++)this.addPendingMark(i[u]);this.addElement(t);for(let u=0;u<i.length;u++)this.removePendingMark(i[u],a);for(let u=0;u<o.length;u++)this.addPendingMark(o[u])}}}addTextNode(t){let n=t.nodeValue,r=this.top;if(r.options&Ib||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&Tb)r.options&Ib?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],o=t.previousSibling;(!i||o&&o.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(t)}else this.findInside(t)}addElement(t,n){let r=t.nodeName.toLowerCase(),i;RV.hasOwnProperty(r)&&this.parser.normalizeLists&&O1e(t);let o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,n));if(o?o.ignore:C1e.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);let a,u=this.top,s=this.needsBlock;if(MV.hasOwnProperty(r))u.content.length&&u.content[0].isInline&&this.open&&(this.open--,u=this.top),a=!0,u.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t);return}this.addAll(t),a&&this.sync(u),this.needsBlock=s}else this.addElementByRule(t,o,o.consuming===!1?i:void 0)}leafFallback(t){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
33
- `))}ignoreFallback(t){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(t){let n=tt.none,r=tt.none;e:for(let i=0;i<t.length;i+=2)for(let o=void 0;;){let a=this.parser.matchStyle(t[i],t[i+1],this,o);if(!a)continue e;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.forEach(u=>{a.clearMark(u)&&(r=u.addToSet(r))}):n=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(n),a.consuming===!1)o=a;else break}return[n,r]}addElementByRule(t,n,r){let i,o,a;n.node?(o=this.parser.schema.nodes[n.node],o.isLeaf?this.insertNode(o.create(n.attrs))||this.leafFallback(t):i=this.enter(o,n.attrs||null,n.preserveWhitespace)):(a=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(a));let u=this.top;if(o&&o.isLeaf)this.findInside(t);else if(r)this.addElement(t,r);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(s=>this.insertNode(s));else{let s=t;typeof n.contentElement=="string"?s=t.querySelector(n.contentElement):typeof n.contentElement=="function"?s=n.contentElement(t):n.contentElement&&(s=n.contentElement),this.findAround(t,s,!0),this.addAll(s)}i&&this.sync(u)&&this.open--,a&&this.removePendingMark(a,u)}addAll(t,n,r){let i=n||0;for(let o=n?t.childNodes[n]:t.firstChild,a=r==null?null:t.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(o);this.findAtPoint(t,i)}findPlace(t){let n,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],a=o.findWrapping(t);if(a&&(!n||n.length>a.length)&&(n=a,r=o,!a.length)||o.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(t){if(t.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(t)){this.closeExtra();let n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));let r=n.activeMarks;for(let i=0;i<t.marks.length;i++)(!n.type||n.type.allowsMarkType(t.marks[i].type))&&(r=t.marks[i].addToSet(r));return n.content.push(t.mark(r)),!0}return!1}enter(t,n,r){let i=this.findPlace(t.create(n));return i&&this.enterInner(t,n,!0,r),i}enterInner(t,n=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let a=kV(t,i,o.options);o.options&Uh&&o.content.length==0&&(a|=Uh),this.nodes.push(new Cb(t,n,o.activeMarks,o.pendingMarks,r,null,a)),this.open++}closeExtra(t=!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(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let n=this.open;n>=0;n--)if(this.nodes[n]==t)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(u,s)=>{for(;u>=0;u--){let c=n[u];if(c==""){if(u==n.length-1||u==0)continue;for(;s>=o;s--)if(a(u-1,s))return!0;return!1}else{let l=s>0||s==0&&i?this.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!l||l.name!=c&&l.groups.indexOf(c)==-1)return!1;s--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.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(t){let n=M1e(t,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(t)>-1)i.pendingMarks=t.removeFromSet(i.pendingMarks);else{i.activeMarks=t.removeFromSet(i.activeMarks);let a=i.popFromStashMark(t);a&&i.type&&i.type.allowsMarkType(a.type)&&(i.activeMarks=a.addToSet(i.activeMarks))}if(i==n)break}}}function O1e(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&RV.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function w1e(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function E1e(e){let t=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=t.exec(e);)r.push(n[1],n[2].trim());return r}function FV(e){let t={};for(let n in e)t[n]=e[n];return t}function x1e(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],a=u=>{o.push(u);for(let s=0;s<u.edgeCount;s++){let{type:c,next:l}=u.edge(s);if(c==t||o.indexOf(l)<0&&a(l))return!0}};if(a(i.contentMatch))return!0}}function M1e(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}class bo{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=$E(n).createDocumentFragment());let i=r,o=[];return t.forEach(a=>{if(o.length||a.marks.length){let u=0,s=0;for(;u<o.length&&s<a.marks.length;){let c=a.marks[s];if(!this.marks[c.type.name]){s++;continue}if(!c.eq(o[u][0])||c.type.spec.spanning===!1)break;u++,s++}for(;u<o.length;)i=o.pop()[1];for(;s<a.marks.length;){let c=a.marks[s++],l=this.serializeMark(c,a.isInline,n);l&&(o.push([c,i]),i.appendChild(l.dom),i=l.contentDOM||l.dom)}}i.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:i}=bo.renderSpec($E(n),this.nodes[t.type.name](t));if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,i)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let i=t.marks.length-1;i>=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&bo.renderSpec($E(r),i(t,n))}static renderSpec(t,n,r=null){if(typeof n=="string")return{dom:t.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let i=n[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let a,u=r?t.createElementNS(r,i):t.createElement(i),s=n[1],c=1;if(s&&typeof s=="object"&&s.nodeType==null&&!Array.isArray(s)){c=2;for(let l in s)if(s[l]!=null){let f=l.indexOf(" ");f>0?u.setAttributeNS(l.slice(0,f),l.slice(f+1),s[l]):u.setAttribute(l,s[l])}}for(let l=c;l<n.length;l++){let f=n[l];if(f===0){if(l<n.length-1||l>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:d,contentDOM:p}=bo.renderSpec(t,f,r);if(u.appendChild(d),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:u,contentDOM:a}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new bo(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=NV(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return NV(t.marks)}}function NV(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function $E(e){return e.document||window.document}const PV=65535,WV=Math.pow(2,16);function R1e(e,t){return e+t*WV}function jV(e){return e&PV}function k1e(e){return(e-(e&PV))/WV}const LV=1,DV=2,Ob=4,BV=8;class SE{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&BV)>0}get deletedBefore(){return(this.delInfo&(LV|Ob))>0}get deletedAfter(){return(this.delInfo&(DV|Ob))>0}get deletedAcross(){return(this.delInfo&Ob)>0}}class Zr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Zr.empty)return Zr.empty}recover(t){let n=0,r=jV(t);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+k1e(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let s=this.ranges[u]-(this.inverted?i:0);if(s>t)break;let c=this.ranges[u+o],l=this.ranges[u+a],f=s+c;if(t<=f){let d=c?t==s?-1:t==f?1:n:n,p=s+i+(d<0?0:l);if(r)return p;let h=t==(n<0?s:f)?null:R1e(u/3,t-s),m=t==s?DV:t==f?LV:Ob;return(n<0?t!=s:t!=f)&&(m|=BV),new SE(p,m,h)}i+=l-c}return r?t+i:new SE(t+i,0,null)}touches(t,n){let r=0,i=jV(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let s=this.ranges[u]-(this.inverted?r:0);if(s>t)break;let c=this.ranges[u+o],l=s+c;if(t<=l&&u==i*3)return!0;r+=this.ranges[u+a]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?o:0),s=a+(this.inverted?0:o),c=this.ranges[i+n],l=this.ranges[i+r];t(u,u+c,s,s+l),o+=l-c}}invert(){return new Zr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Zr.empty:new Zr(t<0?[0,-t,0]:[0,0,t])}}Zr.empty=new Zr([]);class Af{constructor(t=[],n,r=0,i=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=i}slice(t=0,n=this.maps.length){return new Af(this.maps,this.mirror,t,n)}copy(){return new Af(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let i=t.getMirror(n);this.appendMap(t.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let i=t.getMirror(n);this.appendMap(t.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new Af;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],u=a.mapResult(t,n);if(u.recover!=null){let s=this.getMirror(o);if(s!=null&&s>o&&s<this.to){o=s,t=this.maps[s].recover(u.recover);continue}}i|=u.delInfo,t=u.pos}return r?t:new SE(t,i,null)}}const TE=Object.create(null);class cr{getMap(){return Zr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=TE[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in TE)throw new RangeError("Duplicate use of step JSON ID "+t);return TE[t]=n,n.prototype.jsonID=t,n}}class Bt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Bt(t,null)}static fail(t){return new Bt(null,t)}static fromReplace(t,n,r,i){try{return Bt.ok(t.replace(n,r,i))}catch(o){if(o instanceof yb)return Bt.fail(o.message);throw o}}}function IE(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(IE(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return K.fromArray(r)}class Eu extends cr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new ae(IE(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Bt.fromReplace(t,this.from,this.to,o)}invert(){return new _o(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Eu(n.pos,r.pos,this.mark)}merge(t){return t instanceof Eu&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Eu(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Eu(n.from,n.to,t.markFromJSON(n.mark))}}cr.jsonID("addMark",Eu);class _o extends cr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new ae(IE(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return Bt.fromReplace(t,this.from,this.to,r)}invert(){return new Eu(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new _o(n.pos,r.pos,this.mark)}merge(t){return t instanceof _o&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new _o(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new _o(n.from,n.to,t.markFromJSON(n.mark))}}cr.jsonID("removeMark",_o);class xu extends cr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Bt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Bt.fromReplace(t,this.pos,this.pos+1,new ae(K.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.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 xu(this.pos,n.marks[i]);return new xu(this.pos,this.mark)}}return new Ff(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new xu(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xu(n.pos,t.markFromJSON(n.mark))}}cr.jsonID("addNodeMark",xu);class Ff extends cr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Bt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Bt.fromReplace(t,this.pos,this.pos+1,new ae(K.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new xu(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ff(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ff(n.pos,t.markFromJSON(n.mark))}}cr.jsonID("removeNodeMark",Ff);class wn extends cr{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&CE(t,this.from,this.to)?Bt.fail("Structure replace would overwrite content"):Bt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Zr([this.from,this.to-this.from,this.slice.size])}invert(t){return new wn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new wn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof wn)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?ae.empty:new ae(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new wn(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?ae.empty:new ae(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new wn(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wn(n.from,n.to,ae.fromJSON(t,n.slice),!!n.structure)}}cr.jsonID("replace",wn);class Zt extends cr{constructor(t,n,r,i,o,a,u=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=u}apply(t){if(this.structure&&(CE(t,this.from,this.gapFrom)||CE(t,this.gapTo,this.to)))return Bt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Bt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Bt.fromReplace(t,this.from,this.to,r):Bt.fail("Content does not fit in gap")}getMap(){return new Zr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Zt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Zt(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 Zt(n.from,n.to,n.gapFrom,n.gapTo,ae.fromJSON(t,n.slice),n.insert,!!n.structure)}}cr.jsonID("replaceAround",Zt);function CE(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function A1e(e,t,n,r){let i=[],o=[],a,u;e.doc.nodesBetween(t,n,(s,c,l)=>{if(!s.isInline)return;let f=s.marks;if(!r.isInSet(f)&&l.type.allowsMarkType(r.type)){let d=Math.max(c,t),p=Math.min(c+s.nodeSize,n),h=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(h)||(a&&a.to==d&&a.mark.eq(f[m])?a.to=p:i.push(a=new _o(d,p,f[m])));u&&u.to==d?u.to=p:o.push(u=new Eu(d,p,r))}}),i.forEach(s=>e.step(s)),o.forEach(s=>e.step(s))}function F1e(e,t,n,r){let i=[],o=0;e.doc.nodesBetween(t,n,(a,u)=>{if(!a.isInline)return;o++;let s=null;if(r instanceof Sb){let c=a.marks,l;for(;l=r.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c)}else r?r.isInSet(a.marks)&&(s=[r]):s=a.marks;if(s&&s.length){let c=Math.min(u+a.nodeSize,n);for(let l=0;l<s.length;l++){let f=s[l],d;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&f.eq(i[p].style)&&(d=h)}d?(d.to=c,d.step=o):i.push({style:f,from:Math.max(u,t),to:c,step:o})}}}),i.forEach(a=>e.step(new _o(a.from,a.to,a.style)))}function N1e(e,t,n,r=n.contentMatch){let i=e.doc.nodeAt(t),o=[],a=t+1;for(let u=0;u<i.childCount;u++){let s=i.child(u),c=a+s.nodeSize,l=r.matchType(s.type);if(!l)o.push(new wn(a,c,ae.empty));else{r=l;for(let f=0;f<s.marks.length;f++)n.allowsMarkType(s.marks[f].type)||e.step(new _o(a,c,s.marks[f]))}a=c}if(!r.validEnd){let u=r.fillBefore(K.empty,!0);e.replace(a,a,new ae(u,0,0))}for(let u=o.length-1;u>=0;u--)e.step(o[u])}function P1e(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Nf(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let i=e.$from.node(r),o=e.$from.index(r),a=e.$to.indexAfter(r);if(r<e.depth&&i.canReplace(o,a,n))return r;if(r==0||i.type.spec.isolating||!P1e(i,o,a))break}return null}function W1e(e,t,n){let{$from:r,$to:i,depth:o}=t,a=r.before(o+1),u=i.after(o+1),s=a,c=u,l=K.empty,f=0;for(let h=o,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,l=K.from(r.node(h).copy(l)),f++):s--;let d=K.empty,p=0;for(let h=o,m=!1;h>n;h--)m||i.after(h+1)<i.end(h)?(m=!0,d=K.from(i.node(h).copy(d)),p++):c++;e.step(new Zt(s,c,a,u,new ae(l.append(d),f,p),l.size-f,!0))}function OE(e,t,n=null,r=e){let i=j1e(e,t),o=i&&L1e(r,t);return o?i.map(UV).concat({type:t,attrs:n}).concat(o.map(UV)):null}function UV(e){return{type:e,attrs:null}}function j1e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}function L1e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;let s=(a.length?a[a.length-1]:t).contentMatch;for(let c=r;s&&c<i;c++)s=s.matchType(n.child(c).type);return!s||!s.validEnd?null:a}function D1e(e,t,n){let r=K.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let u=n[a].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=K.from(n[a].type.create(n[a].attrs,r))}let i=t.start,o=t.end;e.step(new Zt(i,o,i,o,new ae(r,0,0),n.length,!0))}function B1e(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(a,u)=>{if(a.isTextblock&&!a.hasMarkup(r,i)&&U1e(e.doc,e.mapping.slice(o).map(u),r)){e.clearIncompatible(e.mapping.slice(o).map(u,1),r);let s=e.mapping.slice(o),c=s.map(u,1),l=s.map(u+a.nodeSize,1);return e.step(new Zt(c,l,c+1,l-1,new ae(K.from(r.create(i,null,a.marks)),0,0),1,!0)),!1}})}function U1e(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function q1e(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let a=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,a);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Zt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new ae(K.from(a),0,0),1,!0))}function Pf(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,l=n-2;c>o;c--,l--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),h=r&&r[l+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[l]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(p))return!1}let u=i.indexAfter(o),s=r&&r[0];return i.node(o).canReplaceWith(u,u,s?s.type:i.node(o+1).type)}function z1e(e,t,n=1,r){let i=e.doc.resolve(t),o=K.empty,a=K.empty;for(let u=i.depth,s=i.depth-n,c=n-1;u>s;u--,c--){o=K.from(i.node(u).copy(o));let l=r&&r[c];a=K.from(l?l.type.create(l.attrs,a):i.node(u).copy(a))}e.step(new wn(t,t,new ae(o.append(a),n,n),!0))}function Mu(e,t){let n=e.resolve(t),r=n.index();return qV(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function qV(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}function zV(e,t,n=-1){let r=e.resolve(t);for(let i=r.depth;;i--){let o,a,u=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):n>0?(o=r.node(i+1),u++,a=r.node(i).maybeChild(u)):(o=r.node(i).maybeChild(u-1),a=r.node(i+1)),o&&!o.isTextblock&&qV(o,a)&&r.node(i).canReplace(u,u+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function K1e(e,t,n){let r=new wn(t-n,t+n,ae.empty,!0);e.step(r)}function V1e(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function H1e(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,s=r.index(a)+(u>0?1:0),c=r.node(a),l=!1;if(o==1)l=c.canReplace(s,s,i);else{let f=c.contentMatchAt(s).findWrapping(i.firstChild.type);l=f&&c.canReplaceWith(s,s,f[0])}if(l)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function wE(e,t,n=t,r=ae.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return KV(i,o,r)?new wn(t,n,r):new G1e(i,o,r).fit()}function KV(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class G1e{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=K.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,a=r.depth,u=i.depth;for(;a&&u&&o.childCount==1;)o=o.firstChild.content,a--,u--;let s=new ae(o,a,u);return t>-1?new Zt(r.pos,t,this.$to.pos,this.$to.end(),s,n):s.size||r.pos!=this.$to.pos?new wn(r.pos,i.pos,s):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=EE(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:s,match:c}=this.frontier[u],l,f=null;if(n==1&&(a?c.matchType(a.type)||(f=c.fillBefore(K.from(a),!1)):o&&s.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:u,parent:o,inject:f};if(n==2&&a&&(l=c.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:o,wrap:l};if(o&&c.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=EE(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ae(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=EE(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new ae(qh(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new ae(qh(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let a=this.unplaced,u=r?r.content:a.content,s=a.openStart-t,c=0,l=[],{match:f,type:d}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)l.push(i.child(m));f=f.matchFragment(i)}let p=u.size+t-(a.content.size-a.openEnd);for(;c<u.childCount;){let m=u.child(c),g=f.matchType(m.type);if(!g)break;c++,(c>1||s==0||m.content.size)&&(f=g,l.push(VV(m.mark(d.allowedMarks(m.marks)),c==1?s:0,c==u.childCount?p:-1)))}let h=c==u.childCount;h||(p=-1),this.placed=zh(this.placed,n,K.from(l)),this.frontier[n].match=f,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=u;m<p;m++){let _=g.lastChild;this.frontier.push({type:_.type,match:_.contentMatchAt(_.childCount)}),g=_.content}this.unplaced=h?t==0?ae.empty:new ae(qh(a.content,t-1,1),t-1,p<0?a.openEnd:t-1):new ae(qh(a.content,t,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!xE(this.$to,this.$to.depth,t.type,t.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(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),a=xE(t,n,i,r,o);if(a){for(let u=n-1;u>=0;u--){let{match:s,type:c}=this.frontier[u],l=xE(t,u,c,s,!0);if(!l||l.childCount)continue e}return{depth:n,fit:a,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=zh(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=zh(this.placed,this.depth,K.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=zh(this.placed,this.frontier.length,n))}}function qh(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(qh(e.firstChild.content,t-1,n)))}function zh(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(zh(e.lastChild.content,t-1,n)))}function EE(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function VV(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,VV(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),e.copy(r)}function xE(e,t,n,r,i){let o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;let u=r.fillBefore(o.content,!0,a);return u&&!Y1e(n,o.content,a)?u:null}function Y1e(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function J1e(e){return e.spec.defining||e.spec.definingForContent}function Z1e(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(KV(i,o,r))return e.step(new wn(t,n,r));let a=GV(i,e.doc.resolve(n));a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let d=i.depth,p=i.pos-1;d>0;d--,p--){let h=i.node(d).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;a.indexOf(d)>-1?u=d:i.before(d)==p&&a.splice(1,0,-d)}let s=a.indexOf(u),c=[],l=r.openStart;for(let d=r.content,p=0;;p++){let h=d.firstChild;if(c.push(h),p==r.openStart)break;d=h.content}for(let d=l-1;d>=0;d--){let p=c[d].type,h=J1e(p);if(h&&i.node(s).type!=p)l=d;else if(h||!p.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+l+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<a.length;m++){let g=a[(m+s)%a.length],_=!0;g<0&&(_=!1,g=-g);let S=i.node(g-1),C=i.index(g-1);if(S.canReplaceWith(C,C,h.type,h.marks))return e.replace(i.before(g),_?o.after(g):n,new ae(HV(r.content,0,r.openStart,p),p,r.openEnd))}}let f=e.steps.length;for(let d=a.length-1;d>=0&&(e.replace(t,n,r),!(e.steps.length>f));d--){let p=a[d];p<0||(t=i.before(p),n=o.after(p))}}function HV(e,t,n,r,i){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(HV(o.content,t+1,n,r,o)))}if(t>r){let o=i.contentMatchAt(0),a=o.fillBefore(e).append(e);e=a.append(o.matchFragment(a).fillBefore(K.empty,!0))}return e}function X1e(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=V1e(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new ae(K.from(r),0,0))}function Q1e(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),o=GV(r,i);for(let a=0;a<o.length;a++){let u=o[a],s=a==o.length-1;if(s&&u==0||r.node(u).type.contentMatch.validEnd)return e.delete(r.start(u),i.end(u));if(u>0&&(s||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return e.delete(r.before(u),i.after(u))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a)return e.delete(r.before(a),n);e.delete(t,n)}function GV(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let o=e.start(i);if(o<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(o==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==o-1)&&n.push(i)}return n}class Wf extends cr{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Bt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Bt.fromReplace(t,this.pos,this.pos+1,new ae(K.from(i),0,n.isLeaf?0:1))}getMap(){return Zr.empty}invert(t){return new Wf(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Wf(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Wf(n.pos,n.attr,n.value)}}cr.jsonID("attr",Wf);let jf=class extends Error{};jf=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},jf.prototype=Object.create(Error.prototype),jf.prototype.constructor=jf,jf.prototype.name="TransformError";class eCe{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Af}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new jf(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=ae.empty){let i=wE(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new ae(K.from(r),0,0))}delete(t,n){return this.replace(t,n,ae.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return Z1e(this,t,n,r),this}replaceRangeWith(t,n,r){return X1e(this,t,n,r),this}deleteRange(t,n){return Q1e(this,t,n),this}lift(t,n){return W1e(this,t,n),this}join(t,n=1){return K1e(this,t,n),this}wrap(t,n){return D1e(this,t,n),this}setBlockType(t,n=t,r,i=null){return B1e(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return q1e(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new Wf(t,n,r)),this}addNodeMark(t,n){return this.step(new xu(t,n)),this}removeNodeMark(t,n){if(!(n instanceof tt)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Ff(t,n)),this}split(t,n=1,r){return z1e(this,t,n,r),this}addMark(t,n,r){return A1e(this,t,n,r),this}removeMark(t,n,r){return F1e(this,t,n,r),this}clearIncompatible(t,n,r){return N1e(this,t,n,r),this}}const ME=Object.create(null);class Ne{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new tCe(t.min(n),t.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 t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=ae.empty){let r=n.content.lastChild,i=null;for(let u=0;u<n.openEnd;u++)i=r,r=r.lastChild;let o=t.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:s,$to:c}=a[u],l=t.mapping.slice(o);t.replaceRange(l.map(s.pos),l.map(c.pos),u?ae.empty:n),u==0&&ZV(t,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:u}=i[o],s=t.mapping.slice(r),c=s.map(a.pos),l=s.map(u.pos);o?t.deleteRange(c,l):(t.replaceRangeWith(c,l,n),ZV(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let i=t.parent.inlineContent?new Be(t):Lf(t.node(0),t.parent,t.pos,t.index(),n,r);if(i)return i;for(let o=t.depth-1;o>=0;o--){let a=n<0?Lf(t.node(0),t.node(o),t.before(o+1),t.index(o),n,r):Lf(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,r);if(a)return a}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Fi(t.node(0))}static atStart(t){return Lf(t,t,0,0,1)||new Fi(t)}static atEnd(t){return Lf(t,t,t.content.size,t.childCount,-1)||new Fi(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ME[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in ME)throw new RangeError("Duplicate use of selection JSON ID "+t);return ME[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Be.between(this.$anchor,this.$head).getBookmark()}}Ne.prototype.visible=!0;class tCe{constructor(t,n){this.$from=t,this.$to=n}}let YV=!1;function JV(e){!YV&&!e.parent.inlineContent&&(YV=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Be extends Ne{constructor(t,n=t){JV(t),JV(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ne.near(r);let i=t.resolve(n.map(this.anchor));return new Be(i.parent.inlineContent?i:r,r)}replace(t,n=ae.empty){if(super.replace(t,n),n==ae.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Be&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new wb(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Be(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=Ne.findFrom(n,r,!0)||Ne.findFrom(n,-r,!0);if(o)n=o.$head;else return Ne.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Ne.findFrom(t,-r,!0)||Ne.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new Be(t,n)}}Ne.jsonID("text",Be);class wb{constructor(t,n){this.anchor=t,this.head=n}map(t){return new wb(t.map(this.anchor),t.map(this.head))}resolve(t){return Be.between(t.resolve(this.anchor),t.resolve(this.head))}}class ve extends Ne{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=t.resolve(i);return r?Ne.near(o):new ve(o)}content(){return new ae(K.from(this.node),0,0)}eq(t){return t instanceof ve&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new RE(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ve(t.resolve(n.anchor))}static create(t,n){return new ve(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}ve.prototype.visible=!1,Ne.jsonID("node",ve);class RE{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new wb(r,r):new RE(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&ve.isSelectable(r)?new ve(n):Ne.near(n)}}class Fi extends Ne{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=ae.empty){if(n==ae.empty){t.delete(0,t.doc.content.size);let r=Ne.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Fi(t)}map(t){return new Fi(t)}eq(t){return t instanceof Fi}getBookmark(){return nCe}}Ne.jsonID("all",Fi);const nCe={map(){return this},resolve(e){return new Fi(e)}};function Lf(e,t,n,r,i,o=!1){if(t.inlineContent)return Be.create(e,n);for(let a=r-(i>0?0:1);i>0?a<t.childCount:a>=0;a+=i){let u=t.child(a);if(u.isAtom){if(!o&&ve.isSelectable(u))return ve.create(e,n-(i<0?u.nodeSize:0))}else{let s=Lf(e,u,n+i,i<0?u.childCount:0,i,o);if(s)return s}n+=u.nodeSize*i}return null}function ZV(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof wn||i instanceof Zt))return;let o=e.mapping.maps[r],a;o.forEach((u,s,c,l)=>{a==null&&(a=l)}),e.setSelection(Ne.near(e.doc.resolve(a),n))}const XV=1,Eb=2,QV=4;class rCe extends eCe{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|XV)&~Eb,this.storedMarks=null,this}get selectionSet(){return(this.updated&XV)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Eb,this}ensureMarks(t){return tt.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Eb)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~Eb,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||tt.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!t)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let a=this.doc.resolve(n);o=r==n?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(t,o)),this.selection.empty||this.setSelection(Ne.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=QV,this}get scrolledIntoView(){return(this.updated&QV)>0}}function e3(e,t){return!t||!e?e:e.bind(t)}class Kh{constructor(t,n,r){this.name=t,this.init=e3(n.init,r),this.apply=e3(n.apply,r)}}const iCe=[new Kh("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Kh("selection",{init(e,t){return e.selection||Ne.atStart(t.doc)},apply(e){return e.selection}}),new Kh("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Kh("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class kE{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=iCe.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 Kh(r.key,r.spec.state,r))})}}class Df{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,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,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),i=null;for(;;){let o=!1;for(let a=0;a<this.config.plugins.length;a++){let u=this.config.plugins[a];if(u.spec.appendTransaction){let s=i?i[a].n:0,c=i?i[a].state:this,l=s<n.length&&u.spec.appendTransaction.call(u,s?n.slice(s):n,c,r);if(l&&r.filterTransaction(l,a)){if(l.setMeta("appendedTransaction",t),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<a?{state:r,n:n.length}:{state:this,n:0})}n.push(l),r=r.applyInner(l),o=!0}i&&(i[a]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Df(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(t,this[o.name],this,n)}return n}get tr(){return new rCe(this)}static create(t){let n=new kE(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Df(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}reconfigure(t){let n=new kE(this.schema,t.plugins),r=n.fields,i=new Df(n);for(let o=0;o<r.length;o++){let a=r[o].name;i[a]=this.hasOwnProperty(a)?this[a]:r[o].init(t,i)}return i}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new kE(t.schema,t.plugins),o=new Df(i);return i.fields.forEach(a=>{if(a.name=="doc")o.doc=vc.fromJSON(t.schema,n.doc);else if(a.name=="selection")o.selection=Ne.fromJSON(o.doc,n.selection);else if(a.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let u in r){let s=r[u],c=s.spec.state;if(s.key==a.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){o[a.name]=c.fromJSON.call(s,t,n[u],o);return}}o[a.name]=a.init(t,o)}}),o}}function t3(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=t3(i,t,{})),n[r]=i}return n}class Rr{constructor(t){this.spec=t,this.props={},t.props&&t3(t.props,this,this.props),this.key=t.key?t.key.key:n3("plugin")}getState(t){return t[this.key]}}const AE=Object.create(null);function n3(e){return e in AE?e+"$"+ ++AE[e]:(AE[e]=0,e+"$")}class Ni{constructor(t="key"){this.key=n3(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const kr=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Vh=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let r3=null;const xa=function(e,t,n){let r=r3||(r3=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},yc=function(e,t,n,r){return n&&(i3(e,t,n,r,-1)||i3(e,t,n,r,1))},oCe=/^(img|br|input|textarea|hr)$/i;function i3(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:$o(e))){let o=e.parentNode;if(!o||o.nodeType!=1||uCe(e)||oCe.test(e.nodeName)||e.contentEditable=="false")return!1;t=kr(e)+(i<0?0:1),e=o}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.contentEditable=="false")return!1;t=i<0?$o(e):0}else return!1}}function $o(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function aCe(e,t,n){for(let r=t==0,i=t==$o(e);r||i;){if(e==n)return!0;let o=kr(e);if(e=e.parentNode,!e)return!1;r=r&&o==0,i=i&&o==$o(e)}}function uCe(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const xb=function(e){return e.focusNode&&yc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function bc(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function sCe(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function cCe(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const So=typeof navigator<"u"?navigator:null,o3=typeof document<"u"?document:null,Ru=So&&So.userAgent||"",FE=/Edge\/(\d+)/.exec(Ru),a3=/MSIE \d/.exec(Ru),NE=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ru),lr=!!(a3||NE||FE),ku=a3?document.documentMode:NE?+NE[1]:FE?+FE[1]:0,Pi=!lr&&/gecko\/(\d+)/i.test(Ru);Pi&&+(/Firefox\/(\d+)/.exec(Ru)||[0,0])[1];const PE=!lr&&/Chrome\/(\d+)/.exec(Ru),En=!!PE,lCe=PE?+PE[1]:0,zn=!lr&&!!So&&/Apple Computer/.test(So.vendor),Bf=zn&&(/Mobile\/\w+/.test(Ru)||!!So&&So.maxTouchPoints>2),Xr=Bf||(So?/Mac/.test(So.platform):!1),fCe=So?/Win/.test(So.platform):!1,Wi=/Android \d/.test(Ru),Mb=!!o3&&"webkitFontSmoothing"in o3.documentElement.style,dCe=Mb?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function pCe(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Au(e,t){return typeof e=="number"?e:e[t]}function hCe(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function u3(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let a=n||e.dom;a;a=Vh(a)){if(a.nodeType!=1)continue;let u=a,s=u==o.body,c=s?pCe(o):hCe(u),l=0,f=0;if(t.top<c.top+Au(r,"top")?f=-(c.top-t.top+Au(i,"top")):t.bottom>c.bottom-Au(r,"bottom")&&(f=t.bottom-c.bottom+Au(i,"bottom")),t.left<c.left+Au(r,"left")?l=-(c.left-t.left+Au(i,"left")):t.right>c.right-Au(r,"right")&&(l=t.right-c.right+Au(i,"right")),l||f)if(s)o.defaultView.scrollBy(l,f);else{let d=u.scrollLeft,p=u.scrollTop;f&&(u.scrollTop+=f),l&&(u.scrollLeft+=l);let h=u.scrollLeft-d,m=u.scrollTop-p;t={left:t.left-h,top:t.top-m,right:t.right-h,bottom:t.bottom-m}}if(s)break}}function mCe(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let o=(t.left+t.right)/2,a=n+1;a<Math.min(innerHeight,t.bottom);a+=5){let u=e.root.elementFromPoint(o,a);if(!u||u==e.dom||!e.dom.contains(u))continue;let s=u.getBoundingClientRect();if(s.top>=n-20){r=u,i=s.top;break}}return{refDOM:r,refTop:i,stack:s3(e.dom)}}function s3(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Vh(r));return t}function vCe({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;c3(n,r==0?0:r-t)}function c3(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Uf=null;function gCe(e){if(e.setActive)return e.setActive();if(Uf)return e.focus(Uf);let t=s3(e);e.focus(Uf==null?{get preventScroll(){return Uf={preventScroll:!0},!0}}:void 0),Uf||(Uf=!1,c3(t,0))}function l3(e,t){let n,r=2e8,i,o=0,a=t.top,u=t.top,s,c;for(let l=e.firstChild,f=0;l;l=l.nextSibling,f++){let d;if(l.nodeType==1)d=l.getClientRects();else if(l.nodeType==3)d=xa(l).getClientRects();else continue;for(let p=0;p<d.length;p++){let h=d[p];if(h.top<=a&&h.bottom>=u){a=Math.max(h.bottom,a),u=Math.min(h.top,u);let m=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(m<r){n=l,r=m,i=m&&n.nodeType==3?{left:h.right<t.left?h.right:h.left,top:t.top}:t,l.nodeType==1&&m&&(o=f+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!s&&h.left<=t.left&&h.right>=t.left&&(s=l,c={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(o=f+1)}}return!n&&s&&(n=s,i=c,r=0),n&&n.nodeType==3?yCe(n,i):!n||r&&n.nodeType==1?{node:e,offset:o}:l3(n,i)}function yCe(e,t){let n=e.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let o=Fu(r,1);if(o.top!=o.bottom&&WE(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}function WE(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function bCe(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function _Ce(e,t,n){let{node:r,offset:i}=l3(t,n),o=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();o=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}function $Ce(e,t,n,r){let i=-1;for(let o=t,a=!1;o!=e.dom;){let u=e.docView.nearestDesc(o,!0);if(!u)return null;if(u.dom.nodeType==1&&(u.node.isBlock&&u.parent&&!a||!u.contentDOM)){let s=u.dom.getBoundingClientRect();if(u.node.isBlock&&u.parent&&!a&&(a=!0,s.left>r.left||s.top>r.top?i=u.posBefore:(s.right<r.left||s.bottom<r.top)&&(i=u.posAfter)),!u.contentDOM&&i<0)return(u.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?u.posBefore:u.posAfter}o=u.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function f3(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let a=e.childNodes[o];if(a.nodeType==1){let u=a.getClientRects();for(let s=0;s<u.length;s++){let c=u[s];if(WE(t,c))return f3(a,t,c)}}if((o=(o+1)%r)==i)break}return e}function SCe(e,t){let n=e.dom.ownerDocument,r,i=0,o=cCe(n,t.left,t.top);o&&({node:r,offset:i}=o);let a=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),u;if(!a||!e.dom.contains(a.nodeType!=1?a.parentNode:a)){let c=e.dom.getBoundingClientRect();if(!WE(t,c)||(a=f3(e.dom,t,c),!a))return null}if(zn)for(let c=a;r&&c;c=Vh(c))c.draggable&&(r=void 0);if(a=bCe(a,t),r){if(Pi&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],l;c.nodeName=="IMG"&&(l=c.getBoundingClientRect()).right<=t.left&&l.bottom>t.top&&i++}r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?u=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(u=$Ce(e,r,i,t))}u==null&&(u=_Ce(e,a,t));let s=e.docView.nearestDesc(a,!0);return{pos:u,inside:s?s.posAtStart-s.border:-1}}function d3(e){return e.top<e.bottom||e.left<e.right}function Fu(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(d3(r))return r}return Array.prototype.find.call(n,d3)||e.getBoundingClientRect()}const TCe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function p3(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),a=Mb||Pi;if(r.nodeType==3)if(a&&(TCe.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let s=Fu(xa(r,i,i),n);if(Pi&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Fu(xa(r,i-1,i-1),-1);if(c.top==s.top){let l=Fu(xa(r,i,i+1),-1);if(l.top!=s.top)return Hh(l,l.left<c.left)}}return s}else{let s=i,c=i,l=n<0?1:-1;return n<0&&!i?(c++,l=-1):n>=0&&i==r.nodeValue.length?(s--,l=1):n<0?s--:c++,Hh(Fu(xa(r,s,c),l),l<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==$o(r))){let s=r.childNodes[i-1];if(s.nodeType==1)return jE(s.getBoundingClientRect(),!1)}if(o==null&&i<$o(r)){let s=r.childNodes[i];if(s.nodeType==1)return jE(s.getBoundingClientRect(),!0)}return jE(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==$o(r))){let s=r.childNodes[i-1],c=s.nodeType==3?xa(s,$o(s)-(a?0:1)):s.nodeType==1&&(s.nodeName!="BR"||!s.nextSibling)?s:null;if(c)return Hh(Fu(c,1),!1)}if(o==null&&i<$o(r)){let s=r.childNodes[i];for(;s.pmViewDesc&&s.pmViewDesc.ignoreForCoords;)s=s.nextSibling;let c=s?s.nodeType==3?xa(s,0,a?0:1):s.nodeType==1?s:null:null;if(c)return Hh(Fu(c,-1),!0)}return Hh(Fu(r.nodeType==3?xa(r):r,-n),n>=0)}function Hh(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function jE(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function h3(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function ICe(e,t,n){let r=t.selection,i=n=="up"?r.$from:r.$to;return h3(e,t,()=>{let{node:o}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let u=e.docView.nearestDesc(o,!0);if(!u)break;if(u.node.isBlock){o=u.contentDOM||u.dom;break}o=u.dom.parentNode}let a=p3(e,i.pos,1);for(let u=o.firstChild;u;u=u.nextSibling){let s;if(u.nodeType==1)s=u.getClientRects();else if(u.nodeType==3)s=xa(u,0,u.nodeValue.length).getClientRects();else continue;for(let c=0;c<s.length;c++){let l=s[c];if(l.bottom>l.top+1&&(n=="up"?a.top-l.top>(l.bottom-a.top)*2:l.bottom-a.bottom>(a.bottom-l.top)*2))return!1}}return!0})}const CCe=/[\u0590-\u08ac]/;function OCe(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,a=i==r.parent.content.size,u=e.domSelection();return!CCe.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?o:a:h3(e,t,()=>{let{focusNode:s,focusOffset:c,anchorNode:l,anchorOffset:f}=e.domSelectionRange(),d=u.caretBidiLevel;u.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:m}=e.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||s==h&&c==m;try{u.collapse(l,f),s&&(s!=l||c!=f)&&u.extend&&u.extend(s,c)}catch{}return d!=null&&(u.caretBidiLevel=d),g})}let m3=null,v3=null,g3=!1;function wCe(e,t,n){return m3==t&&v3==n?g3:(m3=t,v3=n,g3=n=="up"||n=="down"?ICe(e,t,n):OCe(e,t,n))}const Qr=0,y3=1,_c=2,To=3;class Gh{constructor(t,n,r,i){this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Qr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==t)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(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let o,a;if(t==this.contentDOM)o=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&!((a=o.pmViewDesc)&&a.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(a)+a.size:this.posAtStart}else{let o,a;if(t==this.contentDOM)o=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.nextSibling}for(;o&&!((a=o.pmViewDesc)&&a.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}let i;if(t==this.dom&&this.contentDOM)i=n>kr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,i=t;i;i=i.parentNode){let o=this.getDesc(i),a;if(o&&(!n||o.node))if(r&&(a=o.nodeDOM)&&!(a.nodeType==1?a.contains(t.nodeType==1?t:t.parentNode):a==t))r=!1;else return o}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==t&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(t<o)return i.descAt(t-r-i.border);r=o}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let a=this.children[r],u=o+a.size;if(u>t||a instanceof $3){i=t-o;break}o=u}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof b3&&o.side>=0;r--);if(n<=0){let o,a=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,a=!1);return o&&n&&a&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?kr(o.dom)+1:0}}else{let o,a=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,a=!1);return o&&a&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?kr(o.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let a=r,u=0;;u++){let s=this.children[u],c=a+s.size;if(i==-1&&t<=c){let l=a+s.border;if(t>=l&&n<=c-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(t,n,l);t=a;for(let f=u;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=kr(d.dom)+1;break}t-=d.size}i==-1&&(i=0)}if(i>-1&&(c>n||u==this.children.length-1)){n=c;for(let l=u+1;l<this.children.length;l++){let f=this.children[l];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=kr(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}a=c}return{node:this.contentDOM,from:t,to:n,fromOffset:i,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,i=!1){let o=Math.min(t,n),a=Math.max(t,n);for(let d=0,p=0;d<this.children.length;d++){let h=this.children[d],m=p+h.size;if(o>p&&a<m)return h.setSelection(t-p-h.border,n-p-h.border,r,i);p=m}let u=this.domFromPos(t,t?-1:1),s=n==t?u:this.domFromPos(n,n?-1:1),c=r.getSelection(),l=!1;if((Pi||zn)&&t==n){let{node:d,offset:p}=u;if(d.nodeType==3){if(l=!!(p&&d.nodeValue[p-1]==`
34
- `),l&&p==d.nodeValue.length)for(let h=d,m;h;h=h.parentNode){if(m=h.nextSibling){m.nodeName=="BR"&&(u=s={node:m.parentNode,offset:kr(m)+1});break}let g=h.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let h=d.childNodes[p-1];l=h&&(h.nodeName=="BR"||h.contentEditable=="false")}}if(Pi&&c.focusNode&&c.focusNode!=s.node&&c.focusNode.nodeType==1){let d=c.focusNode.childNodes[c.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||l&&zn)&&yc(u.node,u.offset,c.anchorNode,c.anchorOffset)&&yc(s.node,s.offset,c.focusNode,c.focusOffset))return;let f=!1;if((c.extend||t==n)&&!l){c.collapse(u.node,u.offset);try{t!=n&&c.extend(s.node,s.offset),f=!0}catch{}}if(!f){if(t>n){let p=u;u=s,s=p}let d=document.createRange();d.setEnd(s.node,s.offset),d.setStart(u.node,u.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],a=r+o.size;if(r==a?t<=a&&n>=r:t<a&&n>r){let u=r+o.border,s=a-o.border;if(t>=u&&n<=s){this.dirty=t==r||n==a?_c:y3,t==u&&n==s&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=To:o.markDirty(t-u,n-u);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?_c:To}r=a}this.dirty=_c}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?_c:y3;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class b3 extends Gh{constructor(t,n,r,i){let o,a=n.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(a.nodeType!=1){let u=document.createElement("span");u.appendChild(a),a=u}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(t,[],a,null),this.widget=n,this.widget=n,o=this}matchesWidget(t){return this.dirty==Qr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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 ECe extends Gh{constructor(t,n,r,i){super(t,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class $c extends Gh{constructor(t,n,r,i){super(t,[],r,i),this.mark=n}static create(t,n,r,i){let o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return(!a||!a.dom)&&(a=bo.renderSpec(document,n.type.spec.toDOM(n,r))),new $c(t,n,a.dom,a.contentDOM||a.dom)}parseRule(){return this.dirty&To||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(t){return this.dirty!=To&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Qr}}slice(t,n,r){let i=$c.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=BE(o,n,a,r)),t>0&&(o=BE(o,0,t,r));for(let u=0;u<o.length;u++)o[u].parent=i;return i.children=o,i}}class Nu extends Gh{constructor(t,n,r,i,o,a,u,s,c){super(t,[],o,a),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=u}static create(t,n,r,i,o,a){let u=o.nodeViews[n.type.name],s,c=u&&u(n,o,()=>{if(!s)return a;if(s.parent)return s.parent.posBeforeChild(s)},r,i),l=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!l)l=document.createTextNode(n.text);else if(l.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else l||({dom:l,contentDOM:f}=bo.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&l.nodeName!="BR"&&(l.hasAttribute("contenteditable")||(l.contentEditable="false"),n.type.spec.draggable&&(l.draggable=!0));let d=l;return l=I3(l,r,n),c?s=new xCe(t,n,r,i,l,f||null,d,c,o,a+1):n.isText?new Rb(t,n,r,i,l,d,o):new Nu(t,n,r,i,l,f||null,d,o,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.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)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>K.empty)}return t}matchesNode(t,n,r){return this.dirty==Qr&&t.eq(this.node)&&DE(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,i=n,o=t.composing?this.localCompositionInfo(t,n):null,a=o&&o.pos>-1?o:null,u=o&&o.pos<0,s=new RCe(this,a&&a.node,t);FCe(this.node,this.innerDeco,(c,l,f)=>{c.spec.marks?s.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!f&&s.syncToMarks(l==this.node.childCount?tt.none:this.node.child(l).marks,r,t),s.placeWidget(c,t,i)},(c,l,f,d)=>{s.syncToMarks(c.marks,r,t);let p;s.findNodeMatch(c,l,f,d)||u&&t.state.selection.from>i&&t.state.selection.to<i+c.nodeSize&&(p=s.findIndexWithChild(o.node))>-1&&s.updateNodeAt(c,l,f,p,t)||s.updateNextNode(c,l,f,t,d,i)||s.addNode(c,l,f,t,i),i+=c.nodeSize}),s.syncToMarks([],r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==_c)&&(a&&this.protectLocalComposition(t,a),S3(this.contentDOM,this.children,t),Bf&&NCe(this.dom))}localCompositionInfo(t,n){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof Be)||r<n||i>n+this.node.content.size)return null;let o=t.domSelectionRange(),a=PCe(o.focusNode,o.focusOffset);if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let u=a.nodeValue,s=WCe(this.node.content,u,r-n,i-n);return s<0?null:{node:a,pos:s,text:u}}else return{node:a,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let a=new ECe(this,o,n,i);t.input.compositionNodes.push(a),this.children=BE(this.children,r,r+i.length,t,a)}update(t,n,r,i){return this.dirty==To||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,i),!0)}updateInner(t,n,r,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Qr}updateOuterDeco(t){if(DE(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=T3(this.dom,this.nodeDOM,LE(this.outerDeco,this.node,n),LE(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 _3(e,t,n,r,i){I3(r,t,e);let o=new Nu(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Rb extends Nu{constructor(t,n,r,i,o,a,u){super(t,n,r,i,o,null,a,u,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,i){return this.dirty==To||this.dirty!=Qr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=Qr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let i=this.node.cut(t,n),o=document.createTextNode(i.text);return new Rb(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=To)}get domAtom(){return!1}}class $3 extends Gh{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Qr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class xCe extends Nu{constructor(t,n,r,i,o,a,u,s,c,l){super(t,n,r,i,o,a,u,c,l),this.spec=s}update(t,n,r,i){if(this.dirty==To)return!1;if(this.spec.update){let o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):super.setSelection(t,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function S3(e,t,n){let r=e.firstChild,i=!1;for(let o=0;o<t.length;o++){let a=t[o],u=a.dom;if(u.parentNode==e){for(;u!=r;)r=C3(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(u,r);if(a instanceof $c){let s=r?r.previousSibling:e.lastChild;S3(a.contentDOM,a.children,n),r=s?s.nextSibling:e.firstChild}}for(;r;)r=C3(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const Yh=function(e){e&&(this.nodeName=e)};Yh.prototype=Object.create(null);const Sc=[new Yh];function LE(e,t,n){if(e.length==0)return Sc;let r=n?Sc[0]:new Yh,i=[r];for(let o=0;o<e.length;o++){let a=e[o].type.attrs;if(a){a.nodeName&&i.push(r=new Yh(a.nodeName));for(let u in a){let s=a[u];s!=null&&(n&&i.length==1&&i.push(r=new Yh(t.isInline?"span":"div")),u=="class"?r.class=(r.class?r.class+" ":"")+s:u=="style"?r.style=(r.style?r.style+";":"")+s:u!="nodeName"&&(r[u]=s))}}}return i}function T3(e,t,n,r){if(n==Sc&&r==Sc)return t;let i=t;for(let o=0;o<r.length;o++){let a=r[o],u=n[o];if(o){let s;u&&u.nodeName==a.nodeName&&i!=e&&(s=i.parentNode)&&s.nodeName.toLowerCase()==a.nodeName||(s=document.createElement(a.nodeName),s.pmIsDeco=!0,s.appendChild(i),u=Sc[0]),i=s}MCe(i,u||Sc[0],a)}return i}function MCe(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&e.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&e.classList.add(i[o]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(t.style);)e.style.removeProperty(i[1])}n.style&&(e.style.cssText+=n.style)}}function I3(e,t,n){return T3(e,e,Sc,LE(t,n,e.nodeType!=1))}function DE(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function C3(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class RCe{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=kCe(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r){let i=0,o=this.stack.length>>1,a=Math.min(o,t.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Qr,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);let u=-1;for(let s=this.index;s<Math.min(this.index+3,this.top.children.length);s++){let c=this.top.children[s];if(c.matchesMark(t[o])&&!this.isLocked(c.dom)){u=s;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let s=$c.create(this.top,t[o],n,r);this.top.children.splice(this.index,0,s),this.top=s,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,r,i){let o=-1,a;if(i>=this.preMatch.index&&(a=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&a.matchesNode(t,n,r))o=this.top.children.indexOf(a,this.index);else for(let u=this.index,s=Math.min(this.top.children.length,u+5);u<s;u++){let c=this.top.children[u];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){o=u;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(t,n,r,i,o){let a=this.top.children[i];return a.dirty==To&&a.dom==a.contentDOM&&(a.dirty=_c),a.update(t,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}t=n}}updateNextNode(t,n,r,i,o,a){for(let u=this.index;u<this.top.children.length;u++){let s=this.top.children[u];if(s instanceof Nu){let c=this.preMatch.matched.get(s);if(c!=null&&c!=o)return!1;let l=s.dom,f,d=this.isLocked(l)&&!(t.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==t.text&&s.dirty!=To&&DE(n,s.outerDeco));if(!d&&s.update(t,n,r,i))return this.destroyBetween(this.index,u),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(s,t,n,r,i,a)))return this.top.children[this.index]=f,f.dirty=_c,f.updateChildren(i,a+1),f.dirty=Qr,this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,i,o,a){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content))return null;let u=Nu.create(this.top,n,r,i,o,a);if(!u.contentDOM)return null;u.children=t.children,t.children=[],t.destroy();for(let s of u.children)s.parent=u;return u}addNode(t,n,r,i,o){let a=Nu.create(this.top,t,n,r,i,o);a.contentDOM&&a.updateChildren(i,o+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(t,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(t)&&(t==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new b3(this.top,t,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof $c;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof Rb)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((zn||En)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new $3(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function kCe(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,a=[];e:for(;i>0;){let u;for(;;)if(r){let c=n.children[r-1];if(c instanceof $c)n=c,r=c.children.length;else{u=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let s=u.node;if(s){if(s!=e.child(i-1))break;--i,o.set(u,i),a.push(u)}}return{index:i,matched:o,matches:a.reverse()}}function ACe(e,t){return e.type.side-t.type.side}function FCe(e,t,n,r){let i=t.locals(e),o=0;if(i.length==0){for(let c=0;c<e.childCount;c++){let l=e.child(c);r(l,i,t.forChild(o,l),c),o+=l.nodeSize}return}let a=0,u=[],s=null;for(let c=0;;){if(a<i.length&&i[a].to==o){let h=i[a++],m;for(;a<i.length&&i[a].to==o;)(m||(m=[h])).push(i[a++]);if(m){m.sort(ACe);for(let g=0;g<m.length;g++)n(m[g],c,!!s)}else n(h,c,!!s)}let l,f;if(s)f=-1,l=s,s=null;else if(c<e.childCount)f=c,l=e.child(c++);else break;for(let h=0;h<u.length;h++)u[h].to<=o&&u.splice(h--,1);for(;a<i.length&&i[a].from<=o&&i[a].to>o;)u.push(i[a++]);let d=o+l.nodeSize;if(l.isText){let h=d;a<i.length&&i[a].from<h&&(h=i[a].from);for(let m=0;m<u.length;m++)u[m].to<h&&(h=u[m].to);h<d&&(s=l.cut(h-o),l=l.cut(0,h-o),d=h,f=-1)}let p=l.isInline&&!l.isLeaf?u.filter(h=>!h.inline):u.slice();r(l,p,t.forChild(o,l),f),o=d}}function NCe(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function PCe(e,t){for(;;){if(e.nodeType==3)return e;if(e.nodeType==1&&t>0){if(e.childNodes.length>t&&e.childNodes[t].nodeType==3)return e.childNodes[t];e=e.childNodes[t-1],t=$o(e)}else if(e.nodeType==1&&t<e.childNodes.length)e=e.childNodes[t],t=0;else return null}}function WCe(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let a=e.child(i++),u=o;if(o+=a.nodeSize,!a.isText)continue;let s=a.text;for(;i<e.childCount;){let c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;s+=c.text}if(o>=n){let c=u<r?s.lastIndexOf(t,r-u-1):-1;if(c>=0&&c+t.length+u>=n)return u+c;if(n==r&&s.length>=r+t.length-u&&s.slice(r-u,r-u+t.length)==t)return r}}return-1}function BE(e,t,n,r,i){let o=[];for(let a=0,u=0;a<e.length;a++){let s=e[a],c=u,l=u+=s.size;c>=n||l<=t?o.push(s):(c<t&&o.push(s.slice(0,t-c,r)),i&&(o.push(i),i=void 0),l>n&&o.push(s.slice(n-c,s.size,r)))}return o}function UE(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&i.size==0,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let u=r.resolve(a),s,c;if(xb(n)){for(s=u;i&&!i.node;)i=i.parent;let l=i.node;if(i&&l.isAtom&&ve.isSelectable(l)&&i.parent&&!(l.isInline&&aCe(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new ve(a==f?u:r.resolve(f))}}else{let l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null;s=r.resolve(l)}if(!c){let l=t=="pointer"||e.state.selection.head<u.pos&&!o?1:-1;c=zE(e,s,u,l)}return c}function O3(e){return e.editable?e.hasFocus():A3(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ma(e,t=!1){let n=e.state.selection;if(M3(e,n),!!O3(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&En){let r=e.domSelectionRange(),i=e.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&yc(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)LCe(e);else{let{anchor:r,head:i}=n,o,a;w3&&!(n instanceof Be)&&(n.$from.parent.inlineContent||(o=E3(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=E3(e,n.to))),e.docView.setSelection(r,i,e.root,t),w3&&(o&&x3(o),a&&x3(a)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jCe(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const w3=zn||En&&lCe<63;function E3(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(zn&&i&&i.contentEditable=="false")return qE(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return qE(i);if(o)return qE(o)}}function qE(e){return e.contentEditable="true",zn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function x3(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function jCe(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!O3(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function LCe(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,kr(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&lr&&ku<=11&&(r.disabled=!0,r.disabled=!1)}function M3(e,t){if(t instanceof ve){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(R3(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else R3(e)}function R3(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function zE(e,t,n,r){return e.someProp("createSelectionBetween",i=>i(e,t,n))||Be.between(t,n,r)}function k3(e){return e.editable&&!e.hasFocus()?!1:A3(e)}function A3(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function DCe(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return yc(t.node,t.offset,n.anchorNode,n.anchorOffset)}function KE(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&Ne.findFrom(o,t)}function Tc(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function F3(e,t,n){let r=e.state.selection;if(r instanceof Be){if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let i=KE(e.state,t);return i&&i instanceof ve?Tc(e,i):!1}else if(!(Xr&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let u=t<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=e.docView.descAt(u))&&!a.contentDOM?ve.isSelectable(o)?Tc(e,new ve(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):Mb?Tc(e,new Be(e.state.doc.resolve(t<0?u:u+o.nodeSize))):!1:!1}}else{if(r instanceof ve&&r.node.isInline)return Tc(e,new Be(t>0?r.$to:r.$from));{let i=KE(e.state,t);return i?Tc(e,i):!1}}}function kb(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Jh(e){let t=e.pmViewDesc;return t&&t.size==0&&(e.nextSibling||e.nodeName!="BR")}function Zh(e,t){return t<0?BCe(e):N3(e)}function BCe(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,a=!1;for(Pi&&n.nodeType==1&&r<kb(n)&&Jh(n.childNodes[r])&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(Jh(u))i=n,o=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(P3(n))break;{let u=n.previousSibling;for(;u&&Jh(u);)i=n.parentNode,o=kr(u),u=u.previousSibling;if(u)n=u,r=kb(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}a?VE(e,n,r):i&&VE(e,i,o)}function N3(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=kb(n),o,a;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(Jh(u))o=n,a=++r;else break}else{if(P3(n))break;{let u=n.nextSibling;for(;u&&Jh(u);)o=u.parentNode,a=kr(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=kb(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}}o&&VE(e,o,a)}function P3(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function VE(e,t,n){let r=e.domSelection();if(xb(r)){let o=document.createRange();o.setEnd(t,n),o.setStart(t,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&Ma(e)},50)}function W3(e,t){let n=e.state.doc.resolve(t);if(!(En||fCe)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(t<n.end()){let o=e.coordsAtPos(t+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function j3(e,t,n){let r=e.state.selection;if(r instanceof Be&&!r.empty||n.indexOf("s")>-1||Xr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let a=KE(e.state,t);if(a&&a instanceof ve)return Tc(e,a)}if(!i.parent.inlineContent){let a=t<0?i:o,u=r instanceof Fi?Ne.near(a,t):Ne.findFrom(a,t);return u?Tc(e,u):!1}return!1}function L3(e,t){if(!(e.state.selection instanceof Be))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let a=e.state.tr;return t<0?a.delete(n.pos-o.nodeSize,n.pos):a.delete(n.pos,n.pos+o.nodeSize),e.dispatch(a),!0}return!1}function D3(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function UCe(e){if(!zn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;D3(e,r,"true"),setTimeout(()=>D3(e,r,"false"),20)}return!1}function qCe(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function zCe(e,t){let n=t.keyCode,r=qCe(t);if(n==8||Xr&&n==72&&r=="c")return L3(e,-1)||Zh(e,-1);if(n==46&&!t.shiftKey||Xr&&n==68&&r=="c")return L3(e,1)||Zh(e,1);if(n==13||n==27)return!0;if(n==37||Xr&&n==66&&r=="c"){let i=n==37?W3(e,e.state.selection.from)=="ltr"?-1:1:-1;return F3(e,i,r)||Zh(e,i)}else if(n==39||Xr&&n==70&&r=="c"){let i=n==39?W3(e,e.state.selection.from)=="ltr"?1:-1:1;return F3(e,i,r)||Zh(e,i)}else{if(n==38||Xr&&n==80&&r=="c")return j3(e,-1,r)||Zh(e,-1);if(n==40||Xr&&n==78&&r=="c")return UCe(e)||j3(e,1,r)||N3(e);if(r==(Xr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function B3(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let a=e.someProp("clipboardSerializer")||bo.fromSchema(e.state.schema),u=Y3(),s=u.createElement("div");s.appendChild(a.serializeFragment(r,{document:u}));let c=s.firstChild,l,f=0;for(;c&&c.nodeType==1&&(l=H3[c.nodeName.toLowerCase()]);){for(let p=l.length-1;p>=0;p--){let h=u.createElement(l[p]);for(;s.firstChild;)h.appendChild(s.firstChild);s.appendChild(h),f++}c=s.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
30
+ `)}const tb=[],tTe=F.createContext(void 0);var Ve;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),a={};for(const u of o)a[u]=i[u];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Ve||(Ve={}));var uE;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(uE||(uE={}));const re=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Iu=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}},Y=Ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),nTe=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Mi extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let u=r,s=0;for(;s<a.path.length;){const c=a.path[s];s===a.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(n(a))):u[c]=u[c]||{_errors:[]},u=u[c],s++}}};return i(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Mi.create=e=>new Mi(e);const Ih=(e,t)=>{let n;switch(e.code){case Y.invalid_type:e.received===re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ve.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ve.joinValues(e.keys,", ")}`;break;case Y.invalid_union:n="Invalid input";break;case Y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ve.joinValues(e.options)}`;break;case Y.invalid_enum_value:n=`Invalid enum value. Expected ${Ve.joinValues(e.options)}, received '${e.received}'`;break;case Y.invalid_arguments:n="Invalid function arguments";break;case Y.invalid_return_type:n="Invalid function return type";break;case Y.invalid_date:n="Invalid date";break;case Y.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ve.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Y.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Y.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Y.custom:n="Invalid input";break;case Y.invalid_intersection_types:n="Intersection results could not be merged";break;case Y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Y.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ve.assertNever(e)}return{message:n}};let BK=Ih;function rTe(e){BK=e}function nb(){return BK}const rb=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let u="";const s=r.filter(c=>!!c).slice().reverse();for(const c of s)u=c(a,{data:t,defaultError:u}).message;return{...i,path:o,message:i.message||u}},iTe=[];function oe(e,t){const n=rb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,nb(),Ih].filter(r=>!!r)});e.common.issues.push(n)}class On{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Se;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return On.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return Se;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const Se=Object.freeze({status:"aborted"}),UK=e=>({status:"dirty",value:e}),qn=e=>({status:"valid",value:e}),sE=e=>e.status==="aborted",cE=e=>e.status==="dirty",ib=e=>e.status==="valid",ob=e=>typeof Promise<"u"&&e instanceof Promise;var pe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(pe||(pe={}));class vo{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const qK=(e,t)=>{if(ib(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Mi(e.common.issues);return this._error=n,this._error}}};function we(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,u)=>a.code!=="invalid_type"?{message:u.defaultError}:typeof u.data>"u"?{message:r??u.defaultError}:{message:n??u.defaultError},description:i}}class xe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Iu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Iu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new On,ctx:{common:t.parent.common,data:t.data,parsedType:Iu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ob(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Iu(t)},o=this._parseSync({data:t,path:i.path,parent:i});return qK(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Iu(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(ob(i)?i:Promise.resolve(i));return qK(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),u=()=>o.addIssue({code:Y.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(s=>s?!0:(u(),!1)):a?!0:(u(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Ai({schema:this,typeName:be.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return wa.create(this,this._def)}nullable(){return pc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ki.create(this,this._def)}promise(){return xf.create(this,this._def)}or(t){return Eh.create([this,t],this._def)}and(t){return xh.create(this,t,this._def)}transform(t){return new Ai({...we(this._def),schema:this,typeName:be.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Fh({...we(this._def),innerType:this,defaultValue:n,typeName:be.ZodDefault})}brand(){return new KK({typeName:be.ZodBranded,type:this,...we(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new fb({...we(this._def),innerType:this,catchValue:n,typeName:be.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Nh.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const oTe=/^c[^\s-]{8,}$/i,aTe=/^[a-z][a-z0-9]*$/,uTe=/[0-9A-HJKMNP-TV-Z]{26}/,sTe=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,cTe=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,lTe=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,fTe=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,dTe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,pTe=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function hTe(e,t){return!!((t==="v4"||!t)&&fTe.test(e)||(t==="v6"||!t)&&dTe.test(e))}class Ri extends xe{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:Y.invalid_string,...pe.errToObj(r)}),this.nonempty=t=>this.min(1,pe.errToObj(t)),this.trim=()=>new Ri({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Ri({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Ri({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.string,received:o.parsedType}),Se}const r=new On;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,u=t.data.length<o.value;(a||u)&&(i=this._getOrReturnCtx(t,i),a?oe(i,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):u&&oe(i,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")cTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"email",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")lTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"emoji",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")sTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"uuid",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")oTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"cuid",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")aTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"cuid2",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")uTe.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"ulid",code:Y.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),oe(i,{validation:"url",code:Y.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"regex",code:Y.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?pTe(o).test(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="ip"?hTe(t.data,o.version)||(i=this._getOrReturnCtx(t,i),oe(i,{validation:"ip",code:Y.invalid_string,message:o.message}),r.dirty()):Ve.assertNever(o);return{status:r.value,value:t.data}}_addCheck(t){return new Ri({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...pe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...pe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...pe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...pe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...pe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...pe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...pe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...pe.errToObj(t)})}datetime(t){var n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...pe.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...pe.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...pe.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...pe.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...pe.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...pe.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...pe.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...pe.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ri.create=e=>{var t;return new Ri({checks:[],typeName:be.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...we(e)})};function mTe(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class Cu extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==re.number){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.number,received:o.parsedType}),Se}let r;const i=new On;for(const o of this._def.checks)o.kind==="int"?Ve.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?mTe(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.not_finite,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,i){return new Cu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(i)}]})}_addCheck(t){return new Cu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:pe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:pe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ve.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Cu.create=e=>new Cu({checks:[],typeName:be.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...we(e)});class Ou extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==re.bigint){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.bigint,received:o.parsedType}),Se}let r;const i=new On;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ve.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,i){return new Ou({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(i)}]})}_addCheck(t){return new Ou({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ou.create=e=>{var t;return new Ou({checks:[],typeName:be.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...we(e)})};class Ch extends xe{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==re.boolean){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.boolean,received:r.parsedType}),Se}return qn(t.data)}}Ch.create=e=>new Ch({typeName:be.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...we(e)});class lc extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_type,expected:re.date,received:o.parsedType}),Se}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return oe(o,{code:Y.invalid_date}),Se}const r=new On;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),oe(i,{code:Y.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Ve.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new lc({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:pe.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:pe.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}lc.create=e=>new lc({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:be.ZodDate,...we(e)});class ab extends xe{_parse(t){if(this._getType(t)!==re.symbol){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.symbol,received:r.parsedType}),Se}return qn(t.data)}}ab.create=e=>new ab({typeName:be.ZodSymbol,...we(e)});class Oh extends xe{_parse(t){if(this._getType(t)!==re.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.undefined,received:r.parsedType}),Se}return qn(t.data)}}Oh.create=e=>new Oh({typeName:be.ZodUndefined,...we(e)});class wh extends xe{_parse(t){if(this._getType(t)!==re.null){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.null,received:r.parsedType}),Se}return qn(t.data)}}wh.create=e=>new wh({typeName:be.ZodNull,...we(e)});class Of extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return qn(t.data)}}Of.create=e=>new Of({typeName:be.ZodAny,...we(e)});class fc extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qn(t.data)}}fc.create=e=>new fc({typeName:be.ZodUnknown,...we(e)});class Oa extends xe{_parse(t){const n=this._getOrReturnCtx(t);return oe(n,{code:Y.invalid_type,expected:re.never,received:n.parsedType}),Se}}Oa.create=e=>new Oa({typeName:be.ZodNever,...we(e)});class ub extends xe{_parse(t){if(this._getType(t)!==re.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.void,received:r.parsedType}),Se}return qn(t.data)}}ub.create=e=>new ub({typeName:be.ZodVoid,...we(e)});class ki extends xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==re.array)return oe(n,{code:Y.invalid_type,expected:re.array,received:n.parsedType}),Se;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,u=n.data.length<i.exactLength.value;(a||u)&&(oe(n,{code:a?Y.too_big:Y.too_small,minimum:u?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(oe(n,{code:Y.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(oe(n,{code:Y.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,u)=>i.type._parseAsync(new vo(n,a,n.path,u)))).then(a=>On.mergeArray(r,a));const o=[...n.data].map((a,u)=>i.type._parseSync(new vo(n,a,n.path,u)));return On.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new ki({...this._def,minLength:{value:t,message:pe.toString(n)}})}max(t,n){return new ki({...this._def,maxLength:{value:t,message:pe.toString(n)}})}length(t,n){return new ki({...this._def,exactLength:{value:t,message:pe.toString(n)}})}nonempty(t){return this.min(1,t)}}ki.create=(e,t)=>new ki({type:e,minLength:null,maxLength:null,exactLength:null,typeName:be.ZodArray,...we(t)});function wf(e){if(e instanceof bt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=wa.create(wf(r))}return new bt({...e._def,shape:()=>t})}else return e instanceof ki?new ki({...e._def,type:wf(e.element)}):e instanceof wa?wa.create(wf(e.unwrap())):e instanceof pc?pc.create(wf(e.unwrap())):e instanceof go?go.create(e.items.map(t=>wf(t))):e}class bt extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ve.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==re.object){const c=this._getOrReturnCtx(t);return oe(c,{code:Y.invalid_type,expected:re.object,received:c.parsedType}),Se}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof Oa&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||u.push(c);const s=[];for(const c of a){const l=o[c],f=i.data[c];s.push({key:{status:"valid",value:c},value:l._parse(new vo(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Oa){const c=this._def.unknownKeys;if(c==="passthrough")for(const l of u)s.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")u.length>0&&(oe(i,{code:Y.unrecognized_keys,keys:u}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const l of u){const f=i.data[l];s.push({key:{status:"valid",value:l},value:c._parse(new vo(i,f,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const l of s){const f=await l.key;c.push({key:f,value:await l.value,alwaysSet:l.alwaysSet})}return c}).then(c=>On.mergeObjectSync(r,c)):On.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(t){return pe.errToObj,new bt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,u;const s=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(u=pe.errToObj(t).message)!==null&&u!==void 0?u:s}:{message:s}}}:{}})}strip(){return new bt({...this._def,unknownKeys:"strip"})}passthrough(){return new bt({...this._def,unknownKeys:"passthrough"})}extend(t){return new bt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new bt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:be.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new bt({...this._def,catchall:t})}pick(t){const n={};return Ve.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new bt({...this._def,shape:()=>n})}omit(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new bt({...this._def,shape:()=>n})}deepPartial(){return wf(this)}partial(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new bt({...this._def,shape:()=>n})}required(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof wa;)o=o._def.innerType;n[r]=o}}),new bt({...this._def,shape:()=>n})}keyof(){return zK(Ve.objectKeys(this.shape))}}bt.create=(e,t)=>new bt({shape:()=>e,unknownKeys:"strip",catchall:Oa.create(),typeName:be.ZodObject,...we(t)}),bt.strictCreate=(e,t)=>new bt({shape:()=>e,unknownKeys:"strict",catchall:Oa.create(),typeName:be.ZodObject,...we(t)}),bt.lazycreate=(e,t)=>new bt({shape:e,unknownKeys:"strip",catchall:Oa.create(),typeName:be.ZodObject,...we(t)});class Eh extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const u of o)if(u.result.status==="valid")return u.result;for(const u of o)if(u.result.status==="dirty")return n.common.issues.push(...u.ctx.common.issues),u.result;const a=o.map(u=>new Mi(u.ctx.common.issues));return oe(n,{code:Y.invalid_union,unionErrors:a}),Se}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const s of r){const c={...n,common:{...n.common,issues:[]},parent:null},l=s._parseSync({data:n.data,path:n.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const u=a.map(s=>new Mi(s));return oe(n,{code:Y.invalid_union,unionErrors:u}),Se}}get options(){return this._def.options}}Eh.create=(e,t)=>new Eh({options:e,typeName:be.ZodUnion,...we(t)});const sb=e=>e instanceof Rh?sb(e.schema):e instanceof Ai?sb(e.innerType()):e instanceof kh?[e.value]:e instanceof wu?e.options:e instanceof Ah?Object.keys(e.enum):e instanceof Fh?sb(e._def.innerType):e instanceof Oh?[void 0]:e instanceof wh?[null]:null;class cb extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.object)return oe(n,{code:Y.invalid_type,expected:re.object,received:n.parsedType}),Se;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(oe(n,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Se)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=sb(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const u of a){if(i.has(u))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(u)}`);i.set(u,o)}}return new cb({typeName:be.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...we(r)})}}function lE(e,t){const n=Iu(e),r=Iu(t);if(e===t)return{valid:!0,data:e};if(n===re.object&&r===re.object){const i=Ve.objectKeys(t),o=Ve.objectKeys(e).filter(u=>i.indexOf(u)!==-1),a={...e,...t};for(const u of o){const s=lE(e[u],t[u]);if(!s.valid)return{valid:!1};a[u]=s.data}return{valid:!0,data:a}}else if(n===re.array&&r===re.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o<e.length;o++){const a=e[o],u=t[o],s=lE(a,u);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}else return n===re.date&&r===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class xh extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(o,a)=>{if(sE(o)||sE(a))return Se;const u=lE(o.value,a.value);return u.valid?((cE(o)||cE(a))&&n.dirty(),{status:n.value,value:u.data}):(oe(r,{code:Y.invalid_intersection_types}),Se)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}xh.create=(e,t,n)=>new xh({left:e,right:t,typeName:be.ZodIntersection,...we(n)});class go extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.array)return oe(r,{code:Y.invalid_type,expected:re.array,received:r.parsedType}),Se;if(r.data.length<this._def.items.length)return oe(r,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Se;!this._def.rest&&r.data.length>this._def.items.length&&(oe(r,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,u)=>{const s=this._def.items[u]||this._def.rest;return s?s._parse(new vo(r,a,r.path,u)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>On.mergeArray(n,a)):On.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new go({...this._def,rest:t})}}go.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new go({items:e,typeName:be.ZodTuple,rest:null,...we(t)})};class Mh extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return oe(r,{code:Y.invalid_type,expected:re.object,received:r.parsedType}),Se;const i=[],o=this._def.keyType,a=this._def.valueType;for(const u in r.data)i.push({key:o._parse(new vo(r,u,r.path,u)),value:a._parse(new vo(r,r.data[u],r.path,u))});return r.common.async?On.mergeObjectAsync(n,i):On.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof xe?new Mh({keyType:t,valueType:n,typeName:be.ZodRecord,...we(r)}):new Mh({keyType:Ri.create(),valueType:t,typeName:be.ZodRecord,...we(n)})}}class lb extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.map)return oe(r,{code:Y.invalid_type,expected:re.map,received:r.parsedType}),Se;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([u,s],c)=>({key:i._parse(new vo(r,u,r.path,[c,"key"])),value:o._parse(new vo(r,s,r.path,[c,"value"]))}));if(r.common.async){const u=new Map;return Promise.resolve().then(async()=>{for(const s of a){const c=await s.key,l=await s.value;if(c.status==="aborted"||l.status==="aborted")return Se;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),u.set(c.value,l.value)}return{status:n.value,value:u}})}else{const u=new Map;for(const s of a){const c=s.key,l=s.value;if(c.status==="aborted"||l.status==="aborted")return Se;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),u.set(c.value,l.value)}return{status:n.value,value:u}}}}lb.create=(e,t,n)=>new lb({valueType:t,keyType:e,typeName:be.ZodMap,...we(n)});class dc extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==re.set)return oe(r,{code:Y.invalid_type,expected:re.set,received:r.parsedType}),Se;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(oe(r,{code:Y.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(oe(r,{code:Y.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(s){const c=new Set;for(const l of s){if(l.status==="aborted")return Se;l.status==="dirty"&&n.dirty(),c.add(l.value)}return{status:n.value,value:c}}const u=[...r.data.values()].map((s,c)=>o._parse(new vo(r,s,r.path,c)));return r.common.async?Promise.all(u).then(s=>a(s)):a(u)}min(t,n){return new dc({...this._def,minSize:{value:t,message:pe.toString(n)}})}max(t,n){return new dc({...this._def,maxSize:{value:t,message:pe.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}dc.create=(e,t)=>new dc({valueType:e,minSize:null,maxSize:null,typeName:be.ZodSet,...we(t)});class Ef extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.function)return oe(n,{code:Y.invalid_type,expected:re.function,received:n.parsedType}),Se;function r(u,s){return rb({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nb(),Ih].filter(c=>!!c),issueData:{code:Y.invalid_arguments,argumentsError:s}})}function i(u,s){return rb({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nb(),Ih].filter(c=>!!c),issueData:{code:Y.invalid_return_type,returnTypeError:s}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;return this._def.returns instanceof xf?qn(async(...u)=>{const s=new Mi([]),c=await this._def.args.parseAsync(u,o).catch(d=>{throw s.addIssue(r(u,d)),s}),l=await a(...c);return await this._def.returns._def.type.parseAsync(l,o).catch(d=>{throw s.addIssue(i(l,d)),s})}):qn((...u)=>{const s=this._def.args.safeParse(u,o);if(!s.success)throw new Mi([r(u,s.error)]);const c=a(...s.data),l=this._def.returns.safeParse(c,o);if(!l.success)throw new Mi([i(c,l.error)]);return l.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ef({...this._def,args:go.create(t).rest(fc.create())})}returns(t){return new Ef({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Ef({args:t||go.create([]).rest(fc.create()),returns:n||fc.create(),typeName:be.ZodFunction,...we(r)})}}class Rh extends xe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Rh.create=(e,t)=>new Rh({getter:e,typeName:be.ZodLazy,...we(t)});class kh extends xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return oe(n,{received:n.data,code:Y.invalid_literal,expected:this._def.value}),Se}return{status:"valid",value:t.data}}get value(){return this._def.value}}kh.create=(e,t)=>new kh({value:e,typeName:be.ZodLiteral,...we(t)});function zK(e,t){return new wu({values:e,typeName:be.ZodEnum,...we(t)})}class wu extends xe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{expected:Ve.joinValues(r),received:n.parsedType,code:Y.invalid_type}),Se}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{received:n.data,code:Y.invalid_enum_value,options:r}),Se}return qn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return wu.create(t)}exclude(t){return wu.create(this.options.filter(n=>!t.includes(n)))}}wu.create=zK;class Ah extends xe{_parse(t){const n=Ve.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==re.string&&r.parsedType!==re.number){const i=Ve.objectValues(n);return oe(r,{expected:Ve.joinValues(i),received:r.parsedType,code:Y.invalid_type}),Se}if(n.indexOf(t.data)===-1){const i=Ve.objectValues(n);return oe(r,{received:r.data,code:Y.invalid_enum_value,options:i}),Se}return qn(t.data)}get enum(){return this._def.values}}Ah.create=(e,t)=>new Ah({values:e,typeName:be.ZodNativeEnum,...we(t)});class xf extends xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.promise&&n.common.async===!1)return oe(n,{code:Y.invalid_type,expected:re.promise,received:n.parsedType}),Se;const r=n.parsedType===re.promise?n.data:Promise.resolve(n.data);return qn(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}xf.create=(e,t)=>new xf({type:e,typeName:be.ZodPromise,...we(t)});class Ai extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===be.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null;if(i.type==="preprocess"){const a=i.transform(r.data);return r.common.async?Promise.resolve(a).then(u=>this._def.schema._parseAsync({data:u,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}const o={addIssue:a=>{oe(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="refinement"){const a=u=>{const s=i.refinement(u,o);if(r.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){const u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?Se:(u.status==="dirty"&&n.dirty(),a(u.value),{status:n.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?Se:(u.status==="dirty"&&n.dirty(),a(u.value).then(()=>({status:n.value,value:u.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ib(a))return a;const u=i.transform(a.value,o);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>ib(a)?Promise.resolve(i.transform(a.value,o)).then(u=>({status:n.value,value:u})):a);Ve.assertNever(i)}}Ai.create=(e,t,n)=>new Ai({schema:e,typeName:be.ZodEffects,effect:t,...we(n)}),Ai.createWithPreprocess=(e,t,n)=>new Ai({schema:t,effect:{type:"preprocess",transform:e},typeName:be.ZodEffects,...we(n)});class wa extends xe{_parse(t){return this._getType(t)===re.undefined?qn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wa.create=(e,t)=>new wa({innerType:e,typeName:be.ZodOptional,...we(t)});class pc extends xe{_parse(t){return this._getType(t)===re.null?qn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:be.ZodNullable,...we(t)});class Fh extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Fh.create=(e,t)=>new Fh({innerType:e,typeName:be.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...we(t)});class fb extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ob(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}fb.create=(e,t)=>new fb({innerType:e,typeName:be.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...we(t)});class db extends xe{_parse(t){if(this._getType(t)!==re.nan){const r=this._getOrReturnCtx(t);return oe(r,{code:Y.invalid_type,expected:re.nan,received:r.parsedType}),Se}return{status:"valid",value:t.data}}}db.create=e=>new db({typeName:be.ZodNaN,...we(e)});const vTe=Symbol("zod_brand");class KK extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Nh extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Se:o.status==="dirty"?(n.dirty(),UK(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Se:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Nh({in:t,out:n,typeName:be.ZodPipeline})}}const VK=(e,t={},n)=>e?Of.create().superRefine((r,i)=>{var o,a;if(!e(r)){const u=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,s=(a=(o=u.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,c=typeof u=="string"?{message:u}:u;i.addIssue({code:"custom",...c,fatal:s})}}):Of.create(),gTe={object:bt.lazycreate};var be;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(be||(be={}));const yTe=(e,t={message:`Input not instance of ${e.name}`})=>VK(n=>n instanceof e,t),_t=Ri.create,Ea=Cu.create,bTe=db.create,_Te=Ou.create,HK=Ch.create,$Te=lc.create,STe=ab.create,TTe=Oh.create,ITe=wh.create,CTe=Of.create,OTe=fc.create,wTe=Oa.create,ETe=ub.create,Mf=ki.create,cr=bt.create,xTe=bt.strictCreate,MTe=Eh.create,GK=cb.create,RTe=xh.create,kTe=go.create,ATe=Mh.create,FTe=lb.create,NTe=dc.create,PTe=Ef.create,WTe=Rh.create,Ph=kh.create,jTe=wu.create,LTe=Ah.create,DTe=xf.create,YK=Ai.create,BTe=wa.create,UTe=pc.create,qTe=Ai.createWithPreprocess,zTe=Nh.create;var zn=Object.freeze({__proto__:null,defaultErrorMap:Ih,setErrorMap:rTe,getErrorMap:nb,makeIssue:rb,EMPTY_PATH:iTe,addIssueToContext:oe,ParseStatus:On,INVALID:Se,DIRTY:UK,OK:qn,isAborted:sE,isDirty:cE,isValid:ib,isAsync:ob,get util(){return Ve},get objectUtil(){return uE},ZodParsedType:re,getParsedType:Iu,ZodType:xe,ZodString:Ri,ZodNumber:Cu,ZodBigInt:Ou,ZodBoolean:Ch,ZodDate:lc,ZodSymbol:ab,ZodUndefined:Oh,ZodNull:wh,ZodAny:Of,ZodUnknown:fc,ZodNever:Oa,ZodVoid:ub,ZodArray:ki,ZodObject:bt,ZodUnion:Eh,ZodDiscriminatedUnion:cb,ZodIntersection:xh,ZodTuple:go,ZodRecord:Mh,ZodMap:lb,ZodSet:dc,ZodFunction:Ef,ZodLazy:Rh,ZodLiteral:kh,ZodEnum:wu,ZodNativeEnum:Ah,ZodPromise:xf,ZodEffects:Ai,ZodTransformer:Ai,ZodOptional:wa,ZodNullable:pc,ZodDefault:Fh,ZodCatch:fb,ZodNaN:db,BRAND:vTe,ZodBranded:KK,ZodPipeline:Nh,custom:VK,Schema:xe,ZodSchema:xe,late:gTe,get ZodFirstPartyTypeKind(){return be},coerce:{string:e=>Ri.create({...e,coerce:!0}),number:e=>Cu.create({...e,coerce:!0}),boolean:e=>Ch.create({...e,coerce:!0}),bigint:e=>Ou.create({...e,coerce:!0}),date:e=>lc.create({...e,coerce:!0})},any:CTe,array:Mf,bigint:_Te,boolean:HK,date:$Te,discriminatedUnion:GK,effect:YK,enum:jTe,function:PTe,instanceof:yTe,intersection:RTe,lazy:WTe,literal:Ph,map:FTe,nan:bTe,nativeEnum:LTe,never:wTe,null:ITe,nullable:UTe,number:Ea,object:cr,oboolean:()=>HK().optional(),onumber:()=>Ea().optional(),optional:BTe,ostring:()=>_t().optional(),pipeline:zTe,preprocess:qTe,promise:DTe,record:ATe,set:NTe,strictObject:xTe,string:_t,symbol:STe,transformer:YK,tuple:kTe,undefined:TTe,union:MTe,unknown:OTe,void:ETe,NEVER:Se,ZodIssueCode:Y,quotelessJson:nTe,ZodError:Mi});function JK(e){const{debouncedUrl:t,content:n,onContentChange:r}=e,i=F.useRef(null),[o,a]=F.useState(!1),[u,s]=F.useState(t);u!==t&&c();function c(){var f;s(t),o&&(a(!1),(f=i.current)==null||f.reset())}function l(){a(!0),r(void 0)}return t===(n==null?void 0:n.embed_url)?y.jsx(fE,{content:n}):y.jsx(T.ErrorBoundary,{ref:i,renderError:KTe,onError:l,children:y.jsx(F.Suspense,{fallback:n&&y.jsx(fE,{content:n}),children:y.jsx(VTe,{url:t,onContentChange:r})})})}function KTe(){return y.jsx(T.EmptyEmbed,{title:"There is no embed data available."})}function fE(e){const{content:t}=e;return y.jsx(T.EmbedPreview,{...JTe(t)})}function VTe(e){const{url:t,onContentChange:n}=e,r=HTe({url:t,onContentChange:n});return y.jsx(fE,{content:r})}function HTe(e){const{url:t,onContentChange:n}=e,{embeds:r}=di(),i=Sh(GTe,[t,r.url]),o=Qy(n);return F.useEffect(()=>{const a=setTimeout(()=>o(i));return()=>{clearTimeout(a)}},[i,o]),i}function GTe(e,t){const n=new URL(t);return n.search=new URLSearchParams({url:e}).toString(),Cf(n.toString(),{okType:YTe(e)})}function YTe(e){return zn.object({type:zn.string(),version:zn.string().or(zn.number()).nullish(),title:zn.string().nullish(),author_name:zn.string().nullish(),author_url:zn.string().nullish(),provider_name:zn.string().nullish(),provider_url:zn.string().nullish(),cache_age:zn.string().or(zn.number()).nullish(),thumbnail_url:zn.string().nullish(),thumbnail_width:zn.number().nullish(),thumbnail_height:zn.number().nullish(),html:zn.string().nullish()}).passthrough().transform(t=>{const n={embed_url:e};return{...n,__TYPE__:"EmbedContent",type:t.type,version:t.version,title:t.title,author_name:t.author_name,author_url:t.author_url,provider_name:t.provider_name,provider_url:t.provider_url,cache_age:t.cache_age,thumbnail_url:t.thumbnail_url,thumbnail_width:t.thumbnail_width,thumbnail_height:t.thumbnail_height,html:t.html,all:{...n,...t}}})}function JTe(e){let t="";switch(e.type){case"video":t=e.title??"";break;case"photo":t="View this post"+(e.provider_name?` on ${e.provider_name}`:"");break;default:t="Open"+(e.provider_name?` on ${e.provider_name}`:"")}return{url:e.embed_url,thumbnail:{url:e.thumbnail_url??"",aspectRatio:e.type==="video"?"16:9":"1:1"},provider:e.provider_name??"",author:e.author_name??"",subtitle:t}}function ZTe(e){const{id:t,readOnly:n,field:r,content:i,onContentChange:o}=e,[a,u]=F.useState((i==null?void 0:i.embed_url)??"");function s(d){u(d),cc(d)||o(void 0)}const[c,l]=F.useState(a),f=F.useCallback(d=>F.startTransition(()=>l(d)),[]);return Tu(a,300,f),y.jsxs(T.Field,{footer:cc(a)&&y.jsx(T.FieldFooter,{children:y.jsx(JK,{debouncedUrl:c,content:i,onContentChange:o})}),children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"cloud"})}),y.jsx(T.FieldLabel,{htmlFor:t,children:Un(r)}),y.jsx(T.FieldControl,{children:y.jsx(T.TextInput,{id:t,readOnly:n,placeholder:Ca(r),value:a,onValueChange:s,variant:cc(a)?"link":"normal",endAdornment:y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"close"}),variant:"secondary",size:"small",disabled:!a,onClick:()=>s("")})})})]})}function XTe(e){const{content:t,field:n,id:r}=e,[i,o]=F.useState(!1),[a,u]=F.useState(!1);return Tu(i,300,()=>u(i)),y.jsxs(T.Field,{onMouseOverChange:o,children:[y.jsx(T.Tooltip,{title:"Coming soon",content:"This feature is currently in development and will be available soon. Stay tuned for updates!",side:"bottom",open:a,children:y.jsx(QTe,{})}),y.jsx(T.FieldIcon,{disabled:!0,children:y.jsx(T.Icon,{name:"notes"})}),y.jsx(T.FieldLabel,{htmlFor:r,children:Un(n)}),y.jsx(T.FieldControl,{disabled:!0,children:y.jsx(T.TextArea,{id:r,onChange:()=>{},placeholder:oE,readOnly:!0,value:t!=null&&t.position?`${t.position.lat}, ${t.position.lng}`:""})})]})}const QTe=F.forwardRef(function(t,n){return y.jsx("div",{ref:n,style:{width:50,position:"absolute",top:40,left:30}})}),Wh="__MAIN_THUMBNAIL__";function ZK(e,t,n){const r=e.name===Wh?void 0:e.name;let i;return t?ho(n)?i=[n.width,n.height]:ho(e.width)||ho(e.height)?i=[e.width??void 0,e.height??void 0]:i=[t.origin.width,t.origin.height]:i=void 0,[r,i?`${i[0]??"auto"}x${i[1]??"auto"}px`:void 0]}function eIe(e){var t,n;return[{...(t=e.config)==null?void 0:t.constraint,name:Wh}].concat(((n=e.config)==null?void 0:n.thumbnails)??[])}function tIe(e,t){var a,u;const{__TYPE__:n,thumbnails:r,...i}=t,o=(u=(a=e.config)==null?void 0:a.thumbnails)==null?void 0:u.map(({name:s})=>r==null?void 0:r[s]);return[i,...o??[]]}function nIe(e,t,n,r){const i=r.length===0?void 0:r;return e===Wh?{...t,alt:i}:{...t,thumbnails:{...t.thumbnails,[e]:{...n,alt:i}}}}function XK(e,t){const{width:n,height:r}=t??{};return n&&r?[n,r]:n?[n,Math.round(e.height*(n/e.width))]:r?[Math.round(e.width*(r/e.height)),r]:[e.width,e.height]}function QK(e,t,n,r,i){const o=new URL(e);if(i){const{x:a,y:u,width:s,height:c}=t;o.searchParams.set("rect",[a,u,s,c].join(",")),o.searchParams.set("w",n.toString()),o.searchParams.set("h",r.toString())}return o.toString()}function eV(e){const t=new URL(e);return t.searchParams.delete("q"),t.searchParams.set("w","800"),t.searchParams.set("h","800"),t.searchParams.set("auto","compress,format"),t.searchParams.set("fit","max"),t.toString()}function tV(e){const t=new URL(e);return t.searchParams.delete("q"),t.searchParams.delete("fm"),t.searchParams.set("w","300"),t.searchParams.set("auto","compress,format"),t.toString()}const nV=({contentView:e,constraints:t,croppedImage:n})=>{const[r,i]=XK(e.origin,t),o=QK(e.origin.url,n,r,i,!0);return{...e,width:r,height:i,url:o,edit:{...e.edit,zoom:n.zoom,crop:{x:n.x,y:n.y}}}},rIe=({field:e,content:t,thumbnail:n,croppedImage:r})=>{var u,s,c,l;if(n===Wh){const f=nV({contentView:t,constraints:(u=e.config)==null?void 0:u.constraint,croppedImage:r});return f.url===t.url?t:{...t,...f}}const i=(c=(s=e.config)==null?void 0:s.thumbnails)==null?void 0:c.find(f=>f.name===n),o=(l=t.thumbnails)==null?void 0:l[n];if(!i||!o)return t;const a=nV({contentView:o,constraints:i,croppedImage:r});return a.url===o.url?t:{...t,thumbnails:{...t.thumbnails,[n]:a}}},iIe=({initialSize:e,constraints:t})=>{const n=t!=null&&t.width&&(t!=null&&t.height)?t.width/t.height:e.width/e.height,[r,i]=e.width<e.height?[e.width,Math.round(e.width/n)]:[Math.round(e.height*n),e.height],o=Math.max(r/e.width,i/e.height,1);return{width:Math.round(r/o),height:Math.round(i/o)}},oIe=({contentView:e,constraints:t})=>{const n=iIe({initialSize:e.origin,constraints:t}),r=e.edit.zoom??1,i=Math.round(n.width/r),o=Math.round(n.height/r);return{...e.edit.crop,width:i,height:o,zoom:r}},rV={x:0,y:0,width:0,height:0,zoom:1},aIe=({selectedImage:{thumbnail:e,contentView:t}})=>e.width&&e.height?e.width/e.height:t?t.origin.width/t.origin.height:1,uIe=({trigger:e,initialImages:t,initialOption:n,onClose:r})=>{var O;const[i,o]=F.useState({}),[a,u]=F.useState({}),[s,c]=F.useState(!1),[l,f]=F.useState(!1),[d,p]=F.useState(n),h=t[d],m=M=>{if(!h)return;const x=h.thumbnail.name,U=i[x]??rV;o({...i,[x]:{...U,zoom:M}})},g=M=>{if(!h)return;const x=h.thumbnail.name,U=i[x]??rV;o({...i,[x]:{...U,...M}})},_=M=>{if(!h)return;const x=h.thumbnail.name,U=a[x];u({...a,[x]:{...U,crop:M}})},S=M=>{if(!h)return;const x=h.thumbnail.name,U=a[x]??{};u({...a,[x]:{...U,aspectRatio:M}})},C=i[(h==null?void 0:h.thumbnail.name)??""],b=s?C??((h==null?void 0:h.contentView)&&oIe({contentView:h.contentView,constraints:h.thumbnail})):void 0,w=a[(h==null?void 0:h.thumbnail.name)??""];return y.jsxs(T.Dialog,{trigger:e,onAnimationEnd:()=>f(!0),open:s,onOpenChange:M=>{M?(p(n),o({}),u({})):(f(!1),r({option:d,croppedImages:i})),c(M)},children:[y.jsx(T.DialogHeader,{icon:"photo",title:"Image editor"}),y.jsx(T.DialogOptions,{value:String(d),onValueChange:M=>p(Number(M)),children:t.map((M,x)=>y.jsx(T.DialogOptionsItem,{value:String(x),icon:"photo",title:M.labels[0]??"Main",subtitle:M.labels[1]??""},M.thumbnail.name))}),h&&y.jsx(T.DialogContent,{children:l&&y.jsx(T.CropperControls,{image:((O=h.contentView)==null?void 0:O.origin.url)??"",crop:(w==null?void 0:w.crop)??{x:0,y:0},onCropChange:_,zoom:(C==null?void 0:C.zoom)??1,onZoomChange:m,aspectRatio:aIe({selectedImage:h,cropper:w}),onAspectRatioChange:S,initialCroppedArea:b,onCropAreaChange:g},h.thumbnail.name)})]})},sIe=" https://prismic.io/docs/guides/manage-images#maximum-file-size",cIe=" https://prismic.io/docs/guides/manage-images#supported-media",iV=cr({id:_t(),kind:_t(),extension:_t(),filename:_t(),width:Ea().optional(),height:Ea().optional(),last_modified:Ea(),url:_t()}),lIe=cr({total:Ea(),cursor:_t().optional(),items:Mf(iV)}),oV=30;function dE(e,t,n,r){const i=new URLSearchParams({assetType:"image",limit:`${oV}`,...r&&{cursor:r}});return Cf(`${e}?${i.toString()}`,{headers:{repository:t},credentials:eb(n),okType:lIe})}aE.registerFetcherConfig(dE,{cacheCapacity:100,revalidationStrategy:{type:"never"}});function fIe(){const{env:e,assets:t}=di(),[n,r]=F.useState(),[i,o]=F.useState([]),[a,u]=F.useState(i);if(!t)throw new Error("Missing EditorConfig.assets");const{url:s,repository:c}=t,l=Sh(dE,[s,c,e,n]);a!==l.items&&(u(l.items),o(p=>[...p,...l.items]));function f(){l.total!==0&&r(l.cursor)}function d(p){const h=[...p,...i];o([]),JSe(dE,[s,c,e,n],{total:h.length,items:h,cursor:void 0})}return{media:i,limit:oV,onHasReachedBottom:f,response:l,updateMedia:d}}function dIe(e){const{onFilesSelected:t}=e,[n,r]=F.useTransition(),[i,o]=F.useState(!1);return Tu(n,100,()=>o(n)),y.jsx(T.ErrorBoundary,{renderError:yIe,children:y.jsx(F.Suspense,{children:y.jsxs(T.FileDropZone,{onFilesSelected:t,overlay:y.jsx(mIe,{}),children:[y.jsx(pIe,{...e,startTransition:r}),y.jsx(T.Box,{position:"relative",width:"100%",justifyContent:"center",children:y.jsx(T.Toast,{anchor:y.jsx(T.Box,{position:"fixed",bottom:72}),loadingIndicator:!0,open:i,title:"Loading media ...",seconds:1})})]})})})}function pIe(e){const{uploadingFiles:t,onFilesSelected:n,onSuccessFiles:r,onFailedFiles:i,onTryAgain:o,onMediaSelected:a,startTransition:u}=e,{media:s,limit:c,onHasReachedBottom:l,response:f,updateMedia:d}=fIe();return F.useEffect(()=>{const p=t.filter(m=>m.status==="success").map(m=>m.response),h=t.filter(m=>m.status==="failed");p.length>0&&(d(p),r()),h.length>0&&i(h)},[i,r,d,t]),s.length===0?y.jsx(hIe,{onFilesSelected:n}):y.jsxs(vIe,{onScrollToBottom:()=>{f.total===c&&u(l)},children:[y.jsx(T.Box,{flexDirection:"column",gap:6,children:t.map((p,h)=>y.jsx(T.UploadProgress,{file:p.file,failed:p.status==="failed",onTryAgain:()=>o(p)},`${p.file.name}${h}`))}),y.jsx(T.Masonry,{items:s,getItemInfo:gIe,children:p=>y.jsx(F.Suspense,{fallback:y.jsx(T.Skeleton,{width:"100%",height:"100%"}),children:y.jsx(T.MasonryMedia,{url:tV(p.url),onClick:()=>a({...p,width:p.width??2e3,height:p.height??2e3})})})})]})}function hIe(e){const{onFilesSelected:t}=e;return y.jsx(T.Box,{justifyContent:"center",flexDirection:"column",height:"100%",padding:24,children:y.jsx(T.Box,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:"grey2",borderRadius:4,padding:{inline:80},children:y.jsxs(T.BlankSlate,{children:[y.jsx(T.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple10",backgroundColor:"purple12"}),y.jsx(T.BlankSlateTitle,{size:"big",children:"Drop files here or"}),y.jsx(T.BlankSlateDescription,{children:y.jsxs(T.Text,{color:"grey11",align:"center",variant:"normal",children:["Explore our documentation to find out the"," ",y.jsx(T.TextLink,{underline:!0,color:"grey11",href:sIe,children:"maximum size"})," ","and"," ",y.jsx(T.TextLink,{underline:!0,color:"grey11",href:cIe,children:"supported image formats"})," ","for uploads in the media library."]})}),y.jsx(T.BlankSlateActions,{children:y.jsx(T.FileUploadTrigger,{title:"Upload Media",onFilesSelected:t})})]})})})}function mIe(){return y.jsx(T.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:y.jsxs(T.BlankSlate,{children:[y.jsx(T.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple10",backgroundColor:"purple12"}),y.jsx(T.BlankSlateTitle,{size:"big",children:"Drop files here"}),y.jsx(T.BlankSlateDescription,{children:"Drop your files to upload them instantly to your media library"})]})})}function vIe(e){const{children:t,onScrollToBottom:n}=e;return y.jsx(T.ScrollArea,{style:{height:"100%",paddingInline:T.tokens.space[24],paddingBlock:T.tokens.space[16],gap:T.tokens.space[16]},onScrollToBottom:n,children:t})}function gIe(e){return{key:e.id,aspectRatio:(e.width??2e3)/(e.height??2e3)}}function yIe(){return y.jsx(T.Box,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:y.jsx(T.DefaultErrorMessage,{title:"Request failed",description:"An error occurred while searching for your image.",errorImageSrc:T.dialogErrorImage})})}let pb;const bIe=new Uint8Array(16);function _Ie(){if(!pb&&(pb=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pb))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pb(bIe)}const mn=[];for(let e=0;e<256;++e)mn.push((e+256).toString(16).slice(1));function $Ie(e,t=0){return(mn[e[t+0]]+mn[e[t+1]]+mn[e[t+2]]+mn[e[t+3]]+"-"+mn[e[t+4]]+mn[e[t+5]]+"-"+mn[e[t+6]]+mn[e[t+7]]+"-"+mn[e[t+8]]+mn[e[t+9]]+"-"+mn[e[t+10]]+mn[e[t+11]]+mn[e[t+12]]+mn[e[t+13]]+mn[e[t+14]]+mn[e[t+15]]).toLowerCase()}const aV={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function SIe(e,t,n){if(aV.randomUUID&&!t&&!e)return aV.randomUUID();e=e||{};const r=e.random||(e.rng||_Ie)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return $Ie(r)}function TIe(e){const{file:t,url:n,repository:r,env:i}=e,o=new FormData;return o.append(t.name,t),Cf(n,{headers:{repository:r,"Content-Type":"multipart/form-data"},method:"POST",body:o,credentials:eb(i),okType:iV})}function IIe(){const[e,t]=F.useState([]),n=di();function r(s){s.forEach(c=>{var l,f;return TIe({file:c.file,url:((l=n.assets)==null?void 0:l.url)??"",repository:((f=n.assets)==null?void 0:f.repository)??"",env:n.env}).then(d=>{t(p=>p.map(h=>h.id===c.id?{...h,status:"success",response:d}:h))}).catch(()=>{t(d=>d.map(p=>p.id===c.id?{...p,status:"failed"}:p))})})}const{onFailedFiles:i,onTryAgain:o}=CIe({setUploadingFiles:t,tryPostMedia:r});function a(s){const c=s.map(l=>({id:SIe(),file:l,status:"loading"}));t(l=>[...l,...c]),r(c)}function u(){t(s=>s.filter(c=>c.status!=="success"))}return{onFilesSelected:a,uploadingFiles:e,onSuccessFiles:u,onFailedFiles:i,onTryAgain:o}}function CIe(e){const{setUploadingFiles:t,tryPostMedia:n}=e,r=F.useRef();function i(a){const u=()=>t(s=>s.filter(c=>!a.includes(c)));r.current=window.setTimeout(u,3e3)}function o(a){clearTimeout(r.current),t(u=>u.map(s=>s.id===a.id?{...a,status:"loading"}:s)),n([a])}return{onTryAgain:o,onFailedFiles:i}}const OIe=cr({id:_t(),width:Ea(),height:Ea(),urls:cr({full:_t(),small:_t().transform(tV)})}),wIe=cr({results:Mf(OIe)}).transform(e=>e.results);function uV(e,t){const n=new URLSearchParams({page:"1",per_page:"30",query:t});return Cf(`${e}/search/photos?${n.toString()}`,{okType:wIe})}aE.registerFetcherConfig(uV,{cacheCapacity:5,revalidationStrategy:{type:"never"}});function EIe(e,t){return Sh(uV,[e,t])}const xIe=e=>{const{onMediaSelected:t}=e,[n,r]=F.useState(""),[i,o]=F.useState(n),[a,u]=F.useTransition(),s=F.useCallback(c=>u(()=>o(c)),[]);return Tu(n,200,s),y.jsxs(y.Fragment,{children:[y.jsx(T.Box,{padding:{inline:24,top:16},flexDirection:"column",children:y.jsx(T.SearchInput,{value:n,placeholder:"Search on Unsplash.com",onValueChange:r})}),y.jsx(kIe,{children:y.jsx(T.ErrorBoundary,{renderError:FIe,children:y.jsx(F.Suspense,{fallback:y.jsx(T.MasonrySkeleton,{}),children:y.jsx(MIe,{term:i,isUpdating:a,onMediaSelected:t})})})})]})},MIe=e=>{const{term:t,isUpdating:n,onMediaSelected:r}=e,i=di(),o=EIe(i.unsplash.url,t||"fruit"),a=RIe(n);return o.length?y.jsx(T.Masonry,{items:o,getItemInfo:AIe,style:a,children:u=>y.jsx(T.MasonryMedia,{url:u.urls.small,onClick:()=>r({id:u.id,url:u.urls.full,width:u.width,height:u.height})})}):y.jsxs(T.BlankSlate,{style:{marginTop:"auto",marginBottom:"auto",...a},children:[y.jsx(T.BlankSlateImage,{children:y.jsx("img",{src:T.dialogErrorImage,alt:"No results"})}),y.jsx(T.BlankSlateTitle,{size:"big",children:"Oh no ..."}),y.jsx(T.BlankSlateDescription,{children:"The search returned no result."})]})};function RIe(e){return{opacity:e?.4:1,transitionProperty:e?"opacity":"none",transitionDuration:T.tokens.transitionDuration[300],transitionTimingFunction:T.tokens.transitionTimingFunction.easeInOut}}const kIe=({children:e})=>y.jsx(T.ScrollArea,{style:{height:"100%",paddingInline:T.tokens.space[24],paddingTop:T.tokens.space[4]},children:e});function AIe(e){return{key:e.id,aspectRatio:e.width/e.height}}function FIe(){return y.jsx(T.Box,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:y.jsx(T.DefaultErrorMessage,{title:"Request failed",description:"An error occurred while searching for your image.",errorImageSrc:T.dialogErrorImage})})}function sV(e){const{trigger:t,onMediaSelected:n}=e,r=di(),{onFilesSelected:i,uploadingFiles:o,onSuccessFiles:a,onFailedFiles:u,onTryAgain:s}=IIe(),[c,l]=F.useState(!1),[f,d]=F.useState(r.assets?"media":"unsplash"),p=h=>{if(h!=="media"&&h!=="unsplash")throw new Error(`Invalid option ${h}.`);d(h)};return y.jsxs(T.Dialog,{trigger:t,open:c,onOpenChange:l,children:[y.jsx(T.DialogHeader,{icon:"folder",title:"Add an image"}),y.jsxs(T.DialogOptions,{value:f,onValueChange:p,children:[r.assets&&y.jsx(T.DialogOptionsItem,{value:"media",title:"Media library",subtitle:"From Prismic",icon:"photo"}),y.jsx(T.DialogOptionsItem,{value:"unsplash",title:"Unsplash",subtitle:"Source of free images",icon:"unsplash"}),r.assets&&y.jsx(T.Box,{flexDirection:"column",justifyContent:"end",flexGrow:1,animation:"fadeIn",children:y.jsx(T.FileUploadTrigger,{startIcon:y.jsx(T.Icon,{name:"cloudUpload"}),title:"Upload media",onFilesSelected:i})})]}),y.jsx(T.DialogContent,{children:y.jsx(NIe,{option:f,uploadingFiles:o,onSuccessFiles:a,onFailedFiles:u,onFilesSelected:i,onTryAgain:s,onMediaSelected:h=>{l(!1),n==null||n(h)}})})]})}function NIe(e){const{option:t,onMediaSelected:n,...r}=e,i=di();switch(t){case"media":return i.assets?y.jsx(dIe,{onMediaSelected:n,...r}):null;case"unsplash":return y.jsx(xIe,{onMediaSelected:n})}}function PIe(e,t){const n={};for(const r in e)n[r]=t(e[r],r);return n}function WIe(e,t,n,r){var u,s,c,l,f,d;if(!n){const p=(u=t.config)==null?void 0:u.thumbnails,h=p&&Object.fromEntries(p.map(m=>[m.name,hb(r,m)]));return{__TYPE__:"ImageContent",...hb(r,(s=t.config)==null?void 0:s.constraint),thumbnails:h}}if(e===Wh){const p=hb(r,(c=t.config)==null?void 0:c.constraint);return p.url===n.url?n:{...n,...p}}const i=(f=(l=t.config)==null?void 0:l.thumbnails)==null?void 0:f.find(p=>p.name===e);if(!i)return n;const o=(d=n.thumbnails)==null?void 0:d[e],a=hb(r,i);return a.url===(o==null?void 0:o.url)?n:{...n,thumbnails:PIe(n.thumbnails??{},(p,h)=>h===e?a:p)}}function hb(e,t){const{width:n,height:r,rect:i}=jIe(e,t),o=Boolean((t==null?void 0:t.width)||(t==null?void 0:t.height));return{url:QK(e.url,i,n,r,o),origin:{id:e.id,url:e.url,width:e.width,height:e.height},width:n,height:r,edit:{background:"transparent",zoom:1,crop:{x:i.x,y:i.y}}}}function jIe(e,t){const[n,r]=XK(e,t),i=Math.max(n/e.width,r/e.height),o=Math.round((e.width-n/i)/2),a=Math.round((e.height-r/i)/2),u=Math.round(n/i),s=Math.round(r/i);return{width:n,height:r,rect:{x:o,y:a,width:u,height:s}}}const LIe=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var w,O;const[o,a]=F.useState(0),[u,s]=F.useTransition(),c=DIe(t),l=c[o],f=e?tIe(t,e):void 0,d=f==null?void 0:f[o],p=Un(t),h=l?ZK(l,e,d).filter(ho):[],m=e&&!i?"visible":"hidden";function g(M){if(!l)return;const x=WIe(l.name,t,e,M);x!==e&&s(()=>r(x))}function _(M){s(()=>a(M))}const S=c.map((M,x)=>{const U=f==null?void 0:f[x];return{thumbnail:M,contentView:U,labels:ZK(M,e,U)}}),C=({option:M,croppedImages:x})=>{if(a(M),!e)return;const U=Object.entries(x).reduce((B,[P,Z])=>rIe({field:t,content:B,thumbnail:P,croppedImage:Z}),e);U!==e&&s(()=>r(U))},b=((O=(w=d==null?void 0:d.url)==null?void 0:w.split("?")[0])==null?void 0:O.slice(-4))===".svg";return y.jsxs(T.Card,{color:"grey2",variant:"dashed",children:[y.jsxs(T.CardHeader,{children:[y.jsxs(T.CardHeaderTitle,{children:[p,h.length!==0&&y.jsx(T.Text,{color:"grey11",component:"span",children:` • ${h.join(" • ")}`})]}),y.jsxs(T.CardHeaderActions,{style:{visibility:m},children:[y.jsx(uIe,{trigger:y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"crop"}),disabled:b,children:"Crop & Resize"}),initialImages:S,initialOption:o,onClose:C}),y.jsx(sV,{trigger:y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"imageSearch"}),children:"Replace"}),onMediaSelected:g}),y.jsx(T.Button,{onClick:()=>{a(0),r(void 0)},startIcon:y.jsx(T.Icon,{name:"delete"}),children:"Clear"})]})]}),y.jsx(F.Suspense,{fallback:y.jsx("div",{style:{height:466}}),children:l&&e&&f?y.jsx(BIe,{allContentViews:f,content:e,contentView:d,id:n,onContentChange:r,onPageChange:_,page:o,readOnly:i,thumbnailName:l.name,isUpdating:u}):y.jsx(UIe,{onMediaSelected:g,readOnly:i,isUpdating:u})})]})};function DIe(e){return F.useMemo(()=>eIe(e),[e])}const BIe=e=>{const{allContentViews:t,content:n,contentView:r,id:i,onContentChange:o,onPageChange:a,page:u,readOnly:s,thumbnailName:c,isUpdating:l}=e;return y.jsxs(T.CardContent,{children:[y.jsx(T.Carousel,{getItemSource:qIe,items:t,onPageChange:a,page:u,style:{height:400},children:f=>(f==null?void 0:f.url)&&y.jsx(T.CarouselItem,{src:eV(f.url),alt:f.alt??void 0,isUpdating:l},`${c}_${f.url}`)}),y.jsxs(T.Field,{labelPosition:"side",children:[y.jsx(T.FieldLabel,{htmlFor:i,children:"Alt text"}),y.jsx(T.FieldControl,{children:y.jsx(T.TextInput,{id:i,onValueChange:f=>{r&&o(nIe(c,n,r,f))},placeholder:"Short description for the visually impaired",readOnly:s||!r,value:(r==null?void 0:r.alt)??""})})]})]})},UIe=({onMediaSelected:e,readOnly:t,isUpdating:n})=>y.jsx(T.CardContent,{children:y.jsx(T.Card,{color:"grey3",variant:"outlined",children:y.jsx(T.CardContent,{style:{paddingBlock:parseFloat(T.tokens.space[48])},children:y.jsxs(T.BlankSlate,{children:[y.jsx(T.BlankSlateIcon,{name:"cloudUpload"}),y.jsx(T.BlankSlateTitle,{children:n?"Preparing your image...":"You haven't selected an image"}),!t&&y.jsx(T.BlankSlateActions,{children:y.jsx(sV,{trigger:y.jsx(T.Button,{disabled:n,children:"Select image"}),onMediaSelected:e})})]})})})});function qIe(e){return e!=null&&e.url?eV(e.url):void 0}function zIe(e){const{content:t,field:n,id:r,onContentChange:i,readOnly:o}=e;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"notes"})}),y.jsx(T.FieldLabel,{htmlFor:r,children:Un(n)}),y.jsx(T.FieldControl,{children:y.jsx(T.TextArea,{id:r,placeholder:Ca(n),readOnly:o,value:(t==null?void 0:t.value)??"",onChange:a=>{i(KIe(a))}})})]})}function KIe(e){return e.length===0?void 0:{__TYPE__:"FieldContent",type:"Text",value:e}}function VIe(e){return e.charAt(0).toUpperCase()+e.slice(1)}const HIe={unclassified:["unclassified","published"],archived:["unclassified","published"],release:["release","published"],published:["published"]};function GIe(e){var _,S;const{searchTerm:t,tagsFilter:n,typesFilter:r}=e,{documents:i,env:o,status:a}=di(),[u,s]=F.useState(""),[c,l]=F.useState([]),[f,d]=F.useState(""),p=[{name:"tags",values:n},{name:"customTypes",values:r},{name:"status",values:HIe[a]},{name:"term",values:[t]}],h=new URLSearchParams(QIe(p)).toString(),m=Sh(cV,[i==null?void 0:i.url,h===f?u:"",o,h]);h!==f?(d(h),s(""),l(m.results)):m.results.length>0&&((_=c.at(-1))==null?void 0:_.id)!==((S=m.results.at(-1))==null?void 0:S.id)&&l(C=>C.concat(m.results));function g(){m.cursor&&s(m.cursor)}return{documents:c,onHasReachedBottom:g,response:m}}aE.registerFetcherConfig(cV,{cacheCapacity:500,revalidationStrategy:{type:"never"}});const YIe=GK("status",[cr({status:Ph("unclassified")}),cr({status:Ph("published")}),cr({status:Ph("release"),release_id:_t()}),cr({status:Ph("archived")})]).and(cr({version_id:_t(),tags:Mf(_t()),custom_type_label:_t(),preview_summary:_t().optional(),preview_image:_t().optional()})),JIe=cr({id:_t(),custom_type_id:_t(),title:_t(),versions:Mf(YIe)}),ZIe=cr({total:Ea(),cursor:_t().optional(),results:Mf(JIe)}),XIe=30;function cV(e,t,n,r){if(!e)throw new Error("Missing EditorConfig.documents");const i=new URLSearchParams({limit:XIe.toString(),...t&&{cursor:t}});return Cf(`${e}?${i.toString()}&${r}`,{credentials:eb(n),okType:ZIe})}function QIe(e){return e.reduce((t,n)=>{const r=n.values.map(i=>[n.name,i]);return t.concat(r)},[])}function e1e(e){const{onSelectDocument:t,...n}=e,{documents:r}=di(),[i,o]=F.useState(""),[a,u]=F.useState("");Tu(i,300,()=>u(i));const[s,c]=F.useTransition(),[l,f]=F.useState(!1);return Tu(s,100,()=>f(s)),y.jsx(T.Dialog,{size:{height:727,width:656},hasClose:!1,...n,children:y.jsx(T.DialogContent,{children:y.jsxs(T.Box,{flexDirection:"column",height:"100%",children:[y.jsxs(T.Box,{padding:16,flexDirection:"column",gap:12,children:[y.jsx(T.FormInput,{value:i,onValueChange:o,placeholder:"Search a page",icon:"search"}),y.jsx(T.Text,{variant:"smallBold",color:"grey11",children:"Link to a document"})]}),r?y.jsx(T.ErrorBoundary,{renderError:t1e,children:y.jsx(F.Suspense,{children:y.jsx(n1e,{searchTerm:a,tagsFilter:[],typesFilter:[],startTransition:c,onSelectDocument:t})})}):y.jsx(lV,{message:"You can't select a document. No mock data can be rendered for this field."}),y.jsx(T.Toast,{anchor:y.jsx(T.Box,{position:"relative",width:"100%",justifyContent:"center",bottom:72}),loadingIndicator:!0,open:l,title:"Loading more results ...",seconds:1})]})})})}function t1e(){return y.jsx(T.Box,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:y.jsx(T.DefaultErrorMessage,{title:"Request failed",description:"An error occurred while fetching documents.",errorImageSrc:T.dialogErrorImage})})}function n1e(e){const{searchTerm:t,tagsFilter:n,typesFilter:r,startTransition:i,onSelectDocument:o}=e,{documents:a,onHasReachedBottom:u}=GIe({searchTerm:t,tagsFilter:n,typesFilter:r});return y.jsx(T.ScrollArea,{onScrollToBottom:()=>i(u),style:{height:"100%",gap:T.tokens.space[16],padding:T.tokens.space[16]},children:y.jsxs(T.Box,{flexDirection:"column",gap:12,children:[a.length===0&&y.jsx(lV,{}),a.map(s=>{var c,l,f,d,p,h;return y.jsx(T.DocumentCard,{documentType:((c=s.versions[0])==null?void 0:c.custom_type_label)??"",description:(l=s.versions[0])==null?void 0:l.preview_summary,tags:((f=s.versions[0])==null?void 0:f.tags)??[],title:s.title,previewImageUrl:(d=s.versions[0])==null?void 0:d.preview_image,onSelect:()=>o(s.id),status:(p=s.versions[0])==null?void 0:p.status},`${s.id}-${((h=s.versions[0])==null?void 0:h.status)??""}`)})]})})}function lV(e){const{message:t="There are no versions matching this request"}=e;return y.jsxs(T.Box,{justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16,children:[y.jsx(T.Box,{height:56,width:56,backgroundColor:"purple12",alignItems:"center",justifyContent:"center",borderRadius:"100%",children:y.jsx(T.Icon,{name:"close",size:"large",color:"purple10"})}),y.jsx(T.Box,{maxWidth:204,children:y.jsx(T.Text,{color:"grey11",align:"center",children:t})})]})}function fV(e){const{hasLink:t,onUnlink:n,selectEnabled:r,selectedType:i,onValueChange:o}=e;return y.jsxs(y.Fragment,{children:[y.jsxs(T.Select,{value:i,variant:"secondary",size:"small",icon:r1e(i),disabled:!r,onValueChange:o,placeholder:"Choose link type",children:[y.jsx(T.SelectItem,{value:"web",icon:"public",children:"Link to web page"}),y.jsx(T.SelectItem,{value:"document",icon:"description",children:"Link to Prismic page"})]}),y.jsx(T.Button,{startIcon:y.jsx(T.Icon,{name:"close"}),variant:"secondary",size:"small",disabled:!t,onClick:n})]})}function r1e(e){if(e)switch(e){case"document":return"description";case"web":return"public";case"media":return"image"}}function i1e(e){var x,U;const{field:t,content:n,onContentChange:r}=e,i=g(),[o,a]=F.useState(()=>m()),[u,s]=F.useState(!1),[c,l]=F.useState(i),f=F.useRef(null);c!==i&&O();const d=o?o1e[o]:void 0,p=(n==null?void 0:n.value.__TYPE__)&&["FileLink","ImageLink"].includes(n==null?void 0:n.value.__TYPE__),h=((x=t.config)==null?void 0:x.select)&&t.config.select==="media";function m(){var B,P;return(B=t.config)!=null&&B.select?dV[(P=t.config)==null?void 0:P.select]:n==null?void 0:n.value.__TYPE__}function g(){return n?n.value.__TYPE__==="DocumentLink"?n.value.id:n.value.__TYPE__==="ExternalLink"?n.value.url:n.value.name:""}function _(B){if(!B)return r(void 0);switch(o){case"ExternalLink":return r({__TYPE__:"LinkContent",value:{__TYPE__:"ExternalLink",url:B}});case"DocumentLink":return r({__TYPE__:"LinkContent",value:{__TYPE__:"DocumentLink",id:B}});default:return r(void 0)}}function S(B){_(B)}function C(B){a(dV[B]),S("")}function b(B){_(B)}function w(){s(!0)}function O(){var B;l(i),u&&(s(!1),(B=f.current)==null||B.reset())}const M=!((U=t.config)!=null&&U.select);return{contentType:o,selectType:d,isUnsupportedField:h||p,fieldValue:i,onValueChange:S,onTypeChange:C,placeholder:Ca(t),isTypeSelectEnabled:M,onDocumentSelected:b,onError:w,errorBoundaryRef:f}}const o1e={DocumentLink:"document",ExternalLink:"web",FileLink:"media",ImageLink:"media"},dV={document:"DocumentLink",web:"ExternalLink",media:"FileLink"};function a1e(e){const{env:t,documents:n}=di();return Sh(s1e,[n==null?void 0:n.url,t,e]).title}const u1e=cr({id:_t(),title:_t()});function s1e(e,t,n){if(!e)throw new Error("Missing EditorConfig.documents");return Cf(`${e}/${n}`,{credentials:eb(t),okType:u1e})}function c1e(e){const{content:t,field:n,id:r,onContentChange:i,readOnly:o}=e,[a,u]=F.useState(!1),[s,c]=F.useState(!1),[l,f]=F.useState(!1),{contentType:d,selectType:p,isUnsupportedField:h,fieldValue:m,onValueChange:g,onTypeChange:_,placeholder:S,errorBoundaryRef:C,isTypeSelectEnabled:b,onDocumentSelected:w,onError:O}=i1e({content:t,field:n,onContentChange:i});if(h)return y.jsx(p1e,{id:r,field:n,content:t});const M=cc(m),x=(a||s)&&Boolean(M),U=o||!d,B=d==="DocumentLink"&&m!=="",P={id:r,contentType:d,isTypeSelectEnabled:b,onBlur:()=>u(!1),onFocus:()=>{u(!0),d==="DocumentLink"&&f(!0)},onTypeChange:_,onValueChange:g,readOnly:U,textType:M?"link":"normal",value:m,placeholder:S,selectType:p};return y.jsxs(y.Fragment,{children:[y.jsx(T.LinkDescriptionPopover,{url:M,title:M?d1e(M):"",open:x,align:"start",sideOffset:-3,openDelay:100,closeDelay:200,onMouseOverChange:c,anchor:y.jsxs(T.Field,{onMouseOverChange:u,children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"link"})}),y.jsx(T.FieldLabel,{htmlFor:r,children:Un(n)}),y.jsx(T.FieldControl,{children:B?y.jsx(F.Suspense,{fallback:y.jsx(pE,{...P,value:"..."}),children:y.jsx(T.ErrorBoundary,{ref:C,onError:O,renderError:()=>l1e(P),children:y.jsx(f1e,{...P,documentId:m,openDocumentListModal:()=>f(!0)})})}):y.jsx(pE,{...P})})]})}),y.jsx(e1e,{open:l,onOpenChange:f,onSelectDocument:Z=>{f(!1),w(Z)}})]})}function l1e(e){return y.jsx(pE,{...e,textType:"link"})}function pE(e){const{id:t,onValueChange:n,placeholder:r,readOnly:i,value:o,textType:a,onFocus:u,onBlur:s,contentType:c,isTypeSelectEnabled:l,selectType:f,onTypeChange:d}=e;return y.jsx(T.TextInput,{id:t,onValueChange:n,placeholder:r,readOnly:i||c==="DocumentLink",value:o,variant:a,onFocus:u,onBlur:s,cursor:c==="DocumentLink"?"pointer":"text",endAdornment:y.jsx(fV,{hasLink:Boolean(o),onUnlink:()=>n(""),selectEnabled:l,selectedType:f,onValueChange:d})})}function f1e(e){const{id:t,documentId:n,openDocumentListModal:r,onValueChange:i,isTypeSelectEnabled:o,selectType:a,onTypeChange:u}=e,s=a1e(n);return y.jsx(T.TextInput,{id:t,readOnly:!0,value:s,variant:"link",onFocus:r,cursor:"pointer",endAdornment:y.jsx(fV,{hasLink:!0,onUnlink:()=>i(""),selectEnabled:o,selectedType:a,onValueChange:u})})}function d1e(e){return e.host.split(".").slice(0,-1).filter(t=>t!=="www").map(VIe).join("")}function p1e({id:e,field:t,content:n}){const[r,i]=F.useState(!1),[o,a]=F.useState(!1);Tu(r,300,()=>a(r));const u=(n==null?void 0:n.value.__TYPE__)==="DocumentLink"?n==null?void 0:n.value.id:n==null?void 0:n.value.url;return y.jsxs(T.Field,{onMouseOverChange:i,children:[y.jsx(T.Tooltip,{title:"Coming soon",content:"This feature is currently in development and will be available soon. Stay tuned for updates!",side:"bottom",open:o,children:y.jsx(h1e,{})}),y.jsx(T.FieldIcon,{disabled:!0,children:y.jsx(T.Icon,{name:"link"})}),y.jsx(T.FieldLabel,{htmlFor:e,children:Un(t)}),y.jsx(T.FieldControl,{disabled:!0,children:y.jsx(T.TextArea,{id:e,onChange:()=>{},placeholder:Ca(t),readOnly:!0,value:u})})]})}const h1e=F.forwardRef(function(t,n){return y.jsx("div",{ref:n,style:{width:50,position:"absolute",top:40,left:30}})}),m1e=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var u,s;const o=Number(e==null?void 0:e.value),a=Number.isFinite(o)?o:void 0;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"pin"})}),y.jsx(T.FieldLabel,{htmlFor:n,children:Un(t)}),y.jsx(T.FieldControl,{children:y.jsx(T.NumberInput,{id:n,value:a,min:(u=t.config)==null?void 0:u.min,max:(s=t.config)==null?void 0:s.max,placeholder:Ca(t),readOnly:i,onValueChange:c=>r(v1e(c))})})]})};function v1e(e){return e===void 0?void 0:{__TYPE__:"FieldContent",type:"Number",value:String(e)}}function vn(e){this.content=e}vn.prototype={constructor:vn,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return i==-1?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new vn(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new vn(n)},addToStart:function(e,t){return new vn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new vn(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(o==-1?i.length:o,0,t,n),new vn(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=vn.from(e),e.size?new vn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=vn.from(e),e.size?new vn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=vn.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},vn.from=function(e){if(e instanceof vn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new vn(t)};function pV(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),o=t.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)n++;return n}if(i.content.size||o.content.size){let a=pV(i.content,o.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function hV(e,t,n,r){for(let i=e.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let a=e.child(--i),u=t.child(--o),s=a.nodeSize;if(a==u){n-=s,r-=s;continue}if(!a.sameMarkup(u))return{a:n,b:r};if(a.isText&&a.text!=u.text){let c=0,l=Math.min(a.text.length,u.text.length);for(;c<l&&a.text[a.text.length-c-1]==u.text[u.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(a.content.size||u.content.size){let c=hV(a.content,u.content,n-1,r-1);if(c)return c}n-=s,r-=s}}class K{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,i=0,o){for(let a=0,u=0;u<n;a++){let s=this.content[a],c=u+s.nodeSize;if(c>t&&r(s,i+u,o||null,a)!==!1&&s.content.size){let l=u+1;s.nodesBetween(Math.max(0,t-l),Math.min(s.content.size,n-l),r,i+l)}u=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let o="",a=!0;return this.nodesBetween(t,n,(u,s)=>{u.isText?(o+=u.text.slice(Math.max(t,s)-s,n-s),a=!r):u.isLeaf?(i?o+=typeof i=="function"?i(u):i:u.type.spec.leafText&&(o+=u.type.spec.leafText(u)),a=!r):!a&&u.isBlock&&(o+=r,a=!0)},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new K(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let o=0,a=0;a<n;o++){let u=this.content[o],s=a+u.nodeSize;s>t&&((a<t||s>n)&&(u.isText?u=u.cut(Math.max(0,t-a),Math.min(u.text.length,n-a)):u=u.cut(Math.max(0,t-a-1),Math.min(u.content.size,n-a-1))),r.push(u),i+=u.nodeSize),a=s}return new K(r,i)}cutByIndex(t,n){return t==n?K.empty:t==0&&n==this.content.length?this:new K(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new K(i,o)}addToStart(t){return new K([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new K(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];t(i,r,n),r+=i.nodeSize}}findDiffStart(t,n=0){return pV(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return hV(this,t,n,r)}findIndex(t,n=-1){if(t==0)return mb(0,t);if(t==this.size)return mb(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=t)return a==t||n>0?mb(r+1,a):mb(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return K.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new K(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return K.empty;let n,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new K(n||t,r)}static from(t){if(!t)return K.empty;if(t instanceof K)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new K([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}K.empty=new K([],0);const hE={index:0,offset:0};function mb(e,t){return hE.index=e,hE.offset=t,hE}function vb(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!vb(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!vb(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let tt=class hM{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&vb(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return hM.none;if(t instanceof hM)return[t];let n=t.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};tt.none=[];class gb extends Error{}class ae{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=vV(this.content,t+this.openStart,n);return r&&new ae(r,this.openStart,this.openEnd)}removeBetween(t,n){return new ae(mV(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return ae.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 ae(K.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new ae(t,r,i)}}ae.empty=new ae(K.empty,0,0);function mV(e,t,n){let{index:r,offset:i}=e.findIndex(t),o=e.maybeChild(r),{index:a,offset:u}=e.findIndex(n);if(i==t||o.isText){if(u!=n&&!e.child(a).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return e.replaceChild(r,o.copy(mV(o.content,t-i-1,n-i-1)))}function vV(e,t,n,r){let{index:i,offset:o}=e.findIndex(t),a=e.maybeChild(i);if(o==t||a.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let u=vV(a.content,t-o-1,n);return u&&e.replaceChild(i,a.copy(u))}function g1e(e,t,n){if(n.openStart>e.depth)throw new gb("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new gb("Inconsistent open depths");return gV(e,t,n,0)}function gV(e,t,n,r){let i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let a=gV(e,t,n,r+1);return o.copy(o.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let a=e.parent,u=a.content;return mc(a,u.cut(0,e.parentOffset).append(n.content).append(u.cut(t.parentOffset)))}else{let{start:a,end:u}=y1e(n,e);return mc(o,bV(e,a,u,t,r))}else return mc(o,yb(e,t,r))}function yV(e,t){if(!t.type.compatibleContent(e.type))throw new gb("Cannot join "+t.type.name+" onto "+e.type.name)}function mE(e,t,n){let r=e.node(n);return yV(r,t.node(n)),r}function hc(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function jh(e,t,n,r){let i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(hc(e.nodeAfter,r),o++));for(let u=o;u<a;u++)hc(i.child(u),r);t&&t.depth==n&&t.textOffset&&hc(t.nodeBefore,r)}function mc(e,t){return e.type.checkContent(t),e.copy(t)}function bV(e,t,n,r,i){let o=e.depth>i&&mE(e,t,i+1),a=r.depth>i&&mE(n,r,i+1),u=[];return jh(null,e,i,u),o&&a&&t.index(i)==n.index(i)?(yV(o,a),hc(mc(o,bV(e,t,n,r,i+1)),u)):(o&&hc(mc(o,yb(e,t,i+1)),u),jh(t,n,i,u),a&&hc(mc(a,yb(n,r,i+1)),u)),jh(r,null,i,u),new K(u)}function yb(e,t,n){let r=[];if(jh(null,e,n,r),e.depth>n){let i=mE(e,t,n+1);hc(mc(i,yb(e,t,n+1)),r)}return jh(t,null,n,r),new K(r)}function y1e(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)i=t.node(o).copy(K.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}class Lh{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return tt.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),i=t.maybeChild(n);if(!r){let u=r;r=i,i=u}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new bb(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let a=t;;){let{index:u,offset:s}=a.content.findIndex(o),c=o-s;if(r.push(a,u,i+s),!c||(a=a.child(u),a.isText))break;o=c-1,i+=s+1}return new Lh(n,r,o)}static resolveCached(t,n){for(let i=0;i<vE.length;i++){let o=vE[i];if(o.pos==n&&o.doc==t)return o}let r=vE[gE]=Lh.resolve(t,n);return gE=(gE+1)%b1e,r}}let vE=[],gE=0,b1e=12;class bb{constructor(t,n,r){this.$from=t,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 _1e=Object.create(null);let vc=class mM{constructor(t,n,r,i=tt.none){this.type=t,this.attrs=n,this.marks=i,this.content=r||K.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,i=0){this.content.nodesBetween(t,n,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,i){return this.content.textBetween(t,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&vb(this.attrs,n||t.defaultAttrs||_1e)&&tt.sameSet(this.marks,r||tt.none)}copy(t=null){return t==this.content?this:new mM(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new mM(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return ae.empty;let i=this.resolve(t),o=this.resolve(n),a=r?0:i.sharedDepth(n),u=i.start(a),c=i.node(a).content.cut(i.pos-u,o.pos-u);return new ae(c,i.depth-a,o.depth-a)}replace(t,n,r){return g1e(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(i==t||n.isText)return n;t-=i+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)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(t){return Lh.resolveCached(this,t)}resolveNoCache(t){return Lh.resolve(this,t)}rangeHasMark(t,n,r){let i=!1;return n>t&&this.nodesBetween(t,n,o=>(r.isInSet(o.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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),_V(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=K.empty,i=0,o=r.childCount){let a=this.contentMatchAt(t).matchFragment(r,i,o),u=a&&a.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let s=i;s<o;s++)if(!this.type.allowsMarks(r.child(s).marks))return!1;return!0}canReplaceWith(t,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),a=o&&o.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=tt.none;for(let n=0;n<this.marks.length;n++)t=this.marks[n].addToSet(t);if(!tt.sameSet(t,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 t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=K.fromJSON(t,n.content);return t.nodeType(n.type).create(n.attrs,i,r)}};vc.prototype.text=void 0;class _b extends vc{constructor(t,n,r,i){if(super(t,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):_V(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new _b(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new _b(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function _V(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class gc{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new $1e(t,n);if(r.next==null)return gc.empty;let i=$V(r);r.next&&r.err("Unexpected trailing text");let o=E1e(w1e(i));return x1e(o,r),o}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let i=[this];function o(a,u){let s=a.matchFragment(t,r);if(s&&(!n||s.validEnd))return K.from(u.map(c=>c.createAndFill()));for(let c=0;c<a.next.length;c++){let{type:l,next:f}=a.next[c];if(!(l.isText||l.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=o(f,u.concat(l));if(d)return d}}return null}return o(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:u,next:s}=o.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in n)&&(!i.type||s.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),n[u.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),t.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+t.indexOf(r.next[a].next);return o}).join(`
31
+ `)}}gc.empty=new gc(!0);class $1e{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function $V(e){let t=[];do t.push(S1e(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function S1e(e){let t=[];do t.push(T1e(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function T1e(e){let t=O1e(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=I1e(e,t);else break;return t}function SV(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function I1e(e,t){let n=SV(e),r=n;return e.eat(",")&&(e.next!="}"?r=SV(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function C1e(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let o in n){let a=n[o];a.groups.indexOf(t)>-1&&i.push(a)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function O1e(e){if(e.eat("(")){let t=$V(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=C1e(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function w1e(e){let t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function r(a,u,s){let c={term:s,to:u};return t[a].push(c),c}function i(a,u){a.forEach(s=>s.to=u)}function o(a,u){if(a.type=="choice")return a.exprs.reduce((s,c)=>s.concat(o(c,u)),[]);if(a.type=="seq")for(let s=0;;s++){let c=o(a.exprs[s],u);if(s==a.exprs.length-1)return c;i(c,u=n())}else if(a.type=="star"){let s=n();return r(u,s),i(o(a.expr,s),s),[r(s)]}else if(a.type=="plus"){let s=n();return i(o(a.expr,u),s),i(o(a.expr,s),s),[r(s)]}else{if(a.type=="opt")return[r(u)].concat(o(a.expr,u));if(a.type=="range"){let s=u;for(let c=0;c<a.min;c++){let l=n();i(o(a.expr,s),l),s=l}if(a.max==-1)i(o(a.expr,s),s);else for(let c=a.min;c<a.max;c++){let l=n();r(s,l),i(o(a.expr,s),l),s=l}return[r(s)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function TV(e,t){return t-e}function IV(e,t){let n=[];return r(t),n.sort(TV);function r(i){let o=e[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let a=0;a<o.length;a++){let{term:u,to:s}=o[a];!u&&n.indexOf(s)==-1&&r(s)}}}function E1e(e){let t=Object.create(null);return n(IV(e,0));function n(r){let i=[];r.forEach(a=>{e[a].forEach(({term:u,to:s})=>{if(!u)return;let c;for(let l=0;l<i.length;l++)i[l][0]==u&&(c=i[l][1]);IV(e,s).forEach(l=>{c||i.push([u,c=[]]),c.indexOf(l)==-1&&c.push(l)})})});let o=t[r.join(",")]=new gc(r.indexOf(e.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(TV);o.next.push({type:i[a][0],next:t[u.join(",")]||n(u)})}return o}}function x1e(e,t){for(let n=0,r=[e];n<r.length;n++){let i=r[n],o=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:s,next:c}=i.next[u];a.push(s.name),o&&!(s.isText||s.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function CV(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function OV(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let o=e[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function wV(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new M1e(e[n]);return t}let EV=class H5{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=wV(r.attrs),this.defaultAttrs=CV(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==gc.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:OV(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new vc(this,this.computeAttrs(t),K.from(n),tt.setFrom(r))}createChecked(t=null,n,r){return n=K.from(n),this.checkContent(n),new vc(this,this.computeAttrs(t),n,tt.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=K.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(K.empty,!0);return o?new vc(this,t,n.append(o),tt.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:tt.none:t}static compile(t,n){let r=Object.create(null);t.forEach((o,a)=>r[o]=new H5(o,n,a));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 o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class M1e{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class $b{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=wV(i.attrs),this.excluded=null;let o=CV(this.attrs);this.instance=o?new tt(this,o):null}create(t=null){return!t&&this.instance?this.instance:new tt(this,OV(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((o,a)=>r[o]=new $b(o,i++,n,a)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}excludes(t){return this.excluded.indexOf(t)>-1}}class R1e{constructor(t){this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=vn.from(t.nodes),n.marks=vn.from(t.marks||{}),this.nodes=EV.compile(this.spec.nodes,this),this.marks=$b.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 o=this.nodes[i],a=o.spec.content||"",u=o.spec.marks;o.contentMatch=r[a]||(r[a]=gc.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet=u=="_"?null:u?xV(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:xV(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof EV){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,i)}text(t,n){let r=this.nodes.text;return new _b(r,r.defaultAttrs,t,tt.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return vc.fromJSON(this,t)}markFromJSON(t){return tt.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function xV(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(let u in e.marks){let s=e.marks[u];(i=="_"||s.spec.group&&s.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=s)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Rf{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=t.nodes[r.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new AV(this,n,!1);return r.addAll(t,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new AV(this,n,!0);return r.addAll(t,n.from,n.to),ae.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(F1e(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(t,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],u=a.style;if(!(u.indexOf(t)!=0||a.context&&!r.matchesContext(a.context)||u.length>t.length&&(u.charCodeAt(t.length)!=61||u.slice(t.length+1)!=n))){if(a.getAttrs){let s=a.getAttrs(n);if(s===!1)continue;a.attrs=s||void 0}return a}}}static schemaRules(t){let n=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<n.length;a++){let u=n[a];if((u.priority==null?50:u.priority)<o)break}n.splice(a,0,i)}for(let i in t.marks){let o=t.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=FV(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=FV(a)),a.node||a.ignore||a.mark||(a.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Rf(t,Rf.schemaRules(t)))}}const MV={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},k1e={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},RV={ol:!0,ul:!0},Sb=1,Tb=2,Dh=4;function kV(e,t,n){return t!=null?(t?Sb:0)|(t==="full"?Tb:0):e&&e.whitespace=="pre"?Sb|Tb:n&~Dh}class Ib{constructor(t,n,r,i,o,a,u){this.type=t,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=u,this.content=[],this.activeMarks=tt.none,this.stashMarks=[],this.match=a||(u&Dh?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(K.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Sb)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=K.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(t){for(let n=this.stashMarks.length-1;n>=0;n--)if(t.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(t){for(let n=0,r=this.pendingMarks;n<r.length;n++){let i=r[n];(this.type?this.type.allowsMarkType(i.type):P1e(i.type,t))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!MV.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class AV{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,a=kV(null,n.preserveWhitespace,0)|(r?Dh:0);i?o=new Ib(i.type,i.attrs,tt.none,tt.none,!0,n.topMatch||i.type.contentMatch,a):r?o=new Ib(null,null,tt.none,tt.none,!0,null,a):o=new Ib(t.schema.topNodeType,null,tt.none,tt.none,!0,null,a),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){if(t.nodeType==3)this.addTextNode(t);else if(t.nodeType==1){let n=t.getAttribute("style");if(!n)this.addElement(t);else{let r=this.readStyles(N1e(n));if(!r)return;let[i,o]=r,a=this.top;for(let u=0;u<o.length;u++)this.removePendingMark(o[u],a);for(let u=0;u<i.length;u++)this.addPendingMark(i[u]);this.addElement(t);for(let u=0;u<i.length;u++)this.removePendingMark(i[u],a);for(let u=0;u<o.length;u++)this.addPendingMark(o[u])}}}addTextNode(t){let n=t.nodeValue,r=this.top;if(r.options&Tb||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&Sb)r.options&Tb?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],o=t.previousSibling;(!i||o&&o.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(t)}else this.findInside(t)}addElement(t,n){let r=t.nodeName.toLowerCase(),i;RV.hasOwnProperty(r)&&this.parser.normalizeLists&&A1e(t);let o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,n));if(o?o.ignore:k1e.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);let a,u=this.top,s=this.needsBlock;if(MV.hasOwnProperty(r))u.content.length&&u.content[0].isInline&&this.open&&(this.open--,u=this.top),a=!0,u.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t);return}this.addAll(t),a&&this.sync(u),this.needsBlock=s}else this.addElementByRule(t,o,o.consuming===!1?i:void 0)}leafFallback(t){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
33
+ `))}ignoreFallback(t){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(t){let n=tt.none,r=tt.none;e:for(let i=0;i<t.length;i+=2)for(let o=void 0;;){let a=this.parser.matchStyle(t[i],t[i+1],this,o);if(!a)continue e;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.forEach(u=>{a.clearMark(u)&&(r=u.addToSet(r))}):n=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(n),a.consuming===!1)o=a;else break}return[n,r]}addElementByRule(t,n,r){let i,o,a;n.node?(o=this.parser.schema.nodes[n.node],o.isLeaf?this.insertNode(o.create(n.attrs))||this.leafFallback(t):i=this.enter(o,n.attrs||null,n.preserveWhitespace)):(a=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(a));let u=this.top;if(o&&o.isLeaf)this.findInside(t);else if(r)this.addElement(t,r);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(s=>this.insertNode(s));else{let s=t;typeof n.contentElement=="string"?s=t.querySelector(n.contentElement):typeof n.contentElement=="function"?s=n.contentElement(t):n.contentElement&&(s=n.contentElement),this.findAround(t,s,!0),this.addAll(s)}i&&this.sync(u)&&this.open--,a&&this.removePendingMark(a,u)}addAll(t,n,r){let i=n||0;for(let o=n?t.childNodes[n]:t.firstChild,a=r==null?null:t.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(o);this.findAtPoint(t,i)}findPlace(t){let n,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],a=o.findWrapping(t);if(a&&(!n||n.length>a.length)&&(n=a,r=o,!a.length)||o.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(t){if(t.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(t)){this.closeExtra();let n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));let r=n.activeMarks;for(let i=0;i<t.marks.length;i++)(!n.type||n.type.allowsMarkType(t.marks[i].type))&&(r=t.marks[i].addToSet(r));return n.content.push(t.mark(r)),!0}return!1}enter(t,n,r){let i=this.findPlace(t.create(n));return i&&this.enterInner(t,n,!0,r),i}enterInner(t,n=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let a=kV(t,i,o.options);o.options&Dh&&o.content.length==0&&(a|=Dh),this.nodes.push(new Ib(t,n,o.activeMarks,o.pendingMarks,r,null,a)),this.open++}closeExtra(t=!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(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let n=this.open;n>=0;n--)if(this.nodes[n]==t)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(u,s)=>{for(;u>=0;u--){let c=n[u];if(c==""){if(u==n.length-1||u==0)continue;for(;s>=o;s--)if(a(u-1,s))return!0;return!1}else{let l=s>0||s==0&&i?this.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!l||l.name!=c&&l.groups.indexOf(c)==-1)return!1;s--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.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(t){let n=W1e(t,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(t)>-1)i.pendingMarks=t.removeFromSet(i.pendingMarks);else{i.activeMarks=t.removeFromSet(i.activeMarks);let a=i.popFromStashMark(t);a&&i.type&&i.type.allowsMarkType(a.type)&&(i.activeMarks=a.addToSet(i.activeMarks))}if(i==n)break}}}function A1e(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&RV.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function F1e(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function N1e(e){let t=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=t.exec(e);)r.push(n[1],n[2].trim());return r}function FV(e){let t={};for(let n in e)t[n]=e[n];return t}function P1e(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],a=u=>{o.push(u);for(let s=0;s<u.edgeCount;s++){let{type:c,next:l}=u.edge(s);if(c==t||o.indexOf(l)<0&&a(l))return!0}};if(a(i.contentMatch))return!0}}function W1e(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}class yo{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=yE(n).createDocumentFragment());let i=r,o=[];return t.forEach(a=>{if(o.length||a.marks.length){let u=0,s=0;for(;u<o.length&&s<a.marks.length;){let c=a.marks[s];if(!this.marks[c.type.name]){s++;continue}if(!c.eq(o[u][0])||c.type.spec.spanning===!1)break;u++,s++}for(;u<o.length;)i=o.pop()[1];for(;s<a.marks.length;){let c=a.marks[s++],l=this.serializeMark(c,a.isInline,n);l&&(o.push([c,i]),i.appendChild(l.dom),i=l.contentDOM||l.dom)}}i.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:i}=yo.renderSpec(yE(n),this.nodes[t.type.name](t));if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,i)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let i=t.marks.length-1;i>=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&yo.renderSpec(yE(r),i(t,n))}static renderSpec(t,n,r=null){if(typeof n=="string")return{dom:t.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let i=n[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let a,u=r?t.createElementNS(r,i):t.createElement(i),s=n[1],c=1;if(s&&typeof s=="object"&&s.nodeType==null&&!Array.isArray(s)){c=2;for(let l in s)if(s[l]!=null){let f=l.indexOf(" ");f>0?u.setAttributeNS(l.slice(0,f),l.slice(f+1),s[l]):u.setAttribute(l,s[l])}}for(let l=c;l<n.length;l++){let f=n[l];if(f===0){if(l<n.length-1||l>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:d,contentDOM:p}=yo.renderSpec(t,f,r);if(u.appendChild(d),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:u,contentDOM:a}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new yo(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=NV(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return NV(t.marks)}}function NV(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function yE(e){return e.document||window.document}const PV=65535,WV=Math.pow(2,16);function j1e(e,t){return e+t*WV}function jV(e){return e&PV}function L1e(e){return(e-(e&PV))/WV}const LV=1,DV=2,Cb=4,BV=8;class bE{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&BV)>0}get deletedBefore(){return(this.delInfo&(LV|Cb))>0}get deletedAfter(){return(this.delInfo&(DV|Cb))>0}get deletedAcross(){return(this.delInfo&Cb)>0}}class Zr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Zr.empty)return Zr.empty}recover(t){let n=0,r=jV(t);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+L1e(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let s=this.ranges[u]-(this.inverted?i:0);if(s>t)break;let c=this.ranges[u+o],l=this.ranges[u+a],f=s+c;if(t<=f){let d=c?t==s?-1:t==f?1:n:n,p=s+i+(d<0?0:l);if(r)return p;let h=t==(n<0?s:f)?null:j1e(u/3,t-s),m=t==s?DV:t==f?LV:Cb;return(n<0?t!=s:t!=f)&&(m|=BV),new bE(p,m,h)}i+=l-c}return r?t+i:new bE(t+i,0,null)}touches(t,n){let r=0,i=jV(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let s=this.ranges[u]-(this.inverted?r:0);if(s>t)break;let c=this.ranges[u+o],l=s+c;if(t<=l&&u==i*3)return!0;r+=this.ranges[u+a]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?o:0),s=a+(this.inverted?0:o),c=this.ranges[i+n],l=this.ranges[i+r];t(u,u+c,s,s+l),o+=l-c}}invert(){return new Zr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Zr.empty:new Zr(t<0?[0,-t,0]:[0,0,t])}}Zr.empty=new Zr([]);class kf{constructor(t=[],n,r=0,i=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=i}slice(t=0,n=this.maps.length){return new kf(this.maps,this.mirror,t,n)}copy(){return new kf(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let i=t.getMirror(n);this.appendMap(t.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let i=t.getMirror(n);this.appendMap(t.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new kf;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],u=a.mapResult(t,n);if(u.recover!=null){let s=this.getMirror(o);if(s!=null&&s>o&&s<this.to){o=s,t=this.maps[s].recover(u.recover);continue}}i|=u.delInfo,t=u.pos}return r?t:new bE(t,i,null)}}const _E=Object.create(null);class lr{getMap(){return Zr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=_E[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in _E)throw new RangeError("Duplicate use of step JSON ID "+t);return _E[t]=n,n.prototype.jsonID=t,n}}class Bt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Bt(t,null)}static fail(t){return new Bt(null,t)}static fromReplace(t,n,r,i){try{return Bt.ok(t.replace(n,r,i))}catch(o){if(o instanceof gb)return Bt.fail(o.message);throw o}}}function $E(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy($E(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return K.fromArray(r)}class Eu extends lr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new ae($E(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Bt.fromReplace(t,this.from,this.to,o)}invert(){return new bo(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Eu(n.pos,r.pos,this.mark)}merge(t){return t instanceof Eu&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Eu(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Eu(n.from,n.to,t.markFromJSON(n.mark))}}lr.jsonID("addMark",Eu);class bo extends lr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new ae($E(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return Bt.fromReplace(t,this.from,this.to,r)}invert(){return new Eu(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new bo(n.pos,r.pos,this.mark)}merge(t){return t instanceof bo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new bo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bo(n.from,n.to,t.markFromJSON(n.mark))}}lr.jsonID("removeMark",bo);class xu extends lr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Bt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Bt.fromReplace(t,this.pos,this.pos+1,new ae(K.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.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 xu(this.pos,n.marks[i]);return new xu(this.pos,this.mark)}}return new Af(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new xu(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xu(n.pos,t.markFromJSON(n.mark))}}lr.jsonID("addNodeMark",xu);class Af extends lr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Bt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Bt.fromReplace(t,this.pos,this.pos+1,new ae(K.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new xu(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Af(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Af(n.pos,t.markFromJSON(n.mark))}}lr.jsonID("removeNodeMark",Af);class wn extends lr{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&SE(t,this.from,this.to)?Bt.fail("Structure replace would overwrite content"):Bt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Zr([this.from,this.to-this.from,this.slice.size])}invert(t){return new wn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new wn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof wn)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?ae.empty:new ae(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new wn(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?ae.empty:new ae(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new wn(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wn(n.from,n.to,ae.fromJSON(t,n.slice),!!n.structure)}}lr.jsonID("replace",wn);class Zt extends lr{constructor(t,n,r,i,o,a,u=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=u}apply(t){if(this.structure&&(SE(t,this.from,this.gapFrom)||SE(t,this.gapTo,this.to)))return Bt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Bt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Bt.fromReplace(t,this.from,this.to,r):Bt.fail("Content does not fit in gap")}getMap(){return new Zr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Zt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Zt(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 Zt(n.from,n.to,n.gapFrom,n.gapTo,ae.fromJSON(t,n.slice),n.insert,!!n.structure)}}lr.jsonID("replaceAround",Zt);function SE(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function D1e(e,t,n,r){let i=[],o=[],a,u;e.doc.nodesBetween(t,n,(s,c,l)=>{if(!s.isInline)return;let f=s.marks;if(!r.isInSet(f)&&l.type.allowsMarkType(r.type)){let d=Math.max(c,t),p=Math.min(c+s.nodeSize,n),h=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(h)||(a&&a.to==d&&a.mark.eq(f[m])?a.to=p:i.push(a=new bo(d,p,f[m])));u&&u.to==d?u.to=p:o.push(u=new Eu(d,p,r))}}),i.forEach(s=>e.step(s)),o.forEach(s=>e.step(s))}function B1e(e,t,n,r){let i=[],o=0;e.doc.nodesBetween(t,n,(a,u)=>{if(!a.isInline)return;o++;let s=null;if(r instanceof $b){let c=a.marks,l;for(;l=r.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c)}else r?r.isInSet(a.marks)&&(s=[r]):s=a.marks;if(s&&s.length){let c=Math.min(u+a.nodeSize,n);for(let l=0;l<s.length;l++){let f=s[l],d;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&f.eq(i[p].style)&&(d=h)}d?(d.to=c,d.step=o):i.push({style:f,from:Math.max(u,t),to:c,step:o})}}}),i.forEach(a=>e.step(new bo(a.from,a.to,a.style)))}function U1e(e,t,n,r=n.contentMatch){let i=e.doc.nodeAt(t),o=[],a=t+1;for(let u=0;u<i.childCount;u++){let s=i.child(u),c=a+s.nodeSize,l=r.matchType(s.type);if(!l)o.push(new wn(a,c,ae.empty));else{r=l;for(let f=0;f<s.marks.length;f++)n.allowsMarkType(s.marks[f].type)||e.step(new bo(a,c,s.marks[f]))}a=c}if(!r.validEnd){let u=r.fillBefore(K.empty,!0);e.replace(a,a,new ae(u,0,0))}for(let u=o.length-1;u>=0;u--)e.step(o[u])}function q1e(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Ff(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let i=e.$from.node(r),o=e.$from.index(r),a=e.$to.indexAfter(r);if(r<e.depth&&i.canReplace(o,a,n))return r;if(r==0||i.type.spec.isolating||!q1e(i,o,a))break}return null}function z1e(e,t,n){let{$from:r,$to:i,depth:o}=t,a=r.before(o+1),u=i.after(o+1),s=a,c=u,l=K.empty,f=0;for(let h=o,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,l=K.from(r.node(h).copy(l)),f++):s--;let d=K.empty,p=0;for(let h=o,m=!1;h>n;h--)m||i.after(h+1)<i.end(h)?(m=!0,d=K.from(i.node(h).copy(d)),p++):c++;e.step(new Zt(s,c,a,u,new ae(l.append(d),f,p),l.size-f,!0))}function TE(e,t,n=null,r=e){let i=K1e(e,t),o=i&&V1e(r,t);return o?i.map(UV).concat({type:t,attrs:n}).concat(o.map(UV)):null}function UV(e){return{type:e,attrs:null}}function K1e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}function V1e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;let s=(a.length?a[a.length-1]:t).contentMatch;for(let c=r;s&&c<i;c++)s=s.matchType(n.child(c).type);return!s||!s.validEnd?null:a}function H1e(e,t,n){let r=K.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let u=n[a].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=K.from(n[a].type.create(n[a].attrs,r))}let i=t.start,o=t.end;e.step(new Zt(i,o,i,o,new ae(r,0,0),n.length,!0))}function G1e(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(a,u)=>{if(a.isTextblock&&!a.hasMarkup(r,i)&&Y1e(e.doc,e.mapping.slice(o).map(u),r)){e.clearIncompatible(e.mapping.slice(o).map(u,1),r);let s=e.mapping.slice(o),c=s.map(u,1),l=s.map(u+a.nodeSize,1);return e.step(new Zt(c,l,c+1,l-1,new ae(K.from(r.create(i,null,a.marks)),0,0),1,!0)),!1}})}function Y1e(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function J1e(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let a=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,a);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Zt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new ae(K.from(a),0,0),1,!0))}function Nf(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,l=n-2;c>o;c--,l--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),h=r&&r[l+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[l]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(p))return!1}let u=i.indexAfter(o),s=r&&r[0];return i.node(o).canReplaceWith(u,u,s?s.type:i.node(o+1).type)}function Z1e(e,t,n=1,r){let i=e.doc.resolve(t),o=K.empty,a=K.empty;for(let u=i.depth,s=i.depth-n,c=n-1;u>s;u--,c--){o=K.from(i.node(u).copy(o));let l=r&&r[c];a=K.from(l?l.type.create(l.attrs,a):i.node(u).copy(a))}e.step(new wn(t,t,new ae(o.append(a),n,n),!0))}function Mu(e,t){let n=e.resolve(t),r=n.index();return qV(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function qV(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}function zV(e,t,n=-1){let r=e.resolve(t);for(let i=r.depth;;i--){let o,a,u=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):n>0?(o=r.node(i+1),u++,a=r.node(i).maybeChild(u)):(o=r.node(i).maybeChild(u-1),a=r.node(i+1)),o&&!o.isTextblock&&qV(o,a)&&r.node(i).canReplace(u,u+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function X1e(e,t,n){let r=new wn(t-n,t+n,ae.empty,!0);e.step(r)}function Q1e(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function eCe(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,s=r.index(a)+(u>0?1:0),c=r.node(a),l=!1;if(o==1)l=c.canReplace(s,s,i);else{let f=c.contentMatchAt(s).findWrapping(i.firstChild.type);l=f&&c.canReplaceWith(s,s,f[0])}if(l)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function IE(e,t,n=t,r=ae.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return KV(i,o,r)?new wn(t,n,r):new tCe(i,o,r).fit()}function KV(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class tCe{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=K.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,a=r.depth,u=i.depth;for(;a&&u&&o.childCount==1;)o=o.firstChild.content,a--,u--;let s=new ae(o,a,u);return t>-1?new Zt(r.pos,t,this.$to.pos,this.$to.end(),s,n):s.size||r.pos!=this.$to.pos?new wn(r.pos,i.pos,s):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=CE(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:s,match:c}=this.frontier[u],l,f=null;if(n==1&&(a?c.matchType(a.type)||(f=c.fillBefore(K.from(a),!1)):o&&s.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:u,parent:o,inject:f};if(n==2&&a&&(l=c.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:o,wrap:l};if(o&&c.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=CE(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ae(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=CE(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new ae(Bh(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new ae(Bh(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let a=this.unplaced,u=r?r.content:a.content,s=a.openStart-t,c=0,l=[],{match:f,type:d}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)l.push(i.child(m));f=f.matchFragment(i)}let p=u.size+t-(a.content.size-a.openEnd);for(;c<u.childCount;){let m=u.child(c),g=f.matchType(m.type);if(!g)break;c++,(c>1||s==0||m.content.size)&&(f=g,l.push(VV(m.mark(d.allowedMarks(m.marks)),c==1?s:0,c==u.childCount?p:-1)))}let h=c==u.childCount;h||(p=-1),this.placed=Uh(this.placed,n,K.from(l)),this.frontier[n].match=f,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=u;m<p;m++){let _=g.lastChild;this.frontier.push({type:_.type,match:_.contentMatchAt(_.childCount)}),g=_.content}this.unplaced=h?t==0?ae.empty:new ae(Bh(a.content,t-1,1),t-1,p<0?a.openEnd:t-1):new ae(Bh(a.content,t,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!OE(this.$to,this.$to.depth,t.type,t.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(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),a=OE(t,n,i,r,o);if(a){for(let u=n-1;u>=0;u--){let{match:s,type:c}=this.frontier[u],l=OE(t,u,c,s,!0);if(!l||l.childCount)continue e}return{depth:n,fit:a,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Uh(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Uh(this.placed,this.depth,K.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=Uh(this.placed,this.frontier.length,n))}}function Bh(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Bh(e.firstChild.content,t-1,n)))}function Uh(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Uh(e.lastChild.content,t-1,n)))}function CE(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function VV(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,VV(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),e.copy(r)}function OE(e,t,n,r,i){let o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;let u=r.fillBefore(o.content,!0,a);return u&&!nCe(n,o.content,a)?u:null}function nCe(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function rCe(e){return e.spec.defining||e.spec.definingForContent}function iCe(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(KV(i,o,r))return e.step(new wn(t,n,r));let a=GV(i,e.doc.resolve(n));a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let d=i.depth,p=i.pos-1;d>0;d--,p--){let h=i.node(d).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;a.indexOf(d)>-1?u=d:i.before(d)==p&&a.splice(1,0,-d)}let s=a.indexOf(u),c=[],l=r.openStart;for(let d=r.content,p=0;;p++){let h=d.firstChild;if(c.push(h),p==r.openStart)break;d=h.content}for(let d=l-1;d>=0;d--){let p=c[d].type,h=rCe(p);if(h&&i.node(s).type!=p)l=d;else if(h||!p.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+l+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<a.length;m++){let g=a[(m+s)%a.length],_=!0;g<0&&(_=!1,g=-g);let S=i.node(g-1),C=i.index(g-1);if(S.canReplaceWith(C,C,h.type,h.marks))return e.replace(i.before(g),_?o.after(g):n,new ae(HV(r.content,0,r.openStart,p),p,r.openEnd))}}let f=e.steps.length;for(let d=a.length-1;d>=0&&(e.replace(t,n,r),!(e.steps.length>f));d--){let p=a[d];p<0||(t=i.before(p),n=o.after(p))}}function HV(e,t,n,r,i){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(HV(o.content,t+1,n,r,o)))}if(t>r){let o=i.contentMatchAt(0),a=o.fillBefore(e).append(e);e=a.append(o.matchFragment(a).fillBefore(K.empty,!0))}return e}function oCe(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Q1e(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new ae(K.from(r),0,0))}function aCe(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),o=GV(r,i);for(let a=0;a<o.length;a++){let u=o[a],s=a==o.length-1;if(s&&u==0||r.node(u).type.contentMatch.validEnd)return e.delete(r.start(u),i.end(u));if(u>0&&(s||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return e.delete(r.before(u),i.after(u))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a)return e.delete(r.before(a),n);e.delete(t,n)}function GV(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let o=e.start(i);if(o<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(o==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==o-1)&&n.push(i)}return n}class Pf extends lr{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Bt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Bt.fromReplace(t,this.pos,this.pos+1,new ae(K.from(i),0,n.isLeaf?0:1))}getMap(){return Zr.empty}invert(t){return new Pf(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Pf(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Pf(n.pos,n.attr,n.value)}}lr.jsonID("attr",Pf);let Wf=class extends Error{};Wf=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Wf.prototype=Object.create(Error.prototype),Wf.prototype.constructor=Wf,Wf.prototype.name="TransformError";class uCe{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new kf}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Wf(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=ae.empty){let i=IE(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new ae(K.from(r),0,0))}delete(t,n){return this.replace(t,n,ae.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return iCe(this,t,n,r),this}replaceRangeWith(t,n,r){return oCe(this,t,n,r),this}deleteRange(t,n){return aCe(this,t,n),this}lift(t,n){return z1e(this,t,n),this}join(t,n=1){return X1e(this,t,n),this}wrap(t,n){return H1e(this,t,n),this}setBlockType(t,n=t,r,i=null){return G1e(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return J1e(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new Pf(t,n,r)),this}addNodeMark(t,n){return this.step(new xu(t,n)),this}removeNodeMark(t,n){if(!(n instanceof tt)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Af(t,n)),this}split(t,n=1,r){return Z1e(this,t,n,r),this}addMark(t,n,r){return D1e(this,t,n,r),this}removeMark(t,n,r){return B1e(this,t,n,r),this}clearIncompatible(t,n,r){return U1e(this,t,n,r),this}}const wE=Object.create(null);class Pe{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new sCe(t.min(n),t.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 t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=ae.empty){let r=n.content.lastChild,i=null;for(let u=0;u<n.openEnd;u++)i=r,r=r.lastChild;let o=t.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:s,$to:c}=a[u],l=t.mapping.slice(o);t.replaceRange(l.map(s.pos),l.map(c.pos),u?ae.empty:n),u==0&&ZV(t,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:u}=i[o],s=t.mapping.slice(r),c=s.map(a.pos),l=s.map(u.pos);o?t.deleteRange(c,l):(t.replaceRangeWith(c,l,n),ZV(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let i=t.parent.inlineContent?new Be(t):jf(t.node(0),t.parent,t.pos,t.index(),n,r);if(i)return i;for(let o=t.depth-1;o>=0;o--){let a=n<0?jf(t.node(0),t.node(o),t.before(o+1),t.index(o),n,r):jf(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,r);if(a)return a}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Fi(t.node(0))}static atStart(t){return jf(t,t,0,0,1)||new Fi(t)}static atEnd(t){return jf(t,t,t.content.size,t.childCount,-1)||new Fi(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=wE[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in wE)throw new RangeError("Duplicate use of selection JSON ID "+t);return wE[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Be.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class sCe{constructor(t,n){this.$from=t,this.$to=n}}let YV=!1;function JV(e){!YV&&!e.parent.inlineContent&&(YV=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Be extends Pe{constructor(t,n=t){JV(t),JV(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Pe.near(r);let i=t.resolve(n.map(this.anchor));return new Be(i.parent.inlineContent?i:r,r)}replace(t,n=ae.empty){if(super.replace(t,n),n==ae.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Be&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Ob(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Be(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=Pe.findFrom(n,r,!0)||Pe.findFrom(n,-r,!0);if(o)n=o.$head;else return Pe.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Pe.findFrom(t,-r,!0)||Pe.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new Be(t,n)}}Pe.jsonID("text",Be);class Ob{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ob(t.map(this.anchor),t.map(this.head))}resolve(t){return Be.between(t.resolve(this.anchor),t.resolve(this.head))}}class ve extends Pe{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=t.resolve(i);return r?Pe.near(o):new ve(o)}content(){return new ae(K.from(this.node),0,0)}eq(t){return t instanceof ve&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new EE(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ve(t.resolve(n.anchor))}static create(t,n){return new ve(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}ve.prototype.visible=!1,Pe.jsonID("node",ve);class EE{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Ob(r,r):new EE(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&ve.isSelectable(r)?new ve(n):Pe.near(n)}}class Fi extends Pe{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=ae.empty){if(n==ae.empty){t.delete(0,t.doc.content.size);let r=Pe.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Fi(t)}map(t){return new Fi(t)}eq(t){return t instanceof Fi}getBookmark(){return cCe}}Pe.jsonID("all",Fi);const cCe={map(){return this},resolve(e){return new Fi(e)}};function jf(e,t,n,r,i,o=!1){if(t.inlineContent)return Be.create(e,n);for(let a=r-(i>0?0:1);i>0?a<t.childCount:a>=0;a+=i){let u=t.child(a);if(u.isAtom){if(!o&&ve.isSelectable(u))return ve.create(e,n-(i<0?u.nodeSize:0))}else{let s=jf(e,u,n+i,i<0?u.childCount:0,i,o);if(s)return s}n+=u.nodeSize*i}return null}function ZV(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof wn||i instanceof Zt))return;let o=e.mapping.maps[r],a;o.forEach((u,s,c,l)=>{a==null&&(a=l)}),e.setSelection(Pe.near(e.doc.resolve(a),n))}const XV=1,wb=2,QV=4;class lCe extends uCe{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|XV)&~wb,this.storedMarks=null,this}get selectionSet(){return(this.updated&XV)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=wb,this}ensureMarks(t){return tt.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&wb)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~wb,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||tt.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!t)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let a=this.doc.resolve(n);o=r==n?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(t,o)),this.selection.empty||this.setSelection(Pe.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=QV,this}get scrolledIntoView(){return(this.updated&QV)>0}}function e3(e,t){return!t||!e?e:e.bind(t)}class qh{constructor(t,n,r){this.name=t,this.init=e3(n.init,r),this.apply=e3(n.apply,r)}}const fCe=[new qh("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new qh("selection",{init(e,t){return e.selection||Pe.atStart(t.doc)},apply(e){return e.selection}}),new qh("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new qh("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class xE{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=fCe.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 qh(r.key,r.spec.state,r))})}}class Lf{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,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,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),i=null;for(;;){let o=!1;for(let a=0;a<this.config.plugins.length;a++){let u=this.config.plugins[a];if(u.spec.appendTransaction){let s=i?i[a].n:0,c=i?i[a].state:this,l=s<n.length&&u.spec.appendTransaction.call(u,s?n.slice(s):n,c,r);if(l&&r.filterTransaction(l,a)){if(l.setMeta("appendedTransaction",t),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<a?{state:r,n:n.length}:{state:this,n:0})}n.push(l),r=r.applyInner(l),o=!0}i&&(i[a]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Lf(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(t,this[o.name],this,n)}return n}get tr(){return new lCe(this)}static create(t){let n=new xE(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Lf(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}reconfigure(t){let n=new xE(this.schema,t.plugins),r=n.fields,i=new Lf(n);for(let o=0;o<r.length;o++){let a=r[o].name;i[a]=this.hasOwnProperty(a)?this[a]:r[o].init(t,i)}return i}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new xE(t.schema,t.plugins),o=new Lf(i);return i.fields.forEach(a=>{if(a.name=="doc")o.doc=vc.fromJSON(t.schema,n.doc);else if(a.name=="selection")o.selection=Pe.fromJSON(o.doc,n.selection);else if(a.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let u in r){let s=r[u],c=s.spec.state;if(s.key==a.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){o[a.name]=c.fromJSON.call(s,t,n[u],o);return}}o[a.name]=a.init(t,o)}}),o}}function t3(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=t3(i,t,{})),n[r]=i}return n}class Rr{constructor(t){this.spec=t,this.props={},t.props&&t3(t.props,this,this.props),this.key=t.key?t.key.key:n3("plugin")}getState(t){return t[this.key]}}const ME=Object.create(null);function n3(e){return e in ME?e+"$"+ ++ME[e]:(ME[e]=0,e+"$")}class Ni{constructor(t="key"){this.key=n3(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const kr=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},zh=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let r3=null;const xa=function(e,t,n){let r=r3||(r3=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},yc=function(e,t,n,r){return n&&(i3(e,t,n,r,-1)||i3(e,t,n,r,1))},dCe=/^(img|br|input|textarea|hr)$/i;function i3(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:_o(e))){let o=e.parentNode;if(!o||o.nodeType!=1||hCe(e)||dCe.test(e.nodeName)||e.contentEditable=="false")return!1;t=kr(e)+(i<0?0:1),e=o}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.contentEditable=="false")return!1;t=i<0?_o(e):0}else return!1}}function _o(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function pCe(e,t,n){for(let r=t==0,i=t==_o(e);r||i;){if(e==n)return!0;let o=kr(e);if(e=e.parentNode,!e)return!1;r=r&&o==0,i=i&&o==_o(e)}}function hCe(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Eb=function(e){return e.focusNode&&yc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function bc(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function mCe(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function vCe(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const $o=typeof navigator<"u"?navigator:null,o3=typeof document<"u"?document:null,Ru=$o&&$o.userAgent||"",RE=/Edge\/(\d+)/.exec(Ru),a3=/MSIE \d/.exec(Ru),kE=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ru),fr=!!(a3||kE||RE),ku=a3?document.documentMode:kE?+kE[1]:RE?+RE[1]:0,Pi=!fr&&/gecko\/(\d+)/i.test(Ru);Pi&&+(/Firefox\/(\d+)/.exec(Ru)||[0,0])[1];const AE=!fr&&/Chrome\/(\d+)/.exec(Ru),En=!!AE,gCe=AE?+AE[1]:0,Kn=!fr&&!!$o&&/Apple Computer/.test($o.vendor),Df=Kn&&(/Mobile\/\w+/.test(Ru)||!!$o&&$o.maxTouchPoints>2),Xr=Df||($o?/Mac/.test($o.platform):!1),yCe=$o?/Win/.test($o.platform):!1,Wi=/Android \d/.test(Ru),xb=!!o3&&"webkitFontSmoothing"in o3.documentElement.style,bCe=xb?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function _Ce(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Au(e,t){return typeof e=="number"?e:e[t]}function $Ce(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function u3(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let a=n||e.dom;a;a=zh(a)){if(a.nodeType!=1)continue;let u=a,s=u==o.body,c=s?_Ce(o):$Ce(u),l=0,f=0;if(t.top<c.top+Au(r,"top")?f=-(c.top-t.top+Au(i,"top")):t.bottom>c.bottom-Au(r,"bottom")&&(f=t.bottom-c.bottom+Au(i,"bottom")),t.left<c.left+Au(r,"left")?l=-(c.left-t.left+Au(i,"left")):t.right>c.right-Au(r,"right")&&(l=t.right-c.right+Au(i,"right")),l||f)if(s)o.defaultView.scrollBy(l,f);else{let d=u.scrollLeft,p=u.scrollTop;f&&(u.scrollTop+=f),l&&(u.scrollLeft+=l);let h=u.scrollLeft-d,m=u.scrollTop-p;t={left:t.left-h,top:t.top-m,right:t.right-h,bottom:t.bottom-m}}if(s)break}}function SCe(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let o=(t.left+t.right)/2,a=n+1;a<Math.min(innerHeight,t.bottom);a+=5){let u=e.root.elementFromPoint(o,a);if(!u||u==e.dom||!e.dom.contains(u))continue;let s=u.getBoundingClientRect();if(s.top>=n-20){r=u,i=s.top;break}}return{refDOM:r,refTop:i,stack:s3(e.dom)}}function s3(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=zh(r));return t}function TCe({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;c3(n,r==0?0:r-t)}function c3(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Bf=null;function ICe(e){if(e.setActive)return e.setActive();if(Bf)return e.focus(Bf);let t=s3(e);e.focus(Bf==null?{get preventScroll(){return Bf={preventScroll:!0},!0}}:void 0),Bf||(Bf=!1,c3(t,0))}function l3(e,t){let n,r=2e8,i,o=0,a=t.top,u=t.top,s,c;for(let l=e.firstChild,f=0;l;l=l.nextSibling,f++){let d;if(l.nodeType==1)d=l.getClientRects();else if(l.nodeType==3)d=xa(l).getClientRects();else continue;for(let p=0;p<d.length;p++){let h=d[p];if(h.top<=a&&h.bottom>=u){a=Math.max(h.bottom,a),u=Math.min(h.top,u);let m=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(m<r){n=l,r=m,i=m&&n.nodeType==3?{left:h.right<t.left?h.right:h.left,top:t.top}:t,l.nodeType==1&&m&&(o=f+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!s&&h.left<=t.left&&h.right>=t.left&&(s=l,c={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(o=f+1)}}return!n&&s&&(n=s,i=c,r=0),n&&n.nodeType==3?CCe(n,i):!n||r&&n.nodeType==1?{node:e,offset:o}:l3(n,i)}function CCe(e,t){let n=e.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let o=Fu(r,1);if(o.top!=o.bottom&&FE(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}function FE(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function OCe(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function wCe(e,t,n){let{node:r,offset:i}=l3(t,n),o=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();o=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}function ECe(e,t,n,r){let i=-1;for(let o=t,a=!1;o!=e.dom;){let u=e.docView.nearestDesc(o,!0);if(!u)return null;if(u.dom.nodeType==1&&(u.node.isBlock&&u.parent&&!a||!u.contentDOM)){let s=u.dom.getBoundingClientRect();if(u.node.isBlock&&u.parent&&!a&&(a=!0,s.left>r.left||s.top>r.top?i=u.posBefore:(s.right<r.left||s.bottom<r.top)&&(i=u.posAfter)),!u.contentDOM&&i<0)return(u.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?u.posBefore:u.posAfter}o=u.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function f3(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let a=e.childNodes[o];if(a.nodeType==1){let u=a.getClientRects();for(let s=0;s<u.length;s++){let c=u[s];if(FE(t,c))return f3(a,t,c)}}if((o=(o+1)%r)==i)break}return e}function xCe(e,t){let n=e.dom.ownerDocument,r,i=0,o=vCe(n,t.left,t.top);o&&({node:r,offset:i}=o);let a=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),u;if(!a||!e.dom.contains(a.nodeType!=1?a.parentNode:a)){let c=e.dom.getBoundingClientRect();if(!FE(t,c)||(a=f3(e.dom,t,c),!a))return null}if(Kn)for(let c=a;r&&c;c=zh(c))c.draggable&&(r=void 0);if(a=OCe(a,t),r){if(Pi&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],l;c.nodeName=="IMG"&&(l=c.getBoundingClientRect()).right<=t.left&&l.bottom>t.top&&i++}r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?u=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(u=ECe(e,r,i,t))}u==null&&(u=wCe(e,a,t));let s=e.docView.nearestDesc(a,!0);return{pos:u,inside:s?s.posAtStart-s.border:-1}}function d3(e){return e.top<e.bottom||e.left<e.right}function Fu(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(d3(r))return r}return Array.prototype.find.call(n,d3)||e.getBoundingClientRect()}const MCe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function p3(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),a=xb||Pi;if(r.nodeType==3)if(a&&(MCe.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let s=Fu(xa(r,i,i),n);if(Pi&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Fu(xa(r,i-1,i-1),-1);if(c.top==s.top){let l=Fu(xa(r,i,i+1),-1);if(l.top!=s.top)return Kh(l,l.left<c.left)}}return s}else{let s=i,c=i,l=n<0?1:-1;return n<0&&!i?(c++,l=-1):n>=0&&i==r.nodeValue.length?(s--,l=1):n<0?s--:c++,Kh(Fu(xa(r,s,c),l),l<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==_o(r))){let s=r.childNodes[i-1];if(s.nodeType==1)return NE(s.getBoundingClientRect(),!1)}if(o==null&&i<_o(r)){let s=r.childNodes[i];if(s.nodeType==1)return NE(s.getBoundingClientRect(),!0)}return NE(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==_o(r))){let s=r.childNodes[i-1],c=s.nodeType==3?xa(s,_o(s)-(a?0:1)):s.nodeType==1&&(s.nodeName!="BR"||!s.nextSibling)?s:null;if(c)return Kh(Fu(c,1),!1)}if(o==null&&i<_o(r)){let s=r.childNodes[i];for(;s.pmViewDesc&&s.pmViewDesc.ignoreForCoords;)s=s.nextSibling;let c=s?s.nodeType==3?xa(s,0,a?0:1):s.nodeType==1?s:null:null;if(c)return Kh(Fu(c,-1),!0)}return Kh(Fu(r.nodeType==3?xa(r):r,-n),n>=0)}function Kh(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function NE(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function h3(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function RCe(e,t,n){let r=t.selection,i=n=="up"?r.$from:r.$to;return h3(e,t,()=>{let{node:o}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let u=e.docView.nearestDesc(o,!0);if(!u)break;if(u.node.isBlock){o=u.contentDOM||u.dom;break}o=u.dom.parentNode}let a=p3(e,i.pos,1);for(let u=o.firstChild;u;u=u.nextSibling){let s;if(u.nodeType==1)s=u.getClientRects();else if(u.nodeType==3)s=xa(u,0,u.nodeValue.length).getClientRects();else continue;for(let c=0;c<s.length;c++){let l=s[c];if(l.bottom>l.top+1&&(n=="up"?a.top-l.top>(l.bottom-a.top)*2:l.bottom-a.bottom>(a.bottom-l.top)*2))return!1}}return!0})}const kCe=/[\u0590-\u08ac]/;function ACe(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,a=i==r.parent.content.size,u=e.domSelection();return!kCe.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?o:a:h3(e,t,()=>{let{focusNode:s,focusOffset:c,anchorNode:l,anchorOffset:f}=e.domSelectionRange(),d=u.caretBidiLevel;u.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:m}=e.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||s==h&&c==m;try{u.collapse(l,f),s&&(s!=l||c!=f)&&u.extend&&u.extend(s,c)}catch{}return d!=null&&(u.caretBidiLevel=d),g})}let m3=null,v3=null,g3=!1;function FCe(e,t,n){return m3==t&&v3==n?g3:(m3=t,v3=n,g3=n=="up"||n=="down"?RCe(e,t,n):ACe(e,t,n))}const Qr=0,y3=1,_c=2,So=3;class Vh{constructor(t,n,r,i){this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Qr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==t)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(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let o,a;if(t==this.contentDOM)o=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&!((a=o.pmViewDesc)&&a.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(a)+a.size:this.posAtStart}else{let o,a;if(t==this.contentDOM)o=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.nextSibling}for(;o&&!((a=o.pmViewDesc)&&a.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}let i;if(t==this.dom&&this.contentDOM)i=n>kr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,i=t;i;i=i.parentNode){let o=this.getDesc(i),a;if(o&&(!n||o.node))if(r&&(a=o.nodeDOM)&&!(a.nodeType==1?a.contains(t.nodeType==1?t:t.parentNode):a==t))r=!1;else return o}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==t&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(t<o)return i.descAt(t-r-i.border);r=o}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let a=this.children[r],u=o+a.size;if(u>t||a instanceof $3){i=t-o;break}o=u}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof b3&&o.side>=0;r--);if(n<=0){let o,a=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,a=!1);return o&&n&&a&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?kr(o.dom)+1:0}}else{let o,a=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,a=!1);return o&&a&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?kr(o.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let a=r,u=0;;u++){let s=this.children[u],c=a+s.size;if(i==-1&&t<=c){let l=a+s.border;if(t>=l&&n<=c-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(t,n,l);t=a;for(let f=u;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=kr(d.dom)+1;break}t-=d.size}i==-1&&(i=0)}if(i>-1&&(c>n||u==this.children.length-1)){n=c;for(let l=u+1;l<this.children.length;l++){let f=this.children[l];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=kr(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}a=c}return{node:this.contentDOM,from:t,to:n,fromOffset:i,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,i=!1){let o=Math.min(t,n),a=Math.max(t,n);for(let d=0,p=0;d<this.children.length;d++){let h=this.children[d],m=p+h.size;if(o>p&&a<m)return h.setSelection(t-p-h.border,n-p-h.border,r,i);p=m}let u=this.domFromPos(t,t?-1:1),s=n==t?u:this.domFromPos(n,n?-1:1),c=r.getSelection(),l=!1;if((Pi||Kn)&&t==n){let{node:d,offset:p}=u;if(d.nodeType==3){if(l=!!(p&&d.nodeValue[p-1]==`
34
+ `),l&&p==d.nodeValue.length)for(let h=d,m;h;h=h.parentNode){if(m=h.nextSibling){m.nodeName=="BR"&&(u=s={node:m.parentNode,offset:kr(m)+1});break}let g=h.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let h=d.childNodes[p-1];l=h&&(h.nodeName=="BR"||h.contentEditable=="false")}}if(Pi&&c.focusNode&&c.focusNode!=s.node&&c.focusNode.nodeType==1){let d=c.focusNode.childNodes[c.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||l&&Kn)&&yc(u.node,u.offset,c.anchorNode,c.anchorOffset)&&yc(s.node,s.offset,c.focusNode,c.focusOffset))return;let f=!1;if((c.extend||t==n)&&!l){c.collapse(u.node,u.offset);try{t!=n&&c.extend(s.node,s.offset),f=!0}catch{}}if(!f){if(t>n){let p=u;u=s,s=p}let d=document.createRange();d.setEnd(s.node,s.offset),d.setStart(u.node,u.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],a=r+o.size;if(r==a?t<=a&&n>=r:t<a&&n>r){let u=r+o.border,s=a-o.border;if(t>=u&&n<=s){this.dirty=t==r||n==a?_c:y3,t==u&&n==s&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=So:o.markDirty(t-u,n-u);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?_c:So}r=a}this.dirty=_c}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?_c:y3;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class b3 extends Vh{constructor(t,n,r,i){let o,a=n.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(a.nodeType!=1){let u=document.createElement("span");u.appendChild(a),a=u}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(t,[],a,null),this.widget=n,this.widget=n,o=this}matchesWidget(t){return this.dirty==Qr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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 NCe extends Vh{constructor(t,n,r,i){super(t,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class $c extends Vh{constructor(t,n,r,i){super(t,[],r,i),this.mark=n}static create(t,n,r,i){let o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return(!a||!a.dom)&&(a=yo.renderSpec(document,n.type.spec.toDOM(n,r))),new $c(t,n,a.dom,a.contentDOM||a.dom)}parseRule(){return this.dirty&So||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(t){return this.dirty!=So&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Qr}}slice(t,n,r){let i=$c.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=jE(o,n,a,r)),t>0&&(o=jE(o,0,t,r));for(let u=0;u<o.length;u++)o[u].parent=i;return i.children=o,i}}class Nu extends Vh{constructor(t,n,r,i,o,a,u,s,c){super(t,[],o,a),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=u}static create(t,n,r,i,o,a){let u=o.nodeViews[n.type.name],s,c=u&&u(n,o,()=>{if(!s)return a;if(s.parent)return s.parent.posBeforeChild(s)},r,i),l=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!l)l=document.createTextNode(n.text);else if(l.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else l||({dom:l,contentDOM:f}=yo.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&l.nodeName!="BR"&&(l.hasAttribute("contenteditable")||(l.contentEditable="false"),n.type.spec.draggable&&(l.draggable=!0));let d=l;return l=I3(l,r,n),c?s=new PCe(t,n,r,i,l,f||null,d,c,o,a+1):n.isText?new Mb(t,n,r,i,l,d,o):new Nu(t,n,r,i,l,f||null,d,o,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.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)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>K.empty)}return t}matchesNode(t,n,r){return this.dirty==Qr&&t.eq(this.node)&&WE(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,i=n,o=t.composing?this.localCompositionInfo(t,n):null,a=o&&o.pos>-1?o:null,u=o&&o.pos<0,s=new jCe(this,a&&a.node,t);BCe(this.node,this.innerDeco,(c,l,f)=>{c.spec.marks?s.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!f&&s.syncToMarks(l==this.node.childCount?tt.none:this.node.child(l).marks,r,t),s.placeWidget(c,t,i)},(c,l,f,d)=>{s.syncToMarks(c.marks,r,t);let p;s.findNodeMatch(c,l,f,d)||u&&t.state.selection.from>i&&t.state.selection.to<i+c.nodeSize&&(p=s.findIndexWithChild(o.node))>-1&&s.updateNodeAt(c,l,f,p,t)||s.updateNextNode(c,l,f,t,d,i)||s.addNode(c,l,f,t,i),i+=c.nodeSize}),s.syncToMarks([],r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==_c)&&(a&&this.protectLocalComposition(t,a),S3(this.contentDOM,this.children,t),Df&&UCe(this.dom))}localCompositionInfo(t,n){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof Be)||r<n||i>n+this.node.content.size)return null;let o=t.domSelectionRange(),a=qCe(o.focusNode,o.focusOffset);if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let u=a.nodeValue,s=zCe(this.node.content,u,r-n,i-n);return s<0?null:{node:a,pos:s,text:u}}else return{node:a,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let a=new NCe(this,o,n,i);t.input.compositionNodes.push(a),this.children=jE(this.children,r,r+i.length,t,a)}update(t,n,r,i){return this.dirty==So||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,i),!0)}updateInner(t,n,r,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Qr}updateOuterDeco(t){if(WE(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=T3(this.dom,this.nodeDOM,PE(this.outerDeco,this.node,n),PE(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 _3(e,t,n,r,i){I3(r,t,e);let o=new Nu(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Mb extends Nu{constructor(t,n,r,i,o,a,u){super(t,n,r,i,o,null,a,u,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,i){return this.dirty==So||this.dirty!=Qr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=Qr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let i=this.node.cut(t,n),o=document.createTextNode(i.text);return new Mb(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=So)}get domAtom(){return!1}}class $3 extends Vh{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Qr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class PCe extends Nu{constructor(t,n,r,i,o,a,u,s,c,l){super(t,n,r,i,o,a,u,c,l),this.spec=s}update(t,n,r,i){if(this.dirty==So)return!1;if(this.spec.update){let o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):super.setSelection(t,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function S3(e,t,n){let r=e.firstChild,i=!1;for(let o=0;o<t.length;o++){let a=t[o],u=a.dom;if(u.parentNode==e){for(;u!=r;)r=C3(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(u,r);if(a instanceof $c){let s=r?r.previousSibling:e.lastChild;S3(a.contentDOM,a.children,n),r=s?s.nextSibling:e.firstChild}}for(;r;)r=C3(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const Hh=function(e){e&&(this.nodeName=e)};Hh.prototype=Object.create(null);const Sc=[new Hh];function PE(e,t,n){if(e.length==0)return Sc;let r=n?Sc[0]:new Hh,i=[r];for(let o=0;o<e.length;o++){let a=e[o].type.attrs;if(a){a.nodeName&&i.push(r=new Hh(a.nodeName));for(let u in a){let s=a[u];s!=null&&(n&&i.length==1&&i.push(r=new Hh(t.isInline?"span":"div")),u=="class"?r.class=(r.class?r.class+" ":"")+s:u=="style"?r.style=(r.style?r.style+";":"")+s:u!="nodeName"&&(r[u]=s))}}}return i}function T3(e,t,n,r){if(n==Sc&&r==Sc)return t;let i=t;for(let o=0;o<r.length;o++){let a=r[o],u=n[o];if(o){let s;u&&u.nodeName==a.nodeName&&i!=e&&(s=i.parentNode)&&s.nodeName.toLowerCase()==a.nodeName||(s=document.createElement(a.nodeName),s.pmIsDeco=!0,s.appendChild(i),u=Sc[0]),i=s}WCe(i,u||Sc[0],a)}return i}function WCe(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&e.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&e.classList.add(i[o]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(t.style);)e.style.removeProperty(i[1])}n.style&&(e.style.cssText+=n.style)}}function I3(e,t,n){return T3(e,e,Sc,PE(t,n,e.nodeType!=1))}function WE(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function C3(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class jCe{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=LCe(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r){let i=0,o=this.stack.length>>1,a=Math.min(o,t.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Qr,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);let u=-1;for(let s=this.index;s<Math.min(this.index+3,this.top.children.length);s++){let c=this.top.children[s];if(c.matchesMark(t[o])&&!this.isLocked(c.dom)){u=s;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let s=$c.create(this.top,t[o],n,r);this.top.children.splice(this.index,0,s),this.top=s,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,r,i){let o=-1,a;if(i>=this.preMatch.index&&(a=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&a.matchesNode(t,n,r))o=this.top.children.indexOf(a,this.index);else for(let u=this.index,s=Math.min(this.top.children.length,u+5);u<s;u++){let c=this.top.children[u];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){o=u;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(t,n,r,i,o){let a=this.top.children[i];return a.dirty==So&&a.dom==a.contentDOM&&(a.dirty=_c),a.update(t,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}t=n}}updateNextNode(t,n,r,i,o,a){for(let u=this.index;u<this.top.children.length;u++){let s=this.top.children[u];if(s instanceof Nu){let c=this.preMatch.matched.get(s);if(c!=null&&c!=o)return!1;let l=s.dom,f,d=this.isLocked(l)&&!(t.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==t.text&&s.dirty!=So&&WE(n,s.outerDeco));if(!d&&s.update(t,n,r,i))return this.destroyBetween(this.index,u),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(s,t,n,r,i,a)))return this.top.children[this.index]=f,f.dirty=_c,f.updateChildren(i,a+1),f.dirty=Qr,this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,i,o,a){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content))return null;let u=Nu.create(this.top,n,r,i,o,a);if(!u.contentDOM)return null;u.children=t.children,t.children=[],t.destroy();for(let s of u.children)s.parent=u;return u}addNode(t,n,r,i,o){let a=Nu.create(this.top,t,n,r,i,o);a.contentDOM&&a.updateChildren(i,o+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(t,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(t)&&(t==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new b3(this.top,t,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof $c;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof Mb)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Kn||En)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new $3(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function LCe(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,a=[];e:for(;i>0;){let u;for(;;)if(r){let c=n.children[r-1];if(c instanceof $c)n=c,r=c.children.length;else{u=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let s=u.node;if(s){if(s!=e.child(i-1))break;--i,o.set(u,i),a.push(u)}}return{index:i,matched:o,matches:a.reverse()}}function DCe(e,t){return e.type.side-t.type.side}function BCe(e,t,n,r){let i=t.locals(e),o=0;if(i.length==0){for(let c=0;c<e.childCount;c++){let l=e.child(c);r(l,i,t.forChild(o,l),c),o+=l.nodeSize}return}let a=0,u=[],s=null;for(let c=0;;){if(a<i.length&&i[a].to==o){let h=i[a++],m;for(;a<i.length&&i[a].to==o;)(m||(m=[h])).push(i[a++]);if(m){m.sort(DCe);for(let g=0;g<m.length;g++)n(m[g],c,!!s)}else n(h,c,!!s)}let l,f;if(s)f=-1,l=s,s=null;else if(c<e.childCount)f=c,l=e.child(c++);else break;for(let h=0;h<u.length;h++)u[h].to<=o&&u.splice(h--,1);for(;a<i.length&&i[a].from<=o&&i[a].to>o;)u.push(i[a++]);let d=o+l.nodeSize;if(l.isText){let h=d;a<i.length&&i[a].from<h&&(h=i[a].from);for(let m=0;m<u.length;m++)u[m].to<h&&(h=u[m].to);h<d&&(s=l.cut(h-o),l=l.cut(0,h-o),d=h,f=-1)}let p=l.isInline&&!l.isLeaf?u.filter(h=>!h.inline):u.slice();r(l,p,t.forChild(o,l),f),o=d}}function UCe(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function qCe(e,t){for(;;){if(e.nodeType==3)return e;if(e.nodeType==1&&t>0){if(e.childNodes.length>t&&e.childNodes[t].nodeType==3)return e.childNodes[t];e=e.childNodes[t-1],t=_o(e)}else if(e.nodeType==1&&t<e.childNodes.length)e=e.childNodes[t],t=0;else return null}}function zCe(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let a=e.child(i++),u=o;if(o+=a.nodeSize,!a.isText)continue;let s=a.text;for(;i<e.childCount;){let c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;s+=c.text}if(o>=n){let c=u<r?s.lastIndexOf(t,r-u-1):-1;if(c>=0&&c+t.length+u>=n)return u+c;if(n==r&&s.length>=r+t.length-u&&s.slice(r-u,r-u+t.length)==t)return r}}return-1}function jE(e,t,n,r,i){let o=[];for(let a=0,u=0;a<e.length;a++){let s=e[a],c=u,l=u+=s.size;c>=n||l<=t?o.push(s):(c<t&&o.push(s.slice(0,t-c,r)),i&&(o.push(i),i=void 0),l>n&&o.push(s.slice(n-c,s.size,r)))}return o}function LE(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&i.size==0,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let u=r.resolve(a),s,c;if(Eb(n)){for(s=u;i&&!i.node;)i=i.parent;let l=i.node;if(i&&l.isAtom&&ve.isSelectable(l)&&i.parent&&!(l.isInline&&pCe(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new ve(a==f?u:r.resolve(f))}}else{let l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null;s=r.resolve(l)}if(!c){let l=t=="pointer"||e.state.selection.head<u.pos&&!o?1:-1;c=BE(e,s,u,l)}return c}function O3(e){return e.editable?e.hasFocus():A3(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ma(e,t=!1){let n=e.state.selection;if(M3(e,n),!!O3(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&En){let r=e.domSelectionRange(),i=e.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&yc(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)VCe(e);else{let{anchor:r,head:i}=n,o,a;w3&&!(n instanceof Be)&&(n.$from.parent.inlineContent||(o=E3(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=E3(e,n.to))),e.docView.setSelection(r,i,e.root,t),w3&&(o&&x3(o),a&&x3(a)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&KCe(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const w3=Kn||En&&gCe<63;function E3(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Kn&&i&&i.contentEditable=="false")return DE(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return DE(i);if(o)return DE(o)}}function DE(e){return e.contentEditable="true",Kn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function x3(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function KCe(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!O3(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function VCe(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,kr(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&fr&&ku<=11&&(r.disabled=!0,r.disabled=!1)}function M3(e,t){if(t instanceof ve){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(R3(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else R3(e)}function R3(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function BE(e,t,n,r){return e.someProp("createSelectionBetween",i=>i(e,t,n))||Be.between(t,n,r)}function k3(e){return e.editable&&!e.hasFocus()?!1:A3(e)}function A3(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function HCe(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return yc(t.node,t.offset,n.anchorNode,n.anchorOffset)}function UE(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&Pe.findFrom(o,t)}function Tc(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function F3(e,t,n){let r=e.state.selection;if(r instanceof Be){if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let i=UE(e.state,t);return i&&i instanceof ve?Tc(e,i):!1}else if(!(Xr&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let u=t<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=e.docView.descAt(u))&&!a.contentDOM?ve.isSelectable(o)?Tc(e,new ve(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):xb?Tc(e,new Be(e.state.doc.resolve(t<0?u:u+o.nodeSize))):!1:!1}}else{if(r instanceof ve&&r.node.isInline)return Tc(e,new Be(t>0?r.$to:r.$from));{let i=UE(e.state,t);return i?Tc(e,i):!1}}}function Rb(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Gh(e){let t=e.pmViewDesc;return t&&t.size==0&&(e.nextSibling||e.nodeName!="BR")}function Yh(e,t){return t<0?GCe(e):N3(e)}function GCe(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,a=!1;for(Pi&&n.nodeType==1&&r<Rb(n)&&Gh(n.childNodes[r])&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(Gh(u))i=n,o=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(P3(n))break;{let u=n.previousSibling;for(;u&&Gh(u);)i=n.parentNode,o=kr(u),u=u.previousSibling;if(u)n=u,r=Rb(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}a?qE(e,n,r):i&&qE(e,i,o)}function N3(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=Rb(n),o,a;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(Gh(u))o=n,a=++r;else break}else{if(P3(n))break;{let u=n.nextSibling;for(;u&&Gh(u);)o=u.parentNode,a=kr(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=Rb(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}}o&&qE(e,o,a)}function P3(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function qE(e,t,n){let r=e.domSelection();if(Eb(r)){let o=document.createRange();o.setEnd(t,n),o.setStart(t,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&Ma(e)},50)}function W3(e,t){let n=e.state.doc.resolve(t);if(!(En||yCe)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(t<n.end()){let o=e.coordsAtPos(t+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function j3(e,t,n){let r=e.state.selection;if(r instanceof Be&&!r.empty||n.indexOf("s")>-1||Xr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let a=UE(e.state,t);if(a&&a instanceof ve)return Tc(e,a)}if(!i.parent.inlineContent){let a=t<0?i:o,u=r instanceof Fi?Pe.near(a,t):Pe.findFrom(a,t);return u?Tc(e,u):!1}return!1}function L3(e,t){if(!(e.state.selection instanceof Be))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let a=e.state.tr;return t<0?a.delete(n.pos-o.nodeSize,n.pos):a.delete(n.pos,n.pos+o.nodeSize),e.dispatch(a),!0}return!1}function D3(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function YCe(e){if(!Kn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;D3(e,r,"true"),setTimeout(()=>D3(e,r,"false"),20)}return!1}function JCe(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function ZCe(e,t){let n=t.keyCode,r=JCe(t);if(n==8||Xr&&n==72&&r=="c")return L3(e,-1)||Yh(e,-1);if(n==46&&!t.shiftKey||Xr&&n==68&&r=="c")return L3(e,1)||Yh(e,1);if(n==13||n==27)return!0;if(n==37||Xr&&n==66&&r=="c"){let i=n==37?W3(e,e.state.selection.from)=="ltr"?-1:1:-1;return F3(e,i,r)||Yh(e,i)}else if(n==39||Xr&&n==70&&r=="c"){let i=n==39?W3(e,e.state.selection.from)=="ltr"?1:-1:1;return F3(e,i,r)||Yh(e,i)}else{if(n==38||Xr&&n==80&&r=="c")return j3(e,-1,r)||Yh(e,-1);if(n==40||Xr&&n==78&&r=="c")return YCe(e)||j3(e,1,r)||N3(e);if(r==(Xr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function B3(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let a=e.someProp("clipboardSerializer")||yo.fromSchema(e.state.schema),u=Y3(),s=u.createElement("div");s.appendChild(a.serializeFragment(r,{document:u}));let c=s.firstChild,l,f=0;for(;c&&c.nodeType==1&&(l=H3[c.nodeName.toLowerCase()]);){for(let p=l.length-1;p>=0;p--){let h=u.createElement(l[p]);for(;s.firstChild;)h.appendChild(s.firstChild);s.appendChild(h),f++}c=s.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
35
35
 
36
36
  `);return{dom:s,text:d}}function U3(e,t,n,r,i){let o=i.parent.type.spec.code,a,u;if(!n&&!t)return null;let s=t&&(r||o||!n);if(s){if(e.someProp("transformPastedText",d=>{t=d(t,o||r,e)}),o)return t?new ae(K.from(e.state.schema.text(t.replace(/\r\n?/g,`
37
- `))),0,0):ae.empty;let f=e.someProp("clipboardTextParser",d=>d(t,i,r,e));if(f)u=f;else{let d=i.marks(),{schema:p}=e.state,h=bo.fromSchema(p);a=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=a.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,d)))})}}else e.someProp("transformPastedHTML",f=>{n=f(n,e)}),a=HCe(n),Mb&&GCe(a);let c=a&&a.querySelector("[data-pm-slice]"),l=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(l&&l[3])for(let f=+l[3];f>0;f--){let d=a.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;a=d}if(u||(u=(e.someProp("clipboardParser")||e.someProp("domParser")||kf.fromSchema(e.state.schema)).parseSlice(a,{preserveWhitespace:!!(s||l),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!KCe.test(d.parentNode.nodeName)?{ignore:!0}:null}})),l)u=YCe(V3(u,+l[1],+l[2]),l[4]);else if(u=ae.maxOpen(VCe(u.content,i),!0),u.openStart||u.openEnd){let f=0,d=0;for(let p=u.content.firstChild;f<u.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=u.content.lastChild;d<u.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);u=V3(u,f,d)}return e.someProp("transformPasted",f=>{u=f(u,e)}),u}const KCe=/^(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 VCe(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),o,a=[];if(e.forEach(u=>{if(!a)return;let s=i.findWrapping(u.type),c;if(!s)return a=null;if(c=a.length&&o.length&&z3(s,o,u,a[a.length-1],0))a[a.length-1]=c;else{a.length&&(a[a.length-1]=K3(a[a.length-1],o.length));let l=q3(u,s);a.push(l),i=i.matchType(l.type),o=s}}),a)return K.from(a)}return e}function q3(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,K.from(e));return e}function z3(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let o=z3(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(K.from(q3(n,e,i+1))))}}function K3(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,K3(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(K.empty,!0);return e.copy(n.append(r))}function HE(e,t,n,r,i,o){let a=t<0?e.firstChild:e.lastChild,u=a.content;return e.childCount>1&&(o=0),i<r-1&&(u=HE(u,t,n,r,i+1,o)),i>=n&&(u=t<0?a.contentMatchAt(0).fillBefore(u,o<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(K.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(u))}function V3(e,t,n){return t<e.openStart&&(e=new ae(HE(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ae(HE(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const H3={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 G3=null;function Y3(){return G3||(G3=document.implementation.createHTMLDocument("title"))}function HCe(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Y3().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&H3[r[1].toLowerCase()])&&(e=i.map(o=>"<"+o+">").join("")+e+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=e,i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function GCe(e){let t=e.querySelectorAll(En?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function YCe(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:o,openEnd:a}=e;for(let u=r.length-2;u>=0;u-=2){let s=n.nodes[r[u]];if(!s||s.hasRequiredAttrs())break;i=K.from(s.create(r[u+1],i)),o++,a++}return new ae(i,o,a)}const Kn={},Vn={},JCe={touchstart:!0,touchmove:!0};class ZCe{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.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function XCe(e){for(let t in Kn){let n=Kn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{eOe(e,r)&&!YE(e,r)&&(e.editable||!(r.type in Vn))&&n(e,r)},JCe[t]?{passive:!0}:void 0)}zn&&e.dom.addEventListener("input",()=>null),GE(e)}function Pu(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function QCe(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function GE(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>YE(e,r))})}function YE(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function eOe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function tOe(e,t){!YE(e,t)&&Kn[t.type]&&(e.editable||!(t.type in Vn))&&Kn[t.type](e,t)}Vn.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Z3(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Wi&&En&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Bf&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",i=>i(e,bc(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||zCe(e,n)?n.preventDefault():Pu(e,"key")},Vn.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},Vn.keypress=(e,t)=>{let n=t;if(Z3(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Xr&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Be)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",o=>o(e,r.$from.pos,r.$to.pos,i))&&e.dispatch(e.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Ab(e){return{left:e.clientX,top:e.clientY}}function nOe(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function JE(e,t,n,r,i){if(r==-1)return!1;let o=e.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(e.someProp(t,u=>a>o.depth?u(e,n,o.nodeAfter,o.before(a),i,!0):u(e,n,o.node(a),o.before(a),i,!1)))return!0;return!1}function qf(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);n=="pointer"&&r.setMeta("pointer",!0),e.dispatch(r)}function rOe(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&ve.isSelectable(r)?(qf(e,new ve(n),"pointer"),!0):!1}function iOe(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof ve&&(r=n.node);let o=e.state.doc.resolve(t);for(let a=o.depth+1;a>0;a--){let u=a>o.depth?o.nodeAfter:o.node(a);if(ve.isSelectable(u)){r&&n.$from.depth>0&&a>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(a);break}}return i!=null?(qf(e,ve.create(e.state.doc,i),"pointer"),!0):!1}function oOe(e,t,n,r,i){return JE(e,"handleClickOn",t,n,r)||e.someProp("handleClick",o=>o(e,t,r))||(i?iOe(e,n):rOe(e,n))}function aOe(e,t,n,r){return JE(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",i=>i(e,t,r))}function uOe(e,t,n,r){return JE(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",i=>i(e,t,r))||sOe(e,n,r)}function sOe(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(qf(e,Be.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(t);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),u=i.before(o);if(a.inlineContent)qf(e,Be.create(r,u+1,u+1+a.content.size),"pointer");else if(ve.isSelectable(a))qf(e,ve.create(r,u),"pointer");else continue;return!0}}function ZE(e){return Fb(e)}const J3=Xr?"metaKey":"ctrlKey";Kn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ZE(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&nOe(n,e.input.lastClick)&&!n[J3]&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let a=e.posAtCoords(Ab(n));a&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new cOe(e,a,n,!!r)):(o=="doubleClick"?aOe:uOe)(e,a.pos,a.inside,n)?n.preventDefault():Pu(e,"pointer"))};class cOe{constructor(t,n,r,i){this.view=t,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[J3],this.allowDefault=r.shiftKey;let o,a;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),a=n.inside;else{let l=t.state.doc.resolve(n.pos);o=l.parent,a=l.depth?l.before():0}const u=i?null:r.target,s=u?t.docView.nearestDesc(u,!0):null;this.target=s?s.dom:null;let{selection:c}=t.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof ve&&c.from<=a&&c.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Pi&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Pu(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ma(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ab(t))),this.updateAllowDefault(t),this.allowDefault||!n?Pu(this.view,"pointer"):oOe(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||zn&&this.mightDrag&&!this.mightDrag.node.isAtom||En&&!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)?(qf(this.view,Ne.near(this.view.state.doc.resolve(n.pos)),"pointer"),t.preventDefault()):Pu(this.view,"pointer")}move(t){this.updateAllowDefault(t),Pu(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Kn.touchstart=e=>{e.input.lastTouch=Date.now(),ZE(e),Pu(e,"pointer")},Kn.touchmove=e=>{e.input.lastTouch=Date.now(),Pu(e,"pointer")},Kn.contextmenu=e=>ZE(e);function Z3(e,t){return e.composing?!0:zn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const lOe=Wi?5e3:-1;Vn.compositionstart=Vn.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Fb(e,!0),e.markCursor=null;else if(Fb(e),Pi&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){e.domSelection().collapse(a,a.nodeValue.length);break}else i=a,o=-1}}e.input.composing=!0}X3(e,lOe)},Vn.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionID++,X3(e,20))};function X3(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Fb(e),t))}function Q3(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=fOe());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function fOe(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Fb(e,t=!1){if(!(Wi&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Q3(e),t||e.docView&&e.docView.dirty){let n=UE(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}}function dOe(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const zf=lr&&ku<15||Bf&&dCe<604;Kn.copy=Vn.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type=="cut";if(r.empty)return;let o=zf?null:n.clipboardData,a=r.content(),{dom:u,text:s}=B3(e,a);o?(n.preventDefault(),o.clearData(),o.setData("text/html",u.innerHTML),o.setData("text/plain",s)):dOe(e,u),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function pOe(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function hOe(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.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=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xh(e,r.value,null,i,t):Xh(e,r.textContent,r.innerHTML,i,t)},50)}function Xh(e,t,n,r,i){let o=U3(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",s=>s(e,i,o||ae.empty)))return!0;if(!o)return!1;let a=pOe(o),u=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(o);return e.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Vn.paste=(e,t)=>{let n=t;if(e.composing&&!Wi)return;let r=zf?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Xh(e,r.getData("text/plain"),r.getData("text/html"),i,n)?n.preventDefault():hOe(e,n)};class mOe{constructor(t,n){this.slice=t,this.move=n}}const e4=Xr?"altKey":"ctrlKey";Kn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(Ab(n));if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof ve?i.to-1:i.to))){if(r&&r.mightDrag)e.dispatch(e.state.tr.setSelection(ve.create(e.state.doc,r.mightDrag.pos)));else if(n.target&&n.target.nodeType==1){let c=e.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=e.docView&&e.dispatch(e.state.tr.setSelection(ve.create(e.state.doc,c.posBefore)))}}let a=e.state.selection.content(),{dom:u,text:s}=B3(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(zf?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",zf||n.dataTransfer.setData("text/plain",s),e.dragging=new mOe(a,!n[e4])},Kn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Vn.dragover=Vn.dragenter=(e,t)=>t.preventDefault(),Vn.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let i=e.posAtCoords(Ab(n));if(!i)return;let o=e.state.doc.resolve(i.pos),a=r&&r.slice;a?e.someProp("transformPasted",h=>{a=h(a,e)}):a=U3(e,n.dataTransfer.getData(zf?"Text":"text/plain"),zf?null:n.dataTransfer.getData("text/html"),!1,o);let u=!!(r&&!n[e4]);if(e.someProp("handleDrop",h=>h(e,n,a||ae.empty,u))){n.preventDefault();return}if(!a)return;n.preventDefault();let s=a?H1e(e.state.doc,o.pos,a):o.pos;s==null&&(s=o.pos);let c=e.state.tr;u&&c.deleteSelection();let l=c.mapping.map(s),f=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(f?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let p=c.doc.resolve(l);if(f&&ve.isSelectable(a.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new ve(p));else{let h=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,_,S)=>h=S),c.setSelection(zE(e,p,c.doc.resolve(h)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},Kn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Ma(e)},20))},Kn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Kn.beforeinput=(e,t)=>{if(En&&Wi&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,bc(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in Vn)Kn[e]=Vn[e];function Qh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class XE{constructor(t,n){this.toDOM=t,this.spec=n||Ic,this.side=this.spec.side||0}map(t,n,r,i){let{pos:o,deleted:a}=t.mapResult(n.from+i,this.side<0?-1:1);return a?null:new Ar(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof XE&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Qh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Wu{constructor(t,n){this.attrs=t,this.spec=n||Ic}map(t,n,r,i){let o=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new Ar(o,a,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Wu&&Qh(this.attrs,t.attrs)&&Qh(this.spec,t.spec)}static is(t){return t.type instanceof Wu}destroy(){}}let vOe=class qH{constructor(t,n){this.attrs=t,this.spec=n||Ic}map(t,n,r,i){let o=t.mapResult(n.from+i,1);if(o.deleted)return null;let a=t.mapResult(n.to+i,-1);return a.deleted||a.pos<=o.pos?null:new Ar(o.pos-r,a.pos-r,this)}valid(t,n){let{index:r,offset:i}=t.content.findIndex(n.from),o;return i==n.from&&!(o=t.child(r)).isText&&i+o.nodeSize==n.to}eq(t){return this==t||t instanceof qH&&Qh(this.attrs,t.attrs)&&Qh(this.spec,t.spec)}destroy(){}};class Ar{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Ar(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new Ar(t,t,new XE(n,r))}static inline(t,n,r,i){return new Ar(t,n,new Wu(r,i))}static node(t,n,r,i){return new Ar(t,n,new vOe(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Wu}}const Kf=[],Ic={};class Wt{constructor(t,n){this.local=t.length?t:Kf,this.children=n.length?n:Kf}static create(t,n){return n.length?Nb(n,t,0,Ic):xn}find(t,n,r){let i=[];return this.findInner(t??0,n??1e9,i,0,r),i}findInner(t,n,r,i,o){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=n&&u.to>=t&&(!o||o(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>t){let u=this.children[a]+1;this.children[a+2].findInner(t-u,n-u,r,i+u,o)}}map(t,n,r){return this==xn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||Ic)}mapInner(t,n,r,i,o){let a;for(let u=0;u<this.local.length;u++){let s=this.local[u].map(t,r,i);s&&s.type.valid(n,s)?(a||(a=[])).push(s):o.onRemove&&o.onRemove(this.local[u].spec)}return this.children.length?gOe(this.children,a||[],t,n,r,i,o):a?new Wt(a.sort(Cc),Kf):xn}add(t,n){return n.length?this==xn?Wt.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,o=0;t.forEach((u,s)=>{let c=s+r,l;if(l=n4(n,u,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<s;)o+=3;i[o]==s?i[o+2]=i[o+2].addInner(u,l,c+1):i.splice(o,0,s,s+u.nodeSize,Nb(l,u,c+1,Ic)),o+=3}});let a=t4(o?r4(n):n,-r);for(let u=0;u<a.length;u++)a[u].type.valid(t,a[u])||a.splice(u--,1);return new Wt(a.length?this.local.concat(a).sort(Cc):this.local,i||this.children)}remove(t){return t.length==0||this==xn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,u=r[o]+n,s=r[o+1]+n;for(let l=0,f;l<t.length;l++)(f=t[l])&&f.from>u&&f.to<s&&(t[l]=null,(a||(a=[])).push(f));if(!a)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(a,u+1);c!=xn?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<t.length;o++)if(a=t[o])for(let u=0;u<i.length;u++)i[u].eq(a,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Wt(i,r):xn}forChild(t,n){if(this==xn)return this;if(n.isLeaf)return Wt.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=t){this.children[u]==t&&(r=this.children[u+2]);break}let o=t+1,a=o+n.content.size;for(let u=0;u<this.local.length;u++){let s=this.local[u];if(s.from<a&&s.to>o&&s.type instanceof Wu){let c=Math.max(o,s.from)-o,l=Math.min(a,s.to)-o;c<l&&(i||(i=[])).push(s.copy(c,l))}}if(i){let u=new Wt(i.sort(Cc),Kf);return r?new ju([u,r]):u}return r||xn}eq(t){if(this==t)return!0;if(!(t instanceof Wt)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return QE(this.localsInner(t))}localsInner(t){if(this==xn)return Kf;if(t.inlineContent||!this.local.some(Wu.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Wu||n.push(this.local[r]);return n}}Wt.empty=new Wt([],[]),Wt.removeOverlap=QE;const xn=Wt.empty;class ju{constructor(t){this.members=t}map(t,n){const r=this.members.map(i=>i.map(t,n,Ic));return ju.from(r)}forChild(t,n){if(n.isLeaf)return Wt.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(t,n);o!=xn&&(o instanceof ju?r=r.concat(o.members):r.push(o))}return ju.from(r)}eq(t){if(!(t instanceof ju)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(t);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let a=0;a<o.length;a++)n.push(o[a])}}return n?QE(r?n:n.sort(Cc)):Kf}static from(t){switch(t.length){case 0:return xn;case 1:return t[0];default:return new ju(t.every(n=>n instanceof Wt)?t:t.reduce((n,r)=>n.concat(r instanceof Wt?r:r.members),[]))}}}function gOe(e,t,n,r,i,o,a){let u=e.slice();for(let c=0,l=o;c<n.maps.length;c++){let f=0;n.maps[c].forEach((d,p,h,m)=>{let g=m-h-(p-d);for(let _=0;_<u.length;_+=3){let S=u[_+1];if(S<0||d>S+l-f)continue;let C=u[_]+l-f;p>=C?u[_+1]=d<=C?-2:-1:h>=i&&g&&(u[_]+=g,u[_+1]+=g)}f+=g}),l=n.maps[c].map(l,-1)}let s=!1;for(let c=0;c<u.length;c+=3)if(u[c+1]<0){if(u[c+1]==-2){s=!0,u[c+1]=-1;continue}let l=n.map(e[c]+o),f=l-i;if(f<0||f>=r.content.size){s=!0;continue}let d=n.map(e[c+1]+o,-1),p=d-i,{index:h,offset:m}=r.content.findIndex(f),g=r.maybeChild(h);if(g&&m==f&&m+g.nodeSize==p){let _=u[c+2].mapInner(n,g,l+1,e[c]+o+1,a);_!=xn?(u[c]=f,u[c+1]=p,u[c+2]=_):(u[c+1]=-2,s=!0)}else s=!0}if(s){let c=yOe(u,e,t,n,i,o,a),l=Nb(c,r,0,a);t=l.local;for(let f=0;f<u.length;f+=3)u[f+1]<0&&(u.splice(f,3),f-=3);for(let f=0,d=0;f<l.children.length;f+=3){let p=l.children[f];for(;d<u.length&&u[d]<p;)d+=3;u.splice(d,0,l.children[f],l.children[f+1],l.children[f+2])}}return new Wt(t.sort(Cc),u)}function t4(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new Ar(i.from+t,i.to+t,i.type))}return n}function yOe(e,t,n,r,i,o,a){function u(s,c){for(let l=0;l<s.local.length;l++){let f=s.local[l].map(r,i,c);f?n.push(f):a.onRemove&&a.onRemove(s.local[l].spec)}for(let l=0;l<s.children.length;l+=3)u(s.children[l+2],s.children[l]+c+1)}for(let s=0;s<e.length;s+=3)e[s+1]==-1&&u(e[s+2],t[s]+o+1);return n}function n4(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let o=0,a;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function r4(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Nb(e,t,n,r){let i=[],o=!1;t.forEach((u,s)=>{let c=n4(e,u,s+n);if(c){o=!0;let l=Nb(c,u,n+s+1,r);l!=xn&&i.push(s,s+u.nodeSize,l)}});let a=t4(o?r4(e):e,-n).sort(Cc);for(let u=0;u<a.length;u++)a[u].type.valid(t,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new Wt(a,i):xn}function Cc(e,t){return e.from-t.from||e.to-t.to}function QE(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),i4(t,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),i4(t,i,r.copy(o.from,r.to)));break}}}return t}function i4(e,t,n){for(;t<e.length&&Cc(n,e[t])>0;)t++;e.splice(t,0,n)}function ex(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=xn&&t.push(r)}),e.cursorWrapper&&t.push(Wt.create(e.state.doc,[e.cursorWrapper.deco])),ju.from(t)}const bOe={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},_Oe=lr&&ku<=11;class $Oe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class SOe{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new $Oe,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);lr&&ku<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),_Oe&&(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,bOe)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[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(k3(this.view)){if(this.suppressingSelectionUpdates)return Ma(this.view);if(lr&&ku<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&yc(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let o=t.focusNode;o;o=Vh(o))n.add(o);for(let o=t.anchorNode;o;o=Vh(o))if(n.has(o)){r=o;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}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.observer?this.observer.takeRecords():[];this.queue.length&&(n=this.queue.concat(n),this.queue.length=0);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&k3(t)&&!this.ignoreSelectionChange(r),o=-1,a=-1,u=!1,s=[];if(t.editable)for(let l=0;l<n.length;l++){let f=this.registerMutation(n[l],s);f&&(o=o<0?f.from:Math.min(f.from,o),a=a<0?f.to:Math.max(f.to,a),f.typeOver&&(u=!0))}if(Pi&&s.length>1){let l=s.filter(f=>f.nodeName=="BR");if(l.length==2){let f=l[0],d=l[1];f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&xb(r)&&(c=UE(t))&&c.eq(Ne.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Ma(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,a),TOe(t)),this.handleDOMChange(o,a,u,s),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Ma(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let l=0;l<t.addedNodes.length;l++)n.push(t.addedNodes[l]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let i=t.previousSibling,o=t.nextSibling;if(lr&&ku<=11&&t.addedNodes.length)for(let l=0;l<t.addedNodes.length;l++){let{previousSibling:f,nextSibling:d}=t.addedNodes[l];(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d)}let a=i&&i.parentNode==t.target?kr(i)+1:0,u=r.localPosFromDOM(t.target,a,-1),s=o&&o.parentNode==t.target?kr(o):t.target.childNodes.length,c=r.localPosFromDOM(t.target,s,1);return{from:u,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}}let o4=new WeakMap,a4=!1;function TOe(e){if(!o4.has(e)&&(o4.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Pi,a4)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."),a4=!0}}function IOe(e){let t;function n(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,i=t.startOffset,o=t.endContainer,a=t.endOffset,u=e.domAtPos(e.state.selection.anchor);return yc(u.node,u.offset,o,a)&&([r,i,o,a]=[o,a,r,i]),{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:a}}function COe(e,t,n){let{node:r,fromOffset:i,toOffset:o,from:a,to:u}=e.docView.parseRange(t,n),s=e.domSelectionRange(),c,l=s.anchorNode;if(l&&e.dom.contains(l.nodeType==1?l:l.parentNode)&&(c=[{node:l,offset:s.anchorOffset}],xb(s)||c.push({node:s.focusNode,offset:s.focusOffset})),En&&e.input.lastKeyCode===8)for(let g=o;g>i;g--){let _=r.childNodes[g-1],S=_.pmViewDesc;if(_.nodeName=="BR"&&!S){o=g;break}if(!S||S.size)break}let f=e.state.doc,d=e.someProp("domParser")||kf.fromSchema(e.state.schema),p=f.resolve(a),h=null,m=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:OOe,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,_=c[1]&&c[1].pos;_==null&&(_=g),h={anchor:g+a,head:_+a}}return{doc:m,sel:h,from:a,to:u}}function OOe(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(zn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||zn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const wOe=/^(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 EOe(e,t,n,r,i){if(t<0){let x=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,U=UE(e,x);if(U&&!e.state.selection.eq(U)){if(En&&Wi&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",P=>P(e,bc(13,"Enter"))))return;let B=e.state.tr.setSelection(U);x=="pointer"?B.setMeta("pointer",!0):x=="key"&&B.scrollIntoView(),e.composing&&B.setMeta("composition",e.input.compositionID),e.dispatch(B)}return}let o=e.state.doc.resolve(t),a=o.sharedDepth(n);t=o.before(a+1),n=e.state.doc.resolve(n).after(a+1);let u=e.state.selection,s=COe(e,t,n),c=e.state.doc,l=c.slice(s.from,s.to),f,d;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,d="end"):(f=e.state.selection.from,d="start"),e.input.lastKeyCode=null;let p=ROe(l.content,s.doc.content,s.from,f,d);if((Bf&&e.input.lastIOSEnter>Date.now()-225||Wi)&&i.some(x=>x.nodeType==1&&!wOe.test(x.nodeName))&&(!p||p.endA>=p.endB)&&e.someProp("handleKeyDown",x=>x(e,bc(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!p)if(r&&u instanceof Be&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(s.sel&&s.sel.anchor!=s.sel.head))p={start:u.from,endA:u.to,endB:u.to};else{if(s.sel){let x=u4(e,e.state.doc,s.sel);if(x&&!x.eq(e.state.selection)){let U=e.state.tr.setSelection(x);e.composing&&U.setMeta("composition",e.input.compositionID),e.dispatch(U)}}return}if(En&&e.cursorWrapper&&s.sel&&s.sel.anchor==e.cursorWrapper.deco.from&&s.sel.head==s.sel.anchor){let x=p.endB-p.start;s.sel={anchor:s.sel.anchor+x,head:s.sel.anchor+x}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&p.start==p.endB&&e.state.selection instanceof Be&&(p.start>e.state.selection.from&&p.start<=e.state.selection.from+2&&e.state.selection.from>=s.from?p.start=e.state.selection.from:p.endA<e.state.selection.to&&p.endA>=e.state.selection.to-2&&e.state.selection.to<=s.to&&(p.endB+=e.state.selection.to-p.endA,p.endA=e.state.selection.to)),lr&&ku<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>s.from&&s.doc.textBetween(p.start-s.from-1,p.start-s.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let h=s.doc.resolveNoCache(p.start-s.from),m=s.doc.resolveNoCache(p.endB-s.from),g=c.resolve(p.start),_=h.sameParent(m)&&h.parent.inlineContent&&g.end()>=p.endA,S;if((Bf&&e.input.lastIOSEnter>Date.now()-225&&(!_||i.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!_&&h.pos<s.doc.content.size&&!h.sameParent(m)&&(S=Ne.findFrom(s.doc.resolve(h.pos+1),1,!0))&&S.head==m.pos)&&e.someProp("handleKeyDown",x=>x(e,bc(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>p.start&&MOe(c,p.start,p.endA,h,m)&&e.someProp("handleKeyDown",x=>x(e,bc(8,"Backspace")))){Wi&&En&&e.domObserver.suppressSelectionUpdates();return}En&&Wi&&p.endB==p.start&&(e.input.lastAndroidDelete=Date.now()),Wi&&!_&&h.start()!=m.start()&&m.parentOffset==0&&h.depth==m.depth&&s.sel&&s.sel.anchor==s.sel.head&&s.sel.head==p.endA&&(p.endB-=2,m=s.doc.resolveNoCache(p.endB-s.from),setTimeout(()=>{e.someProp("handleKeyDown",function(x){return x(e,bc(13,"Enter"))})},20));let C=p.start,b=p.endA,w,O,M;if(_){if(h.pos==m.pos)lr&&ku<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ma(e),20)),w=e.state.tr.delete(C,b),O=c.resolve(p.start).marksAcross(c.resolve(p.endA));else if(p.endA==p.endB&&(M=xOe(h.parent.content.cut(h.parentOffset,m.parentOffset),g.parent.content.cut(g.parentOffset,p.endA-g.start()))))w=e.state.tr,M.type=="add"?w.addMark(C,b,M.mark):w.removeMark(C,b,M.mark);else if(h.parent.child(h.index()).isText&&h.index()==m.index()-(m.textOffset?0:1)){let x=h.parent.textBetween(h.parentOffset,m.parentOffset);if(e.someProp("handleTextInput",U=>U(e,C,b,x)))return;w=e.state.tr.insertText(x,C,b)}}if(w||(w=e.state.tr.replace(C,b,s.doc.slice(p.start-s.from,p.endB-s.from))),s.sel){let x=u4(e,w.doc,s.sel);x&&!(En&&Wi&&e.composing&&x.empty&&(p.start!=p.endB||e.input.lastAndroidDelete<Date.now()-100)&&(x.head==C||x.head==w.mapping.map(b)-1)||lr&&x.empty&&x.head==C)&&w.setSelection(x)}O&&w.ensureMarks(O),e.composing&&w.setMeta("composition",e.input.compositionID),e.dispatch(w.scrollIntoView())}function u4(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:zE(e,t.resolve(n.anchor),t.resolve(n.head))}function xOe(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,a,u,s;for(let l=0;l<r.length;l++)i=r[l].removeFromSet(i);for(let l=0;l<n.length;l++)o=n[l].removeFromSet(o);if(i.length==1&&o.length==0)u=i[0],a="add",s=l=>l.mark(u.addToSet(l.marks));else if(i.length==0&&o.length==1)u=o[0],a="remove",s=l=>l.mark(u.removeFromSet(l.marks));else return null;let c=[];for(let l=0;l<t.childCount;l++)c.push(s(t.child(l)));if(K.from(c).eq(e))return{mark:u,type:a}}function MOe(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||tx(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let a=e.resolve(tx(o,!0,!0));return!a.parent.isTextblock||a.pos>n||tx(a,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function tx(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let o=e.node(r).maybeChild(e.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function ROe(e,t,n,r,i){let o=e.findDiffStart(t,n);if(o==null)return null;let{a,b:u}=e.findDiffEnd(t,n+e.size,n+t.size);if(i=="end"){let s=Math.max(0,o-Math.min(a,u));r-=a+s-o}if(a<o&&e.size<t.size){let s=r<=o&&r>=a?o-r:0;o-=s,u=o+(u-a),a=o}else if(u<o){let s=r<=o&&r>=u?o-r:0;o-=s,a=o+(a-u),u=o}return{start:o,endA:a,endB:u}}class kOe{constructor(t,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 ZCe,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(d4),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=l4(this),c4(this),this.nodeViews=f4(this),this.docView=_3(this.state.doc,s4(this),ex(this),this.dom,this),this.domObserver=new SOe(this,(r,i,o,a)=>EOe(this,r,i,o,a)),this.domObserver.start(),XCe(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&GE(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(d4),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){let r=this.state,i=!1,o=!1;t.storedMarks&&this.composing&&(Q3(this),o=!0),this.state=t;let a=r.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let d=f4(this);FOe(d,this.nodeViews)&&(this.nodeViews=d,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&GE(this),this.editable=l4(this),c4(this);let u=ex(this),s=s4(this),c=r.plugins!=t.plugins&&!r.doc.eq(t.doc)?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",l=i||!this.docView.matchesNode(t.doc,s,u);(l||!t.selection.eq(r.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&mCe(this);if(o){this.domObserver.stop();let d=l&&(lr||En)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&AOe(r.selection,t.selection);if(l){let p=En?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(t.doc,s,u,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=_3(t.doc,s,u,this.dom,this)),p&&!this.trackWrites&&(d=!0)}d||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&DCe(this))?Ma(this,d):(M3(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&vCe(f)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ve){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&u3(this,n.getBoundingClientRect(),t)}else u3(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.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,t)}}someProp(t,n){let r=this._props&&this._props[t],i;if(r!=null&&(i=n?n(r):r))return i;for(let a=0;a<this.directPlugins.length;a++){let u=this.directPlugins[a].props[t];if(u!=null&&(i=n?n(u):u))return i}let o=this.state.plugins;if(o)for(let a=0;a<o.length;a++){let u=o[a].props[t];if(u!=null&&(i=n?n(u):u))return i}}hasFocus(){if(lr){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&gCe(this.dom),Ma(this),this.domObserver.start()}get root(){let t=this._root;if(t==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 t||document}posAtCoords(t){return SCe(this,t)}coordsAtPos(t,n=1){return p3(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let i=this.docView.posFromDOM(t,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return wCe(this,n||this.state,t)}pasteHTML(t,n){return Xh(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Xh(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(QCe(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ex(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(t){return tOe(this,t)}dispatch(t){let n=this._props.dispatchTransaction;n?n.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return zn&&this.root.nodeType===11&&sCe(this.dom.ownerDocument)==this.dom?IOe(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function s4(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Ar.node(0,e.state.doc.content.size,t)]}function c4(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Ar.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function l4(e){return!e.someProp("editable",t=>t(e.state)===!1)}function AOe(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function f4(e){let t=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function FOe(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r}function d4(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Lu={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:"'"},Pb={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},NOe=typeof navigator<"u"&&/Mac/.test(navigator.platform),POe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gn=0;gn<10;gn++)Lu[48+gn]=Lu[96+gn]=String(gn);for(var gn=1;gn<=24;gn++)Lu[gn+111]="F"+gn;for(var gn=65;gn<=90;gn++)Lu[gn]=String.fromCharCode(gn+32),Pb[gn]=String.fromCharCode(gn);for(var nx in Lu)Pb.hasOwnProperty(nx)||(Pb[nx]=Lu[nx]);function WOe(e){var t=NOe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||POe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Pb:Lu)[e.keyCode]||e.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 jOe=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function LOe(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,i,o,a;for(let u=0;u<t.length-1;u++){let s=t[u];if(/^(cmd|meta|m)$/i.test(s))a=!0;else if(/^a(lt)?$/i.test(s))r=!0;else if(/^(c|ctrl|control)$/i.test(s))i=!0;else if(/^s(hift)?$/i.test(s))o=!0;else if(/^mod$/i.test(s))jOe?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+s)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function DOe(e){let t=Object.create(null);for(let n in e)t[LOe(n)]=e[n];return t}function rx(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function BOe(e){return new Rr({props:{handleKeyDown:UOe(e)}})}function UOe(e){let t=DOe(e);return function(n,r){let i=WOe(r),o,a=t[rx(i,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=t[rx(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=Lu[r.keyCode])&&o!=i){let u=t[rx(o,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}const qOe=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function zOe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const KOe=(e,t,n)=>{let r=zOe(e,n);if(!r)return!1;let i=p4(r);if(!i){let a=r.blockRange(),u=a&&Nf(a);return u==null?!1:(t&&t(e.tr.lift(a,u).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&v4(e,i,t))return!0;if(r.parent.content.size==0&&(Vf(o,"end")||ve.isSelectable(o))){let a=wE(e.doc,r.before(),r.after(),ae.empty);if(a&&a.slice.size<a.to-a.from){if(t){let u=e.tr.step(a);u.setSelection(Vf(o,"end")?Ne.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):ve.create(u.doc,i.pos-o.nodeSize)),t(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1};function Vf(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const VOe=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=p4(r)}let a=o&&o.nodeBefore;return!a||!ve.isSelectable(a)?!1:(t&&t(e.tr.setSelection(ve.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function p4(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function HOe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const GOe=(e,t,n)=>{let r=HOe(e,n);if(!r)return!1;let i=h4(r);if(!i)return!1;let o=i.nodeAfter;if(v4(e,i,t))return!0;if(r.parent.content.size==0&&(Vf(o,"start")||ve.isSelectable(o))){let a=wE(e.doc,r.before(),r.after(),ae.empty);if(a&&a.slice.size<a.to-a.from){if(t){let u=e.tr.step(a);u.setSelection(Vf(o,"start")?Ne.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):ve.create(u.doc,u.mapping.map(i.pos))),t(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},YOe=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=h4(r)}let a=o&&o.nodeAfter;return!a||!ve.isSelectable(a)?!1:(t&&t(e.tr.setSelection(ve.create(e.doc,o.pos)).scrollIntoView()),!0)};function h4(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const JOe=(e,t)=>{let n=e.selection,r=n instanceof ve,i;if(r){if(n.node.isTextblock||!Mu(e.doc,n.from))return!1;i=n.from}else if(i=zV(e.doc,n.from,-1),i==null)return!1;if(t){let o=e.tr.join(i);r&&o.setSelection(ve.create(o.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},ZOe=(e,t)=>{let n=e.selection,r;if(n instanceof ve){if(n.node.isTextblock||!Mu(e.doc,n.to))return!1;r=n.to}else if(r=zV(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},XOe=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&Nf(i);return o==null?!1:(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)},QOe=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
38
- `).scrollIntoView()),!0)};function m4(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const ewe=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),a=m4(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(t){let u=n.after(),s=e.tr.replaceWith(u,u,a.createAndFill());s.setSelection(Ne.near(s.doc.resolve(u),1)),t(s.scrollIntoView())}return!0},twe=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Fi||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=m4(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=e.tr.insert(a,o.createAndFill());u.setSelection(Be.create(u.doc,a+1)),t(u.scrollIntoView())}return!0},nwe=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Pf(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Nf(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},rwe=(e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),t&&t(e.tr.setSelection(ve.create(e.doc,i))),!0)};function iwe(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||Mu(e.doc,t.pos))?!1:(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0)}function v4(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o,a;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(iwe(e,t,n))return!0;let u=t.parent.canReplace(t.index(),t.index()+1);if(u&&(o=(a=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let f=t.pos+i.nodeSize,d=K.empty;for(let m=o.length-1;m>=0;m--)d=K.from(o[m].create(null,d));d=K.from(r.copy(d));let p=e.tr.step(new Zt(t.pos-1,f,t.pos,f,new ae(d,1,0),o.length,!0)),h=f+2*o.length;Mu(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}let s=Ne.findFrom(t,1),c=s&&s.$from.blockRange(s.$to),l=c&&Nf(c);if(l!=null&&l>=t.depth)return n&&n(e.tr.lift(c,l).scrollIntoView()),!0;if(u&&Vf(i,"start",!0)&&Vf(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let p=i,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let m=K.empty;for(let _=d.length-1;_>=0;_--)m=K.from(d[_].copy(m));let g=e.tr.step(new Zt(t.pos-d.length,t.pos+i.nodeSize,t.pos+h,t.pos+i.nodeSize-h,new ae(m,d.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function g4(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(t.tr.setSelection(Be.create(t.doc,e<0?i.start(o):i.end(o)))),!0):!1}}const owe=g4(-1),awe=g4(1);function uwe(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,a=i.blockRange(o),u=a&&OE(a,e,t);return u?(r&&r(n.tr.wrap(a,u).scrollIntoView()),!0):!1}}function y4(e,t=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[o];n.doc.nodesBetween(a,u,(s,c)=>{if(i)return!1;if(!(!s.isTextblock||s.hasMarkup(e,t)))if(s.type==e)i=!0;else{let l=n.doc.resolve(c),f=l.index();i=l.parent.canReplaceWith(f,f+1,e)}})}if(!i)return!1;if(r){let o=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:s}}=n.selection.ranges[a];o.setBlockType(u,s,e,t)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function swe(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,a=i.blockRange(o),u=!1,s=a;if(!a)return!1;if(a.depth>=2&&i.node(a.depth-1).type.compatibleContent(e)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;let l=n.doc.resolve(a.start-2);s=new _b(l,l,a.depth),a.endIndex<a.parent.childCount&&(a=new _b(i,n.doc.resolve(o.end(a.depth)),a.depth)),u=!0}let c=OE(s,e,t,a);return c?(r&&r(cwe(n.tr,a,c,u,e).scrollIntoView()),!0):!1}}function cwe(e,t,n,r,i){let o=K.empty;for(let l=n.length-1;l>=0;l--)o=K.from(n[l].type.create(n[l].attrs,o));e.step(new Zt(t.start-(r?2:0),t.end,t.start,t.end,new ae(o,0,0),n.length,!0));let a=0;for(let l=0;l<n.length;l++)n[l].type==i&&(a=l+1);let u=n.length-a,s=t.start+n.length-(r?2:0),c=t.parent;for(let l=t.startIndex,f=t.endIndex,d=!0;l<f;l++,d=!1)!d&&Pf(e.doc,s,u)&&(e.split(s,u),s+=2*u),s+=c.child(l).nodeSize;return e}function lwe(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==e);return o?n?r.node(o.depth-1).type==e?fwe(t,n,e,o):dwe(t,n,o):!0:!1}}function fwe(e,t,n,r){let i=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Zt(o-1,a,o,a,new ae(K.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new _b(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=Nf(r);if(u==null)return!1;i.lift(r,u);let s=i.mapping.map(o,-1)-1;return Mu(i.doc,s)&&i.join(s),t(i.scrollIntoView()),!0}function dwe(e,t,n){let r=e.tr,i=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),a=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let u=n.startIndex==0,s=n.endIndex==i.childCount,c=o.node(-1),l=o.index(-1);if(!c.canReplace(l+(u?0:1),l+1,a.content.append(s?K.empty:K.from(i))))return!1;let f=o.pos,d=f+a.nodeSize;return r.step(new Zt(f-(u?1:0),d+(s?1:0),f+1,d-1,new ae((u?K.empty:K.from(i.copy(K.empty))).append(s?K.empty:K.from(i.copy(K.empty))),u?0:1,s?0:1),u?0:1)),t(r.scrollIntoView()),!0}function pwe(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==e);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let u=o.parent,s=u.child(a-1);if(s.type!=e)return!1;if(n){let c=s.lastChild&&s.lastChild.type==u.type,l=K.from(c?e.create():null),f=new ae(K.from(e.create(null,K.from(u.type.create(null,l)))),c?3:1,0),d=o.start,p=o.end;n(t.tr.step(new Zt(d-(c?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}function Wb(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),filterTransaction:t.filterTransaction,plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class jb{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([u,s])=>[u,(...l)=>{const f=s(...l)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u=[],s=!!t,c=t||o.tr,l=()=>(!s&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(c),u.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,p])=>[d,(...m)=>{const g=this.buildProps(c,n),_=p(...m)(g);return u.push(_),f}])),run:l};return f}createCan(t){const{rawCommands:n,state:r}=this,i=!1,o=t||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([s,c])=>[s,(...l)=>c(...l)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(t,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i;o.storedMarks&&t.setStoredMarks(o.storedMarks);const u={tr:t,editor:i,view:a,state:Wb({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([s,c])=>[s,(...l)=>c(...l)(u)]))}};return u}}class hwe{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const r=this.callbacks[t];return r&&r.forEach(i=>i.apply(this,n)),this}off(t,n){const r=this.callbacks[t];return r&&(n?this.callbacks[t]=r.filter(i=>i!==n):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}function ce(e,t,n){return e.config[t]===void 0&&e.parent?ce(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?ce(e.parent,t,n):null}):e.config[t]}function Lb(e){const t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),r=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function b4(e){const t=[],{nodeExtensions:n,markExtensions:r}=Lb(e),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},s=ce(a,"addGlobalAttributes",u);if(!s)return;s().forEach(l=>{l.types.forEach(f=>{Object.entries(l.attributes).forEach(([d,p])=>{t.push({type:f,name:d,attribute:{...o,...p}})})})})}),i.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},s=ce(a,"addAttributes",u);if(!s)return;const c=s();Object.entries(c).forEach(([l,f])=>{const d={...o,...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,t.push({type:a.name,name:l,attribute:d})})}),t}function Xt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function It(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}i==="class"?r[i]=[r[i],o].join(" "):i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function ix(e,t){return t.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>It(n,r),{})}function _4(e){return typeof e=="function"}function Me(e,t=void 0,...n){return _4(e)?t?e.bind(t)(...n):e(...n):e}function mwe(e={}){return Object.keys(e).length===0&&e.constructor===Object}function vwe(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function $4(e,t){return e.style?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const i=t.reduce((o,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(n):vwe(n.getAttribute(a.name));return u==null?o:{...o,[a.name]:u}},{});return{...r,...i}}}}function S4(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&mwe(n)?!1:n!=null))}function T4(e,t){var n;const r=b4(e),{nodeExtensions:i,markExtensions:o}=Lb(e),a=(n=i.find(c=>ce(c,"topNode")))===null||n===void 0?void 0:n.name,u=Object.fromEntries(i.map(c=>{const l=r.filter(_=>_.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:t},d=e.reduce((_,S)=>{const C=ce(S,"extendNodeSchema",f);return{..._,...C?C(c):{}}},{}),p=S4({...d,content:Me(ce(c,"content",f)),marks:Me(ce(c,"marks",f)),group:Me(ce(c,"group",f)),inline:Me(ce(c,"inline",f)),atom:Me(ce(c,"atom",f)),selectable:Me(ce(c,"selectable",f)),draggable:Me(ce(c,"draggable",f)),code:Me(ce(c,"code",f)),defining:Me(ce(c,"defining",f)),isolating:Me(ce(c,"isolating",f)),attrs:Object.fromEntries(l.map(_=>{var S;return[_.name,{default:(S=_==null?void 0:_.attribute)===null||S===void 0?void 0:S.default}]}))}),h=Me(ce(c,"parseHTML",f));h&&(p.parseDOM=h.map(_=>$4(_,l)));const m=ce(c,"renderHTML",f);m&&(p.toDOM=_=>m({node:_,HTMLAttributes:ix(_,l)}));const g=ce(c,"renderText",f);return g&&(p.toText=g),[c.name,p]})),s=Object.fromEntries(o.map(c=>{const l=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:t},d=e.reduce((g,_)=>{const S=ce(_,"extendMarkSchema",f);return{...g,...S?S(c):{}}},{}),p=S4({...d,inclusive:Me(ce(c,"inclusive",f)),excludes:Me(ce(c,"excludes",f)),group:Me(ce(c,"group",f)),spanning:Me(ce(c,"spanning",f)),code:Me(ce(c,"code",f)),attrs:Object.fromEntries(l.map(g=>{var _;return[g.name,{default:(_=g==null?void 0:g.attribute)===null||_===void 0?void 0:_.default}]}))}),h=Me(ce(c,"parseHTML",f));h&&(p.parseDOM=h.map(g=>$4(g,l)));const m=ce(c,"renderHTML",f);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:ix(g,l)})),[c.name,p]}));return new I1e({topNode:a,nodes:u,marks:s})}function ox(e,t){return t.nodes[e]||t.marks[e]||null}function I4(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}const gwe=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(i,o,a,u)=>{var s,c;const l=((c=(s=i.type.spec).toText)===null||c===void 0?void 0:c.call(s,{node:i,pos:o,parent:a,index:u}))||i.textContent||"%leaf%";n+=l.slice(0,Math.max(0,r-o))}),n};function ax(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class ux{constructor(t){this.find=t.find,this.handler=t.handler}}const ywe=(e,t)=>{if(ax(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,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 sx(e){var t;const{editor:n,from:r,to:i,text:o,rules:a,plugin:u}=e,{view:s}=n;if(s.composing)return!1;const c=s.state.doc.resolve(r);if(c.parent.type.spec.code||!((t=c.nodeBefore||c.nodeAfter)===null||t===void 0)&&t.marks.find(d=>d.type.spec.code))return!1;let l=!1;const f=gwe(c)+o;return a.forEach(d=>{if(l)return;const p=ywe(f,d.find);if(!p)return;const h=s.state.tr,m=Wb({state:s.state,transaction:h}),g={from:r-(p[0].length-o.length),to:i},{commands:_,chain:S,can:C}=new jb({editor:n,state:m});d.handler({state:m,range:g,match:p,commands:_,chain:S,can:C})===null||!h.steps.length||(h.setMeta(u,{transform:h,from:r,to:i,text:o}),s.dispatch(h),l=!0)}),l}function bwe(e){const{editor:t,rules:n}=e,r=new Rr({state:{init(){return null},apply(i,o){const a=i.getMeta(r);return a||(i.selectionSet||i.docChanged?null:o)}},props:{handleTextInput(i,o,a,u){return sx({editor:t,from:o,to:a,text:u,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&sx({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?sx({editor:t,from:a.pos,to:a.pos,text:`
39
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function _we(e){return typeof e=="number"}class $we{constructor(t){this.find=t.find,this.handler=t.handler}}const Swe=(e,t)=>{if(ax(t))return[...e.matchAll(t)];const n=t(e);return n?n.map(r=>{const i=[r.text];return i.index=r.index,i.input=e,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function Twe(e){const{editor:t,state:n,from:r,to:i,rule:o}=e,{commands:a,chain:u,can:s}=new jb({editor:t,state:n}),c=[];return n.doc.nodesBetween(r,i,(f,d)=>{if(!f.isTextblock||f.type.spec.code)return;const p=Math.max(r,d),h=Math.min(i,d+f.content.size),m=f.textBetween(p-d,h-d,void 0,"");Swe(m,o.find).forEach(_=>{if(_.index===void 0)return;const S=p+_.index+1,C=S+_[0].length,b={from:n.tr.mapping.map(S),to:n.tr.mapping.map(C)},w=o.handler({state:n,range:b,match:_,commands:a,chain:u,can:s});c.push(w)})}),c.every(f=>f!==null)}function Iwe(e){const{editor:t,rules:n}=e;let r=null,i=!1,o=!1;return n.map(u=>new Rr({view(s){const c=l=>{var f;r=!((f=s.dom.parentElement)===null||f===void 0)&&f.contains(l.target)?s.dom.parentElement:null};return window.addEventListener("dragstart",c),{destroy(){window.removeEventListener("dragstart",c)}}},props:{handleDOMEvents:{drop:s=>(o=r===s.dom.parentElement,!1),paste:(s,c)=>{var l;const f=(l=c.clipboardData)===null||l===void 0?void 0:l.getData("text/html");return i=!!(f!=null&&f.includes("data-pm-slice")),!1}}},appendTransaction:(s,c,l)=>{const f=s[0],d=f.getMeta("uiEvent")==="paste"&&!i,p=f.getMeta("uiEvent")==="drop"&&!o;if(!d&&!p)return;const h=c.doc.content.findDiffStart(l.doc.content),m=c.doc.content.findDiffEnd(l.doc.content);if(!_we(h)||!m||h===m.b)return;const g=l.tr,_=Wb({state:l,transaction:g});if(!(!Twe({editor:t,state:_,from:Math.max(h-1,0),to:m.b-1,rule:u})||!g.steps.length))return g}}))}function Cwe(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return[...new Set(t)]}class Oc{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=Oc.resolve(t),this.schema=T4(this.extensions,n),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const o={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:ox(r.name,this.schema)};r.type==="mark"&&(!((i=Me(ce(r,"keepOnSplit",o)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const a=ce(r,"onBeforeCreate",o);a&&this.editor.on("beforeCreate",a);const u=ce(r,"onCreate",o);u&&this.editor.on("create",u);const s=ce(r,"onUpdate",o);s&&this.editor.on("update",s);const c=ce(r,"onSelectionUpdate",o);c&&this.editor.on("selectionUpdate",c);const l=ce(r,"onTransaction",o);l&&this.editor.on("transaction",l);const f=ce(r,"onFocus",o);f&&this.editor.on("focus",f);const d=ce(r,"onBlur",o);d&&this.editor.on("blur",d);const p=ce(r,"onDestroy",o);p&&this.editor.on("destroy",p)})}static resolve(t){const n=Oc.sort(Oc.flatten(t)),r=Cwe(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(t){return t.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=ce(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(t){return t.sort((r,i)=>{const o=ce(r,"priority")||100,a=ce(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((t,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:ox(n.name,this.schema)},i=ce(n,"addCommands",r);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this,n=Oc.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(a=>{const u={name:a.name,options:a.options,storage:a.storage,editor:t,type:ox(a.name,this.schema)},s=[],c=ce(a,"addKeyboardShortcuts",u);let l={};if(a.type==="mark"&&a.config.exitable&&(l.ArrowRight=()=>tm.handleExit({editor:t,mark:a})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,_])=>[g,()=>_({editor:t})]));l={...l,...m}}const f=BOe(l);s.push(f);const d=ce(a,"addInputRules",u);I4(a,t.options.enableInputRules)&&d&&r.push(...d());const p=ce(a,"addPasteRules",u);I4(a,t.options.enablePasteRules)&&p&&i.push(...p());const h=ce(a,"addProseMirrorPlugins",u);if(h){const m=h();s.push(...m)}return s}).flat();return[bwe({editor:t,rules:r}),...Iwe({editor:t,rules:i}),...o]}get attributes(){return b4(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=Lb(this.extensions);return Object.fromEntries(n.filter(r=>!!ce(r,"addNodeView")).map(r=>{const i=this.attributes.filter(s=>s.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:t,type:Xt(r.name,this.schema)},a=ce(r,"addNodeView",o);if(!a)return[];const u=(s,c,l,f)=>{const d=ix(s,i);return a()({editor:t,node:s,getPos:l,decorations:f,HTMLAttributes:d,extension:r})};return[r.name,u]}))}}function Owe(e){return Object.prototype.toString.call(e).slice(8,-1)}function cx(e){return Owe(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Db(e,t){const n={...e};return cx(e)&&cx(t)&&Object.keys(t).forEach(r=>{cx(t[r])?r in e?n[r]=Db(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}class fr{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Me(ce(this,"addOptions",{name:this.name}))),this.storage=Me(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new fr(t)}configure(t={}){const n=this.extend();return n.options=Db(this.options,t),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){const n=new fr(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Me(ce(n,"addOptions",{name:n.name})),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}}function C4(e,t,n){const{from:r,to:i}=t,{blockSeparator:o=`
37
+ `))),0,0):ae.empty;let f=e.someProp("clipboardTextParser",d=>d(t,i,r,e));if(f)u=f;else{let d=i.marks(),{schema:p}=e.state,h=yo.fromSchema(p);a=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=a.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,d)))})}}else e.someProp("transformPastedHTML",f=>{n=f(n,e)}),a=eOe(n),xb&&tOe(a);let c=a&&a.querySelector("[data-pm-slice]"),l=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(l&&l[3])for(let f=+l[3];f>0;f--){let d=a.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;a=d}if(u||(u=(e.someProp("clipboardParser")||e.someProp("domParser")||Rf.fromSchema(e.state.schema)).parseSlice(a,{preserveWhitespace:!!(s||l),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!XCe.test(d.parentNode.nodeName)?{ignore:!0}:null}})),l)u=nOe(V3(u,+l[1],+l[2]),l[4]);else if(u=ae.maxOpen(QCe(u.content,i),!0),u.openStart||u.openEnd){let f=0,d=0;for(let p=u.content.firstChild;f<u.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=u.content.lastChild;d<u.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);u=V3(u,f,d)}return e.someProp("transformPasted",f=>{u=f(u,e)}),u}const XCe=/^(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 QCe(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),o,a=[];if(e.forEach(u=>{if(!a)return;let s=i.findWrapping(u.type),c;if(!s)return a=null;if(c=a.length&&o.length&&z3(s,o,u,a[a.length-1],0))a[a.length-1]=c;else{a.length&&(a[a.length-1]=K3(a[a.length-1],o.length));let l=q3(u,s);a.push(l),i=i.matchType(l.type),o=s}}),a)return K.from(a)}return e}function q3(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,K.from(e));return e}function z3(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let o=z3(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(K.from(q3(n,e,i+1))))}}function K3(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,K3(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(K.empty,!0);return e.copy(n.append(r))}function zE(e,t,n,r,i,o){let a=t<0?e.firstChild:e.lastChild,u=a.content;return e.childCount>1&&(o=0),i<r-1&&(u=zE(u,t,n,r,i+1,o)),i>=n&&(u=t<0?a.contentMatchAt(0).fillBefore(u,o<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(K.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(u))}function V3(e,t,n){return t<e.openStart&&(e=new ae(zE(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ae(zE(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const H3={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 G3=null;function Y3(){return G3||(G3=document.implementation.createHTMLDocument("title"))}function eOe(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Y3().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&H3[r[1].toLowerCase()])&&(e=i.map(o=>"<"+o+">").join("")+e+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=e,i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function tOe(e){let t=e.querySelectorAll(En?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function nOe(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:o,openEnd:a}=e;for(let u=r.length-2;u>=0;u-=2){let s=n.nodes[r[u]];if(!s||s.hasRequiredAttrs())break;i=K.from(s.create(r[u+1],i)),o++,a++}return new ae(i,o,a)}const Vn={},Hn={},rOe={touchstart:!0,touchmove:!0};class iOe{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.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function oOe(e){for(let t in Vn){let n=Vn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{uOe(e,r)&&!VE(e,r)&&(e.editable||!(r.type in Hn))&&n(e,r)},rOe[t]?{passive:!0}:void 0)}Kn&&e.dom.addEventListener("input",()=>null),KE(e)}function Pu(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function aOe(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function KE(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>VE(e,r))})}function VE(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function uOe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function sOe(e,t){!VE(e,t)&&Vn[t.type]&&(e.editable||!(t.type in Hn))&&Vn[t.type](e,t)}Hn.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Z3(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Wi&&En&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Df&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",i=>i(e,bc(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||ZCe(e,n)?n.preventDefault():Pu(e,"key")},Hn.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},Hn.keypress=(e,t)=>{let n=t;if(Z3(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Xr&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Be)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",o=>o(e,r.$from.pos,r.$to.pos,i))&&e.dispatch(e.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function kb(e){return{left:e.clientX,top:e.clientY}}function cOe(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function HE(e,t,n,r,i){if(r==-1)return!1;let o=e.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(e.someProp(t,u=>a>o.depth?u(e,n,o.nodeAfter,o.before(a),i,!0):u(e,n,o.node(a),o.before(a),i,!1)))return!0;return!1}function Uf(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);n=="pointer"&&r.setMeta("pointer",!0),e.dispatch(r)}function lOe(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&ve.isSelectable(r)?(Uf(e,new ve(n),"pointer"),!0):!1}function fOe(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof ve&&(r=n.node);let o=e.state.doc.resolve(t);for(let a=o.depth+1;a>0;a--){let u=a>o.depth?o.nodeAfter:o.node(a);if(ve.isSelectable(u)){r&&n.$from.depth>0&&a>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(a);break}}return i!=null?(Uf(e,ve.create(e.state.doc,i),"pointer"),!0):!1}function dOe(e,t,n,r,i){return HE(e,"handleClickOn",t,n,r)||e.someProp("handleClick",o=>o(e,t,r))||(i?fOe(e,n):lOe(e,n))}function pOe(e,t,n,r){return HE(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",i=>i(e,t,r))}function hOe(e,t,n,r){return HE(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",i=>i(e,t,r))||mOe(e,n,r)}function mOe(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Uf(e,Be.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(t);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),u=i.before(o);if(a.inlineContent)Uf(e,Be.create(r,u+1,u+1+a.content.size),"pointer");else if(ve.isSelectable(a))Uf(e,ve.create(r,u),"pointer");else continue;return!0}}function GE(e){return Ab(e)}const J3=Xr?"metaKey":"ctrlKey";Vn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=GE(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&cOe(n,e.input.lastClick)&&!n[J3]&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let a=e.posAtCoords(kb(n));a&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new vOe(e,a,n,!!r)):(o=="doubleClick"?pOe:hOe)(e,a.pos,a.inside,n)?n.preventDefault():Pu(e,"pointer"))};class vOe{constructor(t,n,r,i){this.view=t,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[J3],this.allowDefault=r.shiftKey;let o,a;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),a=n.inside;else{let l=t.state.doc.resolve(n.pos);o=l.parent,a=l.depth?l.before():0}const u=i?null:r.target,s=u?t.docView.nearestDesc(u,!0):null;this.target=s?s.dom:null;let{selection:c}=t.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof ve&&c.from<=a&&c.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Pi&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Pu(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ma(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(kb(t))),this.updateAllowDefault(t),this.allowDefault||!n?Pu(this.view,"pointer"):dOe(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Kn&&this.mightDrag&&!this.mightDrag.node.isAtom||En&&!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)?(Uf(this.view,Pe.near(this.view.state.doc.resolve(n.pos)),"pointer"),t.preventDefault()):Pu(this.view,"pointer")}move(t){this.updateAllowDefault(t),Pu(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Vn.touchstart=e=>{e.input.lastTouch=Date.now(),GE(e),Pu(e,"pointer")},Vn.touchmove=e=>{e.input.lastTouch=Date.now(),Pu(e,"pointer")},Vn.contextmenu=e=>GE(e);function Z3(e,t){return e.composing?!0:Kn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const gOe=Wi?5e3:-1;Hn.compositionstart=Hn.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Ab(e,!0),e.markCursor=null;else if(Ab(e),Pi&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){e.domSelection().collapse(a,a.nodeValue.length);break}else i=a,o=-1}}e.input.composing=!0}X3(e,gOe)},Hn.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionID++,X3(e,20))};function X3(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Ab(e),t))}function Q3(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=yOe());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function yOe(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Ab(e,t=!1){if(!(Wi&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Q3(e),t||e.docView&&e.docView.dirty){let n=LE(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}}function bOe(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const qf=fr&&ku<15||Df&&bCe<604;Vn.copy=Hn.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type=="cut";if(r.empty)return;let o=qf?null:n.clipboardData,a=r.content(),{dom:u,text:s}=B3(e,a);o?(n.preventDefault(),o.clearData(),o.setData("text/html",u.innerHTML),o.setData("text/plain",s)):bOe(e,u),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function _Oe(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function $Oe(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.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=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Jh(e,r.value,null,i,t):Jh(e,r.textContent,r.innerHTML,i,t)},50)}function Jh(e,t,n,r,i){let o=U3(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",s=>s(e,i,o||ae.empty)))return!0;if(!o)return!1;let a=_Oe(o),u=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(o);return e.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Hn.paste=(e,t)=>{let n=t;if(e.composing&&!Wi)return;let r=qf?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Jh(e,r.getData("text/plain"),r.getData("text/html"),i,n)?n.preventDefault():$Oe(e,n)};class SOe{constructor(t,n){this.slice=t,this.move=n}}const e4=Xr?"altKey":"ctrlKey";Vn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(kb(n));if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof ve?i.to-1:i.to))){if(r&&r.mightDrag)e.dispatch(e.state.tr.setSelection(ve.create(e.state.doc,r.mightDrag.pos)));else if(n.target&&n.target.nodeType==1){let c=e.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=e.docView&&e.dispatch(e.state.tr.setSelection(ve.create(e.state.doc,c.posBefore)))}}let a=e.state.selection.content(),{dom:u,text:s}=B3(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(qf?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",qf||n.dataTransfer.setData("text/plain",s),e.dragging=new SOe(a,!n[e4])},Vn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Hn.dragover=Hn.dragenter=(e,t)=>t.preventDefault(),Hn.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let i=e.posAtCoords(kb(n));if(!i)return;let o=e.state.doc.resolve(i.pos),a=r&&r.slice;a?e.someProp("transformPasted",h=>{a=h(a,e)}):a=U3(e,n.dataTransfer.getData(qf?"Text":"text/plain"),qf?null:n.dataTransfer.getData("text/html"),!1,o);let u=!!(r&&!n[e4]);if(e.someProp("handleDrop",h=>h(e,n,a||ae.empty,u))){n.preventDefault();return}if(!a)return;n.preventDefault();let s=a?eCe(e.state.doc,o.pos,a):o.pos;s==null&&(s=o.pos);let c=e.state.tr;u&&c.deleteSelection();let l=c.mapping.map(s),f=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(f?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let p=c.doc.resolve(l);if(f&&ve.isSelectable(a.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new ve(p));else{let h=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,_,S)=>h=S),c.setSelection(BE(e,p,c.doc.resolve(h)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},Vn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Ma(e)},20))},Vn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Vn.beforeinput=(e,t)=>{if(En&&Wi&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,bc(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in Hn)Vn[e]=Hn[e];function Zh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class YE{constructor(t,n){this.toDOM=t,this.spec=n||Ic,this.side=this.spec.side||0}map(t,n,r,i){let{pos:o,deleted:a}=t.mapResult(n.from+i,this.side<0?-1:1);return a?null:new Ar(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof YE&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Zh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Wu{constructor(t,n){this.attrs=t,this.spec=n||Ic}map(t,n,r,i){let o=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new Ar(o,a,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Wu&&Zh(this.attrs,t.attrs)&&Zh(this.spec,t.spec)}static is(t){return t.type instanceof Wu}destroy(){}}let TOe=class G5{constructor(t,n){this.attrs=t,this.spec=n||Ic}map(t,n,r,i){let o=t.mapResult(n.from+i,1);if(o.deleted)return null;let a=t.mapResult(n.to+i,-1);return a.deleted||a.pos<=o.pos?null:new Ar(o.pos-r,a.pos-r,this)}valid(t,n){let{index:r,offset:i}=t.content.findIndex(n.from),o;return i==n.from&&!(o=t.child(r)).isText&&i+o.nodeSize==n.to}eq(t){return this==t||t instanceof G5&&Zh(this.attrs,t.attrs)&&Zh(this.spec,t.spec)}destroy(){}};class Ar{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Ar(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new Ar(t,t,new YE(n,r))}static inline(t,n,r,i){return new Ar(t,n,new Wu(r,i))}static node(t,n,r,i){return new Ar(t,n,new TOe(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Wu}}const zf=[],Ic={};class Wt{constructor(t,n){this.local=t.length?t:zf,this.children=n.length?n:zf}static create(t,n){return n.length?Fb(n,t,0,Ic):xn}find(t,n,r){let i=[];return this.findInner(t??0,n??1e9,i,0,r),i}findInner(t,n,r,i,o){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=n&&u.to>=t&&(!o||o(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>t){let u=this.children[a]+1;this.children[a+2].findInner(t-u,n-u,r,i+u,o)}}map(t,n,r){return this==xn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||Ic)}mapInner(t,n,r,i,o){let a;for(let u=0;u<this.local.length;u++){let s=this.local[u].map(t,r,i);s&&s.type.valid(n,s)?(a||(a=[])).push(s):o.onRemove&&o.onRemove(this.local[u].spec)}return this.children.length?IOe(this.children,a||[],t,n,r,i,o):a?new Wt(a.sort(Cc),zf):xn}add(t,n){return n.length?this==xn?Wt.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,o=0;t.forEach((u,s)=>{let c=s+r,l;if(l=n4(n,u,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<s;)o+=3;i[o]==s?i[o+2]=i[o+2].addInner(u,l,c+1):i.splice(o,0,s,s+u.nodeSize,Fb(l,u,c+1,Ic)),o+=3}});let a=t4(o?r4(n):n,-r);for(let u=0;u<a.length;u++)a[u].type.valid(t,a[u])||a.splice(u--,1);return new Wt(a.length?this.local.concat(a).sort(Cc):this.local,i||this.children)}remove(t){return t.length==0||this==xn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,u=r[o]+n,s=r[o+1]+n;for(let l=0,f;l<t.length;l++)(f=t[l])&&f.from>u&&f.to<s&&(t[l]=null,(a||(a=[])).push(f));if(!a)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(a,u+1);c!=xn?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<t.length;o++)if(a=t[o])for(let u=0;u<i.length;u++)i[u].eq(a,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Wt(i,r):xn}forChild(t,n){if(this==xn)return this;if(n.isLeaf)return Wt.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=t){this.children[u]==t&&(r=this.children[u+2]);break}let o=t+1,a=o+n.content.size;for(let u=0;u<this.local.length;u++){let s=this.local[u];if(s.from<a&&s.to>o&&s.type instanceof Wu){let c=Math.max(o,s.from)-o,l=Math.min(a,s.to)-o;c<l&&(i||(i=[])).push(s.copy(c,l))}}if(i){let u=new Wt(i.sort(Cc),zf);return r?new ju([u,r]):u}return r||xn}eq(t){if(this==t)return!0;if(!(t instanceof Wt)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return JE(this.localsInner(t))}localsInner(t){if(this==xn)return zf;if(t.inlineContent||!this.local.some(Wu.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Wu||n.push(this.local[r]);return n}}Wt.empty=new Wt([],[]),Wt.removeOverlap=JE;const xn=Wt.empty;class ju{constructor(t){this.members=t}map(t,n){const r=this.members.map(i=>i.map(t,n,Ic));return ju.from(r)}forChild(t,n){if(n.isLeaf)return Wt.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(t,n);o!=xn&&(o instanceof ju?r=r.concat(o.members):r.push(o))}return ju.from(r)}eq(t){if(!(t instanceof ju)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(t);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let a=0;a<o.length;a++)n.push(o[a])}}return n?JE(r?n:n.sort(Cc)):zf}static from(t){switch(t.length){case 0:return xn;case 1:return t[0];default:return new ju(t.every(n=>n instanceof Wt)?t:t.reduce((n,r)=>n.concat(r instanceof Wt?r:r.members),[]))}}}function IOe(e,t,n,r,i,o,a){let u=e.slice();for(let c=0,l=o;c<n.maps.length;c++){let f=0;n.maps[c].forEach((d,p,h,m)=>{let g=m-h-(p-d);for(let _=0;_<u.length;_+=3){let S=u[_+1];if(S<0||d>S+l-f)continue;let C=u[_]+l-f;p>=C?u[_+1]=d<=C?-2:-1:h>=i&&g&&(u[_]+=g,u[_+1]+=g)}f+=g}),l=n.maps[c].map(l,-1)}let s=!1;for(let c=0;c<u.length;c+=3)if(u[c+1]<0){if(u[c+1]==-2){s=!0,u[c+1]=-1;continue}let l=n.map(e[c]+o),f=l-i;if(f<0||f>=r.content.size){s=!0;continue}let d=n.map(e[c+1]+o,-1),p=d-i,{index:h,offset:m}=r.content.findIndex(f),g=r.maybeChild(h);if(g&&m==f&&m+g.nodeSize==p){let _=u[c+2].mapInner(n,g,l+1,e[c]+o+1,a);_!=xn?(u[c]=f,u[c+1]=p,u[c+2]=_):(u[c+1]=-2,s=!0)}else s=!0}if(s){let c=COe(u,e,t,n,i,o,a),l=Fb(c,r,0,a);t=l.local;for(let f=0;f<u.length;f+=3)u[f+1]<0&&(u.splice(f,3),f-=3);for(let f=0,d=0;f<l.children.length;f+=3){let p=l.children[f];for(;d<u.length&&u[d]<p;)d+=3;u.splice(d,0,l.children[f],l.children[f+1],l.children[f+2])}}return new Wt(t.sort(Cc),u)}function t4(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new Ar(i.from+t,i.to+t,i.type))}return n}function COe(e,t,n,r,i,o,a){function u(s,c){for(let l=0;l<s.local.length;l++){let f=s.local[l].map(r,i,c);f?n.push(f):a.onRemove&&a.onRemove(s.local[l].spec)}for(let l=0;l<s.children.length;l+=3)u(s.children[l+2],s.children[l]+c+1)}for(let s=0;s<e.length;s+=3)e[s+1]==-1&&u(e[s+2],t[s]+o+1);return n}function n4(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let o=0,a;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function r4(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Fb(e,t,n,r){let i=[],o=!1;t.forEach((u,s)=>{let c=n4(e,u,s+n);if(c){o=!0;let l=Fb(c,u,n+s+1,r);l!=xn&&i.push(s,s+u.nodeSize,l)}});let a=t4(o?r4(e):e,-n).sort(Cc);for(let u=0;u<a.length;u++)a[u].type.valid(t,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new Wt(a,i):xn}function Cc(e,t){return e.from-t.from||e.to-t.to}function JE(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),i4(t,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),i4(t,i,r.copy(o.from,r.to)));break}}}return t}function i4(e,t,n){for(;t<e.length&&Cc(n,e[t])>0;)t++;e.splice(t,0,n)}function ZE(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=xn&&t.push(r)}),e.cursorWrapper&&t.push(Wt.create(e.state.doc,[e.cursorWrapper.deco])),ju.from(t)}const OOe={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},wOe=fr&&ku<=11;class EOe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class xOe{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new EOe,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);fr&&ku<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),wOe&&(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,OOe)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[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(k3(this.view)){if(this.suppressingSelectionUpdates)return Ma(this.view);if(fr&&ku<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&yc(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let o=t.focusNode;o;o=zh(o))n.add(o);for(let o=t.anchorNode;o;o=zh(o))if(n.has(o)){r=o;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}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.observer?this.observer.takeRecords():[];this.queue.length&&(n=this.queue.concat(n),this.queue.length=0);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&k3(t)&&!this.ignoreSelectionChange(r),o=-1,a=-1,u=!1,s=[];if(t.editable)for(let l=0;l<n.length;l++){let f=this.registerMutation(n[l],s);f&&(o=o<0?f.from:Math.min(f.from,o),a=a<0?f.to:Math.max(f.to,a),f.typeOver&&(u=!0))}if(Pi&&s.length>1){let l=s.filter(f=>f.nodeName=="BR");if(l.length==2){let f=l[0],d=l[1];f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Eb(r)&&(c=LE(t))&&c.eq(Pe.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Ma(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,a),MOe(t)),this.handleDOMChange(o,a,u,s),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Ma(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let l=0;l<t.addedNodes.length;l++)n.push(t.addedNodes[l]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let i=t.previousSibling,o=t.nextSibling;if(fr&&ku<=11&&t.addedNodes.length)for(let l=0;l<t.addedNodes.length;l++){let{previousSibling:f,nextSibling:d}=t.addedNodes[l];(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d)}let a=i&&i.parentNode==t.target?kr(i)+1:0,u=r.localPosFromDOM(t.target,a,-1),s=o&&o.parentNode==t.target?kr(o):t.target.childNodes.length,c=r.localPosFromDOM(t.target,s,1);return{from:u,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}}let o4=new WeakMap,a4=!1;function MOe(e){if(!o4.has(e)&&(o4.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Pi,a4)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."),a4=!0}}function ROe(e){let t;function n(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,i=t.startOffset,o=t.endContainer,a=t.endOffset,u=e.domAtPos(e.state.selection.anchor);return yc(u.node,u.offset,o,a)&&([r,i,o,a]=[o,a,r,i]),{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:a}}function kOe(e,t,n){let{node:r,fromOffset:i,toOffset:o,from:a,to:u}=e.docView.parseRange(t,n),s=e.domSelectionRange(),c,l=s.anchorNode;if(l&&e.dom.contains(l.nodeType==1?l:l.parentNode)&&(c=[{node:l,offset:s.anchorOffset}],Eb(s)||c.push({node:s.focusNode,offset:s.focusOffset})),En&&e.input.lastKeyCode===8)for(let g=o;g>i;g--){let _=r.childNodes[g-1],S=_.pmViewDesc;if(_.nodeName=="BR"&&!S){o=g;break}if(!S||S.size)break}let f=e.state.doc,d=e.someProp("domParser")||Rf.fromSchema(e.state.schema),p=f.resolve(a),h=null,m=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:AOe,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,_=c[1]&&c[1].pos;_==null&&(_=g),h={anchor:g+a,head:_+a}}return{doc:m,sel:h,from:a,to:u}}function AOe(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Kn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Kn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const FOe=/^(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 NOe(e,t,n,r,i){if(t<0){let x=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,U=LE(e,x);if(U&&!e.state.selection.eq(U)){if(En&&Wi&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",P=>P(e,bc(13,"Enter"))))return;let B=e.state.tr.setSelection(U);x=="pointer"?B.setMeta("pointer",!0):x=="key"&&B.scrollIntoView(),e.composing&&B.setMeta("composition",e.input.compositionID),e.dispatch(B)}return}let o=e.state.doc.resolve(t),a=o.sharedDepth(n);t=o.before(a+1),n=e.state.doc.resolve(n).after(a+1);let u=e.state.selection,s=kOe(e,t,n),c=e.state.doc,l=c.slice(s.from,s.to),f,d;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,d="end"):(f=e.state.selection.from,d="start"),e.input.lastKeyCode=null;let p=jOe(l.content,s.doc.content,s.from,f,d);if((Df&&e.input.lastIOSEnter>Date.now()-225||Wi)&&i.some(x=>x.nodeType==1&&!FOe.test(x.nodeName))&&(!p||p.endA>=p.endB)&&e.someProp("handleKeyDown",x=>x(e,bc(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!p)if(r&&u instanceof Be&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(s.sel&&s.sel.anchor!=s.sel.head))p={start:u.from,endA:u.to,endB:u.to};else{if(s.sel){let x=u4(e,e.state.doc,s.sel);if(x&&!x.eq(e.state.selection)){let U=e.state.tr.setSelection(x);e.composing&&U.setMeta("composition",e.input.compositionID),e.dispatch(U)}}return}if(En&&e.cursorWrapper&&s.sel&&s.sel.anchor==e.cursorWrapper.deco.from&&s.sel.head==s.sel.anchor){let x=p.endB-p.start;s.sel={anchor:s.sel.anchor+x,head:s.sel.anchor+x}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&p.start==p.endB&&e.state.selection instanceof Be&&(p.start>e.state.selection.from&&p.start<=e.state.selection.from+2&&e.state.selection.from>=s.from?p.start=e.state.selection.from:p.endA<e.state.selection.to&&p.endA>=e.state.selection.to-2&&e.state.selection.to<=s.to&&(p.endB+=e.state.selection.to-p.endA,p.endA=e.state.selection.to)),fr&&ku<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>s.from&&s.doc.textBetween(p.start-s.from-1,p.start-s.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let h=s.doc.resolveNoCache(p.start-s.from),m=s.doc.resolveNoCache(p.endB-s.from),g=c.resolve(p.start),_=h.sameParent(m)&&h.parent.inlineContent&&g.end()>=p.endA,S;if((Df&&e.input.lastIOSEnter>Date.now()-225&&(!_||i.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!_&&h.pos<s.doc.content.size&&!h.sameParent(m)&&(S=Pe.findFrom(s.doc.resolve(h.pos+1),1,!0))&&S.head==m.pos)&&e.someProp("handleKeyDown",x=>x(e,bc(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>p.start&&WOe(c,p.start,p.endA,h,m)&&e.someProp("handleKeyDown",x=>x(e,bc(8,"Backspace")))){Wi&&En&&e.domObserver.suppressSelectionUpdates();return}En&&Wi&&p.endB==p.start&&(e.input.lastAndroidDelete=Date.now()),Wi&&!_&&h.start()!=m.start()&&m.parentOffset==0&&h.depth==m.depth&&s.sel&&s.sel.anchor==s.sel.head&&s.sel.head==p.endA&&(p.endB-=2,m=s.doc.resolveNoCache(p.endB-s.from),setTimeout(()=>{e.someProp("handleKeyDown",function(x){return x(e,bc(13,"Enter"))})},20));let C=p.start,b=p.endA,w,O,M;if(_){if(h.pos==m.pos)fr&&ku<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ma(e),20)),w=e.state.tr.delete(C,b),O=c.resolve(p.start).marksAcross(c.resolve(p.endA));else if(p.endA==p.endB&&(M=POe(h.parent.content.cut(h.parentOffset,m.parentOffset),g.parent.content.cut(g.parentOffset,p.endA-g.start()))))w=e.state.tr,M.type=="add"?w.addMark(C,b,M.mark):w.removeMark(C,b,M.mark);else if(h.parent.child(h.index()).isText&&h.index()==m.index()-(m.textOffset?0:1)){let x=h.parent.textBetween(h.parentOffset,m.parentOffset);if(e.someProp("handleTextInput",U=>U(e,C,b,x)))return;w=e.state.tr.insertText(x,C,b)}}if(w||(w=e.state.tr.replace(C,b,s.doc.slice(p.start-s.from,p.endB-s.from))),s.sel){let x=u4(e,w.doc,s.sel);x&&!(En&&Wi&&e.composing&&x.empty&&(p.start!=p.endB||e.input.lastAndroidDelete<Date.now()-100)&&(x.head==C||x.head==w.mapping.map(b)-1)||fr&&x.empty&&x.head==C)&&w.setSelection(x)}O&&w.ensureMarks(O),e.composing&&w.setMeta("composition",e.input.compositionID),e.dispatch(w.scrollIntoView())}function u4(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:BE(e,t.resolve(n.anchor),t.resolve(n.head))}function POe(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,a,u,s;for(let l=0;l<r.length;l++)i=r[l].removeFromSet(i);for(let l=0;l<n.length;l++)o=n[l].removeFromSet(o);if(i.length==1&&o.length==0)u=i[0],a="add",s=l=>l.mark(u.addToSet(l.marks));else if(i.length==0&&o.length==1)u=o[0],a="remove",s=l=>l.mark(u.removeFromSet(l.marks));else return null;let c=[];for(let l=0;l<t.childCount;l++)c.push(s(t.child(l)));if(K.from(c).eq(e))return{mark:u,type:a}}function WOe(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||XE(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let a=e.resolve(XE(o,!0,!0));return!a.parent.isTextblock||a.pos>n||XE(a,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function XE(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let o=e.node(r).maybeChild(e.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function jOe(e,t,n,r,i){let o=e.findDiffStart(t,n);if(o==null)return null;let{a,b:u}=e.findDiffEnd(t,n+e.size,n+t.size);if(i=="end"){let s=Math.max(0,o-Math.min(a,u));r-=a+s-o}if(a<o&&e.size<t.size){let s=r<=o&&r>=a?o-r:0;o-=s,u=o+(u-a),a=o}else if(u<o){let s=r<=o&&r>=u?o-r:0;o-=s,a=o+(a-u),u=o}return{start:o,endA:a,endB:u}}class LOe{constructor(t,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 iOe,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(d4),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=l4(this),c4(this),this.nodeViews=f4(this),this.docView=_3(this.state.doc,s4(this),ZE(this),this.dom,this),this.domObserver=new xOe(this,(r,i,o,a)=>NOe(this,r,i,o,a)),this.domObserver.start(),oOe(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&KE(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(d4),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){let r=this.state,i=!1,o=!1;t.storedMarks&&this.composing&&(Q3(this),o=!0),this.state=t;let a=r.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let d=f4(this);BOe(d,this.nodeViews)&&(this.nodeViews=d,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&KE(this),this.editable=l4(this),c4(this);let u=ZE(this),s=s4(this),c=r.plugins!=t.plugins&&!r.doc.eq(t.doc)?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",l=i||!this.docView.matchesNode(t.doc,s,u);(l||!t.selection.eq(r.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&SCe(this);if(o){this.domObserver.stop();let d=l&&(fr||En)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&DOe(r.selection,t.selection);if(l){let p=En?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(t.doc,s,u,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=_3(t.doc,s,u,this.dom,this)),p&&!this.trackWrites&&(d=!0)}d||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&HCe(this))?Ma(this,d):(M3(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&TCe(f)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ve){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&u3(this,n.getBoundingClientRect(),t)}else u3(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.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,t)}}someProp(t,n){let r=this._props&&this._props[t],i;if(r!=null&&(i=n?n(r):r))return i;for(let a=0;a<this.directPlugins.length;a++){let u=this.directPlugins[a].props[t];if(u!=null&&(i=n?n(u):u))return i}let o=this.state.plugins;if(o)for(let a=0;a<o.length;a++){let u=o[a].props[t];if(u!=null&&(i=n?n(u):u))return i}}hasFocus(){if(fr){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ICe(this.dom),Ma(this),this.domObserver.start()}get root(){let t=this._root;if(t==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 t||document}posAtCoords(t){return xCe(this,t)}coordsAtPos(t,n=1){return p3(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let i=this.docView.posFromDOM(t,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return FCe(this,n||this.state,t)}pasteHTML(t,n){return Jh(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Jh(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(aOe(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ZE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(t){return sOe(this,t)}dispatch(t){let n=this._props.dispatchTransaction;n?n.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return Kn&&this.root.nodeType===11&&mCe(this.dom.ownerDocument)==this.dom?ROe(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function s4(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Ar.node(0,e.state.doc.content.size,t)]}function c4(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Ar.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function l4(e){return!e.someProp("editable",t=>t(e.state)===!1)}function DOe(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function f4(e){let t=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function BOe(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r}function d4(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Lu={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:"'"},Nb={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},UOe=typeof navigator<"u"&&/Mac/.test(navigator.platform),qOe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gn=0;gn<10;gn++)Lu[48+gn]=Lu[96+gn]=String(gn);for(var gn=1;gn<=24;gn++)Lu[gn+111]="F"+gn;for(var gn=65;gn<=90;gn++)Lu[gn]=String.fromCharCode(gn+32),Nb[gn]=String.fromCharCode(gn);for(var QE in Lu)Nb.hasOwnProperty(QE)||(Nb[QE]=Lu[QE]);function zOe(e){var t=UOe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||qOe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Nb:Lu)[e.keyCode]||e.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 KOe=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function VOe(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,i,o,a;for(let u=0;u<t.length-1;u++){let s=t[u];if(/^(cmd|meta|m)$/i.test(s))a=!0;else if(/^a(lt)?$/i.test(s))r=!0;else if(/^(c|ctrl|control)$/i.test(s))i=!0;else if(/^s(hift)?$/i.test(s))o=!0;else if(/^mod$/i.test(s))KOe?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+s)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function HOe(e){let t=Object.create(null);for(let n in e)t[VOe(n)]=e[n];return t}function ex(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function GOe(e){return new Rr({props:{handleKeyDown:YOe(e)}})}function YOe(e){let t=HOe(e);return function(n,r){let i=zOe(r),o,a=t[ex(i,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=t[ex(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=Lu[r.keyCode])&&o!=i){let u=t[ex(o,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}const JOe=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ZOe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const XOe=(e,t,n)=>{let r=ZOe(e,n);if(!r)return!1;let i=p4(r);if(!i){let a=r.blockRange(),u=a&&Ff(a);return u==null?!1:(t&&t(e.tr.lift(a,u).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&v4(e,i,t))return!0;if(r.parent.content.size==0&&(Kf(o,"end")||ve.isSelectable(o))){let a=IE(e.doc,r.before(),r.after(),ae.empty);if(a&&a.slice.size<a.to-a.from){if(t){let u=e.tr.step(a);u.setSelection(Kf(o,"end")?Pe.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):ve.create(u.doc,i.pos-o.nodeSize)),t(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1};function Kf(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const QOe=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=p4(r)}let a=o&&o.nodeBefore;return!a||!ve.isSelectable(a)?!1:(t&&t(e.tr.setSelection(ve.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function p4(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function ewe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const twe=(e,t,n)=>{let r=ewe(e,n);if(!r)return!1;let i=h4(r);if(!i)return!1;let o=i.nodeAfter;if(v4(e,i,t))return!0;if(r.parent.content.size==0&&(Kf(o,"start")||ve.isSelectable(o))){let a=IE(e.doc,r.before(),r.after(),ae.empty);if(a&&a.slice.size<a.to-a.from){if(t){let u=e.tr.step(a);u.setSelection(Kf(o,"start")?Pe.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):ve.create(u.doc,u.mapping.map(i.pos))),t(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},nwe=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=h4(r)}let a=o&&o.nodeAfter;return!a||!ve.isSelectable(a)?!1:(t&&t(e.tr.setSelection(ve.create(e.doc,o.pos)).scrollIntoView()),!0)};function h4(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const rwe=(e,t)=>{let n=e.selection,r=n instanceof ve,i;if(r){if(n.node.isTextblock||!Mu(e.doc,n.from))return!1;i=n.from}else if(i=zV(e.doc,n.from,-1),i==null)return!1;if(t){let o=e.tr.join(i);r&&o.setSelection(ve.create(o.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},iwe=(e,t)=>{let n=e.selection,r;if(n instanceof ve){if(n.node.isTextblock||!Mu(e.doc,n.to))return!1;r=n.to}else if(r=zV(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},owe=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&Ff(i);return o==null?!1:(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)},awe=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
38
+ `).scrollIntoView()),!0)};function m4(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const uwe=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),a=m4(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(t){let u=n.after(),s=e.tr.replaceWith(u,u,a.createAndFill());s.setSelection(Pe.near(s.doc.resolve(u),1)),t(s.scrollIntoView())}return!0},swe=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Fi||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=m4(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=e.tr.insert(a,o.createAndFill());u.setSelection(Be.create(u.doc,a+1)),t(u.scrollIntoView())}return!0},cwe=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Nf(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ff(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},lwe=(e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),t&&t(e.tr.setSelection(ve.create(e.doc,i))),!0)};function fwe(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||Mu(e.doc,t.pos))?!1:(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0)}function v4(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o,a;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(fwe(e,t,n))return!0;let u=t.parent.canReplace(t.index(),t.index()+1);if(u&&(o=(a=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let f=t.pos+i.nodeSize,d=K.empty;for(let m=o.length-1;m>=0;m--)d=K.from(o[m].create(null,d));d=K.from(r.copy(d));let p=e.tr.step(new Zt(t.pos-1,f,t.pos,f,new ae(d,1,0),o.length,!0)),h=f+2*o.length;Mu(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}let s=Pe.findFrom(t,1),c=s&&s.$from.blockRange(s.$to),l=c&&Ff(c);if(l!=null&&l>=t.depth)return n&&n(e.tr.lift(c,l).scrollIntoView()),!0;if(u&&Kf(i,"start",!0)&&Kf(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let p=i,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let m=K.empty;for(let _=d.length-1;_>=0;_--)m=K.from(d[_].copy(m));let g=e.tr.step(new Zt(t.pos-d.length,t.pos+i.nodeSize,t.pos+h,t.pos+i.nodeSize-h,new ae(m,d.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function g4(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(t.tr.setSelection(Be.create(t.doc,e<0?i.start(o):i.end(o)))),!0):!1}}const dwe=g4(-1),pwe=g4(1);function hwe(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,a=i.blockRange(o),u=a&&TE(a,e,t);return u?(r&&r(n.tr.wrap(a,u).scrollIntoView()),!0):!1}}function y4(e,t=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[o];n.doc.nodesBetween(a,u,(s,c)=>{if(i)return!1;if(!(!s.isTextblock||s.hasMarkup(e,t)))if(s.type==e)i=!0;else{let l=n.doc.resolve(c),f=l.index();i=l.parent.canReplaceWith(f,f+1,e)}})}if(!i)return!1;if(r){let o=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:s}}=n.selection.ranges[a];o.setBlockType(u,s,e,t)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function mwe(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,a=i.blockRange(o),u=!1,s=a;if(!a)return!1;if(a.depth>=2&&i.node(a.depth-1).type.compatibleContent(e)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;let l=n.doc.resolve(a.start-2);s=new bb(l,l,a.depth),a.endIndex<a.parent.childCount&&(a=new bb(i,n.doc.resolve(o.end(a.depth)),a.depth)),u=!0}let c=TE(s,e,t,a);return c?(r&&r(vwe(n.tr,a,c,u,e).scrollIntoView()),!0):!1}}function vwe(e,t,n,r,i){let o=K.empty;for(let l=n.length-1;l>=0;l--)o=K.from(n[l].type.create(n[l].attrs,o));e.step(new Zt(t.start-(r?2:0),t.end,t.start,t.end,new ae(o,0,0),n.length,!0));let a=0;for(let l=0;l<n.length;l++)n[l].type==i&&(a=l+1);let u=n.length-a,s=t.start+n.length-(r?2:0),c=t.parent;for(let l=t.startIndex,f=t.endIndex,d=!0;l<f;l++,d=!1)!d&&Nf(e.doc,s,u)&&(e.split(s,u),s+=2*u),s+=c.child(l).nodeSize;return e}function gwe(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==e);return o?n?r.node(o.depth-1).type==e?ywe(t,n,e,o):bwe(t,n,o):!0:!1}}function ywe(e,t,n,r){let i=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Zt(o-1,a,o,a,new ae(K.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new bb(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=Ff(r);if(u==null)return!1;i.lift(r,u);let s=i.mapping.map(o,-1)-1;return Mu(i.doc,s)&&i.join(s),t(i.scrollIntoView()),!0}function bwe(e,t,n){let r=e.tr,i=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),a=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let u=n.startIndex==0,s=n.endIndex==i.childCount,c=o.node(-1),l=o.index(-1);if(!c.canReplace(l+(u?0:1),l+1,a.content.append(s?K.empty:K.from(i))))return!1;let f=o.pos,d=f+a.nodeSize;return r.step(new Zt(f-(u?1:0),d+(s?1:0),f+1,d-1,new ae((u?K.empty:K.from(i.copy(K.empty))).append(s?K.empty:K.from(i.copy(K.empty))),u?0:1,s?0:1),u?0:1)),t(r.scrollIntoView()),!0}function _we(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==e);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let u=o.parent,s=u.child(a-1);if(s.type!=e)return!1;if(n){let c=s.lastChild&&s.lastChild.type==u.type,l=K.from(c?e.create():null),f=new ae(K.from(e.create(null,K.from(u.type.create(null,l)))),c?3:1,0),d=o.start,p=o.end;n(t.tr.step(new Zt(d-(c?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}function Pb(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),filterTransaction:t.filterTransaction,plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class Wb{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([u,s])=>[u,(...l)=>{const f=s(...l)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u=[],s=!!t,c=t||o.tr,l=()=>(!s&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(c),u.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,p])=>[d,(...m)=>{const g=this.buildProps(c,n),_=p(...m)(g);return u.push(_),f}])),run:l};return f}createCan(t){const{rawCommands:n,state:r}=this,i=!1,o=t||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([s,c])=>[s,(...l)=>c(...l)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(t,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i;o.storedMarks&&t.setStoredMarks(o.storedMarks);const u={tr:t,editor:i,view:a,state:Pb({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([s,c])=>[s,(...l)=>c(...l)(u)]))}};return u}}class $we{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const r=this.callbacks[t];return r&&r.forEach(i=>i.apply(this,n)),this}off(t,n){const r=this.callbacks[t];return r&&(n?this.callbacks[t]=r.filter(i=>i!==n):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}function ce(e,t,n){return e.config[t]===void 0&&e.parent?ce(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?ce(e.parent,t,n):null}):e.config[t]}function jb(e){const t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),r=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function b4(e){const t=[],{nodeExtensions:n,markExtensions:r}=jb(e),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},s=ce(a,"addGlobalAttributes",u);if(!s)return;s().forEach(l=>{l.types.forEach(f=>{Object.entries(l.attributes).forEach(([d,p])=>{t.push({type:f,name:d,attribute:{...o,...p}})})})})}),i.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},s=ce(a,"addAttributes",u);if(!s)return;const c=s();Object.entries(c).forEach(([l,f])=>{const d={...o,...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,t.push({type:a.name,name:l,attribute:d})})}),t}function Xt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function $t(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}i==="class"?r[i]=[r[i],o].join(" "):i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function tx(e,t){return t.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>$t(n,r),{})}function _4(e){return typeof e=="function"}function Me(e,t=void 0,...n){return _4(e)?t?e.bind(t)(...n):e(...n):e}function Swe(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Twe(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function $4(e,t){return e.style?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const i=t.reduce((o,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(n):Twe(n.getAttribute(a.name));return u==null?o:{...o,[a.name]:u}},{});return{...r,...i}}}}function S4(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&Swe(n)?!1:n!=null))}function T4(e,t){var n;const r=b4(e),{nodeExtensions:i,markExtensions:o}=jb(e),a=(n=i.find(c=>ce(c,"topNode")))===null||n===void 0?void 0:n.name,u=Object.fromEntries(i.map(c=>{const l=r.filter(_=>_.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:t},d=e.reduce((_,S)=>{const C=ce(S,"extendNodeSchema",f);return{..._,...C?C(c):{}}},{}),p=S4({...d,content:Me(ce(c,"content",f)),marks:Me(ce(c,"marks",f)),group:Me(ce(c,"group",f)),inline:Me(ce(c,"inline",f)),atom:Me(ce(c,"atom",f)),selectable:Me(ce(c,"selectable",f)),draggable:Me(ce(c,"draggable",f)),code:Me(ce(c,"code",f)),defining:Me(ce(c,"defining",f)),isolating:Me(ce(c,"isolating",f)),attrs:Object.fromEntries(l.map(_=>{var S;return[_.name,{default:(S=_==null?void 0:_.attribute)===null||S===void 0?void 0:S.default}]}))}),h=Me(ce(c,"parseHTML",f));h&&(p.parseDOM=h.map(_=>$4(_,l)));const m=ce(c,"renderHTML",f);m&&(p.toDOM=_=>m({node:_,HTMLAttributes:tx(_,l)}));const g=ce(c,"renderText",f);return g&&(p.toText=g),[c.name,p]})),s=Object.fromEntries(o.map(c=>{const l=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:t},d=e.reduce((g,_)=>{const S=ce(_,"extendMarkSchema",f);return{...g,...S?S(c):{}}},{}),p=S4({...d,inclusive:Me(ce(c,"inclusive",f)),excludes:Me(ce(c,"excludes",f)),group:Me(ce(c,"group",f)),spanning:Me(ce(c,"spanning",f)),code:Me(ce(c,"code",f)),attrs:Object.fromEntries(l.map(g=>{var _;return[g.name,{default:(_=g==null?void 0:g.attribute)===null||_===void 0?void 0:_.default}]}))}),h=Me(ce(c,"parseHTML",f));h&&(p.parseDOM=h.map(g=>$4(g,l)));const m=ce(c,"renderHTML",f);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:tx(g,l)})),[c.name,p]}));return new R1e({topNode:a,nodes:u,marks:s})}function nx(e,t){return t.nodes[e]||t.marks[e]||null}function I4(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}const Iwe=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(i,o,a,u)=>{var s,c;const l=((c=(s=i.type.spec).toText)===null||c===void 0?void 0:c.call(s,{node:i,pos:o,parent:a,index:u}))||i.textContent||"%leaf%";n+=l.slice(0,Math.max(0,r-o))}),n};function rx(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class ix{constructor(t){this.find=t.find,this.handler=t.handler}}const Cwe=(e,t)=>{if(rx(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,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 ox(e){var t;const{editor:n,from:r,to:i,text:o,rules:a,plugin:u}=e,{view:s}=n;if(s.composing)return!1;const c=s.state.doc.resolve(r);if(c.parent.type.spec.code||!((t=c.nodeBefore||c.nodeAfter)===null||t===void 0)&&t.marks.find(d=>d.type.spec.code))return!1;let l=!1;const f=Iwe(c)+o;return a.forEach(d=>{if(l)return;const p=Cwe(f,d.find);if(!p)return;const h=s.state.tr,m=Pb({state:s.state,transaction:h}),g={from:r-(p[0].length-o.length),to:i},{commands:_,chain:S,can:C}=new Wb({editor:n,state:m});d.handler({state:m,range:g,match:p,commands:_,chain:S,can:C})===null||!h.steps.length||(h.setMeta(u,{transform:h,from:r,to:i,text:o}),s.dispatch(h),l=!0)}),l}function Owe(e){const{editor:t,rules:n}=e,r=new Rr({state:{init(){return null},apply(i,o){const a=i.getMeta(r);return a||(i.selectionSet||i.docChanged?null:o)}},props:{handleTextInput(i,o,a,u){return ox({editor:t,from:o,to:a,text:u,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ox({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?ox({editor:t,from:a.pos,to:a.pos,text:`
39
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function wwe(e){return typeof e=="number"}class Ewe{constructor(t){this.find=t.find,this.handler=t.handler}}const xwe=(e,t)=>{if(rx(t))return[...e.matchAll(t)];const n=t(e);return n?n.map(r=>{const i=[r.text];return i.index=r.index,i.input=e,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function Mwe(e){const{editor:t,state:n,from:r,to:i,rule:o}=e,{commands:a,chain:u,can:s}=new Wb({editor:t,state:n}),c=[];return n.doc.nodesBetween(r,i,(f,d)=>{if(!f.isTextblock||f.type.spec.code)return;const p=Math.max(r,d),h=Math.min(i,d+f.content.size),m=f.textBetween(p-d,h-d,void 0,"");xwe(m,o.find).forEach(_=>{if(_.index===void 0)return;const S=p+_.index+1,C=S+_[0].length,b={from:n.tr.mapping.map(S),to:n.tr.mapping.map(C)},w=o.handler({state:n,range:b,match:_,commands:a,chain:u,can:s});c.push(w)})}),c.every(f=>f!==null)}function Rwe(e){const{editor:t,rules:n}=e;let r=null,i=!1,o=!1;return n.map(u=>new Rr({view(s){const c=l=>{var f;r=!((f=s.dom.parentElement)===null||f===void 0)&&f.contains(l.target)?s.dom.parentElement:null};return window.addEventListener("dragstart",c),{destroy(){window.removeEventListener("dragstart",c)}}},props:{handleDOMEvents:{drop:s=>(o=r===s.dom.parentElement,!1),paste:(s,c)=>{var l;const f=(l=c.clipboardData)===null||l===void 0?void 0:l.getData("text/html");return i=!!(f!=null&&f.includes("data-pm-slice")),!1}}},appendTransaction:(s,c,l)=>{const f=s[0],d=f.getMeta("uiEvent")==="paste"&&!i,p=f.getMeta("uiEvent")==="drop"&&!o;if(!d&&!p)return;const h=c.doc.content.findDiffStart(l.doc.content),m=c.doc.content.findDiffEnd(l.doc.content);if(!wwe(h)||!m||h===m.b)return;const g=l.tr,_=Pb({state:l,transaction:g});if(!(!Mwe({editor:t,state:_,from:Math.max(h-1,0),to:m.b-1,rule:u})||!g.steps.length))return g}}))}function kwe(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return[...new Set(t)]}class Oc{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=Oc.resolve(t),this.schema=T4(this.extensions,n),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const o={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:nx(r.name,this.schema)};r.type==="mark"&&(!((i=Me(ce(r,"keepOnSplit",o)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const a=ce(r,"onBeforeCreate",o);a&&this.editor.on("beforeCreate",a);const u=ce(r,"onCreate",o);u&&this.editor.on("create",u);const s=ce(r,"onUpdate",o);s&&this.editor.on("update",s);const c=ce(r,"onSelectionUpdate",o);c&&this.editor.on("selectionUpdate",c);const l=ce(r,"onTransaction",o);l&&this.editor.on("transaction",l);const f=ce(r,"onFocus",o);f&&this.editor.on("focus",f);const d=ce(r,"onBlur",o);d&&this.editor.on("blur",d);const p=ce(r,"onDestroy",o);p&&this.editor.on("destroy",p)})}static resolve(t){const n=Oc.sort(Oc.flatten(t)),r=kwe(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(t){return t.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=ce(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(t){return t.sort((r,i)=>{const o=ce(r,"priority")||100,a=ce(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((t,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:nx(n.name,this.schema)},i=ce(n,"addCommands",r);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this,n=Oc.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(a=>{const u={name:a.name,options:a.options,storage:a.storage,editor:t,type:nx(a.name,this.schema)},s=[],c=ce(a,"addKeyboardShortcuts",u);let l={};if(a.type==="mark"&&a.config.exitable&&(l.ArrowRight=()=>Qh.handleExit({editor:t,mark:a})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,_])=>[g,()=>_({editor:t})]));l={...l,...m}}const f=GOe(l);s.push(f);const d=ce(a,"addInputRules",u);I4(a,t.options.enableInputRules)&&d&&r.push(...d());const p=ce(a,"addPasteRules",u);I4(a,t.options.enablePasteRules)&&p&&i.push(...p());const h=ce(a,"addProseMirrorPlugins",u);if(h){const m=h();s.push(...m)}return s}).flat();return[Owe({editor:t,rules:r}),...Rwe({editor:t,rules:i}),...o]}get attributes(){return b4(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=jb(this.extensions);return Object.fromEntries(n.filter(r=>!!ce(r,"addNodeView")).map(r=>{const i=this.attributes.filter(s=>s.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:t,type:Xt(r.name,this.schema)},a=ce(r,"addNodeView",o);if(!a)return[];const u=(s,c,l,f)=>{const d=tx(s,i);return a()({editor:t,node:s,getPos:l,decorations:f,HTMLAttributes:d,extension:r})};return[r.name,u]}))}}function Awe(e){return Object.prototype.toString.call(e).slice(8,-1)}function ax(e){return Awe(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Lb(e,t){const n={...e};return ax(e)&&ax(t)&&Object.keys(t).forEach(r=>{ax(t[r])?r in e?n[r]=Lb(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}class dr{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Me(ce(this,"addOptions",{name:this.name}))),this.storage=Me(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new dr(t)}configure(t={}){const n=this.extend();return n.options=Lb(this.options,t),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){const n=new dr(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Me(ce(n,"addOptions",{name:n.name})),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}}function C4(e,t,n){const{from:r,to:i}=t,{blockSeparator:o=`
40
40
 
41
- `,textSerializers:a={}}=n||{};let u="",s=!0;return e.nodesBetween(r,i,(c,l,f,d)=>{var p;const h=a==null?void 0:a[c.type.name];h?(c.isBlock&&!s&&(u+=o,s=!0),f&&(u+=h({node:c,pos:l,parent:f,index:d,range:t}))):c.isText?(u+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,l)-l,i-l),s=!1):c.isBlock&&!s&&(u+=o,s=!0)}),u}function O4(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const wwe=fr.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Rr({key:new Ni("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,a=Math.min(...o.map(l=>l.$from.pos)),u=Math.max(...o.map(l=>l.$to.pos)),s=O4(n);return C4(r,{from:a,to:u},{textSerializers:s})}}})]}}),Ewe=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),xwe=(e=!1)=>({commands:t})=>t.setContent("",e),Mwe=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:a})=>{e.doc.nodesBetween(o.pos,a.pos,(u,s)=>{if(u.type.isText)return;const{doc:c,mapping:l}=t,f=c.resolve(l.map(s)),d=c.resolve(l.map(s+u.nodeSize)),p=f.blockRange(d);if(!p)return;const h=Nf(p);if(u.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());t.setNodeMarkup(p.start,m)}(h||h===0)&&t.lift(p,h)})}),!0},Rwe=e=>t=>e(t),kwe=()=>({state:e,dispatch:t})=>twe(e,t),Awe=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(t){const u=i.before(o),s=i.after(o);e.delete(u,s).scrollIntoView()}return!0}return!1},Fwe=e=>({tr:t,state:n,dispatch:r})=>{const i=Xt(e,n.schema),o=t.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const s=o.before(a),c=o.after(a);t.delete(s,c).scrollIntoView()}return!0}return!1},Nwe=e=>({tr:t,dispatch:n})=>{const{from:r,to:i}=e;return n&&t.delete(r,i),!0},Pwe=()=>({state:e,dispatch:t})=>qOe(e,t),Wwe=()=>({commands:e})=>e.keyboardShortcut("Enter"),jwe=()=>({state:e,dispatch:t})=>ewe(e,t);function Bb(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>n.strict?t[i]===e[i]:ax(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function lx(e,t,n={}){return e.find(r=>r.type===t&&Bb(r.attrs,n))}function Lwe(e,t,n={}){return!!lx(e,t,n)}function fx(e,t,n={}){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(e.parentOffset===r.offset&&r.offset!==0&&(r=e.parent.childBefore(e.parentOffset)),!r.node)return;const i=lx([...r.node.marks],t,n);if(!i)return;let o=r.index,a=e.start()+r.offset,u=o+1,s=a+r.node.nodeSize;for(lx([...r.node.marks],t,n);o>0&&i.isInSet(e.parent.child(o-1).marks);)o-=1,a-=e.parent.child(o).nodeSize;for(;u<e.parent.childCount&&Lwe([...e.parent.child(u).marks],t,n);)s+=e.parent.child(u).nodeSize,u+=1;return{from:a,to:s}}function Du(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const Dwe=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const o=Du(e,r.schema),{doc:a,selection:u}=n,{$from:s,from:c,to:l}=u;if(i){const f=fx(s,o,t);if(f&&f.from<=c&&f.to>=l){const d=Be.create(a,f.from,f.to);n.setSelection(d)}}return!0},Bwe=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function dx(e){return e instanceof Be}function Ra(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function w4(e,t=null){if(!t)return null;const n=Ne.atStart(e),r=Ne.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const i=n.from,o=r.to;return t==="all"?Be.create(e,Ra(0,i,o),Ra(e.content.size,i,o)):Be.create(e,Ra(t,i,o),Ra(t,i,o))}function Ub(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Uwe=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};const a=()=>{Ub()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!dx(n.state.selection))return a(),!0;const u=w4(i.doc,e)||n.state.selection,s=n.state.selection.eq(u);return o&&(s||i.setSelection(u),s&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},qwe=(e,t)=>n=>e.every((r,i)=>t(r,{...n,index:i})),zwe=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t);function E4(e){const t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,"text/html").body}function qb(e,t,n){if(n={slice:!0,parseOptions:{},...n},typeof e=="object"&&e!==null)try{return Array.isArray(e)&&e.length>0?K.fromArray(e.map(r=>t.nodeFromJSON(r))):t.nodeFromJSON(e)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),qb("",t,n)}if(typeof e=="string"){const r=kf.fromSchema(t);return n.slice?r.parseSlice(E4(e),n.parseOptions).content:r.parse(E4(e),n.parseOptions)}return qb("",t,n)}function Kwe(e,t,n){const r=e.steps.length-1;if(r<t)return;const i=e.steps[r];if(!(i instanceof wn||i instanceof Zt))return;const o=e.mapping.maps[r];let a=0;o.forEach((u,s,c,l)=>{a===0&&(a=l)}),e.setSelection(Ne.near(e.doc.resolve(a),n))}const Vwe=e=>e.toString().startsWith("<"),Hwe=(e,t,n)=>({tr:r,dispatch:i,editor:o})=>{if(i){n={parseOptions:{},updateSelection:!0,...n};const a=qb(t,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(a.toString()==="<>")return!0;let{from:u,to:s}=typeof e=="number"?{from:e,to:e}:e,c=!0,l=!0;if((Vwe(a)?a:[a]).forEach(d=>{d.check(),c=c?d.isText&&d.marks.length===0:!1,l=l?d.isBlock:!1}),u===s&&l){const{parent:d}=r.doc.resolve(u);d.isTextblock&&!d.type.spec.code&&!d.childCount&&(u-=1,s+=1)}c?Array.isArray(t)?r.insertText(t.map(d=>d.text||"").join(""),u,s):typeof t=="object"&&t&&t.text?r.insertText(t.text,u,s):r.insertText(t,u,s):r.replaceWith(u,s,a),n.updateSelection&&Kwe(r,r.steps.length-1,-1)}return!0},Gwe=()=>({state:e,dispatch:t})=>JOe(e,t),Ywe=()=>({state:e,dispatch:t})=>ZOe(e,t),Jwe=()=>({state:e,dispatch:t})=>KOe(e,t),Zwe=()=>({state:e,dispatch:t})=>GOe(e,t);function x4(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Xwe(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,i,o,a;for(let u=0;u<t.length-1;u+=1){const s=t[u];if(/^(cmd|meta|m)$/i.test(s))a=!0;else if(/^a(lt)?$/i.test(s))r=!0;else if(/^(c|ctrl|control)$/i.test(s))i=!0;else if(/^s(hift)?$/i.test(s))o=!0;else if(/^mod$/i.test(s))Ub()||x4()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${s}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const Qwe=e=>({editor:t,view:n,tr:r,dispatch:i})=>{const o=Xwe(e).split(/-(?!$)/),a=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),s=t.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,u))});return s==null||s.steps.forEach(c=>{const l=c.map(r.mapping);l&&i&&r.maybeStep(l)}),!0};function em(e,t,n={}){const{from:r,to:i,empty:o}=e.selection,a=t?Xt(t,e.schema):null,u=[];e.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;const p=Math.max(r,d),h=Math.min(i,d+f.nodeSize);u.push({node:f,from:p,to:h})});const s=i-r,c=u.filter(f=>a?a.name===f.node.type.name:!0).filter(f=>Bb(f.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((f,d)=>f+d.to-d.from,0)>=s}const eEe=(e,t={})=>({state:n,dispatch:r})=>{const i=Xt(e,n.schema);return em(n,i,t)?XOe(n,r):!1},tEe=()=>({state:e,dispatch:t})=>nwe(e,t),nEe=e=>({state:t,dispatch:n})=>{const r=Xt(e,t.schema);return lwe(r)(t,n)},rEe=()=>({state:e,dispatch:t})=>QOe(e,t);function zb(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function M4(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,i)=>(n.includes(i)||(r[i]=e[i]),r),{})}const iEe=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const u=zb(typeof e=="string"?e:e.name,r.schema);return u?(u==="node"&&(o=Xt(e,r.schema)),u==="mark"&&(a=Du(e,r.schema)),i&&n.selection.ranges.forEach(s=>{r.doc.nodesBetween(s.$from.pos,s.$to.pos,(c,l)=>{o&&o===c.type&&n.setNodeMarkup(l,void 0,M4(c.attrs,t)),a&&c.marks.length&&c.marks.forEach(f=>{a===f.type&&n.addMark(l,l+c.nodeSize,a.create(M4(f.attrs,t)))})})}),!0):!1},oEe=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),aEe=()=>({tr:e,commands:t})=>t.setTextSelection({from:0,to:e.doc.content.size}),uEe=()=>({state:e,dispatch:t})=>VOe(e,t),sEe=()=>({state:e,dispatch:t})=>YOe(e,t),cEe=()=>({state:e,dispatch:t})=>rwe(e,t),lEe=()=>({state:e,dispatch:t})=>awe(e,t),fEe=()=>({state:e,dispatch:t})=>owe(e,t);function R4(e,t,n={}){return qb(e,t,{slice:!1,parseOptions:n})}const dEe=(e,t=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:a}=r,u=R4(e,i.schema,n);return o&&r.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0};function pEe(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function hEe(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function px(e){return t=>hEe(t.$from,e)}function mEe(e,t){const n=bo.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function vEe(e,t){const n=Oc.resolve(e);return T4(n,t)}function gEe(e,t){const n={from:0,to:e.content.size};return C4(e,n,t)}function Kb(e,t){const n=Du(t,e.schema),{from:r,to:i,empty:o}=e.selection,a=[];o?(e.storedMarks&&a.push(...e.storedMarks),a.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,s=>{a.push(...s.marks)});const u=a.find(s=>s.type.name===n.name);return u?{...u.attrs}:{}}function yEe(e,t){const n=Xt(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,u=>{o.push(u)});const a=o.reverse().find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function bEe(e,t){const n=zb(typeof t=="string"?t:t.name,e.schema);return n==="node"?yEe(e,t):n==="mark"?Kb(e,t):{}}function k4(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(i=>{const o=n.resolve(e-1),a=fx(o,i.type);a&&r.push({mark:i,...a})}):n.nodesBetween(e,t,(i,o)=>{r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function Vb(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=e.find(o=>o.type===t&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function hx(e,t,n={}){const{empty:r,ranges:i}=e.selection,o=t?Du(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>Bb(f.attrs,n,{strict:!1}));let a=0;const u=[];if(i.forEach(({$from:f,$to:d})=>{const p=f.pos,h=d.pos;e.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;const _=Math.max(p,g),S=Math.min(h,g+m.nodeSize),C=S-_;a+=C,u.push(...m.marks.map(b=>({mark:b,from:_,to:S})))})}),a===0)return!1;const s=u.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>Bb(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),c=u.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,d)=>f+d.to-d.from,0);return(s>0?s+c:s)>=a}function _Ee(e,t,n={}){if(!t)return em(e,null,n)||hx(e,null,n);const r=zb(t,e.schema);return r==="node"?em(e,t,n):r==="mark"?hx(e,t,n):!1}function A4(e,t){const{nodeExtensions:n}=Lb(t),r=n.find(a=>a.name===e);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=Me(ce(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function $Ee(e){var t;const n=(t=e.type.createAndFill())===null||t===void 0?void 0:t.toJSON(),r=e.toJSON();return JSON.stringify(n)===JSON.stringify(r)}function SEe(e){return e instanceof ve}function TEe(e,t,n){const i=e.state.doc.content.size,o=Ra(t,0,i),a=Ra(n,0,i),u=e.coordsAtPos(o),s=e.coordsAtPos(a,-1),c=Math.min(u.top,s.top),l=Math.max(u.bottom,s.bottom),f=Math.min(u.left,s.left),d=Math.max(u.right,s.right),p=d-f,h=l-c,_={top:c,bottom:l,left:f,right:d,width:p,height:h,x:f,y:c};return{..._,toJSON:()=>_}}function IEe(e,t,n){var r;const{selection:i}=t;let o=null;if(dx(i)&&(o=i.$cursor),o){const u=(r=e.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(u)||!u.some(s=>s.type.excludes(n))}const{ranges:a}=i;return a.some(({$from:u,$to:s})=>{let c=u.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(u.pos,s.pos,(l,f,d)=>{if(c)return!1;if(l.isInline){const p=!d||d.type.allowsMarkType(n),h=!!n.isInSet(l.marks)||!l.marks.some(m=>m.type.excludes(n));c=p&&h}return!c}),c})}const CEe=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:a,ranges:u}=o,s=Du(e,r.schema);if(i)if(a){const c=Kb(r,s);n.addStoredMark(s.create({...c,...t}))}else u.forEach(c=>{const l=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(l,f,(d,p)=>{const h=Math.max(p,l),m=Math.min(p+d.nodeSize,f);d.marks.find(_=>_.type===s)?d.marks.forEach(_=>{s===_.type&&n.addMark(h,m,s.create({..._.attrs,...t}))}):n.addMark(h,m,s.create(t))})});return IEe(r,n,s)},OEe=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),wEe=(e,t={})=>({state:n,dispatch:r,chain:i})=>{const o=Xt(e,n.schema);return o.isTextblock?i().command(({commands:a})=>y4(o,t)(n)?!0:a.clearNodes()).command(({state:a})=>y4(o,t)(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},EEe=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,i=Ra(e,0,r.content.size),o=ve.create(r,i);t.setSelection(o)}return!0},xEe=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:i,to:o}=typeof e=="number"?{from:e,to:e}:e,a=Be.atStart(r).from,u=Be.atEnd(r).to,s=Ra(i,a,u),c=Ra(o,a,u),l=Be.create(r,s,c);t.setSelection(l)}return!0},MEe=e=>({state:t,dispatch:n})=>{const r=Xt(e,t.schema);return pwe(r)(t,n)};function F4(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(i=>t==null?void 0:t.includes(i.type.name));e.tr.ensureMarks(r)}}const REe=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:a}=t,{$from:u,$to:s}=o,c=i.extensionManager.attributes,l=Vb(c,u.node().type.name,u.node().attrs);if(o instanceof ve&&o.node.isBlock)return!u.parentOffset||!Pf(a,u.pos)?!1:(r&&(e&&F4(n,i.extensionManager.splittableMarks),t.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;if(r){const f=s.parentOffset===s.parent.content.size;o instanceof Be&&t.deleteSelection();const d=u.depth===0?void 0:pEe(u.node(-1).contentMatchAt(u.indexAfter(-1)));let p=f&&d?[{type:d,attrs:l}]:void 0,h=Pf(t.doc,t.mapping.map(u.pos),1,p);if(!p&&!h&&Pf(t.doc,t.mapping.map(u.pos),1,d?[{type:d}]:void 0)&&(h=!0,p=d?[{type:d,attrs:l}]:void 0),h&&(t.split(t.mapping.map(u.pos),1,p),d&&!f&&!u.parentOffset&&u.parent.type!==d)){const m=t.mapping.map(u.before()),g=t.doc.resolve(m);u.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&t.setNodeMarkup(t.mapping.map(u.before()),d)}e&&F4(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return!0},kEe=e=>({tr:t,state:n,dispatch:r,editor:i})=>{var o;const a=Xt(e,n.schema),{$from:u,$to:s}=n.selection,c=n.selection.node;if(c&&c.isBlock||u.depth<2||!u.sameParent(s))return!1;const l=u.node(-1);if(l.type!==a)return!1;const f=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(r){let g=K.empty;const _=u.index(-1)?1:u.index(-2)?2:3;for(let M=u.depth-_;M>=u.depth-3;M-=1)g=K.from(u.node(M).copy(g));const S=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,C=Vb(f,u.node().type.name,u.node().attrs),b=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(C))||void 0;g=g.append(K.from(a.createAndFill(null,b)||void 0));const w=u.before(u.depth-(_-1));t.replace(w,u.after(-S),new ae(g,4-_,0));let O=-1;t.doc.nodesBetween(w,t.doc.content.size,(M,x)=>{if(O>-1)return!1;M.isTextblock&&M.content.size===0&&(O=x+1)}),O>-1&&t.setSelection(Be.near(t.doc.resolve(O))),t.scrollIntoView()}return!0}const d=s.pos===u.end()?l.contentMatchAt(0).defaultType:null,p=Vb(f,l.type.name,l.attrs),h=Vb(f,u.node().type.name,u.node().attrs);t.delete(u.pos,s.pos);const m=d?[{type:a,attrs:p},{type:d,attrs:h}]:[{type:a,attrs:p}];if(!Pf(t.doc,u.pos,2))return!1;if(r){const{selection:g,storedMarks:_}=n,{splittableMarks:S}=i.extensionManager,C=_||g.$to.parentOffset&&g.$from.marks();if(t.split(u.pos,2,m).scrollIntoView(),!C||!r)return!0;const b=C.filter(w=>S.includes(w.type.name));t.ensureMarks(b)}return!0},mx=(e,t)=>{const n=px(a=>a.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Mu(e.doc,n.pos)&&e.join(n.pos),!0},vx=(e,t)=>{const n=px(a=>a.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Mu(e.doc,r)&&e.join(r),!0};var AEe=Object.freeze({__proto__:null,blur:Ewe,clearContent:xwe,clearNodes:Mwe,command:Rwe,createParagraphNear:kwe,deleteCurrentNode:Awe,deleteNode:Fwe,deleteRange:Nwe,deleteSelection:Pwe,enter:Wwe,exitCode:jwe,extendMarkRange:Dwe,first:Bwe,focus:Uwe,forEach:qwe,insertContent:zwe,insertContentAt:Hwe,joinUp:Gwe,joinDown:Ywe,joinBackward:Jwe,joinForward:Zwe,keyboardShortcut:Qwe,lift:eEe,liftEmptyBlock:tEe,liftListItem:nEe,newlineInCode:rEe,resetAttributes:iEe,scrollIntoView:oEe,selectAll:aEe,selectNodeBackward:uEe,selectNodeForward:sEe,selectParentNode:cEe,selectTextblockEnd:lEe,selectTextblockStart:fEe,setContent:dEe,setMark:CEe,setMeta:OEe,setNode:wEe,setNodeSelection:EEe,setTextSelection:xEe,sinkListItem:MEe,splitBlock:REe,splitListItem:kEe,toggleList:(e,t,n,r={})=>({editor:i,tr:o,state:a,dispatch:u,chain:s,commands:c,can:l})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,p=Xt(e,a.schema),h=Xt(t,a.schema),{selection:m,storedMarks:g}=a,{$from:_,$to:S}=m,C=_.blockRange(S),b=g||m.$to.parentOffset&&m.$from.marks();if(!C)return!1;const w=px(O=>A4(O.type.name,f))(m);if(C.depth>=1&&w&&C.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(h);if(A4(w.node.type.name,f)&&p.validContent(w.node.content)&&u)return s().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>mx(o,p)).command(()=>vx(o,p)).run()}return!n||!b||!u?s().command(()=>l().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>mx(o,p)).command(()=>vx(o,p)).run():s().command(()=>{const O=l().wrapInList(p,r),M=b.filter(x=>d.includes(x.type.name));return o.ensureMarks(M),O?!0:c.clearNodes()}).wrapInList(p,r).command(()=>mx(o,p)).command(()=>vx(o,p)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,a=Du(e,r.schema);return hx(r,a,t)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,t)},toggleNode:(e,t,n={})=>({state:r,commands:i})=>{const o=Xt(e,r.schema),a=Xt(t,r.schema);return em(r,o,n)?i.setNode(a):i.setNode(o,n)},toggleWrap:(e,t={})=>({state:n,commands:r})=>{const i=Xt(e,n.schema);return em(n,i,t)?r.lift(i):r.wrapIn(i,t)},undoInputRule:()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){const a=e.tr,u=o.transform;for(let s=u.steps.length-1;s>=0;s-=1)a.step(u.steps[s].invert(u.docs[s]));if(o.text){const s=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,e.schema.text(o.text,s))}else a.delete(o.from,o.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=t,{selection:u}=n,s=Du(e,r.schema),{$from:c,empty:l,ranges:f}=u;if(!i)return!0;if(l&&a){let{from:d,to:p}=u;const h=(o=c.marks().find(g=>g.type===s))===null||o===void 0?void 0:o.attrs,m=fx(c,s,h);m&&(d=m.from,p=m.to),n.removeMark(d,p,s)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,s)});return n.removeStoredMark(s),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const u=zb(typeof e=="string"?e:e.name,r.schema);return u?(u==="node"&&(o=Xt(e,r.schema)),u==="mark"&&(a=Du(e,r.schema)),i&&n.selection.ranges.forEach(s=>{const c=s.$from.pos,l=s.$to.pos;r.doc.nodesBetween(c,l,(f,d)=>{o&&o===f.type&&n.setNodeMarkup(d,void 0,{...f.attrs,...t}),a&&f.marks.length&&f.marks.forEach(p=>{if(a===p.type){const h=Math.max(d,c),m=Math.min(d+f.nodeSize,l);n.addMark(h,m,a.create({...p.attrs,...t}))}})})}),!0):!1},wrapIn:(e,t={})=>({state:n,dispatch:r})=>{const i=Xt(e,n.schema);return uwe(i,t)(n,r)},wrapInList:(e,t={})=>({state:n,dispatch:r})=>{const i=Xt(e,n.schema);return swe(i,t)(n,r)}});const FEe=fr.create({name:"commands",addCommands(){return{...AEe}}}),NEe=fr.create({name:"editable",addProseMirrorPlugins(){return[new Rr({key:new Ni("editable"),props:{editable:()=>this.editor.options.editable}})]}}),PEe=fr.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Rr({key:new Ni("focusEvents"),props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),WEe=fr.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:u})=>{const{selection:s,doc:c}=u,{empty:l,$anchor:f}=s,{pos:d,parent:p}=f,h=Ne.atStart(c).from===d;return!l||!h||!p.type.isTextblock||p.textContent.length?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ub()||x4()?o:i},addProseMirrorPlugins(){return[new Rr({key:new Ni("clearDocument"),appendTransaction:(e,t,n)=>{if(!(e.some(h=>h.docChanged)&&!t.doc.eq(n.doc)))return;const{empty:i,from:o,to:a}=t.selection,u=Ne.atStart(t.doc).from,s=Ne.atEnd(t.doc).to;if(i||!(o===u&&a===s)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,d=Wb({state:n,transaction:f}),{commands:p}=new jb({editor:this.editor,state:d});if(p.clearNodes(),!!f.steps.length)return f}})]}}),jEe=fr.create({name:"tabindex",addProseMirrorPlugins(){return[new Rr({key:new Ni("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var LEe=Object.freeze({__proto__:null,ClipboardTextSerializer:wwe,Commands:FEe,Editable:NEe,FocusEvents:PEe,Keymap:WEe,Tabindex:jEe});const DEe=`.ProseMirror {
41
+ `,textSerializers:a={}}=n||{};let u="",s=!0;return e.nodesBetween(r,i,(c,l,f,d)=>{var p;const h=a==null?void 0:a[c.type.name];h?(c.isBlock&&!s&&(u+=o,s=!0),f&&(u+=h({node:c,pos:l,parent:f,index:d,range:t}))):c.isText?(u+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,l)-l,i-l),s=!1):c.isBlock&&!s&&(u+=o,s=!0)}),u}function O4(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const Fwe=dr.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Rr({key:new Ni("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,a=Math.min(...o.map(l=>l.$from.pos)),u=Math.max(...o.map(l=>l.$to.pos)),s=O4(n);return C4(r,{from:a,to:u},{textSerializers:s})}}})]}}),Nwe=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),Pwe=(e=!1)=>({commands:t})=>t.setContent("",e),Wwe=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:a})=>{e.doc.nodesBetween(o.pos,a.pos,(u,s)=>{if(u.type.isText)return;const{doc:c,mapping:l}=t,f=c.resolve(l.map(s)),d=c.resolve(l.map(s+u.nodeSize)),p=f.blockRange(d);if(!p)return;const h=Ff(p);if(u.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());t.setNodeMarkup(p.start,m)}(h||h===0)&&t.lift(p,h)})}),!0},jwe=e=>t=>e(t),Lwe=()=>({state:e,dispatch:t})=>swe(e,t),Dwe=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(t){const u=i.before(o),s=i.after(o);e.delete(u,s).scrollIntoView()}return!0}return!1},Bwe=e=>({tr:t,state:n,dispatch:r})=>{const i=Xt(e,n.schema),o=t.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const s=o.before(a),c=o.after(a);t.delete(s,c).scrollIntoView()}return!0}return!1},Uwe=e=>({tr:t,dispatch:n})=>{const{from:r,to:i}=e;return n&&t.delete(r,i),!0},qwe=()=>({state:e,dispatch:t})=>JOe(e,t),zwe=()=>({commands:e})=>e.keyboardShortcut("Enter"),Kwe=()=>({state:e,dispatch:t})=>uwe(e,t);function Db(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>n.strict?t[i]===e[i]:rx(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function ux(e,t,n={}){return e.find(r=>r.type===t&&Db(r.attrs,n))}function Vwe(e,t,n={}){return!!ux(e,t,n)}function sx(e,t,n={}){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(e.parentOffset===r.offset&&r.offset!==0&&(r=e.parent.childBefore(e.parentOffset)),!r.node)return;const i=ux([...r.node.marks],t,n);if(!i)return;let o=r.index,a=e.start()+r.offset,u=o+1,s=a+r.node.nodeSize;for(ux([...r.node.marks],t,n);o>0&&i.isInSet(e.parent.child(o-1).marks);)o-=1,a-=e.parent.child(o).nodeSize;for(;u<e.parent.childCount&&Vwe([...e.parent.child(u).marks],t,n);)s+=e.parent.child(u).nodeSize,u+=1;return{from:a,to:s}}function Du(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const Hwe=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const o=Du(e,r.schema),{doc:a,selection:u}=n,{$from:s,from:c,to:l}=u;if(i){const f=sx(s,o,t);if(f&&f.from<=c&&f.to>=l){const d=Be.create(a,f.from,f.to);n.setSelection(d)}}return!0},Gwe=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function cx(e){return e instanceof Be}function Ra(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function w4(e,t=null){if(!t)return null;const n=Pe.atStart(e),r=Pe.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const i=n.from,o=r.to;return t==="all"?Be.create(e,Ra(0,i,o),Ra(e.content.size,i,o)):Be.create(e,Ra(t,i,o),Ra(t,i,o))}function Bb(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Ywe=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};const a=()=>{Bb()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!cx(n.state.selection))return a(),!0;const u=w4(i.doc,e)||n.state.selection,s=n.state.selection.eq(u);return o&&(s||i.setSelection(u),s&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},Jwe=(e,t)=>n=>e.every((r,i)=>t(r,{...n,index:i})),Zwe=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t);function E4(e){const t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,"text/html").body}function Ub(e,t,n){if(n={slice:!0,parseOptions:{},...n},typeof e=="object"&&e!==null)try{return Array.isArray(e)&&e.length>0?K.fromArray(e.map(r=>t.nodeFromJSON(r))):t.nodeFromJSON(e)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),Ub("",t,n)}if(typeof e=="string"){const r=Rf.fromSchema(t);return n.slice?r.parseSlice(E4(e),n.parseOptions).content:r.parse(E4(e),n.parseOptions)}return Ub("",t,n)}function Xwe(e,t,n){const r=e.steps.length-1;if(r<t)return;const i=e.steps[r];if(!(i instanceof wn||i instanceof Zt))return;const o=e.mapping.maps[r];let a=0;o.forEach((u,s,c,l)=>{a===0&&(a=l)}),e.setSelection(Pe.near(e.doc.resolve(a),n))}const Qwe=e=>e.toString().startsWith("<"),eEe=(e,t,n)=>({tr:r,dispatch:i,editor:o})=>{if(i){n={parseOptions:{},updateSelection:!0,...n};const a=Ub(t,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(a.toString()==="<>")return!0;let{from:u,to:s}=typeof e=="number"?{from:e,to:e}:e,c=!0,l=!0;if((Qwe(a)?a:[a]).forEach(d=>{d.check(),c=c?d.isText&&d.marks.length===0:!1,l=l?d.isBlock:!1}),u===s&&l){const{parent:d}=r.doc.resolve(u);d.isTextblock&&!d.type.spec.code&&!d.childCount&&(u-=1,s+=1)}c?Array.isArray(t)?r.insertText(t.map(d=>d.text||"").join(""),u,s):typeof t=="object"&&t&&t.text?r.insertText(t.text,u,s):r.insertText(t,u,s):r.replaceWith(u,s,a),n.updateSelection&&Xwe(r,r.steps.length-1,-1)}return!0},tEe=()=>({state:e,dispatch:t})=>rwe(e,t),nEe=()=>({state:e,dispatch:t})=>iwe(e,t),rEe=()=>({state:e,dispatch:t})=>XOe(e,t),iEe=()=>({state:e,dispatch:t})=>twe(e,t);function x4(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function oEe(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,i,o,a;for(let u=0;u<t.length-1;u+=1){const s=t[u];if(/^(cmd|meta|m)$/i.test(s))a=!0;else if(/^a(lt)?$/i.test(s))r=!0;else if(/^(c|ctrl|control)$/i.test(s))i=!0;else if(/^s(hift)?$/i.test(s))o=!0;else if(/^mod$/i.test(s))Bb()||x4()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${s}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const aEe=e=>({editor:t,view:n,tr:r,dispatch:i})=>{const o=oEe(e).split(/-(?!$)/),a=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),s=t.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,u))});return s==null||s.steps.forEach(c=>{const l=c.map(r.mapping);l&&i&&r.maybeStep(l)}),!0};function Xh(e,t,n={}){const{from:r,to:i,empty:o}=e.selection,a=t?Xt(t,e.schema):null,u=[];e.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;const p=Math.max(r,d),h=Math.min(i,d+f.nodeSize);u.push({node:f,from:p,to:h})});const s=i-r,c=u.filter(f=>a?a.name===f.node.type.name:!0).filter(f=>Db(f.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((f,d)=>f+d.to-d.from,0)>=s}const uEe=(e,t={})=>({state:n,dispatch:r})=>{const i=Xt(e,n.schema);return Xh(n,i,t)?owe(n,r):!1},sEe=()=>({state:e,dispatch:t})=>cwe(e,t),cEe=e=>({state:t,dispatch:n})=>{const r=Xt(e,t.schema);return gwe(r)(t,n)},lEe=()=>({state:e,dispatch:t})=>awe(e,t);function qb(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function M4(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,i)=>(n.includes(i)||(r[i]=e[i]),r),{})}const fEe=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const u=qb(typeof e=="string"?e:e.name,r.schema);return u?(u==="node"&&(o=Xt(e,r.schema)),u==="mark"&&(a=Du(e,r.schema)),i&&n.selection.ranges.forEach(s=>{r.doc.nodesBetween(s.$from.pos,s.$to.pos,(c,l)=>{o&&o===c.type&&n.setNodeMarkup(l,void 0,M4(c.attrs,t)),a&&c.marks.length&&c.marks.forEach(f=>{a===f.type&&n.addMark(l,l+c.nodeSize,a.create(M4(f.attrs,t)))})})}),!0):!1},dEe=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),pEe=()=>({tr:e,commands:t})=>t.setTextSelection({from:0,to:e.doc.content.size}),hEe=()=>({state:e,dispatch:t})=>QOe(e,t),mEe=()=>({state:e,dispatch:t})=>nwe(e,t),vEe=()=>({state:e,dispatch:t})=>lwe(e,t),gEe=()=>({state:e,dispatch:t})=>pwe(e,t),yEe=()=>({state:e,dispatch:t})=>dwe(e,t);function R4(e,t,n={}){return Ub(e,t,{slice:!1,parseOptions:n})}const bEe=(e,t=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:a}=r,u=R4(e,i.schema,n);return o&&r.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0};function _Ee(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function $Ee(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function lx(e){return t=>$Ee(t.$from,e)}function SEe(e,t){const n=yo.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function TEe(e,t){const n=Oc.resolve(e);return T4(n,t)}function IEe(e,t){const n={from:0,to:e.content.size};return C4(e,n,t)}function zb(e,t){const n=Du(t,e.schema),{from:r,to:i,empty:o}=e.selection,a=[];o?(e.storedMarks&&a.push(...e.storedMarks),a.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,s=>{a.push(...s.marks)});const u=a.find(s=>s.type.name===n.name);return u?{...u.attrs}:{}}function CEe(e,t){const n=Xt(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,u=>{o.push(u)});const a=o.reverse().find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function OEe(e,t){const n=qb(typeof t=="string"?t:t.name,e.schema);return n==="node"?CEe(e,t):n==="mark"?zb(e,t):{}}function k4(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(i=>{const o=n.resolve(e-1),a=sx(o,i.type);a&&r.push({mark:i,...a})}):n.nodesBetween(e,t,(i,o)=>{r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function Kb(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=e.find(o=>o.type===t&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function fx(e,t,n={}){const{empty:r,ranges:i}=e.selection,o=t?Du(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>Db(f.attrs,n,{strict:!1}));let a=0;const u=[];if(i.forEach(({$from:f,$to:d})=>{const p=f.pos,h=d.pos;e.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;const _=Math.max(p,g),S=Math.min(h,g+m.nodeSize),C=S-_;a+=C,u.push(...m.marks.map(b=>({mark:b,from:_,to:S})))})}),a===0)return!1;const s=u.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>Db(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),c=u.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,d)=>f+d.to-d.from,0);return(s>0?s+c:s)>=a}function wEe(e,t,n={}){if(!t)return Xh(e,null,n)||fx(e,null,n);const r=qb(t,e.schema);return r==="node"?Xh(e,t,n):r==="mark"?fx(e,t,n):!1}function A4(e,t){const{nodeExtensions:n}=jb(t),r=n.find(a=>a.name===e);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=Me(ce(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function EEe(e){var t;const n=(t=e.type.createAndFill())===null||t===void 0?void 0:t.toJSON(),r=e.toJSON();return JSON.stringify(n)===JSON.stringify(r)}function xEe(e){return e instanceof ve}function MEe(e,t,n){const i=e.state.doc.content.size,o=Ra(t,0,i),a=Ra(n,0,i),u=e.coordsAtPos(o),s=e.coordsAtPos(a,-1),c=Math.min(u.top,s.top),l=Math.max(u.bottom,s.bottom),f=Math.min(u.left,s.left),d=Math.max(u.right,s.right),p=d-f,h=l-c,_={top:c,bottom:l,left:f,right:d,width:p,height:h,x:f,y:c};return{..._,toJSON:()=>_}}function REe(e,t,n){var r;const{selection:i}=t;let o=null;if(cx(i)&&(o=i.$cursor),o){const u=(r=e.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(u)||!u.some(s=>s.type.excludes(n))}const{ranges:a}=i;return a.some(({$from:u,$to:s})=>{let c=u.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(u.pos,s.pos,(l,f,d)=>{if(c)return!1;if(l.isInline){const p=!d||d.type.allowsMarkType(n),h=!!n.isInSet(l.marks)||!l.marks.some(m=>m.type.excludes(n));c=p&&h}return!c}),c})}const kEe=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:a,ranges:u}=o,s=Du(e,r.schema);if(i)if(a){const c=zb(r,s);n.addStoredMark(s.create({...c,...t}))}else u.forEach(c=>{const l=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(l,f,(d,p)=>{const h=Math.max(p,l),m=Math.min(p+d.nodeSize,f);d.marks.find(_=>_.type===s)?d.marks.forEach(_=>{s===_.type&&n.addMark(h,m,s.create({..._.attrs,...t}))}):n.addMark(h,m,s.create(t))})});return REe(r,n,s)},AEe=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),FEe=(e,t={})=>({state:n,dispatch:r,chain:i})=>{const o=Xt(e,n.schema);return o.isTextblock?i().command(({commands:a})=>y4(o,t)(n)?!0:a.clearNodes()).command(({state:a})=>y4(o,t)(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},NEe=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,i=Ra(e,0,r.content.size),o=ve.create(r,i);t.setSelection(o)}return!0},PEe=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:i,to:o}=typeof e=="number"?{from:e,to:e}:e,a=Be.atStart(r).from,u=Be.atEnd(r).to,s=Ra(i,a,u),c=Ra(o,a,u),l=Be.create(r,s,c);t.setSelection(l)}return!0},WEe=e=>({state:t,dispatch:n})=>{const r=Xt(e,t.schema);return _we(r)(t,n)};function F4(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(i=>t==null?void 0:t.includes(i.type.name));e.tr.ensureMarks(r)}}const jEe=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:a}=t,{$from:u,$to:s}=o,c=i.extensionManager.attributes,l=Kb(c,u.node().type.name,u.node().attrs);if(o instanceof ve&&o.node.isBlock)return!u.parentOffset||!Nf(a,u.pos)?!1:(r&&(e&&F4(n,i.extensionManager.splittableMarks),t.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;if(r){const f=s.parentOffset===s.parent.content.size;o instanceof Be&&t.deleteSelection();const d=u.depth===0?void 0:_Ee(u.node(-1).contentMatchAt(u.indexAfter(-1)));let p=f&&d?[{type:d,attrs:l}]:void 0,h=Nf(t.doc,t.mapping.map(u.pos),1,p);if(!p&&!h&&Nf(t.doc,t.mapping.map(u.pos),1,d?[{type:d}]:void 0)&&(h=!0,p=d?[{type:d,attrs:l}]:void 0),h&&(t.split(t.mapping.map(u.pos),1,p),d&&!f&&!u.parentOffset&&u.parent.type!==d)){const m=t.mapping.map(u.before()),g=t.doc.resolve(m);u.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&t.setNodeMarkup(t.mapping.map(u.before()),d)}e&&F4(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return!0},LEe=e=>({tr:t,state:n,dispatch:r,editor:i})=>{var o;const a=Xt(e,n.schema),{$from:u,$to:s}=n.selection,c=n.selection.node;if(c&&c.isBlock||u.depth<2||!u.sameParent(s))return!1;const l=u.node(-1);if(l.type!==a)return!1;const f=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(r){let g=K.empty;const _=u.index(-1)?1:u.index(-2)?2:3;for(let M=u.depth-_;M>=u.depth-3;M-=1)g=K.from(u.node(M).copy(g));const S=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,C=Kb(f,u.node().type.name,u.node().attrs),b=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(C))||void 0;g=g.append(K.from(a.createAndFill(null,b)||void 0));const w=u.before(u.depth-(_-1));t.replace(w,u.after(-S),new ae(g,4-_,0));let O=-1;t.doc.nodesBetween(w,t.doc.content.size,(M,x)=>{if(O>-1)return!1;M.isTextblock&&M.content.size===0&&(O=x+1)}),O>-1&&t.setSelection(Be.near(t.doc.resolve(O))),t.scrollIntoView()}return!0}const d=s.pos===u.end()?l.contentMatchAt(0).defaultType:null,p=Kb(f,l.type.name,l.attrs),h=Kb(f,u.node().type.name,u.node().attrs);t.delete(u.pos,s.pos);const m=d?[{type:a,attrs:p},{type:d,attrs:h}]:[{type:a,attrs:p}];if(!Nf(t.doc,u.pos,2))return!1;if(r){const{selection:g,storedMarks:_}=n,{splittableMarks:S}=i.extensionManager,C=_||g.$to.parentOffset&&g.$from.marks();if(t.split(u.pos,2,m).scrollIntoView(),!C||!r)return!0;const b=C.filter(w=>S.includes(w.type.name));t.ensureMarks(b)}return!0},dx=(e,t)=>{const n=lx(a=>a.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Mu(e.doc,n.pos)&&e.join(n.pos),!0},px=(e,t)=>{const n=lx(a=>a.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Mu(e.doc,r)&&e.join(r),!0};var DEe=Object.freeze({__proto__:null,blur:Nwe,clearContent:Pwe,clearNodes:Wwe,command:jwe,createParagraphNear:Lwe,deleteCurrentNode:Dwe,deleteNode:Bwe,deleteRange:Uwe,deleteSelection:qwe,enter:zwe,exitCode:Kwe,extendMarkRange:Hwe,first:Gwe,focus:Ywe,forEach:Jwe,insertContent:Zwe,insertContentAt:eEe,joinUp:tEe,joinDown:nEe,joinBackward:rEe,joinForward:iEe,keyboardShortcut:aEe,lift:uEe,liftEmptyBlock:sEe,liftListItem:cEe,newlineInCode:lEe,resetAttributes:fEe,scrollIntoView:dEe,selectAll:pEe,selectNodeBackward:hEe,selectNodeForward:mEe,selectParentNode:vEe,selectTextblockEnd:gEe,selectTextblockStart:yEe,setContent:bEe,setMark:kEe,setMeta:AEe,setNode:FEe,setNodeSelection:NEe,setTextSelection:PEe,sinkListItem:WEe,splitBlock:jEe,splitListItem:LEe,toggleList:(e,t,n,r={})=>({editor:i,tr:o,state:a,dispatch:u,chain:s,commands:c,can:l})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,p=Xt(e,a.schema),h=Xt(t,a.schema),{selection:m,storedMarks:g}=a,{$from:_,$to:S}=m,C=_.blockRange(S),b=g||m.$to.parentOffset&&m.$from.marks();if(!C)return!1;const w=lx(O=>A4(O.type.name,f))(m);if(C.depth>=1&&w&&C.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(h);if(A4(w.node.type.name,f)&&p.validContent(w.node.content)&&u)return s().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>dx(o,p)).command(()=>px(o,p)).run()}return!n||!b||!u?s().command(()=>l().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>dx(o,p)).command(()=>px(o,p)).run():s().command(()=>{const O=l().wrapInList(p,r),M=b.filter(x=>d.includes(x.type.name));return o.ensureMarks(M),O?!0:c.clearNodes()}).wrapInList(p,r).command(()=>dx(o,p)).command(()=>px(o,p)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,a=Du(e,r.schema);return fx(r,a,t)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,t)},toggleNode:(e,t,n={})=>({state:r,commands:i})=>{const o=Xt(e,r.schema),a=Xt(t,r.schema);return Xh(r,o,n)?i.setNode(a):i.setNode(o,n)},toggleWrap:(e,t={})=>({state:n,commands:r})=>{const i=Xt(e,n.schema);return Xh(n,i,t)?r.lift(i):r.wrapIn(i,t)},undoInputRule:()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){const a=e.tr,u=o.transform;for(let s=u.steps.length-1;s>=0;s-=1)a.step(u.steps[s].invert(u.docs[s]));if(o.text){const s=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,e.schema.text(o.text,s))}else a.delete(o.from,o.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=t,{selection:u}=n,s=Du(e,r.schema),{$from:c,empty:l,ranges:f}=u;if(!i)return!0;if(l&&a){let{from:d,to:p}=u;const h=(o=c.marks().find(g=>g.type===s))===null||o===void 0?void 0:o.attrs,m=sx(c,s,h);m&&(d=m.from,p=m.to),n.removeMark(d,p,s)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,s)});return n.removeStoredMark(s),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const u=qb(typeof e=="string"?e:e.name,r.schema);return u?(u==="node"&&(o=Xt(e,r.schema)),u==="mark"&&(a=Du(e,r.schema)),i&&n.selection.ranges.forEach(s=>{const c=s.$from.pos,l=s.$to.pos;r.doc.nodesBetween(c,l,(f,d)=>{o&&o===f.type&&n.setNodeMarkup(d,void 0,{...f.attrs,...t}),a&&f.marks.length&&f.marks.forEach(p=>{if(a===p.type){const h=Math.max(d,c),m=Math.min(d+f.nodeSize,l);n.addMark(h,m,a.create({...p.attrs,...t}))}})})}),!0):!1},wrapIn:(e,t={})=>({state:n,dispatch:r})=>{const i=Xt(e,n.schema);return hwe(i,t)(n,r)},wrapInList:(e,t={})=>({state:n,dispatch:r})=>{const i=Xt(e,n.schema);return mwe(i,t)(n,r)}});const BEe=dr.create({name:"commands",addCommands(){return{...DEe}}}),UEe=dr.create({name:"editable",addProseMirrorPlugins(){return[new Rr({key:new Ni("editable"),props:{editable:()=>this.editor.options.editable}})]}}),qEe=dr.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Rr({key:new Ni("focusEvents"),props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),zEe=dr.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:u})=>{const{selection:s,doc:c}=u,{empty:l,$anchor:f}=s,{pos:d,parent:p}=f,h=Pe.atStart(c).from===d;return!l||!h||!p.type.isTextblock||p.textContent.length?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Bb()||x4()?o:i},addProseMirrorPlugins(){return[new Rr({key:new Ni("clearDocument"),appendTransaction:(e,t,n)=>{if(!(e.some(h=>h.docChanged)&&!t.doc.eq(n.doc)))return;const{empty:i,from:o,to:a}=t.selection,u=Pe.atStart(t.doc).from,s=Pe.atEnd(t.doc).to;if(i||!(o===u&&a===s)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,d=Pb({state:n,transaction:f}),{commands:p}=new Wb({editor:this.editor,state:d});if(p.clearNodes(),!!f.steps.length)return f}})]}}),KEe=dr.create({name:"tabindex",addProseMirrorPlugins(){return[new Rr({key:new Ni("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var VEe=Object.freeze({__proto__:null,ClipboardTextSerializer:Fwe,Commands:BEe,Editable:UEe,FocusEvents:qEe,Keymap:zEe,Tabindex:KEe});const HEe=`.ProseMirror {
42
42
  position: relative;
43
43
  }
44
44
 
@@ -112,34 +112,34 @@ img.ProseMirror-separator {
112
112
 
113
113
  .tippy-box[data-animation=fade][data-state=hidden] {
114
114
  opacity: 0
115
- }`;function BEe(e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}let UEe=class extends hwe{constructor(t={}){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:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),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=BEe(DEe,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),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(t,n){const r=_4(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(t){if(this.isDestroyed)return;const n=typeof t=="string"?`${t}$`:t.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){const n=[...this.options.enableCoreExtensions?Object.values(LEe):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Oc(n,this)}createCommandManager(){this.commandManager=new jb({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const t=R4(this.options.content,this.schema,this.options.parseOptions),n=w4(t,this.options.autofocus);this.view=new kOe(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Df.create({doc:t,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(a=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(a)});return}const n=this.state.apply(t),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=t.getMeta("focus"),o=t.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return bEe(this.state,t)}isActive(t,n){const r=typeof t=="string"?t:null,i=typeof t=="string"?n:t;return _Ee(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return mEe(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=`
115
+ }`;function GEe(e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}let YEe=class extends $we{constructor(t={}){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:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),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=GEe(HEe,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),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(t,n){const r=_4(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(t){if(this.isDestroyed)return;const n=typeof t=="string"?`${t}$`:t.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){const n=[...this.options.enableCoreExtensions?Object.values(VEe):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Oc(n,this)}createCommandManager(){this.commandManager=new Wb({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const t=R4(this.options.content,this.schema,this.options.parseOptions),n=w4(t,this.options.autofocus);this.view=new LOe(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Lf.create({doc:t,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(a=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(a)});return}const n=this.state.apply(t),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=t.getMeta("focus"),o=t.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return OEe(this.state,t)}isActive(t,n){const r=typeof t=="string"?t:null,i=typeof t=="string"?n:t;return wEe(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return SEe(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=`
116
116
 
117
- `,textSerializers:r={}}=t||{};return gEe(this.state.doc,{blockSeparator:n,textSerializers:{...O4(this.schema),...r}})}get isEmpty(){return $Ee(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 t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}};function Hb(e){return new ux({find:e.find,handler:({state:t,range:n,match:r})=>{const i=Me(e.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=t,a=r[r.length-1],u=r[0];let s=n.to;if(a){const c=u.search(/\S/),l=n.from+u.indexOf(a),f=l+a.length;if(k4(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(m=>m===e.type&&m!==p.mark.type)).filter(p=>p.to>l).length)return null;f<n.to&&o.delete(f,n.to),l>n.from&&o.delete(n.from+c,l),s=n.from+c+a.length,o.addMark(n.from+c,s,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function gx(e){return new ux({find:e.find,handler:({state:t,range:n,match:r})=>{const i=t.doc.resolve(n.from),o=Me(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function Gb(e){return new ux({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{const o=Me(e.getAttributes,void 0,r)||{},a=t.tr.delete(n.from,n.to),s=a.doc.resolve(n.from).blockRange(),c=s&&OE(s,e.type,o);if(!c)return null;if(a.wrap(s,c),e.keepMarks&&e.editor){const{selection:f,storedMarks:d}=t,{splittableMarks:p}=e.editor.extensionManager,h=d||f.$to.parentOffset&&f.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));a.ensureMarks(m)}}if(e.keepAttributes){const f=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}const l=a.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Mu(a.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&a.join(n.from-1)}})}let tm=class gM{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Me(ce(this,"addOptions",{name:this.name}))),this.storage=Me(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new gM(t)}configure(t={}){const n=this.extend();return n.options=Db(this.options,t),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){const n=new gM(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Me(ce(n,"addOptions",{name:n.name})),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const s=a.find(c=>(c==null?void 0:c.type.name)===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}};class Hn{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Me(ce(this,"addOptions",{name:this.name}))),this.storage=Me(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Hn(t)}configure(t={}){const n=this.extend();return n.options=Db(this.options,t),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){const n=new Hn(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Me(ce(n,"addOptions",{name:n.name})),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}}class qEe{constructor(t,n,r){this.isDragging=!1,this.component=t,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(t){var n,r,i,o,a,u,s;const{view:c}=this.editor,l=t.target,f=l.nodeType===3?(n=l.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):l.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(l)||!f)return;let d=0,p=0;if(this.dom!==f){const g=this.dom.getBoundingClientRect(),_=f.getBoundingClientRect(),S=(i=t.offsetX)!==null&&i!==void 0?i:(o=t.nativeEvent)===null||o===void 0?void 0:o.offsetX,C=(a=t.offsetY)!==null&&a!==void 0?a:(u=t.nativeEvent)===null||u===void 0?void 0:u.offsetY;d=_.x-g.x+S,p=_.y-g.y+C}(s=t.dataTransfer)===null||s===void 0||s.setDragImage(this.dom,d,p);const h=ve.create(c.state.doc,this.getPos()),m=c.state.tr.setSelection(h);c.dispatch(m)}stopEvent(t){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const r=t.target;if(!(this.dom.contains(r)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(r))))return!1;const o=t.type.startsWith("drag"),a=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!a&&!o)return!0;const{isEditable:s}=this.editor,{isDragging:c}=this,l=!!this.node.type.spec.draggable,f=ve.isSelectable(this.node),d=t.type==="copy",p=t.type==="paste",h=t.type==="cut",m=t.type==="mousedown";if(!l&&f&&o&&t.preventDefault(),l&&o&&!c)return t.preventDefault(),!1;if(l&&s&&!c&&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!(c||a||d||p||h||m&&f)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&Ub()&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:n})=>{const r=this.getPos();return n.setNodeMarkup(r,void 0,{...this.node.attrs,...t}),!0})}deleteNode(){const t=this.getPos(),n=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:n})}}function Yb(e){return new $we({find:e.find,handler:({state:t,range:n,match:r})=>{const i=Me(e.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=t,a=r[r.length-1],u=r[0];let s=n.to;if(a){const c=u.search(/\S/),l=n.from+u.indexOf(a),f=l+a.length;if(k4(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(m=>m===e.type&&m!==p.mark.type)).filter(p=>p.to>l).length)return null;f<n.to&&o.delete(f,n.to),l>n.from&&o.delete(n.from+c,l),s=n.from+c+a.length,o.addMark(n.from+c,s,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function zEe(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Jb=200,Qt=function(){};Qt.prototype.append=function(t){return t.length?(t=Qt.from(t),!this.length&&t||t.length<Jb&&this.leafAppend(t)||this.length<Jb&&t.leafPrepend(this)||this.appendInner(t)):this},Qt.prototype.prepend=function(t){return t.length?Qt.from(t).append(this):this},Qt.prototype.appendInner=function(t){return new KEe(this,t)},Qt.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Qt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))},Qt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Qt.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)},Qt.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(t(o,a))},n,r),i},Qt.from=function(t){return t instanceof Qt?t:t&&t.length?new N4(t):Qt.empty};var N4=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new t(this.values.slice(i,o))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,o,a,u){for(var s=o;s<a;s++)if(i(this.values[s],u+s)===!1)return!1},t.prototype.forEachInvertedInner=function(i,o,a,u){for(var s=o-1;s>=a;s--)if(i(this.values[s],u+s)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=Jb)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=Jb)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Qt);Qt.empty=new N4([]);var KEe=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,i,o,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(o,u),a)===!1||o>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,o)-u,a+u)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,o,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(o,u)-u,a+u)===!1||o<u&&this.left.forEachInvertedInner(r,Math.min(i,u),o,a)===!1)return!1},t.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(Qt);const VEe=500;class ji{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,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,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=t.tr,u,s,c=[],l=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,l.push(f);return}if(i){l.push(new Io(f.map));let p=f.step.map(i.slice(o)),h;p&&a.maybeStep(p).doc&&(h=a.mapping.maps[a.mapping.maps.length-1],c.push(new Io(h,void 0,void 0,c.length+l.length))),o--,h&&i.appendMap(h,o)}else a.maybeStep(f.step);if(f.selection)return u=i?f.selection.map(i.slice(o)):f.selection,s=new ji(this.items.slice(0,r).append(l.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:a,selection:u}}addTransform(t,n,r,i){let o=[],a=this.eventCount,u=this.items,s=!i&&u.length?u.get(u.length-1):null;for(let l=0;l<t.steps.length;l++){let f=t.steps[l].invert(t.docs[l]),d=new Io(t.mapping.maps[l],f,n),p;(p=s&&s.merge(d))&&(d=p,l?o.pop():u=u.slice(0,u.length-1)),o.push(d),n&&(a++,n=void 0),i||(s=d)}let c=a-r.depth;return c>GEe&&(u=HEe(u,c),a-=c),new ji(u.append(o),a)}remapping(t,n){let r=new Af;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},t,n),r}addMaps(t){return this.eventCount==0?this:new ji(this.items.append(t.map(n=>new Io(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=t.mapping,a=t.steps.length,u=this.eventCount;this.items.forEach(d=>{d.selection&&u--},i);let s=n;this.items.forEach(d=>{let p=o.getMirror(--s);if(p==null)return;a=Math.min(a,p);let h=o.maps[p];if(d.step){let m=t.steps[p].invert(t.docs[p]),g=d.selection&&d.selection.map(o.slice(s+1,p));g&&u++,r.push(new Io(h,m,g))}else r.push(new Io(h))},i);let c=[];for(let d=n;d<a;d++)c.push(new Io(o.maps[d]));let l=this.items.slice(0,i).append(c).append(r),f=new ji(l,u);return f.emptyItemCount()>VEe&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach((a,u)=>{if(u>=t)i.push(a),a.selection&&o++;else if(a.step){let s=a.step.map(n.slice(r)),c=s&&s.getMap();if(r--,c&&n.appendMap(c,r),s){let l=a.selection&&a.selection.map(n.slice(r));l&&o++;let f=new Io(c.invert(),s,l),d,p=i.length-1;(d=i.length&&i[p].merge(f))?i[p]=d:i.push(f)}}else a.map&&r--},this.items.length,0),new ji(Qt.from(i.reverse()),o)}}ji.empty=new ji(Qt.empty,0);function HEe(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}class Io{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Io(n.getMap().invert(),n,this.selection)}}}class Bu{constructor(t,n,r,i,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const GEe=20;function YEe(e,t,n,r){let i=n.getMeta(Uu),o;if(i)return i.historyState;n.getMeta(ZEe)&&(e=new Bu(e.done,e.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(a&&a.getMeta(Uu))return a.getMeta(Uu).redo?new Bu(e.done.addTransform(n,void 0,r,Zb(t)),e.undone,P4(n.mapping.maps[n.steps.length-1]),e.prevTime,e.prevComposition):new Bu(e.done,e.undone.addTransform(n,void 0,r,Zb(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=n.getMeta("composition"),s=e.prevTime==0||!a&&e.prevComposition!=u&&(e.prevTime<(n.time||0)-r.newGroupDelay||!JEe(n,e.prevRanges)),c=a?yx(e.prevRanges,n.mapping):P4(n.mapping.maps[n.steps.length-1]);return new Bu(e.done.addTransform(n,s?t.selection.getBookmark():void 0,r,Zb(t)),ji.empty,c,n.time,u??e.prevComposition)}else return(o=n.getMeta("rebased"))?new Bu(e.done.rebased(n,o),e.undone.rebased(n,o),yx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Bu(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),yx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function JEe(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<t.length;o+=2)r<=t[o+1]&&i>=t[o]&&(n=!0)}),n}function P4(e){let t=[];return e.forEach((n,r,i,o)=>t.push(i,o)),t}function yx(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}function W4(e,t,n,r){let i=Zb(t),o=Uu.get(t).spec.config,a=(r?e.undone:e.done).popEvent(t,i);if(!a)return;let u=a.selection.resolve(a.transform.doc),s=(r?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),o,i),c=new Bu(r?s:a.remaining,r?a.remaining:s,null,0,-1);n(a.transform.setSelection(u).setMeta(Uu,{redo:r,historyState:c}).scrollIntoView())}let bx=!1,j4=null;function Zb(e){let t=e.plugins;if(j4!=t){bx=!1,j4=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){bx=!0;break}}return bx}const Uu=new Ni("history"),ZEe=new Ni("closeHistory");function XEe(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Rr({key:Uu,state:{init(){return new Bu(ji.empty,ji.empty,null,0,-1)},apply(t,n,r){return YEe(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,i=r=="historyUndo"?L4:r=="historyRedo"?D4:null;return i?(n.preventDefault(),i(t.state,t.dispatch)):!1}}}})}const L4=(e,t)=>{let n=Uu.getState(e);return!n||n.done.eventCount==0?!1:(t&&W4(n,e,t,!1),!0)},D4=(e,t)=>{let n=Uu.getState(e);return!n||n.undone.eventCount==0?!1:(t&&W4(n,e,t,!0),!0)},QEe=fr.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>L4(e,t),redo:()=>({state:e,dispatch:t})=>D4(e,t)}},addProseMirrorPlugins(){return[XEe(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});var dr="top",ei="bottom",ti="right",pr="left",_x="auto",nm=[dr,ei,ti,pr],Hf="start",rm="end",exe="clippingParents",B4="viewport",im="popper",txe="reference",U4=nm.reduce(function(e,t){return e.concat([t+"-"+Hf,t+"-"+rm])},[]),q4=[].concat(nm,[_x]).reduce(function(e,t){return e.concat([t,t+"-"+Hf,t+"-"+rm])},[]),nxe="beforeRead",rxe="read",ixe="afterRead",oxe="beforeMain",axe="main",uxe="afterMain",sxe="beforeWrite",cxe="write",lxe="afterWrite",fxe=[nxe,rxe,ixe,oxe,axe,uxe,sxe,cxe,lxe];function Co(e){return e?(e.nodeName||"").toLowerCase():null}function Fr(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function wc(e){var t=Fr(e).Element;return e instanceof t||e instanceof Element}function ni(e){var t=Fr(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function $x(e){if(typeof ShadowRoot>"u")return!1;var t=Fr(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function dxe(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},o=t.elements[n];!ni(o)||!Co(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(a){var u=i[a];u===!1?o.removeAttribute(a):o.setAttribute(a,u===!0?"":u)}))})}function pxe(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],o=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=a.reduce(function(s,c){return s[c]="",s},{});!ni(i)||!Co(i)||(Object.assign(i.style,u),Object.keys(o).forEach(function(s){i.removeAttribute(s)}))})}}const z4={name:"applyStyles",enabled:!0,phase:"write",fn:dxe,effect:pxe,requires:["computeStyles"]};function Oo(e){return e.split("-")[0]}var Ec=Math.max,Xb=Math.min,Gf=Math.round;function Sx(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function K4(){return!/^((?!chrome|android).)*safari/i.test(Sx())}function Yf(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,o=1;t&&ni(e)&&(i=e.offsetWidth>0&&Gf(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Gf(r.height)/e.offsetHeight||1);var a=wc(e)?Fr(e):window,u=a.visualViewport,s=!K4()&&n,c=(r.left+(s&&u?u.offsetLeft:0))/i,l=(r.top+(s&&u?u.offsetTop:0))/o,f=r.width/i,d=r.height/o;return{width:f,height:d,top:l,right:c+f,bottom:l+d,left:c,x:c,y:l}}function Tx(e){var t=Yf(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function V4(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&$x(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ka(e){return Fr(e).getComputedStyle(e)}function hxe(e){return["table","td","th"].indexOf(Co(e))>=0}function qu(e){return((wc(e)?e.ownerDocument:e.document)||window.document).documentElement}function Qb(e){return Co(e)==="html"?e:e.assignedSlot||e.parentNode||($x(e)?e.host:null)||qu(e)}function H4(e){return!ni(e)||ka(e).position==="fixed"?null:e.offsetParent}function mxe(e){var t=/firefox/i.test(Sx()),n=/Trident/i.test(Sx());if(n&&ni(e)){var r=ka(e);if(r.position==="fixed")return null}var i=Qb(e);for($x(i)&&(i=i.host);ni(i)&&["html","body"].indexOf(Co(i))<0;){var o=ka(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function om(e){for(var t=Fr(e),n=H4(e);n&&hxe(n)&&ka(n).position==="static";)n=H4(n);return n&&(Co(n)==="html"||Co(n)==="body"&&ka(n).position==="static")?t:n||mxe(e)||t}function Ix(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function am(e,t,n){return Ec(e,Xb(t,n))}function vxe(e,t,n){var r=am(e,t,n);return r>n?n:r}function G4(){return{top:0,right:0,bottom:0,left:0}}function Y4(e){return Object.assign({},G4(),e)}function J4(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var gxe=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Y4(typeof t!="number"?t:J4(t,nm))};function yxe(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,u=Oo(n.placement),s=Ix(u),c=[pr,ti].indexOf(u)>=0,l=c?"height":"width";if(!(!o||!a)){var f=gxe(i.padding,n),d=Tx(o),p=s==="y"?dr:pr,h=s==="y"?ei:ti,m=n.rects.reference[l]+n.rects.reference[s]-a[s]-n.rects.popper[l],g=a[s]-n.rects.reference[s],_=om(o),S=_?s==="y"?_.clientHeight||0:_.clientWidth||0:0,C=m/2-g/2,b=f[p],w=S-d[l]-f[h],O=S/2-d[l]/2+C,M=am(b,O,w),x=s;n.modifiersData[r]=(t={},t[x]=M,t.centerOffset=M-O,t)}}function bxe(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||V4(t.elements.popper,i)&&(t.elements.arrow=i))}const _xe={name:"arrow",enabled:!0,phase:"main",fn:yxe,effect:bxe,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Jf(e){return e.split("-")[1]}var $xe={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Sxe(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:Gf(n*i)/i||0,y:Gf(r*i)/i||0}}function Z4(e){var t,n=e.popper,r=e.popperRect,i=e.placement,o=e.variation,a=e.offsets,u=e.position,s=e.gpuAcceleration,c=e.adaptive,l=e.roundOffsets,f=e.isFixed,d=a.x,p=d===void 0?0:d,h=a.y,m=h===void 0?0:h,g=typeof l=="function"?l({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var _=a.hasOwnProperty("x"),S=a.hasOwnProperty("y"),C=pr,b=dr,w=window;if(c){var O=om(n),M="clientHeight",x="clientWidth";if(O===Fr(n)&&(O=qu(n),ka(O).position!=="static"&&u==="absolute"&&(M="scrollHeight",x="scrollWidth")),O=O,i===dr||(i===pr||i===ti)&&o===rm){b=ei;var U=f&&O===w&&w.visualViewport?w.visualViewport.height:O[M];m-=U-r.height,m*=s?1:-1}if(i===pr||(i===dr||i===ei)&&o===rm){C=ti;var B=f&&O===w&&w.visualViewport?w.visualViewport.width:O[x];p-=B-r.width,p*=s?1:-1}}var P=Object.assign({position:u},c&&$xe),Z=l===!0?Sxe({x:p,y:m},Fr(n)):{x:p,y:m};if(p=Z.x,m=Z.y,s){var ee;return Object.assign({},P,(ee={},ee[b]=S?"0":"",ee[C]=_?"0":"",ee.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",ee))}return Object.assign({},P,(t={},t[b]=S?m+"px":"",t[C]=_?p+"px":"",t.transform="",t))}function Txe(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,a=o===void 0?!0:o,u=n.roundOffsets,s=u===void 0?!0:u,c={placement:Oo(t.placement),variation:Jf(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Z4(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:s})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Z4(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:s})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ixe={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Txe,data:{}};var e_={passive:!0};function Cxe(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=i===void 0?!0:i,a=r.resize,u=a===void 0?!0:a,s=Fr(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&c.forEach(function(l){l.addEventListener("scroll",n.update,e_)}),u&&s.addEventListener("resize",n.update,e_),function(){o&&c.forEach(function(l){l.removeEventListener("scroll",n.update,e_)}),u&&s.removeEventListener("resize",n.update,e_)}}const Oxe={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Cxe,data:{}};var wxe={left:"right",right:"left",bottom:"top",top:"bottom"};function t_(e){return e.replace(/left|right|bottom|top/g,function(t){return wxe[t]})}var Exe={start:"end",end:"start"};function X4(e){return e.replace(/start|end/g,function(t){return Exe[t]})}function Cx(e){var t=Fr(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ox(e){return Yf(qu(e)).left+Cx(e).scrollLeft}function xxe(e,t){var n=Fr(e),r=qu(e),i=n.visualViewport,o=r.clientWidth,a=r.clientHeight,u=0,s=0;if(i){o=i.width,a=i.height;var c=K4();(c||!c&&t==="fixed")&&(u=i.offsetLeft,s=i.offsetTop)}return{width:o,height:a,x:u+Ox(e),y:s}}function Mxe(e){var t,n=qu(e),r=Cx(e),i=(t=e.ownerDocument)==null?void 0:t.body,o=Ec(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=Ec(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),u=-r.scrollLeft+Ox(e),s=-r.scrollTop;return ka(i||n).direction==="rtl"&&(u+=Ec(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:u,y:s}}function wx(e){var t=ka(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Q4(e){return["html","body","#document"].indexOf(Co(e))>=0?e.ownerDocument.body:ni(e)&&wx(e)?e:Q4(Qb(e))}function um(e,t){var n;t===void 0&&(t=[]);var r=Q4(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=Fr(r),a=i?[o].concat(o.visualViewport||[],wx(r)?r:[]):r,u=t.concat(a);return i?u:u.concat(um(Qb(a)))}function Ex(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Rxe(e,t){var n=Yf(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function e5(e,t,n){return t===B4?Ex(xxe(e,n)):wc(t)?Rxe(t,n):Ex(Mxe(qu(e)))}function kxe(e){var t=um(Qb(e)),n=["absolute","fixed"].indexOf(ka(e).position)>=0,r=n&&ni(e)?om(e):e;return wc(r)?t.filter(function(i){return wc(i)&&V4(i,r)&&Co(i)!=="body"}):[]}function Axe(e,t,n,r){var i=t==="clippingParents"?kxe(e):[].concat(t),o=[].concat(i,[n]),a=o[0],u=o.reduce(function(s,c){var l=e5(e,c,r);return s.top=Ec(l.top,s.top),s.right=Xb(l.right,s.right),s.bottom=Xb(l.bottom,s.bottom),s.left=Ec(l.left,s.left),s},e5(e,a,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function t5(e){var t=e.reference,n=e.element,r=e.placement,i=r?Oo(r):null,o=r?Jf(r):null,a=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,s;switch(i){case dr:s={x:a,y:t.y-n.height};break;case ei:s={x:a,y:t.y+t.height};break;case ti:s={x:t.x+t.width,y:u};break;case pr:s={x:t.x-n.width,y:u};break;default:s={x:t.x,y:t.y}}var c=i?Ix(i):null;if(c!=null){var l=c==="y"?"height":"width";switch(o){case Hf:s[c]=s[c]-(t[l]/2-n[l]/2);break;case rm:s[c]=s[c]+(t[l]/2-n[l]/2);break}}return s}function sm(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,o=n.strategy,a=o===void 0?e.strategy:o,u=n.boundary,s=u===void 0?exe:u,c=n.rootBoundary,l=c===void 0?B4:c,f=n.elementContext,d=f===void 0?im:f,p=n.altBoundary,h=p===void 0?!1:p,m=n.padding,g=m===void 0?0:m,_=Y4(typeof g!="number"?g:J4(g,nm)),S=d===im?txe:im,C=e.rects.popper,b=e.elements[h?S:d],w=Axe(wc(b)?b:b.contextElement||qu(e.elements.popper),s,l,a),O=Yf(e.elements.reference),M=t5({reference:O,element:C,strategy:"absolute",placement:i}),x=Ex(Object.assign({},C,M)),U=d===im?x:O,B={top:w.top-U.top+_.top,bottom:U.bottom-w.bottom+_.bottom,left:w.left-U.left+_.left,right:U.right-w.right+_.right},P=e.modifiersData.offset;if(d===im&&P){var Z=P[i];Object.keys(B).forEach(function(ee){var J=[ti,ei].indexOf(ee)>=0?1:-1,ge=[dr,ei].indexOf(ee)>=0?"y":"x";B[ee]+=Z[ge]*J})}return B}function Fxe(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,u=n.flipVariations,s=n.allowedAutoPlacements,c=s===void 0?q4:s,l=Jf(r),f=l?u?U4:U4.filter(function(h){return Jf(h)===l}):nm,d=f.filter(function(h){return c.indexOf(h)>=0});d.length===0&&(d=f);var p=d.reduce(function(h,m){return h[m]=sm(e,{placement:m,boundary:i,rootBoundary:o,padding:a})[Oo(m)],h},{});return Object.keys(p).sort(function(h,m){return p[h]-p[m]})}function Nxe(e){if(Oo(e)===_x)return[];var t=t_(e);return[X4(e),t,X4(t)]}function Pxe(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,u=a===void 0?!0:a,s=n.fallbackPlacements,c=n.padding,l=n.boundary,f=n.rootBoundary,d=n.altBoundary,p=n.flipVariations,h=p===void 0?!0:p,m=n.allowedAutoPlacements,g=t.options.placement,_=Oo(g),S=_===g,C=s||(S||!h?[t_(g)]:Nxe(g)),b=[g].concat(C).reduce(function(ne,Re){return ne.concat(Oo(Re)===_x?Fxe(t,{placement:Re,boundary:l,rootBoundary:f,padding:c,flipVariations:h,allowedAutoPlacements:m}):Re)},[]),w=t.rects.reference,O=t.rects.popper,M=new Map,x=!0,U=b[0],B=0;B<b.length;B++){var P=b[B],Z=Oo(P),ee=Jf(P)===Hf,J=[dr,ei].indexOf(Z)>=0,ge=J?"width":"height",Ie=sm(t,{placement:P,boundary:l,rootBoundary:f,altBoundary:d,padding:c}),k=J?ee?ti:pr:ee?ei:dr;w[ge]>O[ge]&&(k=t_(k));var A=t_(k),I=[];if(o&&I.push(Ie[Z]<=0),u&&I.push(Ie[k]<=0,Ie[A]<=0),I.every(function(ne){return ne})){U=P,x=!1;break}M.set(P,I)}if(x)for(var $=h?3:1,R=function(Re){var se=b.find(function(Ae){var ze=M.get(Ae);if(ze)return ze.slice(0,Re).every(function(He){return He})});if(se)return U=se,"break"},L=$;L>0;L--){var X=R(L);if(X==="break")break}t.placement!==U&&(t.modifiersData[r]._skip=!0,t.placement=U,t.reset=!0)}}const Wxe={name:"flip",enabled:!0,phase:"main",fn:Pxe,requiresIfExists:["offset"],data:{_skip:!1}};function n5(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function r5(e){return[dr,ti,ei,pr].some(function(t){return e[t]>=0})}function jxe(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=sm(t,{elementContext:"reference"}),u=sm(t,{altBoundary:!0}),s=n5(a,r),c=n5(u,i,o),l=r5(s),f=r5(c);t.modifiersData[n]={referenceClippingOffsets:s,popperEscapeOffsets:c,isReferenceHidden:l,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":f})}const Lxe={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:jxe};function Dxe(e,t,n){var r=Oo(e),i=[pr,dr].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=o[0],u=o[1];return a=a||0,u=(u||0)*i,[pr,ti].indexOf(r)>=0?{x:u,y:a}:{x:a,y:u}}function Bxe(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=i===void 0?[0,0]:i,a=q4.reduce(function(l,f){return l[f]=Dxe(f,t.rects,o),l},{}),u=a[t.placement],s=u.x,c=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=s,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}const Uxe={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Bxe};function qxe(e){var t=e.state,n=e.name;t.modifiersData[n]=t5({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const zxe={name:"popperOffsets",enabled:!0,phase:"read",fn:qxe,data:{}};function Kxe(e){return e==="x"?"y":"x"}function Vxe(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,u=a===void 0?!1:a,s=n.boundary,c=n.rootBoundary,l=n.altBoundary,f=n.padding,d=n.tether,p=d===void 0?!0:d,h=n.tetherOffset,m=h===void 0?0:h,g=sm(t,{boundary:s,rootBoundary:c,padding:f,altBoundary:l}),_=Oo(t.placement),S=Jf(t.placement),C=!S,b=Ix(_),w=Kxe(b),O=t.modifiersData.popperOffsets,M=t.rects.reference,x=t.rects.popper,U=typeof m=="function"?m(Object.assign({},t.rects,{placement:t.placement})):m,B=typeof U=="number"?{mainAxis:U,altAxis:U}:Object.assign({mainAxis:0,altAxis:0},U),P=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Z={x:0,y:0};if(O){if(o){var ee,J=b==="y"?dr:pr,ge=b==="y"?ei:ti,Ie=b==="y"?"height":"width",k=O[b],A=k+g[J],I=k-g[ge],$=p?-x[Ie]/2:0,R=S===Hf?M[Ie]:x[Ie],L=S===Hf?-x[Ie]:-M[Ie],X=t.elements.arrow,ne=p&&X?Tx(X):{width:0,height:0},Re=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:G4(),se=Re[J],Ae=Re[ge],ze=am(0,M[Ie],ne[Ie]),He=C?M[Ie]/2-$-ze-se-B.mainAxis:R-ze-se-B.mainAxis,ut=C?-M[Ie]/2+$+ze+Ae+B.mainAxis:L+ze+Ae+B.mainAxis,Ut=t.elements.arrow&&om(t.elements.arrow),en=Ut?b==="y"?Ut.clientTop||0:Ut.clientLeft||0:0,yn=(ee=P==null?void 0:P[b])!=null?ee:0,mr=k+He-yn-en,Bi=k+ut-yn,ii=am(p?Xb(A,mr):A,k,p?Ec(I,Bi):I);O[b]=ii,Z[b]=ii-k}if(u){var Ro,Wa=b==="x"?dr:pr,Ui=b==="x"?ei:ti,vr=O[w],oi=w==="y"?"height":"width",qi=vr+g[Wa],zi=vr-g[Ui],ja=[dr,pr].indexOf(_)!==-1,La=(Ro=P==null?void 0:P[w])!=null?Ro:0,Da=ja?qi:vr-M[oi]-x[oi]-La+B.altAxis,ai=ja?vr+M[oi]+x[oi]-La-B.altAxis:zi,Ju=p&&ja?vxe(Da,vr,ai):am(p?Da:qi,vr,p?ai:zi);O[w]=Ju,Z[w]=Ju-vr}t.modifiersData[r]=Z}}const Hxe={name:"preventOverflow",enabled:!0,phase:"main",fn:Vxe,requiresIfExists:["offset"]};function Gxe(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Yxe(e){return e===Fr(e)||!ni(e)?Cx(e):Gxe(e)}function Jxe(e){var t=e.getBoundingClientRect(),n=Gf(t.width)/e.offsetWidth||1,r=Gf(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Zxe(e,t,n){n===void 0&&(n=!1);var r=ni(t),i=ni(t)&&Jxe(t),o=qu(t),a=Yf(e,i,n),u={scrollLeft:0,scrollTop:0},s={x:0,y:0};return(r||!r&&!n)&&((Co(t)!=="body"||wx(o))&&(u=Yxe(t)),ni(t)?(s=Yf(t,!0),s.x+=t.clientLeft,s.y+=t.clientTop):o&&(s.x=Ox(o))),{x:a.left+u.scrollLeft-s.x,y:a.top+u.scrollTop-s.y,width:a.width,height:a.height}}function Xxe(e){var t=new Map,n=new Set,r=[];e.forEach(function(o){t.set(o.name,o)});function i(o){n.add(o.name);var a=[].concat(o.requires||[],o.requiresIfExists||[]);a.forEach(function(u){if(!n.has(u)){var s=t.get(u);s&&i(s)}}),r.push(o)}return e.forEach(function(o){n.has(o.name)||i(o)}),r}function Qxe(e){var t=Xxe(e);return fxe.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function eMe(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function tMe(e){var t=e.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(t).map(function(n){return t[n]})}var i5={placement:"bottom",modifiers:[],strategy:"absolute"};function o5(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function nMe(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,o=i===void 0?i5:i;return function(u,s,c){c===void 0&&(c=o);var l={placement:"bottom",orderedModifiers:[],options:Object.assign({},i5,o),modifiersData:{},elements:{reference:u,popper:s},attributes:{},styles:{}},f=[],d=!1,p={state:l,setOptions:function(_){var S=typeof _=="function"?_(l.options):_;m(),l.options=Object.assign({},o,l.options,S),l.scrollParents={reference:wc(u)?um(u):u.contextElement?um(u.contextElement):[],popper:um(s)};var C=Qxe(tMe([].concat(r,l.options.modifiers)));return l.orderedModifiers=C.filter(function(b){return b.enabled}),h(),p.update()},forceUpdate:function(){if(!d){var _=l.elements,S=_.reference,C=_.popper;if(o5(S,C)){l.rects={reference:Zxe(S,om(C),l.options.strategy==="fixed"),popper:Tx(C)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach(function(B){return l.modifiersData[B.name]=Object.assign({},B.data)});for(var b=0;b<l.orderedModifiers.length;b++){if(l.reset===!0){l.reset=!1,b=-1;continue}var w=l.orderedModifiers[b],O=w.fn,M=w.options,x=M===void 0?{}:M,U=w.name;typeof O=="function"&&(l=O({state:l,options:x,name:U,instance:p})||l)}}}},update:eMe(function(){return new Promise(function(g){p.forceUpdate(),g(l)})}),destroy:function(){m(),d=!0}};if(!o5(u,s))return p;p.setOptions(c).then(function(g){!d&&c.onFirstUpdate&&c.onFirstUpdate(g)});function h(){l.orderedModifiers.forEach(function(g){var _=g.name,S=g.options,C=S===void 0?{}:S,b=g.effect;if(typeof b=="function"){var w=b({state:l,name:_,instance:p,options:C}),O=function(){};f.push(w||O)}})}function m(){f.forEach(function(g){return g()}),f=[]}return p}}var rMe=[Oxe,zxe,Ixe,z4,Uxe,Wxe,Hxe,_xe,Lxe],iMe=nMe({defaultModifiers:rMe}),oMe="tippy-box",a5="tippy-content",aMe="tippy-backdrop",u5="tippy-arrow",s5="tippy-svg-arrow",xc={passive:!0,capture:!0},c5=function(){return document.body};function uMe(e,t){return{}.hasOwnProperty.call(e,t)}function xx(e,t,n){if(Array.isArray(e)){var r=e[t];return r??(Array.isArray(n)?n[t]:n)}return e}function Mx(e,t){var n={}.toString.call(e);return n.indexOf("[object")===0&&n.indexOf(t+"]")>-1}function l5(e,t){return typeof e=="function"?e.apply(void 0,t):e}function f5(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function sMe(e,t){var n=Object.assign({},e);return t.forEach(function(r){delete n[r]}),n}function cMe(e){return e.split(/\s+/).filter(Boolean)}function Zf(e){return[].concat(e)}function d5(e,t){e.indexOf(t)===-1&&e.push(t)}function lMe(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function fMe(e){return e.split("-")[0]}function n_(e){return[].slice.call(e)}function p5(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function cm(){return document.createElement("div")}function lm(e){return["Element","Fragment"].some(function(t){return Mx(e,t)})}function dMe(e){return Mx(e,"NodeList")}function pMe(e){return Mx(e,"MouseEvent")}function hMe(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function mMe(e){return lm(e)?[e]:dMe(e)?n_(e):Array.isArray(e)?e:n_(document.querySelectorAll(e))}function Rx(e,t){e.forEach(function(n){n&&(n.style.transitionDuration=t+"ms")})}function h5(e,t){e.forEach(function(n){n&&n.setAttribute("data-state",t)})}function vMe(e){var t,n=Zf(e),r=n[0];return r!=null&&(t=r.ownerDocument)!=null&&t.body?r.ownerDocument:document}function gMe(e,t){var n=t.clientX,r=t.clientY;return e.every(function(i){var o=i.popperRect,a=i.popperState,u=i.props,s=u.interactiveBorder,c=fMe(a.placement),l=a.modifiersData.offset;if(!l)return!0;var f=c==="bottom"?l.top.y:0,d=c==="top"?l.bottom.y:0,p=c==="right"?l.left.x:0,h=c==="left"?l.right.x:0,m=o.top-r+f>s,g=r-o.bottom-d>s,_=o.left-n+p>s,S=n-o.right-h>s;return m||g||_||S})}function kx(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){e[r](i,n)})}function m5(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var wo={isTouch:!1},v5=0;function yMe(){wo.isTouch||(wo.isTouch=!0,window.performance&&document.addEventListener("mousemove",g5))}function g5(){var e=performance.now();e-v5<20&&(wo.isTouch=!1,document.removeEventListener("mousemove",g5)),v5=e}function bMe(){var e=document.activeElement;if(hMe(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function _Me(){document.addEventListener("touchstart",yMe,xc),window.addEventListener("blur",bMe)}var $Me=typeof window<"u"&&typeof document<"u",SMe=$Me?!!window.msCrypto:!1;function Xf(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function y5(e){var t=/[ \t]{2,}/g,n=/^[ \t]*/gm;return e.replace(t," ").replace(n,"").trim()}function TMe(e){return y5(`
117
+ `,textSerializers:r={}}=t||{};return IEe(this.state.doc,{blockSeparator:n,textSerializers:{...O4(this.schema),...r}})}get isEmpty(){return EEe(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 t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}};function Vb(e){return new ix({find:e.find,handler:({state:t,range:n,match:r})=>{const i=Me(e.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=t,a=r[r.length-1],u=r[0];let s=n.to;if(a){const c=u.search(/\S/),l=n.from+u.indexOf(a),f=l+a.length;if(k4(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(m=>m===e.type&&m!==p.mark.type)).filter(p=>p.to>l).length)return null;f<n.to&&o.delete(f,n.to),l>n.from&&o.delete(n.from+c,l),s=n.from+c+a.length,o.addMark(n.from+c,s,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function hx(e){return new ix({find:e.find,handler:({state:t,range:n,match:r})=>{const i=t.doc.resolve(n.from),o=Me(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function Hb(e){return new ix({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{const o=Me(e.getAttributes,void 0,r)||{},a=t.tr.delete(n.from,n.to),s=a.doc.resolve(n.from).blockRange(),c=s&&TE(s,e.type,o);if(!c)return null;if(a.wrap(s,c),e.keepMarks&&e.editor){const{selection:f,storedMarks:d}=t,{splittableMarks:p}=e.editor.extensionManager,h=d||f.$to.parentOffset&&f.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));a.ensureMarks(m)}}if(e.keepAttributes){const f=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}const l=a.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Mu(a.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&a.join(n.from-1)}})}let Qh=class vM{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Me(ce(this,"addOptions",{name:this.name}))),this.storage=Me(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new vM(t)}configure(t={}){const n=this.extend();return n.options=Lb(this.options,t),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){const n=new vM(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Me(ce(n,"addOptions",{name:n.name})),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const s=a.find(c=>(c==null?void 0:c.type.name)===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}};class Mn{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Me(ce(this,"addOptions",{name:this.name}))),this.storage=Me(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Mn(t)}configure(t={}){const n=this.extend();return n.options=Lb(this.options,t),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){const n=new Mn(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Me(ce(n,"addOptions",{name:n.name})),n.storage=Me(ce(n,"addStorage",{name:n.name,options:n.options})),n}}class JEe{constructor(t,n,r){this.isDragging=!1,this.component=t,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(t){var n,r,i,o,a,u,s;const{view:c}=this.editor,l=t.target,f=l.nodeType===3?(n=l.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):l.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(l)||!f)return;let d=0,p=0;if(this.dom!==f){const g=this.dom.getBoundingClientRect(),_=f.getBoundingClientRect(),S=(i=t.offsetX)!==null&&i!==void 0?i:(o=t.nativeEvent)===null||o===void 0?void 0:o.offsetX,C=(a=t.offsetY)!==null&&a!==void 0?a:(u=t.nativeEvent)===null||u===void 0?void 0:u.offsetY;d=_.x-g.x+S,p=_.y-g.y+C}(s=t.dataTransfer)===null||s===void 0||s.setDragImage(this.dom,d,p);const h=ve.create(c.state.doc,this.getPos()),m=c.state.tr.setSelection(h);c.dispatch(m)}stopEvent(t){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const r=t.target;if(!(this.dom.contains(r)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(r))))return!1;const o=t.type.startsWith("drag"),a=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!a&&!o)return!0;const{isEditable:s}=this.editor,{isDragging:c}=this,l=!!this.node.type.spec.draggable,f=ve.isSelectable(this.node),d=t.type==="copy",p=t.type==="paste",h=t.type==="cut",m=t.type==="mousedown";if(!l&&f&&o&&t.preventDefault(),l&&o&&!c)return t.preventDefault(),!1;if(l&&s&&!c&&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!(c||a||d||p||h||m&&f)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&Bb()&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:n})=>{const r=this.getPos();return n.setNodeMarkup(r,void 0,{...this.node.attrs,...t}),!0})}deleteNode(){const t=this.getPos(),n=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:n})}}function Gb(e){return new Ewe({find:e.find,handler:({state:t,range:n,match:r})=>{const i=Me(e.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=t,a=r[r.length-1],u=r[0];let s=n.to;if(a){const c=u.search(/\S/),l=n.from+u.indexOf(a),f=l+a.length;if(k4(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(m=>m===e.type&&m!==p.mark.type)).filter(p=>p.to>l).length)return null;f<n.to&&o.delete(f,n.to),l>n.from&&o.delete(n.from+c,l),s=n.from+c+a.length,o.addMark(n.from+c,s,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function ZEe(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Yb=200,Qt=function(){};Qt.prototype.append=function(t){return t.length?(t=Qt.from(t),!this.length&&t||t.length<Yb&&this.leafAppend(t)||this.length<Yb&&t.leafPrepend(this)||this.appendInner(t)):this},Qt.prototype.prepend=function(t){return t.length?Qt.from(t).append(this):this},Qt.prototype.appendInner=function(t){return new XEe(this,t)},Qt.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Qt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))},Qt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Qt.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)},Qt.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(t(o,a))},n,r),i},Qt.from=function(t){return t instanceof Qt?t:t&&t.length?new N4(t):Qt.empty};var N4=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new t(this.values.slice(i,o))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,o,a,u){for(var s=o;s<a;s++)if(i(this.values[s],u+s)===!1)return!1},t.prototype.forEachInvertedInner=function(i,o,a,u){for(var s=o-1;s>=a;s--)if(i(this.values[s],u+s)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=Yb)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=Yb)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Qt);Qt.empty=new N4([]);var XEe=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,i,o,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(o,u),a)===!1||o>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,o)-u,a+u)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,o,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(o,u)-u,a+u)===!1||o<u&&this.left.forEachInvertedInner(r,Math.min(i,u),o,a)===!1)return!1},t.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(Qt);const QEe=500;class ji{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,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,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=t.tr,u,s,c=[],l=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,l.push(f);return}if(i){l.push(new To(f.map));let p=f.step.map(i.slice(o)),h;p&&a.maybeStep(p).doc&&(h=a.mapping.maps[a.mapping.maps.length-1],c.push(new To(h,void 0,void 0,c.length+l.length))),o--,h&&i.appendMap(h,o)}else a.maybeStep(f.step);if(f.selection)return u=i?f.selection.map(i.slice(o)):f.selection,s=new ji(this.items.slice(0,r).append(l.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:a,selection:u}}addTransform(t,n,r,i){let o=[],a=this.eventCount,u=this.items,s=!i&&u.length?u.get(u.length-1):null;for(let l=0;l<t.steps.length;l++){let f=t.steps[l].invert(t.docs[l]),d=new To(t.mapping.maps[l],f,n),p;(p=s&&s.merge(d))&&(d=p,l?o.pop():u=u.slice(0,u.length-1)),o.push(d),n&&(a++,n=void 0),i||(s=d)}let c=a-r.depth;return c>txe&&(u=exe(u,c),a-=c),new ji(u.append(o),a)}remapping(t,n){let r=new kf;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},t,n),r}addMaps(t){return this.eventCount==0?this:new ji(this.items.append(t.map(n=>new To(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=t.mapping,a=t.steps.length,u=this.eventCount;this.items.forEach(d=>{d.selection&&u--},i);let s=n;this.items.forEach(d=>{let p=o.getMirror(--s);if(p==null)return;a=Math.min(a,p);let h=o.maps[p];if(d.step){let m=t.steps[p].invert(t.docs[p]),g=d.selection&&d.selection.map(o.slice(s+1,p));g&&u++,r.push(new To(h,m,g))}else r.push(new To(h))},i);let c=[];for(let d=n;d<a;d++)c.push(new To(o.maps[d]));let l=this.items.slice(0,i).append(c).append(r),f=new ji(l,u);return f.emptyItemCount()>QEe&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach((a,u)=>{if(u>=t)i.push(a),a.selection&&o++;else if(a.step){let s=a.step.map(n.slice(r)),c=s&&s.getMap();if(r--,c&&n.appendMap(c,r),s){let l=a.selection&&a.selection.map(n.slice(r));l&&o++;let f=new To(c.invert(),s,l),d,p=i.length-1;(d=i.length&&i[p].merge(f))?i[p]=d:i.push(f)}}else a.map&&r--},this.items.length,0),new ji(Qt.from(i.reverse()),o)}}ji.empty=new ji(Qt.empty,0);function exe(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}class To{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new To(n.getMap().invert(),n,this.selection)}}}class Bu{constructor(t,n,r,i,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const txe=20;function nxe(e,t,n,r){let i=n.getMeta(Uu),o;if(i)return i.historyState;n.getMeta(ixe)&&(e=new Bu(e.done,e.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(a&&a.getMeta(Uu))return a.getMeta(Uu).redo?new Bu(e.done.addTransform(n,void 0,r,Jb(t)),e.undone,P4(n.mapping.maps[n.steps.length-1]),e.prevTime,e.prevComposition):new Bu(e.done,e.undone.addTransform(n,void 0,r,Jb(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=n.getMeta("composition"),s=e.prevTime==0||!a&&e.prevComposition!=u&&(e.prevTime<(n.time||0)-r.newGroupDelay||!rxe(n,e.prevRanges)),c=a?mx(e.prevRanges,n.mapping):P4(n.mapping.maps[n.steps.length-1]);return new Bu(e.done.addTransform(n,s?t.selection.getBookmark():void 0,r,Jb(t)),ji.empty,c,n.time,u??e.prevComposition)}else return(o=n.getMeta("rebased"))?new Bu(e.done.rebased(n,o),e.undone.rebased(n,o),mx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Bu(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),mx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function rxe(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<t.length;o+=2)r<=t[o+1]&&i>=t[o]&&(n=!0)}),n}function P4(e){let t=[];return e.forEach((n,r,i,o)=>t.push(i,o)),t}function mx(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}function W4(e,t,n,r){let i=Jb(t),o=Uu.get(t).spec.config,a=(r?e.undone:e.done).popEvent(t,i);if(!a)return;let u=a.selection.resolve(a.transform.doc),s=(r?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),o,i),c=new Bu(r?s:a.remaining,r?a.remaining:s,null,0,-1);n(a.transform.setSelection(u).setMeta(Uu,{redo:r,historyState:c}).scrollIntoView())}let vx=!1,j4=null;function Jb(e){let t=e.plugins;if(j4!=t){vx=!1,j4=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){vx=!0;break}}return vx}const Uu=new Ni("history"),ixe=new Ni("closeHistory");function oxe(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Rr({key:Uu,state:{init(){return new Bu(ji.empty,ji.empty,null,0,-1)},apply(t,n,r){return nxe(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,i=r=="historyUndo"?L4:r=="historyRedo"?D4:null;return i?(n.preventDefault(),i(t.state,t.dispatch)):!1}}}})}const L4=(e,t)=>{let n=Uu.getState(e);return!n||n.done.eventCount==0?!1:(t&&W4(n,e,t,!1),!0)},D4=(e,t)=>{let n=Uu.getState(e);return!n||n.undone.eventCount==0?!1:(t&&W4(n,e,t,!0),!0)},axe=dr.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>L4(e,t),redo:()=>({state:e,dispatch:t})=>D4(e,t)}},addProseMirrorPlugins(){return[oxe(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});var pr="top",ei="bottom",ti="right",hr="left",gx="auto",em=[pr,ei,ti,hr],Vf="start",tm="end",uxe="clippingParents",B4="viewport",nm="popper",sxe="reference",U4=em.reduce(function(e,t){return e.concat([t+"-"+Vf,t+"-"+tm])},[]),q4=[].concat(em,[gx]).reduce(function(e,t){return e.concat([t,t+"-"+Vf,t+"-"+tm])},[]),cxe="beforeRead",lxe="read",fxe="afterRead",dxe="beforeMain",pxe="main",hxe="afterMain",mxe="beforeWrite",vxe="write",gxe="afterWrite",yxe=[cxe,lxe,fxe,dxe,pxe,hxe,mxe,vxe,gxe];function Io(e){return e?(e.nodeName||"").toLowerCase():null}function Fr(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function wc(e){var t=Fr(e).Element;return e instanceof t||e instanceof Element}function ni(e){var t=Fr(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function yx(e){if(typeof ShadowRoot>"u")return!1;var t=Fr(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function bxe(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},o=t.elements[n];!ni(o)||!Io(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(a){var u=i[a];u===!1?o.removeAttribute(a):o.setAttribute(a,u===!0?"":u)}))})}function _xe(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],o=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=a.reduce(function(s,c){return s[c]="",s},{});!ni(i)||!Io(i)||(Object.assign(i.style,u),Object.keys(o).forEach(function(s){i.removeAttribute(s)}))})}}const z4={name:"applyStyles",enabled:!0,phase:"write",fn:bxe,effect:_xe,requires:["computeStyles"]};function Co(e){return e.split("-")[0]}var Ec=Math.max,Zb=Math.min,Hf=Math.round;function bx(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function K4(){return!/^((?!chrome|android).)*safari/i.test(bx())}function Gf(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,o=1;t&&ni(e)&&(i=e.offsetWidth>0&&Hf(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Hf(r.height)/e.offsetHeight||1);var a=wc(e)?Fr(e):window,u=a.visualViewport,s=!K4()&&n,c=(r.left+(s&&u?u.offsetLeft:0))/i,l=(r.top+(s&&u?u.offsetTop:0))/o,f=r.width/i,d=r.height/o;return{width:f,height:d,top:l,right:c+f,bottom:l+d,left:c,x:c,y:l}}function _x(e){var t=Gf(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function V4(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&yx(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ka(e){return Fr(e).getComputedStyle(e)}function $xe(e){return["table","td","th"].indexOf(Io(e))>=0}function qu(e){return((wc(e)?e.ownerDocument:e.document)||window.document).documentElement}function Xb(e){return Io(e)==="html"?e:e.assignedSlot||e.parentNode||(yx(e)?e.host:null)||qu(e)}function H4(e){return!ni(e)||ka(e).position==="fixed"?null:e.offsetParent}function Sxe(e){var t=/firefox/i.test(bx()),n=/Trident/i.test(bx());if(n&&ni(e)){var r=ka(e);if(r.position==="fixed")return null}var i=Xb(e);for(yx(i)&&(i=i.host);ni(i)&&["html","body"].indexOf(Io(i))<0;){var o=ka(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function rm(e){for(var t=Fr(e),n=H4(e);n&&$xe(n)&&ka(n).position==="static";)n=H4(n);return n&&(Io(n)==="html"||Io(n)==="body"&&ka(n).position==="static")?t:n||Sxe(e)||t}function $x(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function im(e,t,n){return Ec(e,Zb(t,n))}function Txe(e,t,n){var r=im(e,t,n);return r>n?n:r}function G4(){return{top:0,right:0,bottom:0,left:0}}function Y4(e){return Object.assign({},G4(),e)}function J4(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var Ixe=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Y4(typeof t!="number"?t:J4(t,em))};function Cxe(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,u=Co(n.placement),s=$x(u),c=[hr,ti].indexOf(u)>=0,l=c?"height":"width";if(!(!o||!a)){var f=Ixe(i.padding,n),d=_x(o),p=s==="y"?pr:hr,h=s==="y"?ei:ti,m=n.rects.reference[l]+n.rects.reference[s]-a[s]-n.rects.popper[l],g=a[s]-n.rects.reference[s],_=rm(o),S=_?s==="y"?_.clientHeight||0:_.clientWidth||0:0,C=m/2-g/2,b=f[p],w=S-d[l]-f[h],O=S/2-d[l]/2+C,M=im(b,O,w),x=s;n.modifiersData[r]=(t={},t[x]=M,t.centerOffset=M-O,t)}}function Oxe(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||V4(t.elements.popper,i)&&(t.elements.arrow=i))}const wxe={name:"arrow",enabled:!0,phase:"main",fn:Cxe,effect:Oxe,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Yf(e){return e.split("-")[1]}var Exe={top:"auto",right:"auto",bottom:"auto",left:"auto"};function xxe(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:Hf(n*i)/i||0,y:Hf(r*i)/i||0}}function Z4(e){var t,n=e.popper,r=e.popperRect,i=e.placement,o=e.variation,a=e.offsets,u=e.position,s=e.gpuAcceleration,c=e.adaptive,l=e.roundOffsets,f=e.isFixed,d=a.x,p=d===void 0?0:d,h=a.y,m=h===void 0?0:h,g=typeof l=="function"?l({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var _=a.hasOwnProperty("x"),S=a.hasOwnProperty("y"),C=hr,b=pr,w=window;if(c){var O=rm(n),M="clientHeight",x="clientWidth";if(O===Fr(n)&&(O=qu(n),ka(O).position!=="static"&&u==="absolute"&&(M="scrollHeight",x="scrollWidth")),O=O,i===pr||(i===hr||i===ti)&&o===tm){b=ei;var U=f&&O===w&&w.visualViewport?w.visualViewport.height:O[M];m-=U-r.height,m*=s?1:-1}if(i===hr||(i===pr||i===ei)&&o===tm){C=ti;var B=f&&O===w&&w.visualViewport?w.visualViewport.width:O[x];p-=B-r.width,p*=s?1:-1}}var P=Object.assign({position:u},c&&Exe),Z=l===!0?xxe({x:p,y:m},Fr(n)):{x:p,y:m};if(p=Z.x,m=Z.y,s){var ee;return Object.assign({},P,(ee={},ee[b]=S?"0":"",ee[C]=_?"0":"",ee.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",ee))}return Object.assign({},P,(t={},t[b]=S?m+"px":"",t[C]=_?p+"px":"",t.transform="",t))}function Mxe(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,a=o===void 0?!0:o,u=n.roundOffsets,s=u===void 0?!0:u,c={placement:Co(t.placement),variation:Yf(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Z4(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:s})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Z4(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:s})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Rxe={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Mxe,data:{}};var Qb={passive:!0};function kxe(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=i===void 0?!0:i,a=r.resize,u=a===void 0?!0:a,s=Fr(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&c.forEach(function(l){l.addEventListener("scroll",n.update,Qb)}),u&&s.addEventListener("resize",n.update,Qb),function(){o&&c.forEach(function(l){l.removeEventListener("scroll",n.update,Qb)}),u&&s.removeEventListener("resize",n.update,Qb)}}const Axe={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:kxe,data:{}};var Fxe={left:"right",right:"left",bottom:"top",top:"bottom"};function e_(e){return e.replace(/left|right|bottom|top/g,function(t){return Fxe[t]})}var Nxe={start:"end",end:"start"};function X4(e){return e.replace(/start|end/g,function(t){return Nxe[t]})}function Sx(e){var t=Fr(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Tx(e){return Gf(qu(e)).left+Sx(e).scrollLeft}function Pxe(e,t){var n=Fr(e),r=qu(e),i=n.visualViewport,o=r.clientWidth,a=r.clientHeight,u=0,s=0;if(i){o=i.width,a=i.height;var c=K4();(c||!c&&t==="fixed")&&(u=i.offsetLeft,s=i.offsetTop)}return{width:o,height:a,x:u+Tx(e),y:s}}function Wxe(e){var t,n=qu(e),r=Sx(e),i=(t=e.ownerDocument)==null?void 0:t.body,o=Ec(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=Ec(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),u=-r.scrollLeft+Tx(e),s=-r.scrollTop;return ka(i||n).direction==="rtl"&&(u+=Ec(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:u,y:s}}function Ix(e){var t=ka(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Q4(e){return["html","body","#document"].indexOf(Io(e))>=0?e.ownerDocument.body:ni(e)&&Ix(e)?e:Q4(Xb(e))}function om(e,t){var n;t===void 0&&(t=[]);var r=Q4(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=Fr(r),a=i?[o].concat(o.visualViewport||[],Ix(r)?r:[]):r,u=t.concat(a);return i?u:u.concat(om(Xb(a)))}function Cx(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function jxe(e,t){var n=Gf(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function eH(e,t,n){return t===B4?Cx(Pxe(e,n)):wc(t)?jxe(t,n):Cx(Wxe(qu(e)))}function Lxe(e){var t=om(Xb(e)),n=["absolute","fixed"].indexOf(ka(e).position)>=0,r=n&&ni(e)?rm(e):e;return wc(r)?t.filter(function(i){return wc(i)&&V4(i,r)&&Io(i)!=="body"}):[]}function Dxe(e,t,n,r){var i=t==="clippingParents"?Lxe(e):[].concat(t),o=[].concat(i,[n]),a=o[0],u=o.reduce(function(s,c){var l=eH(e,c,r);return s.top=Ec(l.top,s.top),s.right=Zb(l.right,s.right),s.bottom=Zb(l.bottom,s.bottom),s.left=Ec(l.left,s.left),s},eH(e,a,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function tH(e){var t=e.reference,n=e.element,r=e.placement,i=r?Co(r):null,o=r?Yf(r):null,a=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,s;switch(i){case pr:s={x:a,y:t.y-n.height};break;case ei:s={x:a,y:t.y+t.height};break;case ti:s={x:t.x+t.width,y:u};break;case hr:s={x:t.x-n.width,y:u};break;default:s={x:t.x,y:t.y}}var c=i?$x(i):null;if(c!=null){var l=c==="y"?"height":"width";switch(o){case Vf:s[c]=s[c]-(t[l]/2-n[l]/2);break;case tm:s[c]=s[c]+(t[l]/2-n[l]/2);break}}return s}function am(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,o=n.strategy,a=o===void 0?e.strategy:o,u=n.boundary,s=u===void 0?uxe:u,c=n.rootBoundary,l=c===void 0?B4:c,f=n.elementContext,d=f===void 0?nm:f,p=n.altBoundary,h=p===void 0?!1:p,m=n.padding,g=m===void 0?0:m,_=Y4(typeof g!="number"?g:J4(g,em)),S=d===nm?sxe:nm,C=e.rects.popper,b=e.elements[h?S:d],w=Dxe(wc(b)?b:b.contextElement||qu(e.elements.popper),s,l,a),O=Gf(e.elements.reference),M=tH({reference:O,element:C,strategy:"absolute",placement:i}),x=Cx(Object.assign({},C,M)),U=d===nm?x:O,B={top:w.top-U.top+_.top,bottom:U.bottom-w.bottom+_.bottom,left:w.left-U.left+_.left,right:U.right-w.right+_.right},P=e.modifiersData.offset;if(d===nm&&P){var Z=P[i];Object.keys(B).forEach(function(ee){var J=[ti,ei].indexOf(ee)>=0?1:-1,ge=[pr,ei].indexOf(ee)>=0?"y":"x";B[ee]+=Z[ge]*J})}return B}function Bxe(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,u=n.flipVariations,s=n.allowedAutoPlacements,c=s===void 0?q4:s,l=Yf(r),f=l?u?U4:U4.filter(function(h){return Yf(h)===l}):em,d=f.filter(function(h){return c.indexOf(h)>=0});d.length===0&&(d=f);var p=d.reduce(function(h,m){return h[m]=am(e,{placement:m,boundary:i,rootBoundary:o,padding:a})[Co(m)],h},{});return Object.keys(p).sort(function(h,m){return p[h]-p[m]})}function Uxe(e){if(Co(e)===gx)return[];var t=e_(e);return[X4(e),t,X4(t)]}function qxe(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,u=a===void 0?!0:a,s=n.fallbackPlacements,c=n.padding,l=n.boundary,f=n.rootBoundary,d=n.altBoundary,p=n.flipVariations,h=p===void 0?!0:p,m=n.allowedAutoPlacements,g=t.options.placement,_=Co(g),S=_===g,C=s||(S||!h?[e_(g)]:Uxe(g)),b=[g].concat(C).reduce(function(ne,ke){return ne.concat(Co(ke)===gx?Bxe(t,{placement:ke,boundary:l,rootBoundary:f,padding:c,flipVariations:h,allowedAutoPlacements:m}):ke)},[]),w=t.rects.reference,O=t.rects.popper,M=new Map,x=!0,U=b[0],B=0;B<b.length;B++){var P=b[B],Z=Co(P),ee=Yf(P)===Vf,J=[pr,ei].indexOf(Z)>=0,ge=J?"width":"height",Te=am(t,{placement:P,boundary:l,rootBoundary:f,altBoundary:d,padding:c}),k=J?ee?ti:hr:ee?ei:pr;w[ge]>O[ge]&&(k=e_(k));var A=e_(k),I=[];if(o&&I.push(Te[Z]<=0),u&&I.push(Te[k]<=0,Te[A]<=0),I.every(function(ne){return ne})){U=P,x=!1;break}M.set(P,I)}if(x)for(var $=h?3:1,R=function(ke){var se=b.find(function(Fe){var ze=M.get(Fe);if(ze)return ze.slice(0,ke).every(function(He){return He})});if(se)return U=se,"break"},L=$;L>0;L--){var X=R(L);if(X==="break")break}t.placement!==U&&(t.modifiersData[r]._skip=!0,t.placement=U,t.reset=!0)}}const zxe={name:"flip",enabled:!0,phase:"main",fn:qxe,requiresIfExists:["offset"],data:{_skip:!1}};function nH(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function rH(e){return[pr,ti,ei,hr].some(function(t){return e[t]>=0})}function Kxe(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=am(t,{elementContext:"reference"}),u=am(t,{altBoundary:!0}),s=nH(a,r),c=nH(u,i,o),l=rH(s),f=rH(c);t.modifiersData[n]={referenceClippingOffsets:s,popperEscapeOffsets:c,isReferenceHidden:l,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":f})}const Vxe={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Kxe};function Hxe(e,t,n){var r=Co(e),i=[hr,pr].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=o[0],u=o[1];return a=a||0,u=(u||0)*i,[hr,ti].indexOf(r)>=0?{x:u,y:a}:{x:a,y:u}}function Gxe(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=i===void 0?[0,0]:i,a=q4.reduce(function(l,f){return l[f]=Hxe(f,t.rects,o),l},{}),u=a[t.placement],s=u.x,c=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=s,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}const Yxe={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Gxe};function Jxe(e){var t=e.state,n=e.name;t.modifiersData[n]=tH({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Zxe={name:"popperOffsets",enabled:!0,phase:"read",fn:Jxe,data:{}};function Xxe(e){return e==="x"?"y":"x"}function Qxe(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,u=a===void 0?!1:a,s=n.boundary,c=n.rootBoundary,l=n.altBoundary,f=n.padding,d=n.tether,p=d===void 0?!0:d,h=n.tetherOffset,m=h===void 0?0:h,g=am(t,{boundary:s,rootBoundary:c,padding:f,altBoundary:l}),_=Co(t.placement),S=Yf(t.placement),C=!S,b=$x(_),w=Xxe(b),O=t.modifiersData.popperOffsets,M=t.rects.reference,x=t.rects.popper,U=typeof m=="function"?m(Object.assign({},t.rects,{placement:t.placement})):m,B=typeof U=="number"?{mainAxis:U,altAxis:U}:Object.assign({mainAxis:0,altAxis:0},U),P=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Z={x:0,y:0};if(O){if(o){var ee,J=b==="y"?pr:hr,ge=b==="y"?ei:ti,Te=b==="y"?"height":"width",k=O[b],A=k+g[J],I=k-g[ge],$=p?-x[Te]/2:0,R=S===Vf?M[Te]:x[Te],L=S===Vf?-x[Te]:-M[Te],X=t.elements.arrow,ne=p&&X?_x(X):{width:0,height:0},ke=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:G4(),se=ke[J],Fe=ke[ge],ze=im(0,M[Te],ne[Te]),He=C?M[Te]/2-$-ze-se-B.mainAxis:R-ze-se-B.mainAxis,ut=C?-M[Te]/2+$+ze+Fe+B.mainAxis:L+ze+Fe+B.mainAxis,Ut=t.elements.arrow&&rm(t.elements.arrow),en=Ut?b==="y"?Ut.clientTop||0:Ut.clientLeft||0:0,yn=(ee=P==null?void 0:P[b])!=null?ee:0,mr=k+He-yn-en,Ui=k+ut-yn,ri=im(p?Zb(A,mr):A,k,p?Ec(I,Ui):I);O[b]=ri,Z[b]=ri-k}if(u){var Mo,Wa=b==="x"?pr:hr,qi=b==="x"?ei:ti,vr=O[w],ii=w==="y"?"height":"width",zi=vr+g[Wa],Ki=vr-g[qi],ja=[pr,hr].indexOf(_)!==-1,La=(Mo=P==null?void 0:P[w])!=null?Mo:0,Da=ja?zi:vr-M[ii]-x[ii]-La+B.altAxis,oi=ja?vr+M[ii]+x[ii]-La-B.altAxis:Ki,Ju=p&&ja?Txe(Da,vr,oi):im(p?Da:zi,vr,p?oi:Ki);O[w]=Ju,Z[w]=Ju-vr}t.modifiersData[r]=Z}}const eMe={name:"preventOverflow",enabled:!0,phase:"main",fn:Qxe,requiresIfExists:["offset"]};function tMe(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function nMe(e){return e===Fr(e)||!ni(e)?Sx(e):tMe(e)}function rMe(e){var t=e.getBoundingClientRect(),n=Hf(t.width)/e.offsetWidth||1,r=Hf(t.height)/e.offsetHeight||1;return n!==1||r!==1}function iMe(e,t,n){n===void 0&&(n=!1);var r=ni(t),i=ni(t)&&rMe(t),o=qu(t),a=Gf(e,i,n),u={scrollLeft:0,scrollTop:0},s={x:0,y:0};return(r||!r&&!n)&&((Io(t)!=="body"||Ix(o))&&(u=nMe(t)),ni(t)?(s=Gf(t,!0),s.x+=t.clientLeft,s.y+=t.clientTop):o&&(s.x=Tx(o))),{x:a.left+u.scrollLeft-s.x,y:a.top+u.scrollTop-s.y,width:a.width,height:a.height}}function oMe(e){var t=new Map,n=new Set,r=[];e.forEach(function(o){t.set(o.name,o)});function i(o){n.add(o.name);var a=[].concat(o.requires||[],o.requiresIfExists||[]);a.forEach(function(u){if(!n.has(u)){var s=t.get(u);s&&i(s)}}),r.push(o)}return e.forEach(function(o){n.has(o.name)||i(o)}),r}function aMe(e){var t=oMe(e);return yxe.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function uMe(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function sMe(e){var t=e.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(t).map(function(n){return t[n]})}var iH={placement:"bottom",modifiers:[],strategy:"absolute"};function oH(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function cMe(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,o=i===void 0?iH:i;return function(u,s,c){c===void 0&&(c=o);var l={placement:"bottom",orderedModifiers:[],options:Object.assign({},iH,o),modifiersData:{},elements:{reference:u,popper:s},attributes:{},styles:{}},f=[],d=!1,p={state:l,setOptions:function(_){var S=typeof _=="function"?_(l.options):_;m(),l.options=Object.assign({},o,l.options,S),l.scrollParents={reference:wc(u)?om(u):u.contextElement?om(u.contextElement):[],popper:om(s)};var C=aMe(sMe([].concat(r,l.options.modifiers)));return l.orderedModifiers=C.filter(function(b){return b.enabled}),h(),p.update()},forceUpdate:function(){if(!d){var _=l.elements,S=_.reference,C=_.popper;if(oH(S,C)){l.rects={reference:iMe(S,rm(C),l.options.strategy==="fixed"),popper:_x(C)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach(function(B){return l.modifiersData[B.name]=Object.assign({},B.data)});for(var b=0;b<l.orderedModifiers.length;b++){if(l.reset===!0){l.reset=!1,b=-1;continue}var w=l.orderedModifiers[b],O=w.fn,M=w.options,x=M===void 0?{}:M,U=w.name;typeof O=="function"&&(l=O({state:l,options:x,name:U,instance:p})||l)}}}},update:uMe(function(){return new Promise(function(g){p.forceUpdate(),g(l)})}),destroy:function(){m(),d=!0}};if(!oH(u,s))return p;p.setOptions(c).then(function(g){!d&&c.onFirstUpdate&&c.onFirstUpdate(g)});function h(){l.orderedModifiers.forEach(function(g){var _=g.name,S=g.options,C=S===void 0?{}:S,b=g.effect;if(typeof b=="function"){var w=b({state:l,name:_,instance:p,options:C}),O=function(){};f.push(w||O)}})}function m(){f.forEach(function(g){return g()}),f=[]}return p}}var lMe=[Axe,Zxe,Rxe,z4,Yxe,zxe,eMe,wxe,Vxe],fMe=cMe({defaultModifiers:lMe}),dMe="tippy-box",aH="tippy-content",pMe="tippy-backdrop",uH="tippy-arrow",sH="tippy-svg-arrow",xc={passive:!0,capture:!0},cH=function(){return document.body};function hMe(e,t){return{}.hasOwnProperty.call(e,t)}function Ox(e,t,n){if(Array.isArray(e)){var r=e[t];return r??(Array.isArray(n)?n[t]:n)}return e}function wx(e,t){var n={}.toString.call(e);return n.indexOf("[object")===0&&n.indexOf(t+"]")>-1}function lH(e,t){return typeof e=="function"?e.apply(void 0,t):e}function fH(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function mMe(e,t){var n=Object.assign({},e);return t.forEach(function(r){delete n[r]}),n}function vMe(e){return e.split(/\s+/).filter(Boolean)}function Jf(e){return[].concat(e)}function dH(e,t){e.indexOf(t)===-1&&e.push(t)}function gMe(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function yMe(e){return e.split("-")[0]}function t_(e){return[].slice.call(e)}function pH(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function um(){return document.createElement("div")}function sm(e){return["Element","Fragment"].some(function(t){return wx(e,t)})}function bMe(e){return wx(e,"NodeList")}function _Me(e){return wx(e,"MouseEvent")}function $Me(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function SMe(e){return sm(e)?[e]:bMe(e)?t_(e):Array.isArray(e)?e:t_(document.querySelectorAll(e))}function Ex(e,t){e.forEach(function(n){n&&(n.style.transitionDuration=t+"ms")})}function hH(e,t){e.forEach(function(n){n&&n.setAttribute("data-state",t)})}function TMe(e){var t,n=Jf(e),r=n[0];return r!=null&&(t=r.ownerDocument)!=null&&t.body?r.ownerDocument:document}function IMe(e,t){var n=t.clientX,r=t.clientY;return e.every(function(i){var o=i.popperRect,a=i.popperState,u=i.props,s=u.interactiveBorder,c=yMe(a.placement),l=a.modifiersData.offset;if(!l)return!0;var f=c==="bottom"?l.top.y:0,d=c==="top"?l.bottom.y:0,p=c==="right"?l.left.x:0,h=c==="left"?l.right.x:0,m=o.top-r+f>s,g=r-o.bottom-d>s,_=o.left-n+p>s,S=n-o.right-h>s;return m||g||_||S})}function xx(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){e[r](i,n)})}function mH(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Oo={isTouch:!1},vH=0;function CMe(){Oo.isTouch||(Oo.isTouch=!0,window.performance&&document.addEventListener("mousemove",gH))}function gH(){var e=performance.now();e-vH<20&&(Oo.isTouch=!1,document.removeEventListener("mousemove",gH)),vH=e}function OMe(){var e=document.activeElement;if($Me(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function wMe(){document.addEventListener("touchstart",CMe,xc),window.addEventListener("blur",OMe)}var EMe=typeof window<"u"&&typeof document<"u",xMe=EMe?!!window.msCrypto:!1;function Zf(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function yH(e){var t=/[ \t]{2,}/g,n=/^[ \t]*/gm;return e.replace(t," ").replace(n,"").trim()}function MMe(e){return yH(`
118
118
  %ctippy.js
119
119
 
120
- %c`+y5(e)+`
120
+ %c`+yH(e)+`
121
121
 
122
122
  %c👷‍ This is a development-only message. It will be removed in production.
123
- `)}function b5(e){return[TMe(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var fm;process.env.NODE_ENV!=="production"&&IMe();function IMe(){fm=new Set}function Aa(e,t){if(e&&!fm.has(t)){var n;fm.add(t),(n=console).warn.apply(n,b5(t))}}function Ax(e,t){if(e&&!fm.has(t)){var n;fm.add(t),(n=console).error.apply(n,b5(t))}}function CMe(e){var t=!e,n=Object.prototype.toString.call(e)==="[object Object]"&&!e.addEventListener;Ax(t,["tippy() was passed","`"+String(e)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Ax(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var _5={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},OMe={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Nr=Object.assign({appendTo:c5,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},_5,OMe),wMe=Object.keys(Nr),EMe=function(t){process.env.NODE_ENV!=="production"&&T5(t,[]);var n=Object.keys(t);n.forEach(function(r){Nr[r]=t[r]})};function $5(e){var t=e.plugins||[],n=t.reduce(function(r,i){var o=i.name,a=i.defaultValue;if(o){var u;r[o]=e[o]!==void 0?e[o]:(u=Nr[o])!=null?u:a}return r},{});return Object.assign({},e,n)}function xMe(e,t){var n=t?Object.keys($5(Object.assign({},Nr,{plugins:t}))):wMe,r=n.reduce(function(i,o){var a=(e.getAttribute("data-tippy-"+o)||"").trim();if(!a)return i;if(o==="content")i[o]=a;else try{i[o]=JSON.parse(a)}catch{i[o]=a}return i},{});return r}function S5(e,t){var n=Object.assign({},t,{content:l5(t.content,[e])},t.ignoreAttributes?{}:xMe(e,t.plugins));return n.aria=Object.assign({},Nr.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?t.interactive:n.aria.expanded,content:n.aria.content==="auto"?t.interactive?null:"describedby":n.aria.content},n}function T5(e,t){e===void 0&&(e={}),t===void 0&&(t=[]);var n=Object.keys(e);n.forEach(function(r){var i=sMe(Nr,Object.keys(_5)),o=!uMe(i,r);o&&(o=t.filter(function(a){return a.name===r}).length===0),Aa(o,["`"+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.",`
123
+ `)}function bH(e){return[MMe(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var cm;process.env.NODE_ENV!=="production"&&RMe();function RMe(){cm=new Set}function Aa(e,t){if(e&&!cm.has(t)){var n;cm.add(t),(n=console).warn.apply(n,bH(t))}}function Mx(e,t){if(e&&!cm.has(t)){var n;cm.add(t),(n=console).error.apply(n,bH(t))}}function kMe(e){var t=!e,n=Object.prototype.toString.call(e)==="[object Object]"&&!e.addEventListener;Mx(t,["tippy() was passed","`"+String(e)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Mx(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var _H={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},AMe={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Nr=Object.assign({appendTo:cH,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},_H,AMe),FMe=Object.keys(Nr),NMe=function(t){process.env.NODE_ENV!=="production"&&TH(t,[]);var n=Object.keys(t);n.forEach(function(r){Nr[r]=t[r]})};function $H(e){var t=e.plugins||[],n=t.reduce(function(r,i){var o=i.name,a=i.defaultValue;if(o){var u;r[o]=e[o]!==void 0?e[o]:(u=Nr[o])!=null?u:a}return r},{});return Object.assign({},e,n)}function PMe(e,t){var n=t?Object.keys($H(Object.assign({},Nr,{plugins:t}))):FMe,r=n.reduce(function(i,o){var a=(e.getAttribute("data-tippy-"+o)||"").trim();if(!a)return i;if(o==="content")i[o]=a;else try{i[o]=JSON.parse(a)}catch{i[o]=a}return i},{});return r}function SH(e,t){var n=Object.assign({},t,{content:lH(t.content,[e])},t.ignoreAttributes?{}:PMe(e,t.plugins));return n.aria=Object.assign({},Nr.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?t.interactive:n.aria.expanded,content:n.aria.content==="auto"?t.interactive?null:"describedby":n.aria.content},n}function TH(e,t){e===void 0&&(e={}),t===void 0&&(t=[]);var n=Object.keys(e);n.forEach(function(r){var i=mMe(Nr,Object.keys(_H)),o=!hMe(i,r);o&&(o=t.filter(function(a){return a.name===r}).length===0),Aa(o,["`"+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.",`
124
124
 
125
125
  `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
126
- `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var MMe=function(){return"innerHTML"};function Fx(e,t){e[MMe()]=t}function I5(e){var t=cm();return e===!0?t.className=u5:(t.className=s5,lm(e)?t.appendChild(e):Fx(t,e)),t}function C5(e,t){lm(t.content)?(Fx(e,""),e.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?Fx(e,t.content):e.textContent=t.content)}function Nx(e){var t=e.firstElementChild,n=n_(t.children);return{box:t,content:n.find(function(r){return r.classList.contains(a5)}),arrow:n.find(function(r){return r.classList.contains(u5)||r.classList.contains(s5)}),backdrop:n.find(function(r){return r.classList.contains(aMe)})}}function O5(e){var t=cm(),n=cm();n.className=oMe,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=cm();r.className=a5,r.setAttribute("data-state","hidden"),C5(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(o,a){var u=Nx(t),s=u.box,c=u.content,l=u.arrow;a.theme?s.setAttribute("data-theme",a.theme):s.removeAttribute("data-theme"),typeof a.animation=="string"?s.setAttribute("data-animation",a.animation):s.removeAttribute("data-animation"),a.inertia?s.setAttribute("data-inertia",""):s.removeAttribute("data-inertia"),s.style.maxWidth=typeof a.maxWidth=="number"?a.maxWidth+"px":a.maxWidth,a.role?s.setAttribute("role",a.role):s.removeAttribute("role"),(o.content!==a.content||o.allowHTML!==a.allowHTML)&&C5(c,e.props),a.arrow?l?o.arrow!==a.arrow&&(s.removeChild(l),s.appendChild(I5(a.arrow))):s.appendChild(I5(a.arrow)):l&&s.removeChild(l)}return{popper:t,onUpdate:i}}O5.$$tippy=!0;var RMe=1,r_=[],Px=[];function kMe(e,t){var n=S5(e,Object.assign({},Nr,$5(p5(t)))),r,i,o,a=!1,u=!1,s=!1,c=!1,l,f,d,p=[],h=f5(mr,n.interactiveDebounce),m,g=RMe++,_=null,S=lMe(n.plugins),C={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:e,popper:cm(),popperInstance:_,props:n,state:C,plugins:S,clearDelayTimeouts:Da,setProps:ai,setContent:Ju,show:ad,hide:W,hideWithInteractivity:F,enable:ja,disable:La,unmount:D,destroy:Fe};if(!n.render)return process.env.NODE_ENV!=="production"&&Ax(!0,"render() function has not been supplied."),b;var w=n.render(b),O=w.popper,M=w.onUpdate;O.setAttribute("data-tippy-root",""),O.id="tippy-"+b.id,b.popper=O,e._tippy=b,O._tippy=b;var x=S.map(function(j){return j.fn(b)}),U=e.hasAttribute("aria-expanded");return Ut(),$(),k(),A("onCreate",[b]),n.showOnCreate&&qi(),O.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),O.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&J().addEventListener("mousemove",h)}),b;function B(){var j=b.props.touch;return Array.isArray(j)?j:[j,0]}function P(){return B()[0]==="hold"}function Z(){var j;return!!((j=b.props.render)!=null&&j.$$tippy)}function ee(){return m||e}function J(){var j=ee().parentNode;return j?vMe(j):document}function ge(){return Nx(O)}function Ie(j){return b.state.isMounted&&!b.state.isVisible||wo.isTouch||l&&l.type==="focus"?0:xx(b.props.delay,j?0:1,Nr.delay)}function k(j){j===void 0&&(j=!1),O.style.pointerEvents=b.props.interactive&&!j?"":"none",O.style.zIndex=""+b.props.zIndex}function A(j,ie,me){if(me===void 0&&(me=!0),x.forEach(function(Ce){Ce[j]&&Ce[j].apply(Ce,ie)}),me){var he;(he=b.props)[j].apply(he,ie)}}function I(){var j=b.props.aria;if(j.content){var ie="aria-"+j.content,me=O.id,he=Zf(b.props.triggerTarget||e);he.forEach(function(Ce){var st=Ce.getAttribute(ie);if(b.state.isVisible)Ce.setAttribute(ie,st?st+" "+me:me);else{var Gn=st&&st.replace(me,"").trim();Gn?Ce.setAttribute(ie,Gn):Ce.removeAttribute(ie)}})}}function $(){if(!(U||!b.props.aria.expanded)){var j=Zf(b.props.triggerTarget||e);j.forEach(function(ie){b.props.interactive?ie.setAttribute("aria-expanded",b.state.isVisible&&ie===ee()?"true":"false"):ie.removeAttribute("aria-expanded")})}}function R(){J().removeEventListener("mousemove",h),r_=r_.filter(function(j){return j!==h})}function L(j){if(!(wo.isTouch&&(s||j.type==="mousedown"))){var ie=j.composedPath&&j.composedPath()[0]||j.target;if(!(b.props.interactive&&m5(O,ie))){if(Zf(b.props.triggerTarget||e).some(function(me){return m5(me,ie)})){if(wo.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else A("onClickOutside",[b,j]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),u=!0,setTimeout(function(){u=!1}),b.state.isMounted||se())}}}function X(){s=!0}function ne(){s=!1}function Re(){var j=J();j.addEventListener("mousedown",L,!0),j.addEventListener("touchend",L,xc),j.addEventListener("touchstart",ne,xc),j.addEventListener("touchmove",X,xc)}function se(){var j=J();j.removeEventListener("mousedown",L,!0),j.removeEventListener("touchend",L,xc),j.removeEventListener("touchstart",ne,xc),j.removeEventListener("touchmove",X,xc)}function Ae(j,ie){He(j,function(){!b.state.isVisible&&O.parentNode&&O.parentNode.contains(O)&&ie()})}function ze(j,ie){He(j,ie)}function He(j,ie){var me=ge().box;function he(Ce){Ce.target===me&&(kx(me,"remove",he),ie())}if(j===0)return ie();kx(me,"remove",f),kx(me,"add",he),f=he}function ut(j,ie,me){me===void 0&&(me=!1);var he=Zf(b.props.triggerTarget||e);he.forEach(function(Ce){Ce.addEventListener(j,ie,me),p.push({node:Ce,eventType:j,handler:ie,options:me})})}function Ut(){P()&&(ut("touchstart",yn,{passive:!0}),ut("touchend",Bi,{passive:!0})),cMe(b.props.trigger).forEach(function(j){if(j!=="manual")switch(ut(j,yn),j){case"mouseenter":ut("mouseleave",Bi);break;case"focus":ut(SMe?"focusout":"blur",ii);break;case"focusin":ut("focusout",ii);break}})}function en(){p.forEach(function(j){var ie=j.node,me=j.eventType,he=j.handler,Ce=j.options;ie.removeEventListener(me,he,Ce)}),p=[]}function yn(j){var ie,me=!1;if(!(!b.state.isEnabled||Ro(j)||u)){var he=((ie=l)==null?void 0:ie.type)==="focus";l=j,m=j.currentTarget,$(),!b.state.isVisible&&pMe(j)&&r_.forEach(function(Ce){return Ce(j)}),j.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||a)&&b.props.hideOnClick!==!1&&b.state.isVisible?me=!0:qi(j),j.type==="click"&&(a=!me),me&&!he&&zi(j)}}function mr(j){var ie=j.target,me=ee().contains(ie)||O.contains(ie);if(!(j.type==="mousemove"&&me)){var he=oi().concat(O).map(function(Ce){var st,Gn=Ce._tippy,Wr=(st=Gn.popperInstance)==null?void 0:st.state;return Wr?{popperRect:Ce.getBoundingClientRect(),popperState:Wr,props:n}:null}).filter(Boolean);gMe(he,j)&&(R(),zi(j))}}function Bi(j){var ie=Ro(j)||b.props.trigger.indexOf("click")>=0&&a;if(!ie){if(b.props.interactive){b.hideWithInteractivity(j);return}zi(j)}}function ii(j){b.props.trigger.indexOf("focusin")<0&&j.target!==ee()||b.props.interactive&&j.relatedTarget&&O.contains(j.relatedTarget)||zi(j)}function Ro(j){return wo.isTouch?P()!==j.type.indexOf("touch")>=0:!1}function Wa(){Ui();var j=b.props,ie=j.popperOptions,me=j.placement,he=j.offset,Ce=j.getReferenceClientRect,st=j.moveTransition,Gn=Z()?Nx(O).arrow:null,Wr=Ce?{getBoundingClientRect:Ce,contextElement:Ce.contextElement||ee()}:e,ud={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(cd){var Ba=cd.state;if(Z()){var hM=ge(),ld=hM.box;["placement","reference-hidden","escaped"].forEach(function(Pc){Pc==="placement"?ld.setAttribute("data-placement",Ba.placement):Ba.attributes.popper["data-popper-"+Pc]?ld.setAttribute("data-"+Pc,""):ld.removeAttribute("data-"+Pc)}),Ba.attributes.popper={}}}},Ki=[{name:"offset",options:{offset:he}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!st}},ud];Z()&&Gn&&Ki.push({name:"arrow",options:{element:Gn,padding:3}}),Ki.push.apply(Ki,(ie==null?void 0:ie.modifiers)||[]),b.popperInstance=iMe(Wr,O,Object.assign({},ie,{placement:me,onFirstUpdate:d,modifiers:Ki}))}function Ui(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function vr(){var j=b.props.appendTo,ie,me=ee();b.props.interactive&&j===c5||j==="parent"?ie=me.parentNode:ie=l5(j,[me]),ie.contains(O)||ie.appendChild(O),b.state.isMounted=!0,Wa(),process.env.NODE_ENV!=="production"&&Aa(b.props.interactive&&j===Nr.appendTo&&me.nextElementSibling!==O,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
126
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var WMe=function(){return"innerHTML"};function Rx(e,t){e[WMe()]=t}function IH(e){var t=um();return e===!0?t.className=uH:(t.className=sH,sm(e)?t.appendChild(e):Rx(t,e)),t}function CH(e,t){sm(t.content)?(Rx(e,""),e.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?Rx(e,t.content):e.textContent=t.content)}function kx(e){var t=e.firstElementChild,n=t_(t.children);return{box:t,content:n.find(function(r){return r.classList.contains(aH)}),arrow:n.find(function(r){return r.classList.contains(uH)||r.classList.contains(sH)}),backdrop:n.find(function(r){return r.classList.contains(pMe)})}}function OH(e){var t=um(),n=um();n.className=dMe,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=um();r.className=aH,r.setAttribute("data-state","hidden"),CH(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(o,a){var u=kx(t),s=u.box,c=u.content,l=u.arrow;a.theme?s.setAttribute("data-theme",a.theme):s.removeAttribute("data-theme"),typeof a.animation=="string"?s.setAttribute("data-animation",a.animation):s.removeAttribute("data-animation"),a.inertia?s.setAttribute("data-inertia",""):s.removeAttribute("data-inertia"),s.style.maxWidth=typeof a.maxWidth=="number"?a.maxWidth+"px":a.maxWidth,a.role?s.setAttribute("role",a.role):s.removeAttribute("role"),(o.content!==a.content||o.allowHTML!==a.allowHTML)&&CH(c,e.props),a.arrow?l?o.arrow!==a.arrow&&(s.removeChild(l),s.appendChild(IH(a.arrow))):s.appendChild(IH(a.arrow)):l&&s.removeChild(l)}return{popper:t,onUpdate:i}}OH.$$tippy=!0;var jMe=1,n_=[],Ax=[];function LMe(e,t){var n=SH(e,Object.assign({},Nr,$H(pH(t)))),r,i,o,a=!1,u=!1,s=!1,c=!1,l,f,d,p=[],h=fH(mr,n.interactiveDebounce),m,g=jMe++,_=null,S=gMe(n.plugins),C={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:e,popper:um(),popperInstance:_,props:n,state:C,plugins:S,clearDelayTimeouts:Da,setProps:oi,setContent:Ju,show:id,hide:W,hideWithInteractivity:N,enable:ja,disable:La,unmount:D,destroy:Ne};if(!n.render)return process.env.NODE_ENV!=="production"&&Mx(!0,"render() function has not been supplied."),b;var w=n.render(b),O=w.popper,M=w.onUpdate;O.setAttribute("data-tippy-root",""),O.id="tippy-"+b.id,b.popper=O,e._tippy=b,O._tippy=b;var x=S.map(function(j){return j.fn(b)}),U=e.hasAttribute("aria-expanded");return Ut(),$(),k(),A("onCreate",[b]),n.showOnCreate&&zi(),O.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),O.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&J().addEventListener("mousemove",h)}),b;function B(){var j=b.props.touch;return Array.isArray(j)?j:[j,0]}function P(){return B()[0]==="hold"}function Z(){var j;return!!((j=b.props.render)!=null&&j.$$tippy)}function ee(){return m||e}function J(){var j=ee().parentNode;return j?TMe(j):document}function ge(){return kx(O)}function Te(j){return b.state.isMounted&&!b.state.isVisible||Oo.isTouch||l&&l.type==="focus"?0:Ox(b.props.delay,j?0:1,Nr.delay)}function k(j){j===void 0&&(j=!1),O.style.pointerEvents=b.props.interactive&&!j?"":"none",O.style.zIndex=""+b.props.zIndex}function A(j,ie,me){if(me===void 0&&(me=!0),x.forEach(function(Ie){Ie[j]&&Ie[j].apply(Ie,ie)}),me){var he;(he=b.props)[j].apply(he,ie)}}function I(){var j=b.props.aria;if(j.content){var ie="aria-"+j.content,me=O.id,he=Jf(b.props.triggerTarget||e);he.forEach(function(Ie){var st=Ie.getAttribute(ie);if(b.state.isVisible)Ie.setAttribute(ie,st?st+" "+me:me);else{var Yn=st&&st.replace(me,"").trim();Yn?Ie.setAttribute(ie,Yn):Ie.removeAttribute(ie)}})}}function $(){if(!(U||!b.props.aria.expanded)){var j=Jf(b.props.triggerTarget||e);j.forEach(function(ie){b.props.interactive?ie.setAttribute("aria-expanded",b.state.isVisible&&ie===ee()?"true":"false"):ie.removeAttribute("aria-expanded")})}}function R(){J().removeEventListener("mousemove",h),n_=n_.filter(function(j){return j!==h})}function L(j){if(!(Oo.isTouch&&(s||j.type==="mousedown"))){var ie=j.composedPath&&j.composedPath()[0]||j.target;if(!(b.props.interactive&&mH(O,ie))){if(Jf(b.props.triggerTarget||e).some(function(me){return mH(me,ie)})){if(Oo.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else A("onClickOutside",[b,j]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),u=!0,setTimeout(function(){u=!1}),b.state.isMounted||se())}}}function X(){s=!0}function ne(){s=!1}function ke(){var j=J();j.addEventListener("mousedown",L,!0),j.addEventListener("touchend",L,xc),j.addEventListener("touchstart",ne,xc),j.addEventListener("touchmove",X,xc)}function se(){var j=J();j.removeEventListener("mousedown",L,!0),j.removeEventListener("touchend",L,xc),j.removeEventListener("touchstart",ne,xc),j.removeEventListener("touchmove",X,xc)}function Fe(j,ie){He(j,function(){!b.state.isVisible&&O.parentNode&&O.parentNode.contains(O)&&ie()})}function ze(j,ie){He(j,ie)}function He(j,ie){var me=ge().box;function he(Ie){Ie.target===me&&(xx(me,"remove",he),ie())}if(j===0)return ie();xx(me,"remove",f),xx(me,"add",he),f=he}function ut(j,ie,me){me===void 0&&(me=!1);var he=Jf(b.props.triggerTarget||e);he.forEach(function(Ie){Ie.addEventListener(j,ie,me),p.push({node:Ie,eventType:j,handler:ie,options:me})})}function Ut(){P()&&(ut("touchstart",yn,{passive:!0}),ut("touchend",Ui,{passive:!0})),vMe(b.props.trigger).forEach(function(j){if(j!=="manual")switch(ut(j,yn),j){case"mouseenter":ut("mouseleave",Ui);break;case"focus":ut(xMe?"focusout":"blur",ri);break;case"focusin":ut("focusout",ri);break}})}function en(){p.forEach(function(j){var ie=j.node,me=j.eventType,he=j.handler,Ie=j.options;ie.removeEventListener(me,he,Ie)}),p=[]}function yn(j){var ie,me=!1;if(!(!b.state.isEnabled||Mo(j)||u)){var he=((ie=l)==null?void 0:ie.type)==="focus";l=j,m=j.currentTarget,$(),!b.state.isVisible&&_Me(j)&&n_.forEach(function(Ie){return Ie(j)}),j.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||a)&&b.props.hideOnClick!==!1&&b.state.isVisible?me=!0:zi(j),j.type==="click"&&(a=!me),me&&!he&&Ki(j)}}function mr(j){var ie=j.target,me=ee().contains(ie)||O.contains(ie);if(!(j.type==="mousemove"&&me)){var he=ii().concat(O).map(function(Ie){var st,Yn=Ie._tippy,Wr=(st=Yn.popperInstance)==null?void 0:st.state;return Wr?{popperRect:Ie.getBoundingClientRect(),popperState:Wr,props:n}:null}).filter(Boolean);IMe(he,j)&&(R(),Ki(j))}}function Ui(j){var ie=Mo(j)||b.props.trigger.indexOf("click")>=0&&a;if(!ie){if(b.props.interactive){b.hideWithInteractivity(j);return}Ki(j)}}function ri(j){b.props.trigger.indexOf("focusin")<0&&j.target!==ee()||b.props.interactive&&j.relatedTarget&&O.contains(j.relatedTarget)||Ki(j)}function Mo(j){return Oo.isTouch?P()!==j.type.indexOf("touch")>=0:!1}function Wa(){qi();var j=b.props,ie=j.popperOptions,me=j.placement,he=j.offset,Ie=j.getReferenceClientRect,st=j.moveTransition,Yn=Z()?kx(O).arrow:null,Wr=Ie?{getBoundingClientRect:Ie,contextElement:Ie.contextElement||ee()}:e,od={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ud){var Ba=ud.state;if(Z()){var pM=ge(),sd=pM.box;["placement","reference-hidden","escaped"].forEach(function(Pc){Pc==="placement"?sd.setAttribute("data-placement",Ba.placement):Ba.attributes.popper["data-popper-"+Pc]?sd.setAttribute("data-"+Pc,""):sd.removeAttribute("data-"+Pc)}),Ba.attributes.popper={}}}},Vi=[{name:"offset",options:{offset:he}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!st}},od];Z()&&Yn&&Vi.push({name:"arrow",options:{element:Yn,padding:3}}),Vi.push.apply(Vi,(ie==null?void 0:ie.modifiers)||[]),b.popperInstance=fMe(Wr,O,Object.assign({},ie,{placement:me,onFirstUpdate:d,modifiers:Vi}))}function qi(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function vr(){var j=b.props.appendTo,ie,me=ee();b.props.interactive&&j===cH||j==="parent"?ie=me.parentNode:ie=lH(j,[me]),ie.contains(O)||ie.appendChild(O),b.state.isMounted=!0,Wa(),process.env.NODE_ENV!=="production"&&Aa(b.props.interactive&&j===Nr.appendTo&&me.nextElementSibling!==O,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
127
127
 
128
128
  `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
129
129
 
130
130
  `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
131
131
 
132
- `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function oi(){return n_(O.querySelectorAll("[data-tippy-root]"))}function qi(j){b.clearDelayTimeouts(),j&&A("onTrigger",[b,j]),Re();var ie=Ie(!0),me=B(),he=me[0],Ce=me[1];wo.isTouch&&he==="hold"&&Ce&&(ie=Ce),ie?r=setTimeout(function(){b.show()},ie):b.show()}function zi(j){if(b.clearDelayTimeouts(),A("onUntrigger",[b,j]),!b.state.isVisible){se();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(j.type)>=0&&a)){var ie=Ie(!1);ie?i=setTimeout(function(){b.state.isVisible&&b.hide()},ie):o=requestAnimationFrame(function(){b.hide()})}}function ja(){b.state.isEnabled=!0}function La(){b.hide(),b.state.isEnabled=!1}function Da(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function ai(j){if(process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Xf("setProps")),!b.state.isDestroyed){A("onBeforeUpdate",[b,j]),en();var ie=b.props,me=S5(e,Object.assign({},ie,p5(j),{ignoreAttributes:!0}));b.props=me,Ut(),ie.interactiveDebounce!==me.interactiveDebounce&&(R(),h=f5(mr,me.interactiveDebounce)),ie.triggerTarget&&!me.triggerTarget?Zf(ie.triggerTarget).forEach(function(he){he.removeAttribute("aria-expanded")}):me.triggerTarget&&e.removeAttribute("aria-expanded"),$(),k(),M&&M(ie,me),b.popperInstance&&(Wa(),oi().forEach(function(he){requestAnimationFrame(he._tippy.popperInstance.forceUpdate)})),A("onAfterUpdate",[b,j])}}function Ju(j){b.setProps({content:j})}function ad(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Xf("show"));var j=b.state.isVisible,ie=b.state.isDestroyed,me=!b.state.isEnabled,he=wo.isTouch&&!b.props.touch,Ce=xx(b.props.duration,0,Nr.duration);if(!(j||ie||me||he)&&!ee().hasAttribute("disabled")&&(A("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,Z()&&(O.style.visibility="visible"),k(),Re(),b.state.isMounted||(O.style.transition="none"),Z()){var st=ge(),Gn=st.box,Wr=st.content;Rx([Gn,Wr],0)}d=function(){var Ki;if(!(!b.state.isVisible||c)){if(c=!0,O.offsetHeight,O.style.transition=b.props.moveTransition,Z()&&b.props.animation){var sd=ge(),cd=sd.box,Ba=sd.content;Rx([cd,Ba],Ce),h5([cd,Ba],"visible")}I(),$(),d5(Px,b),(Ki=b.popperInstance)==null||Ki.forceUpdate(),A("onMount",[b]),b.props.animation&&Z()&&ze(Ce,function(){b.state.isShown=!0,A("onShown",[b])})}},vr()}}function W(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Xf("hide"));var j=!b.state.isVisible,ie=b.state.isDestroyed,me=!b.state.isEnabled,he=xx(b.props.duration,1,Nr.duration);if(!(j||ie||me)&&(A("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,a=!1,Z()&&(O.style.visibility="hidden"),R(),se(),k(!0),Z()){var Ce=ge(),st=Ce.box,Gn=Ce.content;b.props.animation&&(Rx([st,Gn],he),h5([st,Gn],"hidden"))}I(),$(),b.props.animation?Z()&&Ae(he,b.unmount):b.unmount()}}function F(j){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Xf("hideWithInteractivity")),J().addEventListener("mousemove",h),d5(r_,h),h(j)}function D(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Xf("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(Ui(),oi().forEach(function(j){j._tippy.unmount()}),O.parentNode&&O.parentNode.removeChild(O),Px=Px.filter(function(j){return j!==b}),b.state.isMounted=!1,A("onHidden",[b]))}function Fe(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Xf("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),en(),delete e._tippy,b.state.isDestroyed=!0,A("onDestroy",[b]))}}function dm(e,t){t===void 0&&(t={});var n=Nr.plugins.concat(t.plugins||[]);process.env.NODE_ENV!=="production"&&(CMe(e),T5(t,n)),_Me();var r=Object.assign({},t,{plugins:n}),i=mMe(e);if(process.env.NODE_ENV!=="production"){var o=lm(r.content),a=i.length>1;Aa(o&&a,["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.",`
132
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function ii(){return t_(O.querySelectorAll("[data-tippy-root]"))}function zi(j){b.clearDelayTimeouts(),j&&A("onTrigger",[b,j]),ke();var ie=Te(!0),me=B(),he=me[0],Ie=me[1];Oo.isTouch&&he==="hold"&&Ie&&(ie=Ie),ie?r=setTimeout(function(){b.show()},ie):b.show()}function Ki(j){if(b.clearDelayTimeouts(),A("onUntrigger",[b,j]),!b.state.isVisible){se();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(j.type)>=0&&a)){var ie=Te(!1);ie?i=setTimeout(function(){b.state.isVisible&&b.hide()},ie):o=requestAnimationFrame(function(){b.hide()})}}function ja(){b.state.isEnabled=!0}function La(){b.hide(),b.state.isEnabled=!1}function Da(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function oi(j){if(process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Zf("setProps")),!b.state.isDestroyed){A("onBeforeUpdate",[b,j]),en();var ie=b.props,me=SH(e,Object.assign({},ie,pH(j),{ignoreAttributes:!0}));b.props=me,Ut(),ie.interactiveDebounce!==me.interactiveDebounce&&(R(),h=fH(mr,me.interactiveDebounce)),ie.triggerTarget&&!me.triggerTarget?Jf(ie.triggerTarget).forEach(function(he){he.removeAttribute("aria-expanded")}):me.triggerTarget&&e.removeAttribute("aria-expanded"),$(),k(),M&&M(ie,me),b.popperInstance&&(Wa(),ii().forEach(function(he){requestAnimationFrame(he._tippy.popperInstance.forceUpdate)})),A("onAfterUpdate",[b,j])}}function Ju(j){b.setProps({content:j})}function id(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Zf("show"));var j=b.state.isVisible,ie=b.state.isDestroyed,me=!b.state.isEnabled,he=Oo.isTouch&&!b.props.touch,Ie=Ox(b.props.duration,0,Nr.duration);if(!(j||ie||me||he)&&!ee().hasAttribute("disabled")&&(A("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,Z()&&(O.style.visibility="visible"),k(),ke(),b.state.isMounted||(O.style.transition="none"),Z()){var st=ge(),Yn=st.box,Wr=st.content;Ex([Yn,Wr],0)}d=function(){var Vi;if(!(!b.state.isVisible||c)){if(c=!0,O.offsetHeight,O.style.transition=b.props.moveTransition,Z()&&b.props.animation){var ad=ge(),ud=ad.box,Ba=ad.content;Ex([ud,Ba],Ie),hH([ud,Ba],"visible")}I(),$(),dH(Ax,b),(Vi=b.popperInstance)==null||Vi.forceUpdate(),A("onMount",[b]),b.props.animation&&Z()&&ze(Ie,function(){b.state.isShown=!0,A("onShown",[b])})}},vr()}}function W(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Zf("hide"));var j=!b.state.isVisible,ie=b.state.isDestroyed,me=!b.state.isEnabled,he=Ox(b.props.duration,1,Nr.duration);if(!(j||ie||me)&&(A("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,a=!1,Z()&&(O.style.visibility="hidden"),R(),se(),k(!0),Z()){var Ie=ge(),st=Ie.box,Yn=Ie.content;b.props.animation&&(Ex([st,Yn],he),hH([st,Yn],"hidden"))}I(),$(),b.props.animation?Z()&&Fe(he,b.unmount):b.unmount()}}function N(j){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Zf("hideWithInteractivity")),J().addEventListener("mousemove",h),dH(n_,h),h(j)}function D(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Zf("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(qi(),ii().forEach(function(j){j._tippy.unmount()}),O.parentNode&&O.parentNode.removeChild(O),Ax=Ax.filter(function(j){return j!==b}),b.state.isMounted=!1,A("onHidden",[b]))}function Ne(){process.env.NODE_ENV!=="production"&&Aa(b.state.isDestroyed,Zf("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),en(),delete e._tippy,b.state.isDestroyed=!0,A("onDestroy",[b]))}}function lm(e,t){t===void 0&&(t={});var n=Nr.plugins.concat(t.plugins||[]);process.env.NODE_ENV!=="production"&&(kMe(e),TH(t,n)),wMe();var r=Object.assign({},t,{plugins:n}),i=SMe(e);if(process.env.NODE_ENV!=="production"){var o=sm(r.content),a=i.length>1;Aa(o&&a,["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.",`
133
133
 
134
134
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
135
135
 
136
136
  `,`1) content: element.innerHTML
137
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var u=i.reduce(function(s,c){var l=c&&kMe(c,r);return l&&s.push(l),s},[]);return lm(e)?u[0]:u}dm.defaultProps=Nr,dm.setDefaultProps=EMe,dm.currentInput=wo,Object.assign({},z4,{effect:function(t){var n=t.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)}}),dm.setDefaultProps({render:O5});class AMe{constructor({editor:t,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:u,state:s,from:c,to:l})=>{const{doc:f,selection:d}=s,{empty:p}=d,h=!f.textBetween(c,l).length&&dx(s.selection),m=this.element.contains(document.activeElement);return!(!(u.hasFocus()||m)||p||h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var s;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&(!((s=this.element.parentNode)===null||s===void 0)&&s.contains(u.relatedTarget))||this.hide()},this.tippyBlurHandler=u=>{this.blurHandler({event:u})},this.handleDebouncedUpdate=(u,s)=>{const c=!(s!=null&&s.selection.eq(u.state.selection)),l=!(s!=null&&s.doc.eq(u.state.doc));!c&&!l||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,c,l,s)},this.updateDelay))},this.updateHandler=(u,s,c,l)=>{var f,d,p;const{state:h,composing:m}=u,{selection:g}=h;if(m||!s&&!c)return;this.createTooltip();const{ranges:S}=g,C=Math.min(...S.map(O=>O.$from.pos)),b=Math.max(...S.map(O=>O.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:u,state:h,oldState:l,from:C,to:b}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(SEe(h.selection)){let O=u.nodeDOM(C);const M=O.dataset.nodeViewWrapper?O:O.querySelector("[data-node-view-wrapper]");if(M&&(O=M.firstChild),O)return O.getBoundingClientRect()}return TEe(u,C,b)})}),this.show()},this.editor=t,this.element=n,this.view=r,this.updateDelay=o,a&&(this.shouldShow=a),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:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=dm(t,{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(t,n){const{state:r}=t,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,n);return}const o=!(n!=null&&n.selection.eq(t.state.selection)),a=!(n!=null&&n.doc.eq(t.state.doc));this.updateHandler(t,o,a,n)}show(){var t;(t=this.tippy)===null||t===void 0||t.show()}hide(){var t;(t=this.tippy)===null||t===void 0||t.hide()}destroy(){var t,n;!((t=this.tippy)===null||t===void 0)&&t.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 w5=e=>new Rr({key:typeof e.pluginKey=="string"?new Ni(e.pluginKey):e.pluginKey,view:t=>new AMe({view:t,...e})});fr.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[w5({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});const FMe=e=>{const[t,n]=N.useState(null);return N.useEffect(()=>{if(!t||e.editor.isDestroyed)return;const{pluginKey:r="bubbleMenu",editor:i,tippyOptions:o={},updateDelay:a,shouldShow:u=null}=e,s=w5({updateDelay:a,editor:i,element:t,pluginKey:r,shouldShow:u,tippyOptions:o});return i.registerPlugin(s),()=>i.unregisterPlugin(r)},[e.editor,t]),N.createElement("div",{ref:n,className:e.className,style:{visibility:"hidden"}},e.children)};class NMe extends UEe{constructor(){super(...arguments),this.contentComponent=null}}const PMe=({renderers:e})=>N.createElement(N.Fragment,null,Object.entries(e).map(([t,n])=>R_.createPortal(n.reactElement,n.element,t)));class WMe extends N.Component{constructor(t){super(t),this.editorContentRef=N.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:t}=this.props;if(t&&t.options.element){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=this,t.createNodeViews(),this.initialized=!0}}maybeFlushSync(t){this.initialized?R_.flushSync(t):t()}setRenderer(t,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[t]:n}}))})}removeRenderer(t){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{const r={...n};return delete r[t],{renderers:r}})})}componentWillUnmount(){const{editor:t}=this.props;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,...n}=this.props;return N.createElement(N.Fragment,null,N.createElement("div",{ref:this.editorContentRef,...n}),N.createElement(PMe,{renderers:this.state.renderers}))}}const jMe=N.memo(WMe),E5=N.createContext({onDragStart:void 0}),LMe=()=>N.useContext(E5),DMe=N.forwardRef((e,t)=>{const{onDragStart:n}=LMe(),r=e.as||"div";return N.createElement(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function BMe(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function UMe(e){var t;return typeof e=="object"&&((t=e.$$typeof)===null||t===void 0?void 0:t.toString())==="Symbol(react.forward_ref)"}class x5{constructor(t,{editor:n,props:r={},as:i="div",className:o="",attrs:a}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),a&&Object.keys(a).forEach(u=>{this.element.setAttribute(u,a[u])}),this.render()}render(){var t,n;const r=this.component,i=this.props;(BMe(r)||UMe(r))&&(i.ref=o=>{this.ref=o}),this.reactElement=N.createElement(r,{...i}),(n=(t=this.editor)===null||t===void 0?void 0:t.contentComponent)===null||n===void 0||n.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t,n;(n=(t=this.editor)===null||t===void 0?void 0:t.contentComponent)===null||n===void 0||n.removeRenderer(this.id)}}class qMe extends qEe{mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const o=a=>a.charAt(0).toUpperCase()+a.substring(1);this.component.displayName=o(this.extension.name)}const n=o=>{const a=this.component,u=this.onDragStart.bind(this),s=c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)};return N.createElement(N.Fragment,null,N.createElement(E5.Provider,{value:{onDragStart:u,nodeViewContentRef:s}},N.createElement(a,{...o})))};n.displayName="ReactNodeView",this.contentDOMElement=this.node.isLeaf?null: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.renderer=new x5(n,{editor:this.editor,props:t,as:r,className:`node-${this.node.type.name} ${i}`.trim(),attrs:this.options.attrs})}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.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}update(t,n){const r=i=>{this.renderer.updateProps(i)};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,o=this.decorations;return this.node=t,this.decorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:t,newDecorations:n,updateProps:()=>r({node:t,decorations:n})})}return t===this.node&&this.decorations===n||(this.node=t,this.decorations=n,r({node:t,decorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.contentDOMElement=null}}function zMe(e,t){return n=>n.editor.contentComponent?new qMe(e,n,t):{}}function KMe(){const[,e]=N.useState(0);return()=>e(t=>t+1)}const VMe=(e={},t=[])=>{const[n,r]=N.useState(null),i=KMe(),{onBeforeCreate:o,onBlur:a,onCreate:u,onDestroy:s,onFocus:c,onSelectionUpdate:l,onTransaction:f,onUpdate:d}=e,p=N.useRef(o),h=N.useRef(a),m=N.useRef(u),g=N.useRef(s),_=N.useRef(c),S=N.useRef(l),C=N.useRef(f),b=N.useRef(d);return N.useEffect(()=>{n&&(o&&(n.off("beforeCreate",p.current),n.on("beforeCreate",o),p.current=o),a&&(n.off("blur",h.current),n.on("blur",a),h.current=a),u&&(n.off("create",m.current),n.on("create",u),m.current=u),s&&(n.off("destroy",g.current),n.on("destroy",s),g.current=s),c&&(n.off("focus",_.current),n.on("focus",c),_.current=c),l&&(n.off("selectionUpdate",S.current),n.on("selectionUpdate",l),S.current=l),f&&(n.off("transaction",C.current),n.on("transaction",f),C.current=f),d&&(n.off("update",b.current),n.on("update",d),b.current=d))},[o,a,u,s,c,l,f,d,n]),N.useEffect(()=>{let w=!0;const O=new NMe(e);return r(O),O.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{w&&i()})})}),()=>{O.destroy(),w=!1}},t),n};var Pe={},M5={},Li={};Object.defineProperty(Li,"__esModule",{value:!0}),Li.Sections=Li.DynamicSection=Li.StaticSection=Li.sectionReader=void 0;const HMe=(0,G.__importStar)(Q),GMe=Zs,Wx=xr;function jx(e){return HMe.record(GMe.WidgetKey,e)}Li.sectionReader=jx,Li.StaticSection=jx(Wx.StaticWidget),Li.DynamicSection=jx(Wx.DynamicWidget),Li.Sections={toStatic(e,t){return Object.entries(e).reduce((r,[i,o])=>({...r,[i]:Wx.Widgets.toStatic(o,t)}),{})}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.filterMissingSharedSlices=e.collectWidgets=e.validateSlices=e.toStatic=e.flattenWidgets=e.CustomType=e.StaticCustomType=e.CustomTypeFormat=void 0;const t=G,n=Cn,r=(0,t.__importStar)(Q),i=_f,o=at,a=Li;e.CustomTypeFormat={page:"page",custom:"custom"};class u extends Error{constructor(_){super(),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slices=_,this.message=this._formatError(_)}_formatError(_){return`The following slices doesn't exists in your Prismic repository:
137
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var u=i.reduce(function(s,c){var l=c&&LMe(c,r);return l&&s.push(l),s},[]);return sm(e)?u[0]:u}lm.defaultProps=Nr,lm.setDefaultProps=NMe,lm.currentInput=Oo,Object.assign({},z4,{effect:function(t){var n=t.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)}}),lm.setDefaultProps({render:OH});class DMe{constructor({editor:t,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:u,state:s,from:c,to:l})=>{const{doc:f,selection:d}=s,{empty:p}=d,h=!f.textBetween(c,l).length&&cx(s.selection),m=this.element.contains(document.activeElement);return!(!(u.hasFocus()||m)||p||h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var s;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&(!((s=this.element.parentNode)===null||s===void 0)&&s.contains(u.relatedTarget))||this.hide()},this.tippyBlurHandler=u=>{this.blurHandler({event:u})},this.handleDebouncedUpdate=(u,s)=>{const c=!(s!=null&&s.selection.eq(u.state.selection)),l=!(s!=null&&s.doc.eq(u.state.doc));!c&&!l||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,c,l,s)},this.updateDelay))},this.updateHandler=(u,s,c,l)=>{var f,d,p;const{state:h,composing:m}=u,{selection:g}=h;if(m||!s&&!c)return;this.createTooltip();const{ranges:S}=g,C=Math.min(...S.map(O=>O.$from.pos)),b=Math.max(...S.map(O=>O.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:u,state:h,oldState:l,from:C,to:b}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(xEe(h.selection)){let O=u.nodeDOM(C);const M=O.dataset.nodeViewWrapper?O:O.querySelector("[data-node-view-wrapper]");if(M&&(O=M.firstChild),O)return O.getBoundingClientRect()}return MEe(u,C,b)})}),this.show()},this.editor=t,this.element=n,this.view=r,this.updateDelay=o,a&&(this.shouldShow=a),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:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=lm(t,{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(t,n){const{state:r}=t,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,n);return}const o=!(n!=null&&n.selection.eq(t.state.selection)),a=!(n!=null&&n.doc.eq(t.state.doc));this.updateHandler(t,o,a,n)}show(){var t;(t=this.tippy)===null||t===void 0||t.show()}hide(){var t;(t=this.tippy)===null||t===void 0||t.hide()}destroy(){var t,n;!((t=this.tippy)===null||t===void 0)&&t.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 wH=e=>new Rr({key:typeof e.pluginKey=="string"?new Ni(e.pluginKey):e.pluginKey,view:t=>new DMe({view:t,...e})});dr.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[wH({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});const BMe=e=>{const[t,n]=F.useState(null);return F.useEffect(()=>{if(!t||e.editor.isDestroyed)return;const{pluginKey:r="bubbleMenu",editor:i,tippyOptions:o={},updateDelay:a,shouldShow:u=null}=e,s=wH({updateDelay:a,editor:i,element:t,pluginKey:r,shouldShow:u,tippyOptions:o});return i.registerPlugin(s),()=>i.unregisterPlugin(r)},[e.editor,t]),F.createElement("div",{ref:n,className:e.className,style:{visibility:"hidden"}},e.children)};class UMe extends YEe{constructor(){super(...arguments),this.contentComponent=null}}const qMe=({renderers:e})=>F.createElement(F.Fragment,null,Object.entries(e).map(([t,n])=>M_.createPortal(n.reactElement,n.element,t)));class zMe extends F.Component{constructor(t){super(t),this.editorContentRef=F.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:t}=this.props;if(t&&t.options.element){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=this,t.createNodeViews(),this.initialized=!0}}maybeFlushSync(t){this.initialized?M_.flushSync(t):t()}setRenderer(t,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[t]:n}}))})}removeRenderer(t){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{const r={...n};return delete r[t],{renderers:r}})})}componentWillUnmount(){const{editor:t}=this.props;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,...n}=this.props;return F.createElement(F.Fragment,null,F.createElement("div",{ref:this.editorContentRef,...n}),F.createElement(qMe,{renderers:this.state.renderers}))}}const KMe=F.memo(zMe),EH=F.createContext({onDragStart:void 0}),VMe=()=>F.useContext(EH),xH=F.forwardRef((e,t)=>{const{onDragStart:n}=VMe(),r=e.as||"div";return F.createElement(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function HMe(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function GMe(e){var t;return typeof e=="object"&&((t=e.$$typeof)===null||t===void 0?void 0:t.toString())==="Symbol(react.forward_ref)"}class MH{constructor(t,{editor:n,props:r={},as:i="div",className:o="",attrs:a}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),a&&Object.keys(a).forEach(u=>{this.element.setAttribute(u,a[u])}),this.render()}render(){var t,n;const r=this.component,i=this.props;(HMe(r)||GMe(r))&&(i.ref=o=>{this.ref=o}),this.reactElement=F.createElement(r,{...i}),(n=(t=this.editor)===null||t===void 0?void 0:t.contentComponent)===null||n===void 0||n.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t,n;(n=(t=this.editor)===null||t===void 0?void 0:t.contentComponent)===null||n===void 0||n.removeRenderer(this.id)}}class YMe extends JEe{mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const o=a=>a.charAt(0).toUpperCase()+a.substring(1);this.component.displayName=o(this.extension.name)}const n=o=>{const a=this.component,u=this.onDragStart.bind(this),s=c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)};return F.createElement(F.Fragment,null,F.createElement(EH.Provider,{value:{onDragStart:u,nodeViewContentRef:s}},F.createElement(a,{...o})))};n.displayName="ReactNodeView",this.contentDOMElement=this.node.isLeaf?null: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.renderer=new MH(n,{editor:this.editor,props:t,as:r,className:`node-${this.node.type.name} ${i}`.trim(),attrs:this.options.attrs})}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.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}update(t,n){const r=i=>{this.renderer.updateProps(i)};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,o=this.decorations;return this.node=t,this.decorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:t,newDecorations:n,updateProps:()=>r({node:t,decorations:n})})}return t===this.node&&this.decorations===n||(this.node=t,this.decorations=n,r({node:t,decorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.contentDOMElement=null}}function RH(e,t){return n=>n.editor.contentComponent?new YMe(e,n,t):{}}function JMe(){const[,e]=F.useState(0);return()=>e(t=>t+1)}const ZMe=(e={},t=[])=>{const[n,r]=F.useState(null),i=JMe(),{onBeforeCreate:o,onBlur:a,onCreate:u,onDestroy:s,onFocus:c,onSelectionUpdate:l,onTransaction:f,onUpdate:d}=e,p=F.useRef(o),h=F.useRef(a),m=F.useRef(u),g=F.useRef(s),_=F.useRef(c),S=F.useRef(l),C=F.useRef(f),b=F.useRef(d);return F.useEffect(()=>{n&&(o&&(n.off("beforeCreate",p.current),n.on("beforeCreate",o),p.current=o),a&&(n.off("blur",h.current),n.on("blur",a),h.current=a),u&&(n.off("create",m.current),n.on("create",u),m.current=u),s&&(n.off("destroy",g.current),n.on("destroy",s),g.current=s),c&&(n.off("focus",_.current),n.on("focus",c),_.current=c),l&&(n.off("selectionUpdate",S.current),n.on("selectionUpdate",l),S.current=l),f&&(n.off("transaction",C.current),n.on("transaction",f),C.current=f),d&&(n.off("update",b.current),n.on("update",d),b.current=d))},[o,a,u,s,c,l,f,d,n]),F.useEffect(()=>{let w=!0;const O=new UMe(e);return r(O),O.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{w&&i()})})}),()=>{O.destroy(),w=!1}},t),n};var Re={},kH={},Li={};Object.defineProperty(Li,"__esModule",{value:!0}),Li.Sections=Li.DynamicSection=Li.StaticSection=Li.sectionReader=void 0;const XMe=(0,G.__importStar)(Q),QMe=Zs,Fx=xr;function Nx(e){return XMe.record(QMe.WidgetKey,e)}Li.sectionReader=Nx,Li.StaticSection=Nx(Fx.StaticWidget),Li.DynamicSection=Nx(Fx.DynamicWidget),Li.Sections={toStatic(e,t){return Object.entries(e).reduce((r,[i,o])=>({...r,[i]:Fx.Widgets.toStatic(o,t)}),{})}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.filterMissingSharedSlices=e.collectWidgets=e.validateSlices=e.toStatic=e.flattenWidgets=e.CustomType=e.StaticCustomType=e.CustomTypeFormat=void 0;const t=G,n=Cn,r=(0,t.__importStar)(Q),i=bf,o=at,a=Li;e.CustomTypeFormat={page:"page",custom:"custom"};class u extends Error{constructor(_){super(),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slices=_,this.message=this._formatError(_)}_formatError(_){return`The following slices doesn't exists in your Prismic repository:
138
138
  ${_.map(C=>` - ${C}`).join(`
139
139
  `)}
140
- `}}function s(g){return r.exact(r.intersection([r.type({id:r.string,label:o.StringOrNull,repeatable:(0,i.withFallback)(r.boolean,!0),json:r.record(r.string,g),status:(0,i.withFallback)(r.boolean,!0)}),r.partial({hash:r.string,format:(0,i.withFallback)(r.keyof(e.CustomTypeFormat),"custom")})]))}e.StaticCustomType=s(a.StaticSection),e.CustomType=s(a.DynamicSection);function c(g){return Object.entries(g.json).reduce((_,[,S])=>{const C=Object.entries(S);return _.concat(C)},[])}e.flattenWidgets=c;function l(g){return c(g).filter(([,C])=>C.type==="Slices").reduce((C,[,b])=>{const w=Object.entries(b.config&&b.config.choices?b.config.choices:{}).filter(([,O])=>O.type==="SharedSlice").map(([O])=>O);return C.concat(w)},[])}function f(g){const _=l(g);return function(S){return _.map(S)}}function d(g,_){const S=Object.entries(g.json).reduce((C,[b,w])=>({...C,[b]:a.Sections.toStatic(w,_)}),{});return{...g,json:S}}e.toStatic=d;function p(g,_){const S=f(g)(C=>{if(!_.get(C))return C}).filter(Boolean);return S.length>0?(0,n.left)(new u(S)):(0,n.right)(g)}e.validateSlices=p;function h(g,_){const S=Object.entries(g.json).reduce((C,[b,w])=>{const O=Object.entries(w).reduce((M,[x,U])=>{const B=_(x,U);return B?{...M,[x]:B}:M},{});return{...C,[b]:O}},{});return{...g,json:S}}e.collectWidgets=h;function m(g,_){return h(g,(S,C)=>{if(C.type==="Slices"){if(!C.config||!C.config.choices)return C;const b=Object.entries(C.config.choices).reduce((O,[M,x])=>x.type==="SharedSlice"&&!_.get(M)?O:{...O,[M]:x},{}),w={...C.config,choices:b};return{...C,config:w}}return C})}e.filterMissingSharedSlices=m}(M5);var R5={},i_={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiffOperation=void 0,function(t){t.Added="added",t.Removed="removed",t.Updated="updated"}(e.DiffOperation||(e.DiffOperation={}))})(i_);var o_={},Mc={},a_={};Object.defineProperty(a_,"__esModule",{value:!0}),a_.toRecord=void 0;function YMe(e,t){return e.reduce((n,r)=>{const i=t(r);return{...n,[i]:r}},{})}a_.toRecord=YMe,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.Objects=Mc.Arrays=void 0;const k5=G;Mc.Arrays=(0,k5.__importStar)(a_),Mc.Objects=(0,k5.__importStar)(_a);var pm={};Object.defineProperty(pm,"__esModule",{value:!0}),pm.VariationComparator=void 0;const u_=Mc,Qf=i_;function JMe(e,t){const n=u_.Objects.zipObjects(e,t);return Object.entries(n).reduce((r,[i,o])=>i==="primary"||i==="items"||(o==null?void 0:o.left)===(o==null?void 0:o.right)?r:{...r,[i]:o==null?void 0:o.right},{})}function A5(e,t){const n=u_.Objects.zipObjects(e,t),r=Object.entries(n).reduce((i,[o,a])=>{if(JSON.stringify(a==null?void 0:a.left)===JSON.stringify(a==null?void 0:a.right))return i;const u=(()=>{if(!(!(a!=null&&a.left)&&!(a!=null&&a.right)))return a!=null&&a.left&&!a.right?{op:Qf.DiffOperation.Removed}:!(a!=null&&a.left)&&(a!=null&&a.right)?{op:Qf.DiffOperation.Added,value:a.right}:{op:Qf.DiffOperation.Updated,value:a.right}})();return u?{...i,[o]:u}:i},{});return u_.Objects.isNotEmpty(r)?r:void 0}pm.VariationComparator={compare(e,t){if(e&&!t)return{op:Qf.DiffOperation.Removed};if(!e&&t)return{op:Qf.DiffOperation.Added,value:t};const n=JMe(e,t),r=A5(e==null?void 0:e.primary,t==null?void 0:t.primary),i=A5(e==null?void 0:e.items,t==null?void 0:t.items),o={...n,...r?{primary:r}:{},...i?{items:i}:{}};if(u_.Objects.isNotEmpty(o))return{op:Qf.DiffOperation.Updated,value:o}}},Object.defineProperty(o_,"__esModule",{value:!0}),o_.SliceComparator=void 0;const ed=Mc,Lx=i_,ZMe=pm;function XMe(e,t){const n=ed.Objects.zipObjects(e,t);return Object.entries(n).reduce((r,[i,o])=>i==="variations"||(o==null?void 0:o.left)===(o==null?void 0:o.right)?r:{...r,[i]:o==null?void 0:o.right},{})}o_.SliceComparator={compare(e,t){if(!e&&t)return{op:Lx.DiffOperation.Added,value:t};if(e&&!t)return{op:Lx.DiffOperation.Removed};const n=XMe(e,t),r=ed.Objects.zipObjects(e&&ed.Arrays.toRecord(e.variations,a=>a.id),t&&ed.Arrays.toRecord(t.variations,a=>a.id)),i=Object.entries(r).reduce((a,[u,s])=>{if(!s)return a;const c=ZMe.VariationComparator.compare(s.left,s.right);return c?{...a,[u]:c}:a},{}),o={...n,...ed.Objects.isNotEmpty(i)?{variations:i}:{}};if(ed.Objects.isNotEmpty(o))return{op:Lx.DiffOperation.Updated,value:o}}},function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(i_,e),(0,t.__exportStar)(o_,e),(0,t.__exportStar)(pm,e)}(R5),function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(M5,e),(0,t.__exportStar)(R5,e),(0,t.__exportStar)(Li,e),(0,t.__exportStar)(ho,e)}(Pe);const QMe=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,eRe=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,tRe=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,nRe=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,rRe=tm.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",It(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Hb({find:QMe,type:this.type}),Hb({find:tRe,type:this.type})]},addPasteRules(){return[Yb({find:eRe,type:this.type}),Yb({find:nRe,type:this.type})]}});var Dx=(e=>(e.Document="document",e.Mark="mark",e.Node="node",e))(Dx||{}),td=(e=>(e.Text="text",e.Embed="embed",e.Image="image",e))(td||{});class iRe{constructor(t,n,r){Wc(this,"extType","document");this.name=t,this.component=n,this.converter=r}}class F5{constructor(t,n,r,i){Wc(this,"extType","mark");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}class nd{constructor(t,n,r,i,o,a=!1){Wc(this,"extType","node");Wc(this,"nodeType","text");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i,this.placeholder=o,this.lockedFormat=a}}class oRe{constructor(t,n,r,i){Wc(this,"extType","node");Wc(this,"nodeType","embed");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}class aRe extends nd{constructor(t,n,r,i,o){super(t,"heading",n,i,o),this.levels=r}}class Bx extends nd{constructor(t,n,r,i){super(t,n,r,i)}}const Ux=rRe.extend({name:"bold"}),uRe={fromPrismic(e){return function(){var t;return(t=e.marks[Ux.name])==null?void 0:t.create()}},toPrismic(){}},N5=new F5([Pe.RichTextNodeType.strong],Ux.name,Ux,uRe),sRe=Hn.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",It(this.options.HTMLAttributes,e),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)}}}),P5=tm.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["span",It(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:t})=>{const n=Kb(e,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:t.unsetMark(this.name)}}}}),W5=/^\s*([-+*])\s$/,cRe=Hn.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:e}){return["ul",It(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sRe.name,this.editor.getAttributes(P5.name)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Gb({find:W5,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Gb({find:W5,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(P5.name),editor:this.editor})),[e]}}),j5=Hn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",It(this.options.HTMLAttributes,e)]},renderText(){return`
141
- `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:u}=r.extensionManager,s=o||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:l})=>{if(l&&s&&a){const f=s.filter(d=>u.includes(d.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Rc={isHardBreak(e){return e.type.name===j5.name},children:{reduce(e,t,n){let r=n;return e.forEach((i,o,a)=>{r=t(r,i,a)}),r},map(e,t){return this.reduce(e,(n,r)=>[...n,t(r)],[])},exists(e,t){return this.reduce(e,(n,r)=>n||t(r),!1)},filter(e,t){return this.reduce(e,(n,r)=>[...n,...t(r)?[r]:[]],[])}},marks:{reduce(e,t,n){let r=n;return e.marks.forEach((i,o)=>{r=t(r,i,o)}),r},map(e,t){return this.reduce(e,(n,r)=>[...n,t(r)],[])},filter(e,t){return this.reduce(e,(n,r)=>[...n,...t(r)?[r]:[]],[])}}};function lRe(e){if(!e||!e.size)return{defaultTextConverter:void 0,extensions:kH()};const t=kH(e),n=Array.from(e.values()),r=(()=>{const a=Xi(c=>n.some(l=>c.richTextNodeTypes.includes(l)))(t),u=a.some(c=>c instanceof Bx)?[Yu,...a]:a;return u.some(c=>c instanceof nd)?u:[RH,...u]})(),i=r.find(a=>a instanceof nd)||RH;function o(a){return u=>i.converter.fromPrismic(a)({...u,type:i.richTextNodeTypes[0]})}return{defaultTextConverter:o,extensions:r}}function fRe(e){if(!(e!=null&&e.single)&&!(e!=null&&e.multi))return;const t=v((e.single||e.multi||"").split(/\s*,\s*/),Tv(n=>WS(()=>{})(Pe.RichTextNodeTypeCodec.decode(n))),Xi(Tu));return new Set(t)}function dRe(e){const t=fRe(e);return lRe(t)}const pRe=Hn.create({name:"doc",topNode:!0,content:"block+"}),L5=Hn.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",It(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}).extend({name:"listItem",content:"paragraph*",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name)}}}),rd={component:L5,converter:{fromPrismic(e){return function(t){var r;const n=Yu.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[L5.name])==null?void 0:r.create({},n)}},toPrismic(e,t){return Rc.children.reduce(e,(n,r)=>{const i=Yu.converter.toPrismic(r),o=(()=>i instanceof Array?i.map(a=>({...a,type:t})):i?[{...i,type:t}]:[])();return[...n,...o]},[])}},placeholder:"List"};function hRe(e){return e.slice(1,e.length).reduce((t,n)=>t.copy(t.content.append(n.content)),e[0])}const qx="document",mRe=e=>pRe.extend({name:qx,content:e?"block+":"block"}),vRe=e=>({fromPrismic(t,n){function r(i){return function(o=void 0){return!o&&n&&Qe.TextBlock.is(i)?n(i):o}}return function(i){var a;const o=i.value.reduce((u,s)=>{const c=e.find(h=>h.richTextNodeTypes.includes(s.type)),l=(()=>{if(c)switch(c.nodeType){case td.Embed:return Qe.EmbedBlock.is(s)&&c.converter.fromPrismic(t)(s);case td.Text:return Qe.TextBlock.is(s)&&c.converter.fromPrismic(t)(s);case td.Image:return Qe.ImageBlock.is(s)&&c.converter.fromPrismic(t)(s);default:return}})(),[f,d]=v(u,s$(u.length-1),([h,m])=>[h,u$(m)]),p=(()=>l?v(d,qo(()=>({merged:!1,node:l}),h=>l.type.name===h.type.name&&(l.type.name===C_.name||l.type.name===E_.name)?{merged:!0,node:hRe([h,l])}:{merged:!1,node:l}),({merged:h,node:m})=>({merged:h,node:r(s)(m)})):{merged:!1,node:r(s)()})();return p.node?[...p.merged?f:u,p.node]:u},[]);return(a=t.nodes[qx])==null?void 0:a.create({},o)}},toPrismic(t){return{__TYPE__:"StructuredTextContent",value:[...Rc.children.reduce(t,(r,i)=>{const o=Object.values(e).find(u=>i.type.name===u.name),a=o==null?void 0:o.converter.toPrismic(i);return a||console.warn(`Cannot convert node of type '${i.type.name}'.`),a?[...r,...a instanceof Array?a:[a]]:r},[])]}}}),zx=new iRe(qx,mRe,vRe),s_=j5.extend({name:"hard_break"}),c_=`
142
- `,D5={fromPrismic(e){return function(t){var n;if(t===c_)return(n=e.nodes[s_.name])==null?void 0:n.create({})}},toPrismic(e){if(e.type.name===s_.name)return c_}},Kx={isEmptyLine(e){return e.length===0},isFirst(e){return e===0}};function gRe(e,t){return function(n){const r=D5.fromPrismic(e)(c_);if(!r)return[n(t)];const i=t.split(c_);return i.length===1?t.length?[n(t)]:[r]:i.reduce((o,a,u)=>Kx.isFirst(u)?Kx.isEmptyLine(a)?o:[...o,n(a)]:Kx.isEmptyLine(a)?[...o,r]:[...o,r,n(a)],[])}}const l_={name:s_.name,component:s_,converter:D5,splitTextToNodes:gRe},yRe=fr.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Rr({key:new Ni("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(!n)return null;const o=e.type.createAndFill(),a=(o==null?void 0:o.sameMarkup(e))&&o.content.findDiffStart(e.content)===null;return e.descendants((u,s)=>{const c=r>=s&&r<=s+u.nodeSize,l=!u.isLeaf&&!u.childCount;if((c||!this.options.showOnlyCurrent)&&l){const f=[this.options.emptyNodeClass];a&&f.push(this.options.emptyEditorClass);const d=Ar.node(s,s+u.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:u,pos:s,hasAnchor:c}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),Wt.create(e,i)}}})]}}),bRe="Type '/' for commands",_Re=e=>yRe.configure({includeChildren:!0,placeholder:t=>$Re({props:t,params:e}),showOnlyCurrent:!1,showOnlyWhenEditable:!1});function $Re({props:e,params:t}){const{editor:n,hasAnchor:r,node:i}=e,{placeholderByNodeType:o,unfocusedPlaceholder:a,nodeExtensions:u}=t,s=!Rc.children.exists(n.state.doc,S=>S===i),c=n.isEditable,l=n.isFocused&&r,f=i.type.name!==Yu.name,d=l||f||s,p=u.length>1;function h(S){return S===bRe?c&&d&&p:c&&d}function m(){if(s)return rd.placeholder;const S=o[i.type.name];return typeof S=="string"?S:S==null?void 0:S(i.attrs)}const g=m(),_=h(g);return a&&!l&&n.isEmpty?a:_&&g||""}function f_(e){return e.split("-")[1]}function B5(e){return e==="y"?"height":"width"}function zu(e){return e.split("-")[0]}function hm(e){return["top","bottom"].includes(zu(e))?"x":"y"}function U5(e,t,n){let{reference:r,floating:i}=e;const o=r.x+r.width/2-i.width/2,a=r.y+r.height/2-i.height/2,u=hm(t),s=B5(u),c=r[s]/2-i[s]/2,l=zu(t),f=u==="x";let d;switch(l){case"top":d={x:o,y:r.y-i.height};break;case"bottom":d={x:o,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:a};break;case"left":d={x:r.x-i.width,y:a};break;default:d={x:r.x,y:r.y}}switch(f_(t)){case"start":d[u]-=c*(n&&f?-1:1);break;case"end":d[u]+=c*(n&&f?-1:1);break}return d}const SRe=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,u=o.filter(Boolean),s=await(a.isRTL==null?void 0:a.isRTL(t));if(process.env.NODE_ENV!=="production"){if(a==null&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),u.filter(m=>{let{name:g}=m;return g==="autoPlacement"||g==="flip"}).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));(!e||!t)&&console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "))}let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:f}=U5(c,r,s),d=r,p={},h=0;for(let m=0;m<u.length;m++){const{name:g,fn:_}=u[m],{x:S,y:C,data:b,reset:w}=await _({x:l,y:f,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});if(l=S??l,f=C??f,p={...p,[g]:{...p[g],...b}},process.env.NODE_ENV!=="production"&&h>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),w&&h<=50){h++,typeof w=="object"&&(w.placement&&(d=w.placement),w.rects&&(c=w.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:l,y:f}=U5(c,d,s)),m=-1;continue}}return{x:l,y:f,placement:d,strategy:i,middlewareData:p}};function TRe(e){return{top:0,right:0,bottom:0,left:0,...e}}function IRe(e){return typeof e!="number"?TRe(e):{top:e,right:e,bottom:e,left:e}}function Vx(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function q5(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:u,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=t,h=IRe(p),g=u[d?f==="floating"?"reference":"floating":f],_=Vx(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:c,rootBoundary:l,strategy:s})),S=f==="floating"?{...a.floating,x:r,y:i}:a.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),b=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},w=Vx(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:S,offsetParent:C,strategy:s}):S);return process.env.NODE_ENV,{top:(_.top-w.top+h.top)/b.y,bottom:(w.bottom-_.bottom+h.bottom)/b.y,left:(_.left-w.left+h.left)/b.x,right:(w.right-_.right+h.right)/b.x}}const CRe=Math.min,ORe=Math.max;function z5(e,t,n){return ORe(e,CRe(t,n))}const wRe={left:"right",right:"left",bottom:"top",top:"bottom"};function d_(e){return e.replace(/left|right|bottom|top/g,t=>wRe[t])}function ERe(e,t,n){n===void 0&&(n=!1);const r=f_(e),i=hm(e),o=B5(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=d_(a)),{main:a,cross:d_(a)}}const xRe={start:"end",end:"start"};function Hx(e){return e.replace(/start|end/g,t=>xRe[t])}function MRe(e){const t=d_(e);return[Hx(e),t,Hx(t)]}function RRe(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:a;default:return[]}}function kRe(e,t,n,r){const i=f_(e);let o=RRe(zu(e),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(Hx)))),o}const ARe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:u,elements:s}=t,{mainAxis:c=!0,crossAxis:l=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...m}=e,g=zu(r),_=zu(a)===a,S=await(u.isRTL==null?void 0:u.isRTL(s.floating)),C=f||(_||!h?[d_(a)]:MRe(a));!f&&p!=="none"&&C.push(...kRe(a,h,p,S));const b=[a,...C],w=await q5(t,m),O=[];let M=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&O.push(w[g]),l){const{main:P,cross:Z}=ERe(r,o,S);O.push(w[P],w[Z])}if(M=[...M,{placement:r,overflows:O}],!O.every(P=>P<=0)){var x,U;const P=(((x=i.flip)==null?void 0:x.index)||0)+1,Z=b[P];if(Z)return{data:{index:P,overflows:M},reset:{placement:Z}};let ee=(U=M.filter(J=>J.overflows[0]<=0).sort((J,ge)=>J.overflows[1]-ge.overflows[1])[0])==null?void 0:U.placement;if(!ee)switch(d){case"bestFit":{var B;const J=(B=M.map(ge=>[ge.placement,ge.overflows.filter(Ie=>Ie>0).reduce((Ie,k)=>Ie+k,0)]).sort((ge,Ie)=>ge[1]-Ie[1])[0])==null?void 0:B[0];J&&(ee=J);break}case"initialPlacement":ee=a;break}if(r!==ee)return{reset:{placement:ee}}}return{}}}};async function FRe(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=zu(n),u=f_(n),s=hm(n)==="x",c=["left","top"].includes(a)?-1:1,l=o&&s?-1:1,f=typeof t=="function"?t(e):t;let{mainAxis:d,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return u&&typeof h=="number"&&(p=u==="end"?h*-1:h),s?{x:p*l,y:d*c}:{x:d*c,y:p*l}}const NRe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,i=await FRe(t,e);return{x:n+i.x,y:r+i.y,data:i}}}};function K5(e){return e==="x"?"y":"x"}const PRe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:u={fn:g=>{let{x:_,y:S}=g;return{x:_,y:S}}},...s}=e,c={x:n,y:r},l=await q5(t,s),f=hm(zu(i)),d=K5(f);let p=c[f],h=c[d];if(o){const g=f==="y"?"top":"left",_=f==="y"?"bottom":"right",S=p+l[g],C=p-l[_];p=z5(S,p,C)}if(a){const g=d==="y"?"top":"left",_=d==="y"?"bottom":"right",S=h+l[g],C=h-l[_];h=z5(S,h,C)}const m=u.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},WRe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:u=0,mainAxis:s=!0,crossAxis:c=!0}=e,l={x:n,y:r},f=hm(i),d=K5(f);let p=l[f],h=l[d];const m=typeof u=="function"?u(t):u,g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(s){const C=f==="y"?"height":"width",b=o.reference[f]-o.floating[C]+g.mainAxis,w=o.reference[f]+o.reference[C]-g.mainAxis;p<b?p=b:p>w&&(p=w)}if(c){var _,S;const C=f==="y"?"width":"height",b=["top","left"].includes(zu(i)),w=o.reference[d]-o.floating[C]+(b&&((_=a.offset)==null?void 0:_[d])||0)+(b?0:g.crossAxis),O=o.reference[d]+o.reference[C]+(b?0:((S=a.offset)==null?void 0:S[d])||0)-(b?g.crossAxis:0);h<w?h=w:h>O&&(h=O)}return{[f]:p,[d]:h}}}};function Pr(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Eo(e){return Pr(e).getComputedStyle(e)}const V5=Math.min,mm=Math.max,p_=Math.round;function H5(e){const t=Eo(e);let n=parseFloat(t.width),r=parseFloat(t.height);const i=e.offsetWidth,o=e.offsetHeight,a=p_(n)!==i||p_(r)!==o;return a&&(n=i,r=o),{width:n,height:r,fallback:a}}function Ku(e){return Y5(e)?(e.nodeName||"").toLowerCase():""}let h_;function G5(){if(h_)return h_;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(h_=e.brands.map(t=>t.brand+"/"+t.version).join(" "),h_):navigator.userAgent}function xo(e){return e instanceof Pr(e).HTMLElement}function Di(e){return e instanceof Pr(e).Element}function Y5(e){return e instanceof Pr(e).Node}function J5(e){if(typeof ShadowRoot>"u")return!1;const t=Pr(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function m_(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Eo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function jRe(e){return["table","td","th"].includes(Ku(e))}function Gx(e){const t=/firefox/i.test(G5()),n=Eo(e),r=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!=="none"||n.perspective!=="none"||(r?r!=="none":!1)||t&&n.willChange==="filter"||t&&(n.filter?n.filter!=="none":!1)||["transform","perspective"].some(i=>n.willChange.includes(i))||["paint","layout","strict","content"].some(i=>{const o=n.contain;return o!=null?o.includes(i):!1})}function Yx(){return/^((?!chrome|android).)*safari/i.test(G5())}function Jx(e){return["html","body","#document"].includes(Ku(e))}function Z5(e){return Di(e)?e:e.contextElement}const X5={x:1,y:1};function id(e){const t=Z5(e);if(!xo(t))return X5;const n=t.getBoundingClientRect(),{width:r,height:i,fallback:o}=H5(t);let a=(o?p_(n.width):n.width)/r,u=(o?p_(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}function kc(e,t,n,r){var i,o;t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),u=Z5(e);let s=X5;t&&(r?Di(r)&&(s=id(r)):s=id(e));const c=u?Pr(u):window,l=Yx()&&n;let f=(a.left+(l&&((i=c.visualViewport)==null?void 0:i.offsetLeft)||0))/s.x,d=(a.top+(l&&((o=c.visualViewport)==null?void 0:o.offsetTop)||0))/s.y,p=a.width/s.x,h=a.height/s.y;if(u){const m=Pr(u),g=r&&Di(r)?Pr(r):r;let _=m.frameElement;for(;_&&r&&g!==m;){const S=id(_),C=_.getBoundingClientRect(),b=getComputedStyle(_);C.x+=(_.clientLeft+parseFloat(b.paddingLeft))*S.x,C.y+=(_.clientTop+parseFloat(b.paddingTop))*S.y,f*=S.x,d*=S.y,p*=S.x,h*=S.y,f+=C.x,d+=C.y,_=Pr(_).frameElement}}return{width:p,height:h,top:d,right:f+p,bottom:d+h,left:f,x:f,y:d}}function Vu(e){return((Y5(e)?e.ownerDocument:e.document)||window.document).documentElement}function v_(e){return Di(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function LRe(e){let{rect:t,offsetParent:n,strategy:r}=e;const i=xo(n),o=Vu(n);if(n===o)return t;let a={scrollLeft:0,scrollTop:0},u={x:1,y:1};const s={x:0,y:0};if((i||!i&&r!=="fixed")&&((Ku(n)!=="body"||m_(o))&&(a=v_(n)),xo(n))){const c=kc(n);u=id(n),s.x=c.x+n.clientLeft,s.y=c.y+n.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-a.scrollLeft*u.x+s.x,y:t.y*u.y-a.scrollTop*u.y+s.y}}function Q5(e){return kc(Vu(e)).left+v_(e).scrollLeft}function DRe(e){const t=Vu(e),n=v_(e),r=e.ownerDocument.body,i=mm(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=mm(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Q5(e);const u=-n.scrollTop;return Eo(r).direction==="rtl"&&(a+=mm(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:u}}function vm(e){if(Ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||J5(e)&&e.host||Vu(e);return J5(t)?t.host:t}function eH(e){const t=vm(e);return Jx(t)?t.ownerDocument.body:xo(t)&&m_(t)?t:eH(t)}function Ac(e,t){var n;t===void 0&&(t=[]);const r=eH(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=Pr(r);return i?t.concat(o,o.visualViewport||[],m_(r)?r:[]):t.concat(r,Ac(r))}function BRe(e,t){const n=Pr(e),r=Vu(e),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,u=0,s=0;if(i){o=i.width,a=i.height;const c=Yx();(!c||c&&t==="fixed")&&(u=i.offsetLeft,s=i.offsetTop)}return{width:o,height:a,x:u,y:s}}function URe(e,t){const n=kc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=xo(e)?id(e):{x:1,y:1},a=e.clientWidth*o.x,u=e.clientHeight*o.y,s=i*o.x,c=r*o.y;return{width:a,height:u,x:s,y:c}}function tH(e,t,n){let r;if(t==="viewport")r=BRe(e,n);else if(t==="document")r=DRe(Vu(e));else if(Di(t))r=URe(t,n);else{const a={...t};if(Yx()){var i,o;const u=Pr(e);a.x-=((i=u.visualViewport)==null?void 0:i.offsetLeft)||0,a.y-=((o=u.visualViewport)==null?void 0:o.offsetTop)||0}r=a}return Vx(r)}function qRe(e,t){const n=t.get(e);if(n)return n;let r=Ac(e).filter(u=>Di(u)&&Ku(u)!=="body"),i=null;const o=Eo(e).position==="fixed";let a=o?vm(e):e;for(;Di(a)&&!Jx(a);){const u=Eo(a),s=Gx(a);u.position==="fixed"?i=null:(o?!s&&!i:!s&&u.position==="static"&&!!i&&["absolute","fixed"].includes(i.position))?r=r.filter(f=>f!==a):i=u,a=vm(a)}return t.set(e,r),r}function zRe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?qRe(t,this._c):[].concat(n),r],u=a[0],s=a.reduce((c,l)=>{const f=tH(t,l,i);return c.top=mm(f.top,c.top),c.right=V5(f.right,c.right),c.bottom=V5(f.bottom,c.bottom),c.left=mm(f.left,c.left),c},tH(t,u,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function KRe(e){return xo(e)?H5(e):e.getBoundingClientRect()}function nH(e,t){return!xo(e)||Eo(e).position==="fixed"?null:t?t(e):e.offsetParent}function VRe(e){let t=vm(e);for(;xo(t)&&!Jx(t);){if(Gx(t))return t;t=vm(t)}return null}function rH(e,t){const n=Pr(e);let r=nH(e,t);for(;r&&jRe(r)&&Eo(r).position==="static";)r=nH(r,t);return r&&(Ku(r)==="html"||Ku(r)==="body"&&Eo(r).position==="static"&&!Gx(r))?n:r||VRe(e)||n}function HRe(e,t,n){const r=xo(t),i=Vu(t),o=kc(e,!0,n==="fixed",t);let a={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if(r||!r&&n!=="fixed")if((Ku(t)!=="body"||m_(i))&&(a=v_(t)),xo(t)){const s=kc(t,!0);u.x=s.x+t.clientLeft,u.y=s.y+t.clientTop}else i&&(u.x=Q5(i));return{x:o.left+a.scrollLeft-u.x,y:o.top+a.scrollTop-u.y,width:o.width,height:o.height}}const GRe={getClippingRect:zRe,convertOffsetParentRelativeRectToViewportRelativeRect:LRe,isElement:Di,getDimensions:KRe,getOffsetParent:rH,getDocumentElement:Vu,getScale:id,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const i=this.getOffsetParent||rH,o=this.getDimensions;return{reference:HRe(t,await i(n),r),floating:{x:0,y:0,...await o(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>Eo(e).direction==="rtl"};function YRe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=!0,animationFrame:u=!1}=r,s=i&&!u,c=s||o?[...Di(e)?Ac(e):e.contextElement?Ac(e.contextElement):[],...Ac(t)]:[];c.forEach(h=>{s&&h.addEventListener("scroll",n,{passive:!0}),o&&h.addEventListener("resize",n)});let l=null;if(a){let h=!0;l=new ResizeObserver(()=>{h||n(),h=!1}),Di(e)&&!u&&l.observe(e),!Di(e)&&e.contextElement&&!u&&l.observe(e.contextElement),l.observe(t)}let f,d=u?kc(e):null;u&&p();function p(){const h=kc(e);d&&(h.x!==d.x||h.y!==d.y||h.width!==d.width||h.height!==d.height)&&n(),d=h,f=requestAnimationFrame(p)}return n(),()=>{var h;c.forEach(m=>{s&&m.removeEventListener("scroll",n),o&&m.removeEventListener("resize",n)}),(h=l)==null||h.disconnect(),l=null,u&&cancelAnimationFrame(f)}}const JRe=(e,t,n)=>{const r=new Map,i={platform:GRe,...n},o={...i.platform,_c:r};return SRe(e,t,{...i,platform:o})};var g_=typeof document<"u"?N.useLayoutEffect:N.useEffect;function y_(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!y_(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!y_(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function iH(e){const t=_e.useRef(e);return g_(()=>{t.current=e}),t}function ZRe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,whileElementsMounted:o,open:a}=e,[u,s]=_e.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[c,l]=_e.useState(r);y_(c,r)||l(r);const f=_e.useRef(null),d=_e.useRef(null),p=_e.useRef(u),h=iH(o),m=iH(i),[g,_]=_e.useState(null),[S,C]=_e.useState(null),b=_e.useCallback(B=>{f.current!==B&&(f.current=B,_(B))},[]),w=_e.useCallback(B=>{d.current!==B&&(d.current=B,C(B))},[]),O=_e.useCallback(()=>{if(!f.current||!d.current)return;const B={placement:t,strategy:n,middleware:c};m.current&&(B.platform=m.current),JRe(f.current,d.current,B).then(P=>{const Z={...P,isPositioned:!0};M.current&&!y_(p.current,Z)&&(p.current=Z,zH.flushSync(()=>{s(Z)}))})},[c,t,n,m]);g_(()=>{a===!1&&p.current.isPositioned&&(p.current.isPositioned=!1,s(B=>({...B,isPositioned:!1})))},[a]);const M=_e.useRef(!1);g_(()=>(M.current=!0,()=>{M.current=!1}),[]),g_(()=>{if(g&&S){if(h.current)return h.current(g,S,O);O()}},[g,S,O,h]);const x=_e.useMemo(()=>({reference:f,floating:d,setReference:b,setFloating:w}),[b,w]),U=_e.useMemo(()=>({reference:g,floating:S}),[g,S]);return _e.useMemo(()=>({...u,update:O,refs:x,elements:U,reference:b,floating:w}),[u,O,x,U,b,w])}var Hu=typeof document<"u"?N.useLayoutEffect:N.useEffect;function XRe(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}let Zx=!1,QRe=0;const oH=()=>"floating-ui-"+QRe++;function eke(){const[e,t]=_e.useState(()=>Zx?oH():void 0);return Hu(()=>{e==null&&t(oH())},[]),_e.useEffect(()=>{Zx||(Zx=!0)},[]),e}const aH=_e["useId".toString()],uH=aH??eke,tke=_e.createContext(null),nke=_e.createContext(null),sH=()=>{var e,t;return(e=(t=_e.useContext(tke))==null?void 0:t.id)!=null?e:null},Xx=()=>_e.useContext(nke);function Qx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function cH(e){var t;return(t=Qx(e).defaultView)!=null?t:window}function b_(e){return e?e instanceof cH(e).Element:!1}function rke(e){return e?e instanceof cH(e).HTMLElement:!1}const lH=_e["useInsertionEffect".toString()];function eM(e){const t=_e.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return lH?lH(()=>{t.current=e}):t.current=e,_e.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function ike(e){let{open:t=!1,onOpenChange:n,whileElementsMounted:r,placement:i,middleware:o,strategy:a,nodeId:u}=e===void 0?{}:e;const[s,c]=_e.useState(null),l=Xx(),f=_e.useRef(null),d=_e.useRef({}),p=_e.useState(()=>XRe())[0],h=ZRe({placement:i,middleware:o,strategy:a,whileElementsMounted:r}),m=eM(n),g=_e.useMemo(()=>({...h.refs,domReference:f}),[h.refs]),_=_e.useMemo(()=>({...h,refs:g,dataRef:d,nodeId:u,events:p,open:t,onOpenChange:m,_:{domReference:s}}),[h,u,p,t,m,g,s]);Hu(()=>{const b=l==null?void 0:l.nodesRef.current.find(w=>w.id===u);b&&(b.context=_)});const{reference:S}=h,C=_e.useCallback(b=>{(b_(b)||b===null)&&(_.refs.domReference.current=b,c(b)),S(b)},[S,_.refs]);return _e.useMemo(()=>({...h,context:_,refs:g,reference:C}),[h,g,_,C])}function tM(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(i=>i?i[n]:null).concat(e).reduce((i,o)=>(o&&Object.entries(o).forEach(a=>{let[u,s]=a;if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof s=="function"){var c;(c=r.get(u))==null||c.push(s),i[u]=function(){for(var l,f=arguments.length,d=new Array(f),p=0;p<f;p++)d[p]=arguments[p];(l=r.get(u))==null||l.forEach(h=>h(...d))}}}else i[u]=s}),i),{})}}const oke=function(e){return e===void 0&&(e=[]),{getReferenceProps:t=>tM(t,e,"reference"),getFloatingProps:t=>tM(t,e,"floating"),getItemProps:t=>tM(t,e,"item")}};function nM(e,t){var n;let r=(n=e.filter(a=>{var u;return a.parentId===t&&((u=a.context)==null?void 0:u.open)}))!=null?n:[],i=r;for(;i.length;){var o;i=(o=e.filter(a=>{var u;return(u=i)==null?void 0:u.some(s=>{var c;return a.parentId===s.id&&((c=a.context)==null?void 0:c.open)})}))!=null?o:[],r=r.concat(i)}return r}function fH(e){let t=e.activeElement;for(;((n=t)==null||(r=n.shadowRoot)==null?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function ake(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Gu(e){e.preventDefault(),e.stopPropagation()}function uke(e){const t=N.useRef(e);return Hu(()=>{t.current=e}),t}function dH(e){const t=N.useRef();return Hu(()=>{t.current=e},[e]),t.current}const ske=function(e,t){let{open:n}=e,{enabled:r=!0,role:i="dialog"}=t===void 0?{}:t;const o=uH(),a=uH(),u={id:o,role:i};return r?i==="tooltip"?{reference:{"aria-describedby":n?o:void 0},floating:u}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":i==="alertdialog"?"dialog":i,"aria-controls":n?o:void 0,...i==="listbox"&&{role:"combobox"},...i==="menu"&&{id:a}},floating:{...u,...i==="menu"&&{"aria-labelledby":a}}}:{}};function rM(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}const cke=function(e,t){let{open:n,onOpenChange:r,refs:i,events:o,nodeId:a}=e,{enabled:u=!0,escapeKey:s=!0,outsidePointerDown:c=!0,referencePointerDown:l=!1,ancestorScroll:f=!1,bubbles:d=!0}=t===void 0?{}:t;const p=Xx(),h=sH()!=null,m=_e.useRef(!1);return _e.useEffect(()=>{if(!n||!u)return;function g(w){if(w.key==="Escape"){if(!d&&p&&nM(p.nodesRef.current,a).length>0)return;o.emit("dismiss",{preventScroll:!1}),r(!1)}}function _(w){const O=m.current;if(m.current=!1,O)return;const M=ake(w);if(b_(M)&&i.floating.current){var x;const B=(x=i.floating.current.ownerDocument.defaultView)!=null?x:window,P=M.scrollWidth>M.clientWidth,Z=M.scrollHeight>M.clientHeight;let ee=Z&&w.offsetX>M.clientWidth;if(Z&&B.getComputedStyle(M).direction==="rtl"&&(ee=w.offsetX<=M.offsetWidth-M.clientWidth),ee||P&&w.offsetY>M.clientHeight)return}const U=p&&nM(p.nodesRef.current,a).some(B=>{var P;return rM(w,(P=B.context)==null?void 0:P.refs.floating.current)});rM(w,i.floating.current)||rM(w,i.domReference.current)||U||!d&&p&&nM(p.nodesRef.current,a).length>0||(o.emit("dismiss",h?{preventScroll:!0}:!1),r(!1))}function S(){r(!1)}const C=Qx(i.floating.current);s&&C.addEventListener("keydown",g),c&&C.addEventListener("pointerdown",_);const b=(f?[...b_(i.reference.current)?Ac(i.reference.current):[],...b_(i.floating.current)?Ac(i.floating.current):[]]:[]).filter(w=>{var O;return w!==((O=C.defaultView)==null?void 0:O.visualViewport)});return b.forEach(w=>w.addEventListener("scroll",S,{passive:!0})),()=>{s&&C.removeEventListener("keydown",g),c&&C.removeEventListener("pointerdown",_),b.forEach(w=>w.removeEventListener("scroll",S))}},[s,c,o,p,a,n,r,f,u,d,i,h]),u?{reference:{onPointerDown(){l&&(o.emit("dismiss"),r(!1))}},floating:{onPointerDownCapture(){m.current=!0}}}:{}},iM="ArrowUp",__="ArrowDown",od="ArrowLeft",gm="ArrowRight";function $_(e,t,n){return Math.floor(e/t)!==n}function ym(e,t){return t<0||t>=e.current.length}function Mn(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:i,amount:o=1}=t===void 0?{}:t;const a=e.current;let u=n;do{var s,c;u=u+(r?-o:o)}while(u>=0&&u<=a.length-1&&(i?i.includes(u):a[u]==null||(s=a[u])!=null&&s.hasAttribute("disabled")||((c=a[u])==null?void 0:c.getAttribute("aria-disabled"))==="true"));return u}function S_(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function pH(e,t){return S_(t,e===iM||e===__,e===od||e===gm)}function oM(e,t,n){return S_(t,e===__,n?e===od:e===gm)||e==="Enter"||e==" "||e===""}function lke(e,t,n){return S_(t,n?e===od:e===gm,e===__)}function fke(e,t,n){return S_(t,n?e===gm:e===od,e===iM)}function aM(e,t){return Mn(e,{disabledIndices:t})}function hH(e,t){return Mn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const dke=function(e,t){let{open:n,onOpenChange:r,refs:i}=e,{listRef:o,activeIndex:a,onNavigate:u=()=>{},enabled:s=!0,selectedIndex:c=null,allowEscape:l=!1,loop:f=!1,nested:d=!1,rtl:p=!1,virtual:h=!1,focusItemOnOpen:m="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:_=!0,disabledIndices:S=void 0,orientation:C="vertical",cols:b=1}=t===void 0?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;process.env.NODE_ENV!=="production"&&(l&&(f||console.warn(["Floating UI: `useListNavigation` looping must be enabled to allow","escaping."].join(" ")),h||console.warn(["Floating UI: `useListNavigation` must be virtual to allow","escaping."].join(" "))),C==="vertical"&&b>1&&console.warn(["Floating UI: In grid list navigation mode (`cols` > 1), the",'`orientation` should be either "horizontal" or "both".'].join(" ")));const w=sH(),O=Xx(),M=dH(n),x=eM(u),U=eM(dH(u)),B=_e.useRef(m),P=_e.useRef(c??-1),Z=_e.useRef(null),ee=uke(S),J=_e.useRef(!1),ge=_e.useRef(-1),[Ie,k]=_e.useState(),A=_e.useCallback(($,R)=>{ge.current=requestAnimationFrame(()=>{if(h){var L;k((L=$.current[R.current])==null?void 0:L.id)}else{var X;(X=$.current[R.current])==null||X.focus({preventScroll:!0})}})},[h]);Hu(()=>{s&&(!M&&n&&B.current&&c!=null&&x(c),M&&!n&&(cancelAnimationFrame(ge.current),P.current=-1,U(null)))},[n,M,c,o,A,s,x,U]),Hu(()=>{if(s&&n)if(a==null){if(c!=null)return;M&&(P.current=-1,A(o,P)),!M&&B.current&&(Z.current!=null||B.current===!0&&Z.current==null)&&(P.current=Z.current==null||oM(Z.current,C,p)||d?aM(o,ee.current):hH(o,ee.current),x(P.current),A(o,P))}else ym(o,a)||(P.current=a,A(o,P))},[n,M,a,c,d,o,x,A,s,l,C,p,h,ee]),Hu(()=>{if(s&&!n&&M){var $,R;const L=O==null||($=O.nodesRef.current.find(X=>X.id===w))==null||(R=$.context)==null?void 0:R.refs.floating.current;L&&!L.contains(fH(Qx(L)))&&L.focus({preventScroll:!0})}},[s,n,M,O,w]),Hu(()=>{Z.current=null});function I($){if(J.current=!0,d&&fke($.key,C,p)){Gu($),r(!1),rke(i.domReference.current)&&i.domReference.current.focus();return}const R=P.current,L=aM(o,S),X=hH(o,S);if($.key==="Home"&&(P.current=L,x(P.current)),$.key==="End"&&(P.current=X,x(P.current)),b>1){const ne=P.current;if($.key===iM){if(Gu($),ne===-1)P.current=X;else if(P.current=Mn(o,{startingIndex:ne,amount:b,decrement:!0,disabledIndices:S}),f&&(ne-b<L||P.current<0)){const Re=ne%b,se=X%b,Ae=X-(se-Re);se===Re?P.current=X:P.current=se>Re?Ae:Ae-b}ym(o,P.current)&&(P.current=ne),x(P.current)}if($.key===__&&(Gu($),ne===-1?P.current=L:(P.current=Mn(o,{startingIndex:ne,amount:b,disabledIndices:S}),f&&ne+b>X&&(P.current=Mn(o,{startingIndex:ne%b-b,amount:b,disabledIndices:S}))),ym(o,P.current)&&(P.current=ne),x(P.current)),C==="both"){const Re=Math.floor(ne/b);$.key===gm&&(Gu($),ne%b!==b-1?(P.current=Mn(o,{startingIndex:ne,disabledIndices:S}),f&&$_(P.current,b,Re)&&(P.current=Mn(o,{startingIndex:ne-ne%b-1,disabledIndices:S}))):f&&(P.current=Mn(o,{startingIndex:ne-ne%b-1,disabledIndices:S})),$_(P.current,b,Re)&&(P.current=ne)),$.key===od&&(Gu($),ne%b!==0?(P.current=Mn(o,{startingIndex:ne,disabledIndices:S,decrement:!0}),f&&$_(P.current,b,Re)&&(P.current=Mn(o,{startingIndex:ne+(b-ne%b),decrement:!0,disabledIndices:S}))):f&&(P.current=Mn(o,{startingIndex:ne+(b-ne%b),decrement:!0,disabledIndices:S})),$_(P.current,b,Re)&&(P.current=ne));const se=Math.floor(X/b)===Re;ym(o,P.current)&&(f&&se?P.current=$.key===od?X:Mn(o,{startingIndex:ne-ne%b-1,disabledIndices:S}):P.current=ne),x(P.current);return}}if(pH($.key,C)){if(Gu($),n&&!h&&fH($.currentTarget.ownerDocument)===$.currentTarget){P.current=oM($.key,C,p)?L:X,x(P.current);return}oM($.key,C,p)?f?P.current=R>=X?l&&R!==o.current.length?-1:L:Mn(o,{startingIndex:R,disabledIndices:S}):P.current=Math.min(X,Mn(o,{startingIndex:R,disabledIndices:S})):f?P.current=R<=L?l&&R!==-1?o.current.length:X:Mn(o,{startingIndex:R,decrement:!0,disabledIndices:S}):P.current=Math.max(L,Mn(o,{startingIndex:R,decrement:!0,disabledIndices:S})),ym(o,P.current)?x(null):x(P.current)}}return s?{reference:{...h&&n&&a!=null&&{"aria-activedescendant":Ie},onKeyDown($){if(J.current=!0,h&&n)return I($);if(($.key.indexOf("Arrow")===0||$.key==="Enter"||$.key===" "||$.key==="")&&(Z.current=$.key),d){lke($.key,C,p)&&(Gu($),n?(P.current=aM(o,S),x(P.current)):r(!0));return}pH($.key,C)&&(c!=null&&(P.current=c),Gu($),!n&&_?r(!0):I($),n&&x(P.current))}},floating:{"aria-orientation":C==="both"?void 0:C,...h&&a!=null&&{"aria-activedescendant":Ie},onKeyDown:I,onPointerMove(){J.current=!1}},item:{onFocus($){let{currentTarget:R}=$;const L=o.current.indexOf(R);L!==-1&&x(L)},onClick:$=>{let{currentTarget:R}=$;return R.focus({preventScroll:!0})},...g&&{onMouseMove($){let{currentTarget:R}=$;const L=R;if(L){const X=o.current.indexOf(L);X!==-1&&x(X)}},onPointerLeave(){if(!J.current&&(P.current=-1,A(o,P),x(null),!h)){var $;($=i.floating.current)==null||$.focus({preventScroll:!0})}}}}}:{}};function pke(e){var t;const{char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:a}=e,u=zEe(n),s=new RegExp(`\\s${u}$`),c=o?"^":"",l=r?new RegExp(`${c}${u}.*?(?=\\s${u}|$)`,"gm"):new RegExp(`${c}(?:^)?${u}[^\\s${u}]*`,"gm"),f=((t=a.nodeBefore)===null||t===void 0?void 0:t.isText)&&a.nodeBefore.text;if(!f)return null;const d=a.pos-f.length,p=Array.from(f.matchAll(l)).pop();if(!p||p.input===void 0||p.index===void 0)return null;const h=p.input.slice(Math.max(0,p.index-1),p.index),m=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(h);if(i!==null&&!m)return null;const g=d+p.index;let _=g+p[0].length;return r&&s.test(f.slice(_-1,_+1))&&(p[0]+=" ",_+=1),g<a.pos&&_>=a.pos?{range:{from:g,to:_},query:p[0].slice(n.length),text:p[0]}:null}const hke=new Ni("suggestion");function mke({pluginKey:e=hke,editor:t,char:n="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:u="suggestion",command:s=()=>null,items:c=()=>[],render:l=()=>({}),allow:f=()=>!0}){let d;const p=l==null?void 0:l(),h=new Rr({key:e,view(){return{update:async(m,g)=>{var _,S,C,b,w,O,M;const x=(_=this.key)===null||_===void 0?void 0:_.getState(g),U=(S=this.key)===null||S===void 0?void 0:S.getState(m.state),B=x.active&&U.active&&x.range.from!==U.range.from,P=!x.active&&U.active,Z=x.active&&!U.active,ee=!P&&!Z&&x.query!==U.query,J=P||B,ge=ee&&!B,Ie=Z||B;if(!J&&!ge&&!Ie)return;const k=Ie&&!J?x:U,A=m.dom.querySelector(`[data-decoration-id="${k.decorationId}"]`);d={editor:t,range:k.range,query:k.query,text:k.text,items:[],command:I=>{s({editor:t,range:k.range,props:I})},decorationNode:A,clientRect:A?()=>{var I;const{decorationId:$}=(I=this.key)===null||I===void 0?void 0:I.getState(t.state),R=m.dom.querySelector(`[data-decoration-id="${$}"]`);return(R==null?void 0:R.getBoundingClientRect())||null}:null},J&&((C=p==null?void 0:p.onBeforeStart)===null||C===void 0||C.call(p,d)),ge&&((b=p==null?void 0:p.onBeforeUpdate)===null||b===void 0||b.call(p,d)),(ge||J)&&(d.items=await c({editor:t,query:k.query})),Ie&&((w=p==null?void 0:p.onExit)===null||w===void 0||w.call(p,d)),ge&&((O=p==null?void 0:p.onUpdate)===null||O===void 0||O.call(p,d)),J&&((M=p==null?void 0:p.onStart)===null||M===void 0||M.call(p,d))},destroy:()=>{var m;d&&((m=p==null?void 0:p.onExit)===null||m===void 0||m.call(p,d))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(m,g,_,S){const{isEditable:C}=t,{composing:b}=t.view,{selection:w}=m,{empty:O,from:M}=w,x={...g};if(x.composing=b,C&&(O||t.view.composing)){(M<g.range.from||M>g.range.to)&&!b&&!g.composing&&(x.active=!1);const U=pke({char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:w.$from}),B=`id_${Math.floor(Math.random()*4294967295)}`;U&&f({editor:t,state:S,range:U.range})?(x.active=!0,x.decorationId=g.decorationId?g.decorationId:B,x.range=U.range,x.query=U.query,x.text=U.text):x.active=!1}else x.active=!1;return x.active||(x.decorationId=null,x.range={from:0,to:0},x.query=null,x.text=null),x}},props:{handleKeyDown(m,g){var _;const{active:S,range:C}=h.getState(m.state);return S&&((_=p==null?void 0:p.onKeyDown)===null||_===void 0?void 0:_.call(p,{view:m,event:g,range:C}))||!1},decorations(m){const{active:g,range:_,decorationId:S}=h.getState(m);return g?Wt.create(m.doc,[Ar.inline(_.from,_.to,{nodeName:a,class:u,"data-decoration-id":S})]):null}}});return h}function mH(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=mH(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function vH(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=mH(e))&&(r&&(r+=" "),r+=t);return r}const vke=Hn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",It(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Mo={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",preformatted:"preformatted",strong:"strong",em:"em",listItem:"list-item",oListItem:"o-list-item",list:"group-list-item",oList:"group-o-list-item",image:"image",embed:"embed",hyperlink:"hyperlink",label:"label",span:"span"},T_=()=>(++T_.i).toString();T_.i=0;const gke=e=>{const t=yke(e),n=[];for(let r=0;r<t.length;r++)n.push(gH(t[r]));return{key:T_(),children:n}},bm=(e,t=[])=>({key:T_(),type:e.type,text:"text"in e?e.text:void 0,node:e,children:t}),uM=e=>bm({type:Mo.span,text:e,spans:[]}),yke=e=>{const t=e.slice(0);for(let n=0;n<t.length;n++){const r=t[n];if(r.type===Mo.listItem||r.type===Mo.oListItem){const i=[r];for(;t[n+1]&&t[n+1].type===r.type;)i.push(t[n+1]),t.splice(n,1);r.type===Mo.listItem?t[n]={type:Mo.list,items:i}:t[n]={type:Mo.oList,items:i}}}return t},gH=e=>{if("text"in e)return bm(e,yH(e.spans,e));if("items"in e){const t=[];for(let n=0;n<e.items.length;n++)t.push(gH(e.items[n]));return bm(e,t)}return bm(e)},yH=(e,t,n)=>{if(!e.length)return[uM(t.text)];const r=e.slice(0);r.sort((o,a)=>o.start-a.start||a.end-o.end);const i=[];for(let o=0;o<r.length;o++){const a=r[o],u=n&&n.start||0,s=a.start-u,c=a.end-u,l=t.text.slice(s,c),f=[];for(let p=o;p<r.length;p++){const h=r[p];h!==a&&h.start>=a.start&&h.end<=a.end&&(f.push(h),r.splice(p,1),p--)}o===0&&s>0&&i.push(uM(t.text.slice(0,s)));const d={...a,text:l};i.push(bm(d,yH(f,{...t,text:l},a))),c<t.text.length&&i.push(uM(t.text.slice(c,r[o+1]?r[o+1].start-u:void 0)))}return i},bke=(e,t)=>bH(gke(e).children,t),bH=(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=t(i.type,i.node,i.text,bH(i.children,t),i.key);o!=null&&n.push(o)}return n};Mo.listItem+"",Mo.oListItem+"",Mo.list+"",Mo.oList+"";const _ke=Hn.create({name:"text",group:"inline"}),$ke={groupBy(e,t){return e.reduce((n,r)=>{const i=t(r),o=(n.get(i)||[]).concat(r);return n.set(i,o)},new Map)},sort(e){return[...e].sort((t,n)=>t.start-n.start)},mergeOverlap(e){const t=this.groupBy(e,r=>r.type),n=Array.from(t.entries()).map(([r,i])=>(this.sort(i).reduce((o,a)=>{if(!o.length)return[a];const u=o.length-1,s=o[u];return s.end>=a.start?[...o.slice(0,u),{...s,end:a.end}]:[...o,a]},[]),i)).reduce((r,i)=>[...r,...i],[]);return this.sort(n)}},_H={fromPrismic(e){return t=>{var n;return(n=dM.find(r=>r.richTextNodeTypes[0]===t.type))==null?void 0:n.converter.fromPrismic(e)(t)}},toPrismic(e,t,n){const[r,i]=(()=>{const o=dM.find(a=>e.type.name===a.name);if(!o)throw new Error(`Invalid mark extension '${e.type.name}'.`);return[o.richTextNodeTypes[0],o.converter.toPrismic(e)]})();return{type:r,start:t,end:n,...i?{data:i}:{}}}},$H=_ke.extend({name:"text"}),Ske={fromPrismic(e){return function(t,n,r=!1){const i={type:t,text:n.content.text,spans:n.content.spans||[]};return bke([i],Tke(e,r))[0]}},toPrismic(e,t,n){const r=Rc.children.reduce(e,(i,o)=>{const a=(()=>o.type.name===l_.name?l_.converter.toPrismic(o):o.textContent)(),u=a?i.text+a:i.text,s=i.text.length,c=u.length,l=(()=>o.marks.length?Rc.marks.map(o,d=>_H.toPrismic(d,s,c)):void 0)();return{...i,text:u,spans:l?[...i.spans,...l]:i.spans}},{text:"",spans:[]});return{type:t,content:{text:r.text,spans:[...$ke.mergeOverlap(r.spans)].sort((i,o)=>i.type.localeCompare(o.type))},...n}}};function Tke(e,t=!1){return(n,r,i,o)=>{if(n==="span"&&i&&i.length)return t?[e.text(i)]:l_.splitTextToNodes(e,i)(a=>e.text(a));{const a=_H.fromPrismic(e)(r);return a?K$(o).map(s=>s.mark([...s.marks,a].sort((c,l)=>c.type.name.localeCompare(l.type.name)))):K$(o)}}}const Fc={name:$H.name,component:$H,converter:Ske};var SH=(e=>(e.LeftToRight="ltr",e.RightToLeft="rtl",e))(SH||{});const Fa="dir",Ike=Pe.RichTextNodeType.rtl,Cke=fr.create({name:"textDirection",addOptions(){return{supportedExtensionNames:[]}},addGlobalAttributes(){return[{types:this.options.supportedExtensionNames,attributes:{[Fa]:{default:"ltr",parseHTML:e=>e.getAttribute(Fa),renderHTML:e=>({[Fa]:e[Fa]==="ltr"?"ltr":"rtl"})}}}]},addCommands(){return{setDirection:e=>({commands:t})=>{switch(e){case"rtl":return t.setRightToLeft();default:return t.setLeftToRight()}},toggleDirection:e=>({commands:t})=>{const n=e==="rtl"?"ltr":"rtl";return t.setDirection(n)},setRightToLeft:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.updateAttributes(t,{[Fa]:"rtl"})),setLeftToRight:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.resetAttributes(t,Fa))}},addKeyboardShortcuts(){return{"Mod-Shift-r":()=>this.editor.commands.setRightToLeft(),"Mod-Shift-l":()=>this.editor.commands.setLeftToRight()}}}),Na={parseNodeAttrsDirection(e){switch(e[Fa]){case"rtl":return"rtl";default:return"ltr"}},fromPrismic(e){const t=(()=>{switch(e.direction){case"rtl":return"rtl";default:return"ltr"}})();return{[Fa]:t}},toPrismic(e){return{direction:this.parseNodeAttrsDirection(e.attrs)}}},I_=vke.extend({name:"paragraph",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",It(this.options.HTMLAttributes,e),0]}}),Oke={fromPrismic(e){return function(t){var r;const n=Fc.converter.fromPrismic(e)(I_.name,t);return(r=e.nodes[I_.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return Fc.converter.toPrismic(e,Pe.RichTextNodeType.paragraph,Na.toPrismic(e))}},Yu=new nd([Pe.RichTextNodeType.paragraph],I_.name,I_,Oke,"Type '/' for commands"),TH=["ArrowDown","ArrowUp","End","Home"],IH=["Enter"],wke=["Escape",...TH,...IH],Eke=fr.create({name:"slash-commands",addOptions(){return{nodeTypes:[]}},addProseMirrorPlugins(){const e=x_(AH,this.options.nodeTypes);return e.length>1?[mke({allowSpaces:!0,char:"/",editor:this.editor,startOfLine:!0,allow:({state:t})=>{const n=t.selection.$from;return n.parent.type.name===Yu.name&&n.depth===1},command:({editor:t,props:n,range:r})=>{n.runCommands(t,{deleteRange:r})},items:({query:t})=>{const n=t.toLocaleLowerCase().trim();return e.filter(r=>{var i,o;return((i=r.shortText)==null?void 0:i.toLocaleLowerCase().includes(n))||((o=r.text)==null?void 0:o.toLocaleLowerCase().includes(n))})},render:()=>{let t;return{onStart:n=>{t=new x5(xke,{editor:n.editor,props:n}),document.body.appendChild(t.element)},onUpdate:n=>{t==null||t.updateProps(n)},onKeyDown:({event:n})=>{var r;return wke.includes(n.key)&&((r=t==null?void 0:t.ref)==null?void 0:r.handleKeyDown(n))},onExit:()=>{t==null||t.destroy(),t==null||t.element.remove()}}}})]:[]}}),xke=N.forwardRef(function({command:t,decorationNode:n,editor:r,items:i},o){const[a,u]=N.useState(!0),s=parseFloat(T.tokens.space[0]),{context:c,floating:l,reference:f,strategy:d,x:p,y:h}=ike({middleware:[NRe(s),ARe(),PRe({limiter:WRe()})],onOpenChange:u,open:a,placement:"top-start",strategy:"fixed",whileElementsMounted:YRe});N.useLayoutEffect(()=>{f(n)},[f,n]),N.useEffect(()=>{let P;const Z=()=>{P=window.setTimeout(()=>{u(!0)})},ee=()=>{u(!1)};return r.on("focus",Z).on("blur",ee),()=>{r.off("focus",Z).off("blur",ee),clearTimeout(P)}},[r]);const[m,g]=N.useState(0),_=N.useRef([]),[S,C]=N.useState();i!==S&&(g(0),_.current=[],C(i));const{getFloatingProps:b,getItemProps:w,getReferenceProps:O}=oke([cke(c,{outsidePointerDown:!1}),dke(c,{activeIndex:m,listRef:_,onNavigate:P=>{g(Z=>P??Z)},openOnArrowKeyDown:!1,virtual:!0}),ske(c,{role:"menu"})]),x=O().onKeyDown;N.useImperativeHandle(o,()=>({handleKeyDown:P=>{if(a){if(TH.includes(P.key)&&x(P),IH.includes(P.key)){const Z=i[m];Z!==void 0&&t(Z)}return!0}else return!1}}),[m,t,i,x,a]);const U=p!==null&&h!==null,B=N.useId();return a?y.jsxs("div",{...b(),className:T.dropdownMenuStyles.content,ref:l,style:{top:parseFloat(T.tokens.space[0]),left:parseFloat(T.tokens.space[0]),minWidth:256,position:d,transform:U?`translate3d(${Math.round(p)}px, ${Math.round(h)}px, 0)`:"translate3d(0, -200%, 0)"},children:[i.map((P,Z)=>N.createElement(CH,{...w({onClick:()=>{t(P)},onPointerDown:ee=>{ee.preventDefault()}}),"data-highlighted":Z===m?"":void 0,id:`${B}[${Z}]`,key:P.nodeType,ref:ee=>{_.current[Z]=ee},shortcut:`/${P.shortText??""}`,startIcon:P.icon},P.text)),i.length===0?y.jsx(CH,{...w({onPointerDown:P=>{P.preventDefault()}}),disabled:!0,id:`${B}[0]`,ref:P=>{_.current[0]=P},children:"No results"}):null]}):null}),CH=N.forwardRef(function({children:t,disabled:n,shortcut:r,startIcon:i,...o},a){return y.jsxs("div",{...o,...n?{"aria-disabled":!0,"data-disabled":!0}:{},className:T.dropdownMenuStyles.item,ref:a,role:"menuitem",children:[N.isValidElement(i)?N.cloneElement(i,{className:vH(i.props.className,T.dropdownMenuStyles.itemStartIcon)}):null,y.jsx(T.Text,{className:vH(T.dropdownMenuStyles.itemText,T.dropdownMenuStyles.itemTextColor.grey),component:"span",children:t}),r?y.jsx(T.Text,{className:T.dropdownMenuStyles.itemShortcut,color:"inherit",component:"span",variant:"inherit",children:r}):null]})});function Mke(e,t){var a,u;const n=t.map(s=>s.richTextNodeTypes).flat(),i={placeholderByNodeType:v(t,Xi(s=>s.nodeType===td.Text),Cv({},(s,c)=>({...s,[c.name]:c.placeholder}))),unfocusedPlaceholder:(a=e.config)==null?void 0:a.placeholder,nodeExtensions:t},o=n.includes(Pe.RichTextNodeType.orderedList)||n.includes(Pe.RichTextNodeType.list);return Xi(s=>s!==void 0)([zx.component(((u=e.config)==null?void 0:u.single)===void 0),Fc.component,l_.component,_Re(i),o?rd.component:void 0,Eke.configure({nodeTypes:n})])}const sM=cRe.extend({name:"bulletList",parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",It(this.options.HTMLAttributes,e),0]}}).configure({itemTypeName:"listItem"}),Rke={fromPrismic(e){return function(t){var r;const n=rd.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[sM.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return y$(Rc.children.map(e,t=>Xi(n=>n!==void 0)(rd.converter.toPrismic(t,Pe.RichTextNodeType.list))))}},C_=new Bx([Pe.RichTextNodeType.list],sM.name,sM,Rke),kke=/^```([a-z]+)?[\s\n]$/,Ake=/^~~~([a-z]+)?[\s\n]$/,O_=Hn.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:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",It(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
140
+ `}}function s(g){return r.exact(r.intersection([r.type({id:r.string,label:o.StringOrNull,repeatable:(0,i.withFallback)(r.boolean,!0),json:r.record(r.string,g),status:(0,i.withFallback)(r.boolean,!0)}),r.partial({hash:r.string,format:(0,i.withFallback)(r.keyof(e.CustomTypeFormat),"custom")})]))}e.StaticCustomType=s(a.StaticSection),e.CustomType=s(a.DynamicSection);function c(g){return Object.entries(g.json).reduce((_,[,S])=>{const C=Object.entries(S);return _.concat(C)},[])}e.flattenWidgets=c;function l(g){return c(g).filter(([,C])=>C.type==="Slices").reduce((C,[,b])=>{const w=Object.entries(b.config&&b.config.choices?b.config.choices:{}).filter(([,O])=>O.type==="SharedSlice").map(([O])=>O);return C.concat(w)},[])}function f(g){const _=l(g);return function(S){return _.map(S)}}function d(g,_){const S=Object.entries(g.json).reduce((C,[b,w])=>({...C,[b]:a.Sections.toStatic(w,_)}),{});return{...g,json:S}}e.toStatic=d;function p(g,_){const S=f(g)(C=>{if(!_.get(C))return C}).filter(Boolean);return S.length>0?(0,n.left)(new u(S)):(0,n.right)(g)}e.validateSlices=p;function h(g,_){const S=Object.entries(g.json).reduce((C,[b,w])=>{const O=Object.entries(w).reduce((M,[x,U])=>{const B=_(x,U);return B?{...M,[x]:B}:M},{});return{...C,[b]:O}},{});return{...g,json:S}}e.collectWidgets=h;function m(g,_){return h(g,(S,C)=>{if(C.type==="Slices"){if(!C.config||!C.config.choices)return C;const b=Object.entries(C.config.choices).reduce((O,[M,x])=>x.type==="SharedSlice"&&!_.get(M)?O:{...O,[M]:x},{}),w={...C.config,choices:b};return{...C,config:w}}return C})}e.filterMissingSharedSlices=m}(kH);var AH={},r_={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiffOperation=void 0,function(t){t.Added="added",t.Removed="removed",t.Updated="updated"}(e.DiffOperation||(e.DiffOperation={}))})(r_);var i_={},Mc={},o_={};Object.defineProperty(o_,"__esModule",{value:!0}),o_.toRecord=void 0;function eRe(e,t){return e.reduce((n,r)=>{const i=t(r);return{...n,[i]:r}},{})}o_.toRecord=eRe,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.Objects=Mc.Arrays=void 0;const FH=G;Mc.Arrays=(0,FH.__importStar)(o_),Mc.Objects=(0,FH.__importStar)(ba);var fm={};Object.defineProperty(fm,"__esModule",{value:!0}),fm.VariationComparator=void 0;const a_=Mc,Xf=r_;function tRe(e,t){const n=a_.Objects.zipObjects(e,t);return Object.entries(n).reduce((r,[i,o])=>i==="primary"||i==="items"||(o==null?void 0:o.left)===(o==null?void 0:o.right)?r:{...r,[i]:o==null?void 0:o.right},{})}function NH(e,t){const n=a_.Objects.zipObjects(e,t),r=Object.entries(n).reduce((i,[o,a])=>{if(JSON.stringify(a==null?void 0:a.left)===JSON.stringify(a==null?void 0:a.right))return i;const u=(()=>{if(!(!(a!=null&&a.left)&&!(a!=null&&a.right)))return a!=null&&a.left&&!a.right?{op:Xf.DiffOperation.Removed}:!(a!=null&&a.left)&&(a!=null&&a.right)?{op:Xf.DiffOperation.Added,value:a.right}:{op:Xf.DiffOperation.Updated,value:a.right}})();return u?{...i,[o]:u}:i},{});return a_.Objects.isNotEmpty(r)?r:void 0}fm.VariationComparator={compare(e,t){if(e&&!t)return{op:Xf.DiffOperation.Removed};if(!e&&t)return{op:Xf.DiffOperation.Added,value:t};const n=tRe(e,t),r=NH(e==null?void 0:e.primary,t==null?void 0:t.primary),i=NH(e==null?void 0:e.items,t==null?void 0:t.items),o={...n,...r?{primary:r}:{},...i?{items:i}:{}};if(a_.Objects.isNotEmpty(o))return{op:Xf.DiffOperation.Updated,value:o}}},Object.defineProperty(i_,"__esModule",{value:!0}),i_.SliceComparator=void 0;const Qf=Mc,Px=r_,nRe=fm;function rRe(e,t){const n=Qf.Objects.zipObjects(e,t);return Object.entries(n).reduce((r,[i,o])=>i==="variations"||(o==null?void 0:o.left)===(o==null?void 0:o.right)?r:{...r,[i]:o==null?void 0:o.right},{})}i_.SliceComparator={compare(e,t){if(!e&&t)return{op:Px.DiffOperation.Added,value:t};if(e&&!t)return{op:Px.DiffOperation.Removed};const n=rRe(e,t),r=Qf.Objects.zipObjects(e&&Qf.Arrays.toRecord(e.variations,a=>a.id),t&&Qf.Arrays.toRecord(t.variations,a=>a.id)),i=Object.entries(r).reduce((a,[u,s])=>{if(!s)return a;const c=nRe.VariationComparator.compare(s.left,s.right);return c?{...a,[u]:c}:a},{}),o={...n,...Qf.Objects.isNotEmpty(i)?{variations:i}:{}};if(Qf.Objects.isNotEmpty(o))return{op:Px.DiffOperation.Updated,value:o}}},function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(r_,e),(0,t.__exportStar)(i_,e),(0,t.__exportStar)(fm,e)}(AH),function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=G;(0,t.__exportStar)(kH,e),(0,t.__exportStar)(AH,e),(0,t.__exportStar)(Li,e),(0,t.__exportStar)(po,e)}(Re);const iRe=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,oRe=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,aRe=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,uRe=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,sRe=Qh.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Vb({find:iRe,type:this.type}),Vb({find:aRe,type:this.type})]},addPasteRules(){return[Gb({find:oRe,type:this.type}),Gb({find:uRe,type:this.type})]}});var Wx=(e=>(e.Document="document",e.Mark="mark",e.Node="node",e))(Wx||{}),ed=(e=>(e.Text="text",e.Embed="embed",e.Image="image",e))(ed||{});class cRe{constructor(t,n,r){qa(this,"extType","document");this.name=t,this.component=n,this.converter=r}}class PH{constructor(t,n,r,i){qa(this,"extType","mark");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}class dm{constructor(t,n,r,i,o,a=!1){qa(this,"extType","node");qa(this,"nodeType","text");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i,this.placeholder=o,this.lockedFormat=a}}function WH(e){return e instanceof dm}class lRe{constructor(t,n,r,i){qa(this,"extType","node");qa(this,"nodeType","embed");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}class fRe{constructor(t,n,r,i){qa(this,"extType","node");qa(this,"nodeType","image");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}class dRe extends dm{constructor(t,n,r,i,o){super(t,"heading",n,i,o),this.levels=r}}class jx extends dm{constructor(t,n,r,i){super(t,n,r,i)}}function pRe(e){return e instanceof jx}const Lx=sRe.extend({name:"bold"}),hRe={fromPrismic(e){return function(){var t;return(t=e.marks[Lx.name])==null?void 0:t.create()}},toPrismic(){}},jH=new PH([Re.RichTextNodeType.strong],Lx.name,Lx,hRe),mRe=Mn.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",$t(this.options.HTMLAttributes,e),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)}}}),LH=Qh.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["span",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:t})=>{const n=zb(e,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:t.unsetMark(this.name)}}}}),DH=/^\s*([-+*])\s$/,vRe=Mn.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:e}){return["ul",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(mRe.name,this.editor.getAttributes(LH.name)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Hb({find:DH,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Hb({find:DH,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(LH.name),editor:this.editor})),[e]}}),BH=Mn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",$t(this.options.HTMLAttributes,e)]},renderText(){return`
141
+ `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:u}=r.extensionManager,s=o||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:l})=>{if(l&&s&&a){const f=s.filter(d=>u.includes(d.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Rc={isHardBreak(e){return e.type.name===BH.name},children:{reduce(e,t,n){let r=n;return e.forEach((i,o,a)=>{r=t(r,i,a)}),r},map(e,t){return this.reduce(e,(n,r)=>[...n,t(r)],[])},exists(e,t){return this.reduce(e,(n,r)=>n||t(r),!1)},filter(e,t){return this.reduce(e,(n,r)=>[...n,...t(r)?[r]:[]],[])}},marks:{reduce(e,t,n){let r=n;return e.marks.forEach((i,o)=>{r=t(r,i,o)}),r},map(e,t){return this.reduce(e,(n,r)=>[...n,t(r)],[])},filter(e,t){return this.reduce(e,(n,r)=>[...n,...t(r)?[r]:[]],[])}}};function Dx(e,t){for(const n of e)if(t(n))return!0;return!1}function gRe(e){if(!e||!(e!=null&&e.single)&&!(e!=null&&e.multi))return UH();const t=yRe(e);if(!(t!=null&&t.size))return UH();const n=bRe(t),r=_Re(n);return{extensions:r,defaultTextConverter:$Re(r)}}function yRe(e){const n=(e.single||e.multi||"").split(/\s*,\s*/).map(r=>{const i=Re.RichTextNodeTypeCodec.decode(r);return i._tag==="Right"?i.right:void 0}).filter(ho);return new Set(n)}function bRe(e){return W5(e).filter(n=>Dx(e,r=>n.richTextNodeTypes.includes(r)))}function _Re(e){const t=new Set(e);return Dx(t,pRe)&&t.add(Yu),Dx(t,WH)||t.add(P5),[...t]}function $Re(e){const t=e.find(WH)??P5;function n(r){return i=>t.converter.fromPrismic(r)({...i,type:t.richTextNodeTypes[0]})}return n}function UH(){return{extensions:W5(),defaultTextConverter:void 0}}const SRe=Mn.create({name:"doc",topNode:!0,content:"block+"}),qH=Mn.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",$t(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}).extend({name:"listItem",content:"paragraph*",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name)}}}),td={component:qH,converter:{fromPrismic(e){return function(t){var r;const n=Yu.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[qH.name])==null?void 0:r.create({},n)}},toPrismic(e,t){return Rc.children.reduce(e,(n,r)=>{const i=Yu.converter.toPrismic(r),o=(()=>i instanceof Array?i.map(a=>({...a,type:t})):i?[{...i,type:t}]:[])();return[...n,...o]},[])}},placeholder:"List"};function TRe(e){return e.slice(1,e.length).reduce((t,n)=>t.copy(t.content.append(n.content)),e[0])}const Bx="document",IRe=e=>SRe.extend({name:Bx,content:e?"block+":"block"}),CRe=e=>({fromPrismic(t,n){function r(i){return function(o=void 0){return!o&&n&&Qe.TextBlock.is(i)?n(i):o}}return function(i){var a;const o=i.value.reduce((u,s)=>{const c=e.find(m=>m.richTextNodeTypes.includes(s.type)),l=(()=>{if(c)switch(c.nodeType){case ed.Embed:return Qe.EmbedBlock.is(s)&&c.converter.fromPrismic(t)(s);case ed.Text:return Qe.TextBlock.is(s)&&c.converter.fromPrismic(t)(s);case ed.Image:return Qe.ImageBlock.is(s)&&c.converter.fromPrismic(t)(s);default:return}})(),f=u.length-1,d=u.slice(0,f),p=a$(d),h=(()=>l?v(p,Uo(()=>({merged:!1,node:l}),m=>l.type.name===m.type.name&&(l.type.name===I_.name||l.type.name===w_.name)?{merged:!0,node:TRe([m,l])}:{merged:!1,node:l}),({merged:m,node:g})=>({merged:m,node:r(s)(g)})):{merged:!1,node:r(s)()})();return h.node?[...h.merged?d:u,h.node]:u},[]);return(a=t.nodes[Bx])==null?void 0:a.create({},o)}},toPrismic(t){return{__TYPE__:"StructuredTextContent",value:[...Rc.children.reduce(t,(r,i)=>{const o=Object.values(e).find(u=>i.type.name===u.name),a=o==null?void 0:o.converter.toPrismic(i);return a||console.warn(`Cannot convert node of type '${i.type.name}'.`),a?[...r,...a instanceof Array?a:[a]]:r},[])]}}}),Ux=new cRe(Bx,IRe,CRe),u_=BH.extend({name:"hard_break"}),s_=`
142
+ `,zH={fromPrismic(e){return function(t){var n;if(t===s_)return(n=e.nodes[u_.name])==null?void 0:n.create({})}},toPrismic(e){if(e.type.name===u_.name)return s_}},qx={isEmptyLine(e){return e.length===0},isFirst(e){return e===0}};function ORe(e,t){return function(n){const r=zH.fromPrismic(e)(s_);if(!r)return[n(t)];const i=t.split(s_);return i.length===1?t.length?[n(t)]:[r]:i.reduce((o,a,u)=>qx.isFirst(u)?qx.isEmptyLine(a)?o:[...o,n(a)]:qx.isEmptyLine(a)?[...o,r]:[...o,r,n(a)],[])}}const c_={name:u_.name,component:u_,converter:zH,splitTextToNodes:ORe},wRe=dr.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Rr({key:new Ni("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(!n)return null;const o=e.type.createAndFill(),a=(o==null?void 0:o.sameMarkup(e))&&o.content.findDiffStart(e.content)===null;return e.descendants((u,s)=>{const c=r>=s&&r<=s+u.nodeSize,l=!u.isLeaf&&!u.childCount;if((c||!this.options.showOnlyCurrent)&&l){const f=[this.options.emptyNodeClass];a&&f.push(this.options.emptyEditorClass);const d=Ar.node(s,s+u.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:u,pos:s,hasAnchor:c}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),Wt.create(e,i)}}})]}}),ERe="Type '/' for commands",xRe=e=>wRe.configure({includeChildren:!0,placeholder:t=>MRe({props:t,params:e}),showOnlyCurrent:!1,showOnlyWhenEditable:!1});function MRe({props:e,params:t}){const{editor:n,hasAnchor:r,node:i}=e,{placeholderByNodeType:o,unfocusedPlaceholder:a,nodeExtensions:u}=t,s=!Rc.children.exists(n.state.doc,S=>S===i),c=n.isEditable,l=n.isFocused&&r,f=i.type.name!==Yu.name,d=l||f||s,p=u.length>1;function h(S){return S===ERe?c&&d&&p:c&&d}function m(){if(s)return td.placeholder;const S=o[i.type.name];return typeof S=="string"?S:S==null?void 0:S(i.attrs)}const g=m(),_=h(g);return a&&!l&&n.isEmpty?a:_&&g||""}function l_(e){return e.split("-")[1]}function KH(e){return e==="y"?"height":"width"}function zu(e){return e.split("-")[0]}function pm(e){return["top","bottom"].includes(zu(e))?"x":"y"}function VH(e,t,n){let{reference:r,floating:i}=e;const o=r.x+r.width/2-i.width/2,a=r.y+r.height/2-i.height/2,u=pm(t),s=KH(u),c=r[s]/2-i[s]/2,l=zu(t),f=u==="x";let d;switch(l){case"top":d={x:o,y:r.y-i.height};break;case"bottom":d={x:o,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:a};break;case"left":d={x:r.x-i.width,y:a};break;default:d={x:r.x,y:r.y}}switch(l_(t)){case"start":d[u]-=c*(n&&f?-1:1);break;case"end":d[u]+=c*(n&&f?-1:1);break}return d}const RRe=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,u=o.filter(Boolean),s=await(a.isRTL==null?void 0:a.isRTL(t));if(process.env.NODE_ENV!=="production"){if(a==null&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),u.filter(m=>{let{name:g}=m;return g==="autoPlacement"||g==="flip"}).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));(!e||!t)&&console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "))}let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:f}=VH(c,r,s),d=r,p={},h=0;for(let m=0;m<u.length;m++){const{name:g,fn:_}=u[m],{x:S,y:C,data:b,reset:w}=await _({x:l,y:f,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});if(l=S??l,f=C??f,p={...p,[g]:{...p[g],...b}},process.env.NODE_ENV!=="production"&&h>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),w&&h<=50){h++,typeof w=="object"&&(w.placement&&(d=w.placement),w.rects&&(c=w.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:l,y:f}=VH(c,d,s)),m=-1;continue}}return{x:l,y:f,placement:d,strategy:i,middlewareData:p}};function kRe(e){return{top:0,right:0,bottom:0,left:0,...e}}function ARe(e){return typeof e!="number"?kRe(e):{top:e,right:e,bottom:e,left:e}}function zx(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function HH(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:u,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=t,h=ARe(p),g=u[d?f==="floating"?"reference":"floating":f],_=zx(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:c,rootBoundary:l,strategy:s})),S=f==="floating"?{...a.floating,x:r,y:i}:a.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),b=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},w=zx(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:S,offsetParent:C,strategy:s}):S);return process.env.NODE_ENV,{top:(_.top-w.top+h.top)/b.y,bottom:(w.bottom-_.bottom+h.bottom)/b.y,left:(_.left-w.left+h.left)/b.x,right:(w.right-_.right+h.right)/b.x}}const FRe=Math.min,NRe=Math.max;function GH(e,t,n){return NRe(e,FRe(t,n))}const PRe={left:"right",right:"left",bottom:"top",top:"bottom"};function f_(e){return e.replace(/left|right|bottom|top/g,t=>PRe[t])}function WRe(e,t,n){n===void 0&&(n=!1);const r=l_(e),i=pm(e),o=KH(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=f_(a)),{main:a,cross:f_(a)}}const jRe={start:"end",end:"start"};function Kx(e){return e.replace(/start|end/g,t=>jRe[t])}function LRe(e){const t=f_(e);return[Kx(e),t,Kx(t)]}function DRe(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:a;default:return[]}}function BRe(e,t,n,r){const i=l_(e);let o=DRe(zu(e),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(Kx)))),o}const URe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:u,elements:s}=t,{mainAxis:c=!0,crossAxis:l=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...m}=e,g=zu(r),_=zu(a)===a,S=await(u.isRTL==null?void 0:u.isRTL(s.floating)),C=f||(_||!h?[f_(a)]:LRe(a));!f&&p!=="none"&&C.push(...BRe(a,h,p,S));const b=[a,...C],w=await HH(t,m),O=[];let M=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&O.push(w[g]),l){const{main:P,cross:Z}=WRe(r,o,S);O.push(w[P],w[Z])}if(M=[...M,{placement:r,overflows:O}],!O.every(P=>P<=0)){var x,U;const P=(((x=i.flip)==null?void 0:x.index)||0)+1,Z=b[P];if(Z)return{data:{index:P,overflows:M},reset:{placement:Z}};let ee=(U=M.filter(J=>J.overflows[0]<=0).sort((J,ge)=>J.overflows[1]-ge.overflows[1])[0])==null?void 0:U.placement;if(!ee)switch(d){case"bestFit":{var B;const J=(B=M.map(ge=>[ge.placement,ge.overflows.filter(Te=>Te>0).reduce((Te,k)=>Te+k,0)]).sort((ge,Te)=>ge[1]-Te[1])[0])==null?void 0:B[0];J&&(ee=J);break}case"initialPlacement":ee=a;break}if(r!==ee)return{reset:{placement:ee}}}return{}}}};async function qRe(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=zu(n),u=l_(n),s=pm(n)==="x",c=["left","top"].includes(a)?-1:1,l=o&&s?-1:1,f=typeof t=="function"?t(e):t;let{mainAxis:d,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return u&&typeof h=="number"&&(p=u==="end"?h*-1:h),s?{x:p*l,y:d*c}:{x:d*c,y:p*l}}const zRe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,i=await qRe(t,e);return{x:n+i.x,y:r+i.y,data:i}}}};function YH(e){return e==="x"?"y":"x"}const KRe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:u={fn:g=>{let{x:_,y:S}=g;return{x:_,y:S}}},...s}=e,c={x:n,y:r},l=await HH(t,s),f=pm(zu(i)),d=YH(f);let p=c[f],h=c[d];if(o){const g=f==="y"?"top":"left",_=f==="y"?"bottom":"right",S=p+l[g],C=p-l[_];p=GH(S,p,C)}if(a){const g=d==="y"?"top":"left",_=d==="y"?"bottom":"right",S=h+l[g],C=h-l[_];h=GH(S,h,C)}const m=u.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},VRe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:u=0,mainAxis:s=!0,crossAxis:c=!0}=e,l={x:n,y:r},f=pm(i),d=YH(f);let p=l[f],h=l[d];const m=typeof u=="function"?u(t):u,g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(s){const C=f==="y"?"height":"width",b=o.reference[f]-o.floating[C]+g.mainAxis,w=o.reference[f]+o.reference[C]-g.mainAxis;p<b?p=b:p>w&&(p=w)}if(c){var _,S;const C=f==="y"?"width":"height",b=["top","left"].includes(zu(i)),w=o.reference[d]-o.floating[C]+(b&&((_=a.offset)==null?void 0:_[d])||0)+(b?0:g.crossAxis),O=o.reference[d]+o.reference[C]+(b?0:((S=a.offset)==null?void 0:S[d])||0)-(b?g.crossAxis:0);h<w?h=w:h>O&&(h=O)}return{[f]:p,[d]:h}}}};function Pr(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wo(e){return Pr(e).getComputedStyle(e)}const JH=Math.min,hm=Math.max,d_=Math.round;function ZH(e){const t=wo(e);let n=parseFloat(t.width),r=parseFloat(t.height);const i=e.offsetWidth,o=e.offsetHeight,a=d_(n)!==i||d_(r)!==o;return a&&(n=i,r=o),{width:n,height:r,fallback:a}}function Ku(e){return QH(e)?(e.nodeName||"").toLowerCase():""}let p_;function XH(){if(p_)return p_;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(p_=e.brands.map(t=>t.brand+"/"+t.version).join(" "),p_):navigator.userAgent}function Eo(e){return e instanceof Pr(e).HTMLElement}function Di(e){return e instanceof Pr(e).Element}function QH(e){return e instanceof Pr(e).Node}function e5(e){if(typeof ShadowRoot>"u")return!1;const t=Pr(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function h_(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=wo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function HRe(e){return["table","td","th"].includes(Ku(e))}function Vx(e){const t=/firefox/i.test(XH()),n=wo(e),r=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!=="none"||n.perspective!=="none"||(r?r!=="none":!1)||t&&n.willChange==="filter"||t&&(n.filter?n.filter!=="none":!1)||["transform","perspective"].some(i=>n.willChange.includes(i))||["paint","layout","strict","content"].some(i=>{const o=n.contain;return o!=null?o.includes(i):!1})}function Hx(){return/^((?!chrome|android).)*safari/i.test(XH())}function Gx(e){return["html","body","#document"].includes(Ku(e))}function t5(e){return Di(e)?e:e.contextElement}const n5={x:1,y:1};function nd(e){const t=t5(e);if(!Eo(t))return n5;const n=t.getBoundingClientRect(),{width:r,height:i,fallback:o}=ZH(t);let a=(o?d_(n.width):n.width)/r,u=(o?d_(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}function kc(e,t,n,r){var i,o;t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),u=t5(e);let s=n5;t&&(r?Di(r)&&(s=nd(r)):s=nd(e));const c=u?Pr(u):window,l=Hx()&&n;let f=(a.left+(l&&((i=c.visualViewport)==null?void 0:i.offsetLeft)||0))/s.x,d=(a.top+(l&&((o=c.visualViewport)==null?void 0:o.offsetTop)||0))/s.y,p=a.width/s.x,h=a.height/s.y;if(u){const m=Pr(u),g=r&&Di(r)?Pr(r):r;let _=m.frameElement;for(;_&&r&&g!==m;){const S=nd(_),C=_.getBoundingClientRect(),b=getComputedStyle(_);C.x+=(_.clientLeft+parseFloat(b.paddingLeft))*S.x,C.y+=(_.clientTop+parseFloat(b.paddingTop))*S.y,f*=S.x,d*=S.y,p*=S.x,h*=S.y,f+=C.x,d+=C.y,_=Pr(_).frameElement}}return{width:p,height:h,top:d,right:f+p,bottom:d+h,left:f,x:f,y:d}}function Vu(e){return((QH(e)?e.ownerDocument:e.document)||window.document).documentElement}function m_(e){return Di(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function GRe(e){let{rect:t,offsetParent:n,strategy:r}=e;const i=Eo(n),o=Vu(n);if(n===o)return t;let a={scrollLeft:0,scrollTop:0},u={x:1,y:1};const s={x:0,y:0};if((i||!i&&r!=="fixed")&&((Ku(n)!=="body"||h_(o))&&(a=m_(n)),Eo(n))){const c=kc(n);u=nd(n),s.x=c.x+n.clientLeft,s.y=c.y+n.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-a.scrollLeft*u.x+s.x,y:t.y*u.y-a.scrollTop*u.y+s.y}}function r5(e){return kc(Vu(e)).left+m_(e).scrollLeft}function YRe(e){const t=Vu(e),n=m_(e),r=e.ownerDocument.body,i=hm(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=hm(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+r5(e);const u=-n.scrollTop;return wo(r).direction==="rtl"&&(a+=hm(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:u}}function mm(e){if(Ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||e5(e)&&e.host||Vu(e);return e5(t)?t.host:t}function i5(e){const t=mm(e);return Gx(t)?t.ownerDocument.body:Eo(t)&&h_(t)?t:i5(t)}function Ac(e,t){var n;t===void 0&&(t=[]);const r=i5(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=Pr(r);return i?t.concat(o,o.visualViewport||[],h_(r)?r:[]):t.concat(r,Ac(r))}function JRe(e,t){const n=Pr(e),r=Vu(e),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,u=0,s=0;if(i){o=i.width,a=i.height;const c=Hx();(!c||c&&t==="fixed")&&(u=i.offsetLeft,s=i.offsetTop)}return{width:o,height:a,x:u,y:s}}function ZRe(e,t){const n=kc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Eo(e)?nd(e):{x:1,y:1},a=e.clientWidth*o.x,u=e.clientHeight*o.y,s=i*o.x,c=r*o.y;return{width:a,height:u,x:s,y:c}}function o5(e,t,n){let r;if(t==="viewport")r=JRe(e,n);else if(t==="document")r=YRe(Vu(e));else if(Di(t))r=ZRe(t,n);else{const a={...t};if(Hx()){var i,o;const u=Pr(e);a.x-=((i=u.visualViewport)==null?void 0:i.offsetLeft)||0,a.y-=((o=u.visualViewport)==null?void 0:o.offsetTop)||0}r=a}return zx(r)}function XRe(e,t){const n=t.get(e);if(n)return n;let r=Ac(e).filter(u=>Di(u)&&Ku(u)!=="body"),i=null;const o=wo(e).position==="fixed";let a=o?mm(e):e;for(;Di(a)&&!Gx(a);){const u=wo(a),s=Vx(a);u.position==="fixed"?i=null:(o?!s&&!i:!s&&u.position==="static"&&!!i&&["absolute","fixed"].includes(i.position))?r=r.filter(f=>f!==a):i=u,a=mm(a)}return t.set(e,r),r}function QRe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?XRe(t,this._c):[].concat(n),r],u=a[0],s=a.reduce((c,l)=>{const f=o5(t,l,i);return c.top=hm(f.top,c.top),c.right=JH(f.right,c.right),c.bottom=JH(f.bottom,c.bottom),c.left=hm(f.left,c.left),c},o5(t,u,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function eke(e){return Eo(e)?ZH(e):e.getBoundingClientRect()}function a5(e,t){return!Eo(e)||wo(e).position==="fixed"?null:t?t(e):e.offsetParent}function tke(e){let t=mm(e);for(;Eo(t)&&!Gx(t);){if(Vx(t))return t;t=mm(t)}return null}function u5(e,t){const n=Pr(e);let r=a5(e,t);for(;r&&HRe(r)&&wo(r).position==="static";)r=a5(r,t);return r&&(Ku(r)==="html"||Ku(r)==="body"&&wo(r).position==="static"&&!Vx(r))?n:r||tke(e)||n}function nke(e,t,n){const r=Eo(t),i=Vu(t),o=kc(e,!0,n==="fixed",t);let a={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if(r||!r&&n!=="fixed")if((Ku(t)!=="body"||h_(i))&&(a=m_(t)),Eo(t)){const s=kc(t,!0);u.x=s.x+t.clientLeft,u.y=s.y+t.clientTop}else i&&(u.x=r5(i));return{x:o.left+a.scrollLeft-u.x,y:o.top+a.scrollTop-u.y,width:o.width,height:o.height}}const rke={getClippingRect:QRe,convertOffsetParentRelativeRectToViewportRelativeRect:GRe,isElement:Di,getDimensions:eke,getOffsetParent:u5,getDocumentElement:Vu,getScale:nd,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const i=this.getOffsetParent||u5,o=this.getDimensions;return{reference:nke(t,await i(n),r),floating:{x:0,y:0,...await o(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>wo(e).direction==="rtl"};function ike(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=!0,animationFrame:u=!1}=r,s=i&&!u,c=s||o?[...Di(e)?Ac(e):e.contextElement?Ac(e.contextElement):[],...Ac(t)]:[];c.forEach(h=>{s&&h.addEventListener("scroll",n,{passive:!0}),o&&h.addEventListener("resize",n)});let l=null;if(a){let h=!0;l=new ResizeObserver(()=>{h||n(),h=!1}),Di(e)&&!u&&l.observe(e),!Di(e)&&e.contextElement&&!u&&l.observe(e.contextElement),l.observe(t)}let f,d=u?kc(e):null;u&&p();function p(){const h=kc(e);d&&(h.x!==d.x||h.y!==d.y||h.width!==d.width||h.height!==d.height)&&n(),d=h,f=requestAnimationFrame(p)}return n(),()=>{var h;c.forEach(m=>{s&&m.removeEventListener("scroll",n),o&&m.removeEventListener("resize",n)}),(h=l)==null||h.disconnect(),l=null,u&&cancelAnimationFrame(f)}}const oke=(e,t,n)=>{const r=new Map,i={platform:rke,...n},o={...i.platform,_c:r};return RRe(e,t,{...i,platform:o})};var v_=typeof document<"u"?F.useLayoutEffect:F.useEffect;function g_(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!g_(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!g_(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function s5(e){const t=Ce.useRef(e);return v_(()=>{t.current=e}),t}function ake(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,whileElementsMounted:o,open:a}=e,[u,s]=Ce.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[c,l]=Ce.useState(r);g_(c,r)||l(r);const f=Ce.useRef(null),d=Ce.useRef(null),p=Ce.useRef(u),h=s5(o),m=s5(i),[g,_]=Ce.useState(null),[S,C]=Ce.useState(null),b=Ce.useCallback(B=>{f.current!==B&&(f.current=B,_(B))},[]),w=Ce.useCallback(B=>{d.current!==B&&(d.current=B,C(B))},[]),O=Ce.useCallback(()=>{if(!f.current||!d.current)return;const B={placement:t,strategy:n,middleware:c};m.current&&(B.platform=m.current),oke(f.current,d.current,B).then(P=>{const Z={...P,isPositioned:!0};M.current&&!g_(p.current,Z)&&(p.current=Z,Y5.flushSync(()=>{s(Z)}))})},[c,t,n,m]);v_(()=>{a===!1&&p.current.isPositioned&&(p.current.isPositioned=!1,s(B=>({...B,isPositioned:!1})))},[a]);const M=Ce.useRef(!1);v_(()=>(M.current=!0,()=>{M.current=!1}),[]),v_(()=>{if(g&&S){if(h.current)return h.current(g,S,O);O()}},[g,S,O,h]);const x=Ce.useMemo(()=>({reference:f,floating:d,setReference:b,setFloating:w}),[b,w]),U=Ce.useMemo(()=>({reference:g,floating:S}),[g,S]);return Ce.useMemo(()=>({...u,update:O,refs:x,elements:U,reference:b,floating:w}),[u,O,x,U,b,w])}var Hu=typeof document<"u"?F.useLayoutEffect:F.useEffect;function uke(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}let Yx=!1,ske=0;const c5=()=>"floating-ui-"+ske++;function cke(){const[e,t]=Ce.useState(()=>Yx?c5():void 0);return Hu(()=>{e==null&&t(c5())},[]),Ce.useEffect(()=>{Yx||(Yx=!0)},[]),e}const l5=Ce["useId".toString()],f5=l5??cke,lke=Ce.createContext(null),fke=Ce.createContext(null),d5=()=>{var e,t;return(e=(t=Ce.useContext(lke))==null?void 0:t.id)!=null?e:null},Jx=()=>Ce.useContext(fke);function Zx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function p5(e){var t;return(t=Zx(e).defaultView)!=null?t:window}function y_(e){return e?e instanceof p5(e).Element:!1}function dke(e){return e?e instanceof p5(e).HTMLElement:!1}const h5=Ce["useInsertionEffect".toString()];function Xx(e){const t=Ce.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return h5?h5(()=>{t.current=e}):t.current=e,Ce.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function pke(e){let{open:t=!1,onOpenChange:n,whileElementsMounted:r,placement:i,middleware:o,strategy:a,nodeId:u}=e===void 0?{}:e;const[s,c]=Ce.useState(null),l=Jx(),f=Ce.useRef(null),d=Ce.useRef({}),p=Ce.useState(()=>uke())[0],h=ake({placement:i,middleware:o,strategy:a,whileElementsMounted:r}),m=Xx(n),g=Ce.useMemo(()=>({...h.refs,domReference:f}),[h.refs]),_=Ce.useMemo(()=>({...h,refs:g,dataRef:d,nodeId:u,events:p,open:t,onOpenChange:m,_:{domReference:s}}),[h,u,p,t,m,g,s]);Hu(()=>{const b=l==null?void 0:l.nodesRef.current.find(w=>w.id===u);b&&(b.context=_)});const{reference:S}=h,C=Ce.useCallback(b=>{(y_(b)||b===null)&&(_.refs.domReference.current=b,c(b)),S(b)},[S,_.refs]);return Ce.useMemo(()=>({...h,context:_,refs:g,reference:C}),[h,g,_,C])}function Qx(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(i=>i?i[n]:null).concat(e).reduce((i,o)=>(o&&Object.entries(o).forEach(a=>{let[u,s]=a;if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof s=="function"){var c;(c=r.get(u))==null||c.push(s),i[u]=function(){for(var l,f=arguments.length,d=new Array(f),p=0;p<f;p++)d[p]=arguments[p];(l=r.get(u))==null||l.forEach(h=>h(...d))}}}else i[u]=s}),i),{})}}const hke=function(e){return e===void 0&&(e=[]),{getReferenceProps:t=>Qx(t,e,"reference"),getFloatingProps:t=>Qx(t,e,"floating"),getItemProps:t=>Qx(t,e,"item")}};function eM(e,t){var n;let r=(n=e.filter(a=>{var u;return a.parentId===t&&((u=a.context)==null?void 0:u.open)}))!=null?n:[],i=r;for(;i.length;){var o;i=(o=e.filter(a=>{var u;return(u=i)==null?void 0:u.some(s=>{var c;return a.parentId===s.id&&((c=a.context)==null?void 0:c.open)})}))!=null?o:[],r=r.concat(i)}return r}function m5(e){let t=e.activeElement;for(;((n=t)==null||(r=n.shadowRoot)==null?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function mke(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Gu(e){e.preventDefault(),e.stopPropagation()}function vke(e){const t=F.useRef(e);return Hu(()=>{t.current=e}),t}function v5(e){const t=F.useRef();return Hu(()=>{t.current=e},[e]),t.current}const gke=function(e,t){let{open:n}=e,{enabled:r=!0,role:i="dialog"}=t===void 0?{}:t;const o=f5(),a=f5(),u={id:o,role:i};return r?i==="tooltip"?{reference:{"aria-describedby":n?o:void 0},floating:u}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":i==="alertdialog"?"dialog":i,"aria-controls":n?o:void 0,...i==="listbox"&&{role:"combobox"},...i==="menu"&&{id:a}},floating:{...u,...i==="menu"&&{"aria-labelledby":a}}}:{}};function tM(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}const yke=function(e,t){let{open:n,onOpenChange:r,refs:i,events:o,nodeId:a}=e,{enabled:u=!0,escapeKey:s=!0,outsidePointerDown:c=!0,referencePointerDown:l=!1,ancestorScroll:f=!1,bubbles:d=!0}=t===void 0?{}:t;const p=Jx(),h=d5()!=null,m=Ce.useRef(!1);return Ce.useEffect(()=>{if(!n||!u)return;function g(w){if(w.key==="Escape"){if(!d&&p&&eM(p.nodesRef.current,a).length>0)return;o.emit("dismiss",{preventScroll:!1}),r(!1)}}function _(w){const O=m.current;if(m.current=!1,O)return;const M=mke(w);if(y_(M)&&i.floating.current){var x;const B=(x=i.floating.current.ownerDocument.defaultView)!=null?x:window,P=M.scrollWidth>M.clientWidth,Z=M.scrollHeight>M.clientHeight;let ee=Z&&w.offsetX>M.clientWidth;if(Z&&B.getComputedStyle(M).direction==="rtl"&&(ee=w.offsetX<=M.offsetWidth-M.clientWidth),ee||P&&w.offsetY>M.clientHeight)return}const U=p&&eM(p.nodesRef.current,a).some(B=>{var P;return tM(w,(P=B.context)==null?void 0:P.refs.floating.current)});tM(w,i.floating.current)||tM(w,i.domReference.current)||U||!d&&p&&eM(p.nodesRef.current,a).length>0||(o.emit("dismiss",h?{preventScroll:!0}:!1),r(!1))}function S(){r(!1)}const C=Zx(i.floating.current);s&&C.addEventListener("keydown",g),c&&C.addEventListener("pointerdown",_);const b=(f?[...y_(i.reference.current)?Ac(i.reference.current):[],...y_(i.floating.current)?Ac(i.floating.current):[]]:[]).filter(w=>{var O;return w!==((O=C.defaultView)==null?void 0:O.visualViewport)});return b.forEach(w=>w.addEventListener("scroll",S,{passive:!0})),()=>{s&&C.removeEventListener("keydown",g),c&&C.removeEventListener("pointerdown",_),b.forEach(w=>w.removeEventListener("scroll",S))}},[s,c,o,p,a,n,r,f,u,d,i,h]),u?{reference:{onPointerDown(){l&&(o.emit("dismiss"),r(!1))}},floating:{onPointerDownCapture(){m.current=!0}}}:{}},nM="ArrowUp",b_="ArrowDown",rd="ArrowLeft",vm="ArrowRight";function __(e,t,n){return Math.floor(e/t)!==n}function gm(e,t){return t<0||t>=e.current.length}function Rn(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:i,amount:o=1}=t===void 0?{}:t;const a=e.current;let u=n;do{var s,c;u=u+(r?-o:o)}while(u>=0&&u<=a.length-1&&(i?i.includes(u):a[u]==null||(s=a[u])!=null&&s.hasAttribute("disabled")||((c=a[u])==null?void 0:c.getAttribute("aria-disabled"))==="true"));return u}function $_(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function g5(e,t){return $_(t,e===nM||e===b_,e===rd||e===vm)}function rM(e,t,n){return $_(t,e===b_,n?e===rd:e===vm)||e==="Enter"||e==" "||e===""}function bke(e,t,n){return $_(t,n?e===rd:e===vm,e===b_)}function _ke(e,t,n){return $_(t,n?e===vm:e===rd,e===nM)}function iM(e,t){return Rn(e,{disabledIndices:t})}function y5(e,t){return Rn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const $ke=function(e,t){let{open:n,onOpenChange:r,refs:i}=e,{listRef:o,activeIndex:a,onNavigate:u=()=>{},enabled:s=!0,selectedIndex:c=null,allowEscape:l=!1,loop:f=!1,nested:d=!1,rtl:p=!1,virtual:h=!1,focusItemOnOpen:m="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:_=!0,disabledIndices:S=void 0,orientation:C="vertical",cols:b=1}=t===void 0?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;process.env.NODE_ENV!=="production"&&(l&&(f||console.warn(["Floating UI: `useListNavigation` looping must be enabled to allow","escaping."].join(" ")),h||console.warn(["Floating UI: `useListNavigation` must be virtual to allow","escaping."].join(" "))),C==="vertical"&&b>1&&console.warn(["Floating UI: In grid list navigation mode (`cols` > 1), the",'`orientation` should be either "horizontal" or "both".'].join(" ")));const w=d5(),O=Jx(),M=v5(n),x=Xx(u),U=Xx(v5(u)),B=Ce.useRef(m),P=Ce.useRef(c??-1),Z=Ce.useRef(null),ee=vke(S),J=Ce.useRef(!1),ge=Ce.useRef(-1),[Te,k]=Ce.useState(),A=Ce.useCallback(($,R)=>{ge.current=requestAnimationFrame(()=>{if(h){var L;k((L=$.current[R.current])==null?void 0:L.id)}else{var X;(X=$.current[R.current])==null||X.focus({preventScroll:!0})}})},[h]);Hu(()=>{s&&(!M&&n&&B.current&&c!=null&&x(c),M&&!n&&(cancelAnimationFrame(ge.current),P.current=-1,U(null)))},[n,M,c,o,A,s,x,U]),Hu(()=>{if(s&&n)if(a==null){if(c!=null)return;M&&(P.current=-1,A(o,P)),!M&&B.current&&(Z.current!=null||B.current===!0&&Z.current==null)&&(P.current=Z.current==null||rM(Z.current,C,p)||d?iM(o,ee.current):y5(o,ee.current),x(P.current),A(o,P))}else gm(o,a)||(P.current=a,A(o,P))},[n,M,a,c,d,o,x,A,s,l,C,p,h,ee]),Hu(()=>{if(s&&!n&&M){var $,R;const L=O==null||($=O.nodesRef.current.find(X=>X.id===w))==null||(R=$.context)==null?void 0:R.refs.floating.current;L&&!L.contains(m5(Zx(L)))&&L.focus({preventScroll:!0})}},[s,n,M,O,w]),Hu(()=>{Z.current=null});function I($){if(J.current=!0,d&&_ke($.key,C,p)){Gu($),r(!1),dke(i.domReference.current)&&i.domReference.current.focus();return}const R=P.current,L=iM(o,S),X=y5(o,S);if($.key==="Home"&&(P.current=L,x(P.current)),$.key==="End"&&(P.current=X,x(P.current)),b>1){const ne=P.current;if($.key===nM){if(Gu($),ne===-1)P.current=X;else if(P.current=Rn(o,{startingIndex:ne,amount:b,decrement:!0,disabledIndices:S}),f&&(ne-b<L||P.current<0)){const ke=ne%b,se=X%b,Fe=X-(se-ke);se===ke?P.current=X:P.current=se>ke?Fe:Fe-b}gm(o,P.current)&&(P.current=ne),x(P.current)}if($.key===b_&&(Gu($),ne===-1?P.current=L:(P.current=Rn(o,{startingIndex:ne,amount:b,disabledIndices:S}),f&&ne+b>X&&(P.current=Rn(o,{startingIndex:ne%b-b,amount:b,disabledIndices:S}))),gm(o,P.current)&&(P.current=ne),x(P.current)),C==="both"){const ke=Math.floor(ne/b);$.key===vm&&(Gu($),ne%b!==b-1?(P.current=Rn(o,{startingIndex:ne,disabledIndices:S}),f&&__(P.current,b,ke)&&(P.current=Rn(o,{startingIndex:ne-ne%b-1,disabledIndices:S}))):f&&(P.current=Rn(o,{startingIndex:ne-ne%b-1,disabledIndices:S})),__(P.current,b,ke)&&(P.current=ne)),$.key===rd&&(Gu($),ne%b!==0?(P.current=Rn(o,{startingIndex:ne,disabledIndices:S,decrement:!0}),f&&__(P.current,b,ke)&&(P.current=Rn(o,{startingIndex:ne+(b-ne%b),decrement:!0,disabledIndices:S}))):f&&(P.current=Rn(o,{startingIndex:ne+(b-ne%b),decrement:!0,disabledIndices:S})),__(P.current,b,ke)&&(P.current=ne));const se=Math.floor(X/b)===ke;gm(o,P.current)&&(f&&se?P.current=$.key===rd?X:Rn(o,{startingIndex:ne-ne%b-1,disabledIndices:S}):P.current=ne),x(P.current);return}}if(g5($.key,C)){if(Gu($),n&&!h&&m5($.currentTarget.ownerDocument)===$.currentTarget){P.current=rM($.key,C,p)?L:X,x(P.current);return}rM($.key,C,p)?f?P.current=R>=X?l&&R!==o.current.length?-1:L:Rn(o,{startingIndex:R,disabledIndices:S}):P.current=Math.min(X,Rn(o,{startingIndex:R,disabledIndices:S})):f?P.current=R<=L?l&&R!==-1?o.current.length:X:Rn(o,{startingIndex:R,decrement:!0,disabledIndices:S}):P.current=Math.max(L,Rn(o,{startingIndex:R,decrement:!0,disabledIndices:S})),gm(o,P.current)?x(null):x(P.current)}}return s?{reference:{...h&&n&&a!=null&&{"aria-activedescendant":Te},onKeyDown($){if(J.current=!0,h&&n)return I($);if(($.key.indexOf("Arrow")===0||$.key==="Enter"||$.key===" "||$.key==="")&&(Z.current=$.key),d){bke($.key,C,p)&&(Gu($),n?(P.current=iM(o,S),x(P.current)):r(!0));return}g5($.key,C)&&(c!=null&&(P.current=c),Gu($),!n&&_?r(!0):I($),n&&x(P.current))}},floating:{"aria-orientation":C==="both"?void 0:C,...h&&a!=null&&{"aria-activedescendant":Te},onKeyDown:I,onPointerMove(){J.current=!1}},item:{onFocus($){let{currentTarget:R}=$;const L=o.current.indexOf(R);L!==-1&&x(L)},onClick:$=>{let{currentTarget:R}=$;return R.focus({preventScroll:!0})},...g&&{onMouseMove($){let{currentTarget:R}=$;const L=R;if(L){const X=o.current.indexOf(L);X!==-1&&x(X)}},onPointerLeave(){if(!J.current&&(P.current=-1,A(o,P),x(null),!h)){var $;($=i.floating.current)==null||$.focus({preventScroll:!0})}}}}}:{}};function Ske(e){var t;const{char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:a}=e,u=ZEe(n),s=new RegExp(`\\s${u}$`),c=o?"^":"",l=r?new RegExp(`${c}${u}.*?(?=\\s${u}|$)`,"gm"):new RegExp(`${c}(?:^)?${u}[^\\s${u}]*`,"gm"),f=((t=a.nodeBefore)===null||t===void 0?void 0:t.isText)&&a.nodeBefore.text;if(!f)return null;const d=a.pos-f.length,p=Array.from(f.matchAll(l)).pop();if(!p||p.input===void 0||p.index===void 0)return null;const h=p.input.slice(Math.max(0,p.index-1),p.index),m=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(h);if(i!==null&&!m)return null;const g=d+p.index;let _=g+p[0].length;return r&&s.test(f.slice(_-1,_+1))&&(p[0]+=" ",_+=1),g<a.pos&&_>=a.pos?{range:{from:g,to:_},query:p[0].slice(n.length),text:p[0]}:null}const Tke=new Ni("suggestion");function Ike({pluginKey:e=Tke,editor:t,char:n="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:u="suggestion",command:s=()=>null,items:c=()=>[],render:l=()=>({}),allow:f=()=>!0}){let d;const p=l==null?void 0:l(),h=new Rr({key:e,view(){return{update:async(m,g)=>{var _,S,C,b,w,O,M;const x=(_=this.key)===null||_===void 0?void 0:_.getState(g),U=(S=this.key)===null||S===void 0?void 0:S.getState(m.state),B=x.active&&U.active&&x.range.from!==U.range.from,P=!x.active&&U.active,Z=x.active&&!U.active,ee=!P&&!Z&&x.query!==U.query,J=P||B,ge=ee&&!B,Te=Z||B;if(!J&&!ge&&!Te)return;const k=Te&&!J?x:U,A=m.dom.querySelector(`[data-decoration-id="${k.decorationId}"]`);d={editor:t,range:k.range,query:k.query,text:k.text,items:[],command:I=>{s({editor:t,range:k.range,props:I})},decorationNode:A,clientRect:A?()=>{var I;const{decorationId:$}=(I=this.key)===null||I===void 0?void 0:I.getState(t.state),R=m.dom.querySelector(`[data-decoration-id="${$}"]`);return(R==null?void 0:R.getBoundingClientRect())||null}:null},J&&((C=p==null?void 0:p.onBeforeStart)===null||C===void 0||C.call(p,d)),ge&&((b=p==null?void 0:p.onBeforeUpdate)===null||b===void 0||b.call(p,d)),(ge||J)&&(d.items=await c({editor:t,query:k.query})),Te&&((w=p==null?void 0:p.onExit)===null||w===void 0||w.call(p,d)),ge&&((O=p==null?void 0:p.onUpdate)===null||O===void 0||O.call(p,d)),J&&((M=p==null?void 0:p.onStart)===null||M===void 0||M.call(p,d))},destroy:()=>{var m;d&&((m=p==null?void 0:p.onExit)===null||m===void 0||m.call(p,d))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(m,g,_,S){const{isEditable:C}=t,{composing:b}=t.view,{selection:w}=m,{empty:O,from:M}=w,x={...g};if(x.composing=b,C&&(O||t.view.composing)){(M<g.range.from||M>g.range.to)&&!b&&!g.composing&&(x.active=!1);const U=Ske({char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:w.$from}),B=`id_${Math.floor(Math.random()*4294967295)}`;U&&f({editor:t,state:S,range:U.range})?(x.active=!0,x.decorationId=g.decorationId?g.decorationId:B,x.range=U.range,x.query=U.query,x.text=U.text):x.active=!1}else x.active=!1;return x.active||(x.decorationId=null,x.range={from:0,to:0},x.query=null,x.text=null),x}},props:{handleKeyDown(m,g){var _;const{active:S,range:C}=h.getState(m.state);return S&&((_=p==null?void 0:p.onKeyDown)===null||_===void 0?void 0:_.call(p,{view:m,event:g,range:C}))||!1},decorations(m){const{active:g,range:_,decorationId:S}=h.getState(m);return g?Wt.create(m.doc,[Ar.inline(_.from,_.to,{nodeName:a,class:u,"data-decoration-id":S})]):null}}});return h}function b5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=b5(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function _5(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=b5(e))&&(r&&(r+=" "),r+=t);return r}const Cke=Mn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),xo={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",preformatted:"preformatted",strong:"strong",em:"em",listItem:"list-item",oListItem:"o-list-item",list:"group-list-item",oList:"group-o-list-item",image:"image",embed:"embed",hyperlink:"hyperlink",label:"label",span:"span"},S_=()=>(++S_.i).toString();S_.i=0;const Oke=e=>{const t=wke(e),n=[];for(let r=0;r<t.length;r++)n.push($5(t[r]));return{key:S_(),children:n}},ym=(e,t=[])=>({key:S_(),type:e.type,text:"text"in e?e.text:void 0,node:e,children:t}),oM=e=>ym({type:xo.span,text:e,spans:[]}),wke=e=>{const t=e.slice(0);for(let n=0;n<t.length;n++){const r=t[n];if(r.type===xo.listItem||r.type===xo.oListItem){const i=[r];for(;t[n+1]&&t[n+1].type===r.type;)i.push(t[n+1]),t.splice(n,1);r.type===xo.listItem?t[n]={type:xo.list,items:i}:t[n]={type:xo.oList,items:i}}}return t},$5=e=>{if("text"in e)return ym(e,S5(e.spans,e));if("items"in e){const t=[];for(let n=0;n<e.items.length;n++)t.push($5(e.items[n]));return ym(e,t)}return ym(e)},S5=(e,t,n)=>{if(!e.length)return[oM(t.text)];const r=e.slice(0);r.sort((o,a)=>o.start-a.start||a.end-o.end);const i=[];for(let o=0;o<r.length;o++){const a=r[o],u=n&&n.start||0,s=a.start-u,c=a.end-u,l=t.text.slice(s,c),f=[];for(let p=o;p<r.length;p++){const h=r[p];h!==a&&h.start>=a.start&&h.end<=a.end&&(f.push(h),r.splice(p,1),p--)}o===0&&s>0&&i.push(oM(t.text.slice(0,s)));const d={...a,text:l};i.push(ym(d,S5(f,{...t,text:l},a))),c<t.text.length&&i.push(oM(t.text.slice(c,r[o+1]?r[o+1].start-u:void 0)))}return i},Eke=(e,t)=>T5(Oke(e).children,t),T5=(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=t(i.type,i.node,i.text,T5(i.children,t),i.key);o!=null&&n.push(o)}return n};xo.listItem+"",xo.oListItem+"",xo.list+"",xo.oList+"";const xke=Mn.create({name:"text",group:"inline"}),Mke={groupBy(e,t){return e.reduce((n,r)=>{const i=t(r),o=(n.get(i)||[]).concat(r);return n.set(i,o)},new Map)},sort(e){return[...e].sort((t,n)=>t.start-n.start)},mergeOverlap(e){const t=this.groupBy(e,r=>r.type),n=Array.from(t.entries()).map(([r,i])=>(this.sort(i).reduce((o,a)=>{if(!o.length)return[a];const u=o.length-1,s=o[u];return s.end>=a.start?[...o.slice(0,u),{...s,end:a.end}]:[...o,a]},[]),i)).reduce((r,i)=>[...r,...i],[]);return this.sort(n)}},I5={fromPrismic(e){return t=>{var n;return(n=fM.find(r=>r.richTextNodeTypes[0]===t.type))==null?void 0:n.converter.fromPrismic(e)(t)}},toPrismic(e,t,n){const[r,i]=(()=>{const o=fM.find(a=>e.type.name===a.name);if(!o)throw new Error(`Invalid mark extension '${e.type.name}'.`);return[o.richTextNodeTypes[0],o.converter.toPrismic(e)]})();return{type:r,start:t,end:n,...i?{data:i}:{}}}},C5=xke.extend({name:"text"}),Rke={fromPrismic(e){return function(t,n,r=!1){const i={type:t,text:n.content.text,spans:n.content.spans||[]};return Eke([i],kke(e,r))[0]}},toPrismic(e,t,n){const r=Rc.children.reduce(e,(i,o)=>{const a=(()=>o.type.name===c_.name?c_.converter.toPrismic(o):o.textContent)(),u=a?i.text+a:i.text,s=i.text.length,c=u.length,l=(()=>o.marks.length?Rc.marks.map(o,d=>I5.toPrismic(d,s,c)):void 0)();return{...i,text:u,spans:l?[...i.spans,...l]:i.spans}},{text:"",spans:[]});return{type:t,content:{text:r.text,spans:[...Mke.mergeOverlap(r.spans)].sort((i,o)=>i.type.localeCompare(o.type))},...n}}};function kke(e,t=!1){return(n,r,i,o)=>{if(n==="span"&&i&&i.length)return t?[e.text(i)]:c_.splitTextToNodes(e,i)(a=>e.text(a));{const a=I5.fromPrismic(e)(r);return a?o.flat().map(s=>s.mark([...s.marks,a].sort((c,l)=>c.type.name.localeCompare(l.type.name)))):o.flat()}}}const Fc={name:C5.name,component:C5,converter:Rke};var O5=(e=>(e.LeftToRight="ltr",e.RightToLeft="rtl",e))(O5||{});const Fa="dir",Ake=Re.RichTextNodeType.rtl,Fke=dr.create({name:"textDirection",addOptions(){return{supportedExtensionNames:[]}},addGlobalAttributes(){return[{types:this.options.supportedExtensionNames,attributes:{[Fa]:{default:"ltr",parseHTML:e=>e.getAttribute(Fa),renderHTML:e=>({[Fa]:e[Fa]==="ltr"?"ltr":"rtl"})}}}]},addCommands(){return{setDirection:e=>({commands:t})=>{switch(e){case"rtl":return t.setRightToLeft();default:return t.setLeftToRight()}},toggleDirection:e=>({commands:t})=>{const n=e==="rtl"?"ltr":"rtl";return t.setDirection(n)},setRightToLeft:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.updateAttributes(t,{[Fa]:"rtl"})),setLeftToRight:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.resetAttributes(t,Fa))}},addKeyboardShortcuts(){return{"Mod-Shift-r":()=>this.editor.commands.setRightToLeft(),"Mod-Shift-l":()=>this.editor.commands.setLeftToRight()}}}),Na={parseNodeAttrsDirection(e){switch(e[Fa]){case"rtl":return"rtl";default:return"ltr"}},fromPrismic(e){const t=(()=>{switch(e.direction){case"rtl":return"rtl";default:return"ltr"}})();return{[Fa]:t}},toPrismic(e){return{direction:this.parseNodeAttrsDirection(e.attrs)}}},T_=Cke.extend({name:"paragraph",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",$t(this.options.HTMLAttributes,e),0]}}),Nke={fromPrismic(e){return function(t){var r;const n=Fc.converter.fromPrismic(e)(T_.name,t);return(r=e.nodes[T_.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return Fc.converter.toPrismic(e,Re.RichTextNodeType.paragraph,Na.toPrismic(e))}},Yu=new dm([Re.RichTextNodeType.paragraph],T_.name,T_,Nke,"Type '/' for commands"),w5=["ArrowDown","ArrowUp","End","Home"],E5=["Enter"],Pke=["Escape",...w5,...E5],Wke=dr.create({name:"slash-commands",addOptions(){return{nodeTypes:[]}},addProseMirrorPlugins(){const e=E_(j5,this.options.nodeTypes);return e.length>1?[Ike({allowSpaces:!0,char:"/",editor:this.editor,startOfLine:!0,allow:({state:t})=>{const n=t.selection.$from;return n.parent.type.name===Yu.name&&n.depth===1},command:({editor:t,props:n,range:r})=>{n.runCommands(t,{deleteRange:r})},items:({query:t})=>{const n=t.toLocaleLowerCase().trim();return e.filter(r=>{var i,o;return((i=r.shortText)==null?void 0:i.toLocaleLowerCase().includes(n))||((o=r.text)==null?void 0:o.toLocaleLowerCase().includes(n))})},render:()=>{let t;return{onStart:n=>{t=new MH(jke,{editor:n.editor,props:n}),document.body.appendChild(t.element)},onUpdate:n=>{t==null||t.updateProps(n)},onKeyDown:({event:n})=>{var r;return Pke.includes(n.key)&&((r=t==null?void 0:t.ref)==null?void 0:r.handleKeyDown(n))},onExit:()=>{t==null||t.destroy(),t==null||t.element.remove()}}}})]:[]}}),jke=F.forwardRef(function({command:t,decorationNode:n,editor:r,items:i},o){const[a,u]=F.useState(!0),s=parseFloat(T.tokens.space[0]),{context:c,floating:l,reference:f,strategy:d,x:p,y:h}=pke({middleware:[zRe(s),URe(),KRe({limiter:VRe()})],onOpenChange:u,open:a,placement:"top-start",strategy:"fixed",whileElementsMounted:ike});F.useLayoutEffect(()=>{f(n)},[f,n]),F.useEffect(()=>{let P;const Z=()=>{P=window.setTimeout(()=>{u(!0)})},ee=()=>{u(!1)};return r.on("focus",Z).on("blur",ee),()=>{r.off("focus",Z).off("blur",ee),clearTimeout(P)}},[r]);const[m,g]=F.useState(0),_=F.useRef([]),[S,C]=F.useState();i!==S&&(g(0),_.current=[],C(i));const{getFloatingProps:b,getItemProps:w,getReferenceProps:O}=hke([yke(c,{outsidePointerDown:!1}),$ke(c,{activeIndex:m,listRef:_,onNavigate:P=>{g(Z=>P??Z)},openOnArrowKeyDown:!1,virtual:!0}),gke(c,{role:"menu"})]),x=O().onKeyDown;F.useImperativeHandle(o,()=>({handleKeyDown:P=>{if(a){if(w5.includes(P.key)&&x(P),E5.includes(P.key)){const Z=i[m];Z!==void 0&&t(Z)}return!0}else return!1}}),[m,t,i,x,a]);const U=p!==null&&h!==null,B=F.useId();return a?y.jsxs("div",{...b(),className:T.dropdownMenuStyles.content,ref:l,style:{top:parseFloat(T.tokens.space[0]),left:parseFloat(T.tokens.space[0]),minWidth:256,position:d,transform:U?`translate3d(${Math.round(p)}px, ${Math.round(h)}px, 0)`:"translate3d(0, -200%, 0)"},children:[i.map((P,Z)=>F.createElement(x5,{...w({onClick:()=>{t(P)},onPointerDown:ee=>{ee.preventDefault()}}),"data-highlighted":Z===m?"":void 0,id:`${B}[${Z}]`,key:P.nodeType,ref:ee=>{_.current[Z]=ee},shortcut:`/${P.shortText??""}`,startIcon:P.icon},P.text)),i.length===0?y.jsx(x5,{...w({onPointerDown:P=>{P.preventDefault()}}),disabled:!0,id:`${B}[0]`,ref:P=>{_.current[0]=P},children:"No results"}):null]}):null}),x5=F.forwardRef(function({children:t,disabled:n,shortcut:r,startIcon:i,...o},a){return y.jsxs("div",{...o,...n?{"aria-disabled":!0,"data-disabled":!0}:{},className:T.dropdownMenuStyles.item,ref:a,role:"menuitem",children:[F.isValidElement(i)?F.cloneElement(i,{className:_5(i.props.className,T.dropdownMenuStyles.itemStartIcon)}):null,y.jsx(T.Text,{className:_5(T.dropdownMenuStyles.itemText,T.dropdownMenuStyles.itemTextColor.grey),component:"span",children:t}),r?y.jsx(T.Text,{className:T.dropdownMenuStyles.itemShortcut,color:"inherit",component:"span",variant:"inherit",children:r}):null]})});function Lke(e,t){var a,u;const n=t.map(s=>s.richTextNodeTypes).flat(),i={placeholderByNodeType:v(t,Sv(s=>s.nodeType===ed.Text),Iv({},(s,c)=>({...s,[c.name]:c.placeholder}))),unfocusedPlaceholder:(a=e.config)==null?void 0:a.placeholder,nodeExtensions:t},o=n.includes(Re.RichTextNodeType.orderedList)||n.includes(Re.RichTextNodeType.list);return Sv(s=>s!==void 0)([Ux.component(((u=e.config)==null?void 0:u.single)===void 0),Fc.component,c_.component,xRe(i),o?td.component:void 0,Wke.configure({nodeTypes:n})])}const aM=vRe.extend({name:"bulletList",parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",$t(this.options.HTMLAttributes,e),0]}}).configure({itemTypeName:"listItem"}),Dke={fromPrismic(e){return function(t){var r;const n=td.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[aM.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return Rc.children.map(e,t=>td.converter.toPrismic(t,Re.RichTextNodeType.list).filter(ho)).flat()}},I_=new jx([Re.RichTextNodeType.list],aM.name,aM,Dke),Bke=/^```([a-z]+)?[\s\n]$/,Uke=/^~~~([a-z]+)?[\s\n]$/,C_=Mn.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:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",$t(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
143
143
 
144
- `);return!o||!a?!1:e.chain().command(({tr:u})=>(u.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const u=i.after();return u===void 0||r.nodeAt(u)?!1:e.commands.exitCode()}}},addInputRules(){return[gx({find:kke,type:this.type,getAttributes:e=>({language:e[1]})}),gx({find:Ake,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Rr({key:new Ni("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:a}=e.state;return a.replaceSelectionWith(this.type.create({language:o})),a.setSelection(Be.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.insertText(n.replace(/\r\n?/g,`
145
- `)),a.setMeta("paste",!0),e.dispatch(a),!0}}})]}}).extend({name:"preformatted",addAttributes(){return{language:{default:null,parseHTML:e=>{var o;const{languageClassPrefix:t}=this.options,i=[...((o=e.firstElementChild)==null?void 0:o.classList)||[]].filter(a=>a.startsWith(t)).map(a=>a.replace(t,""))[0];return i||null},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:e}){return["pre",It(this.options.HTMLAttributes),["code",e,0]]}}).configure({exitOnTripleEnter:!1}),Fke={fromPrismic(e){return function(t){var r;const n=Fc.converter.fromPrismic(e)(O_.name,t,!0);return(r=e.nodes[O_.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return Fc.converter.toPrismic(e,Pe.RichTextNodeType.preformatted,Na.toPrismic(e))}},OH=new nd([Pe.RichTextNodeType.preformatted],O_.name,O_,Fke,"",!0);function Nke(e,t,n){const{node:r}=e,i=r.attrs.content,[o,a]=N.useState((i==null?void 0:i.embed_url)??""),u=eb(e.updateAttributes);function s(h){u({content:h})}function c(h){a(h),cc(h)||s(void 0)}const[l,f]=N.useState(o),d=N.useCallback(h=>N.startTransition(()=>f(h)),[]);Su(o,300,d);const{onKeyDown:p}=Pke(e,o,t,n);return{inputRef:t,containerRef:n,onKeyDown:p,url:o,urlChanged:c,onContentChange:s,debouncedUrl:l}}function Pke(e,t,n,r){const{editor:i,getPos:o,node:a}=e,[u,s]=N.useState(!0);N.useEffect(()=>{!u||!e.editor.isFocused||setTimeout(()=>{var l;return(l=n.current)==null?void 0:l.focus()})},[n,u,e.editor.isFocused]);function c(l){const f=o(),d=o()+a.nodeSize;l.code==="Enter"&&(s(!1),i.chain().insertContentAt(d,{type:"paragraph"}).focus(d+1).run()),l.code==="Backspace"&&t===""&&i.chain().deleteRange({from:f,to:d}).focus(d+1).run(),l.code==="ArrowUp"&&(s(!1),i.chain().focus(f-1).run()),l.code==="ArrowDown"&&(s(!1),i.chain().focus(d+1).run())}return{containerRef:r,inputRef:n,onKeyDown:c}}function Wke(e){const t=N.useRef(null),n=N.useRef(null),{onKeyDown:r,url:i,urlChanged:o,onContentChange:a,debouncedUrl:u}=Nke(e,t,n);return y.jsx(DMe,{className:"custom-embed",children:y.jsx("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:y.jsxs(T.Box,{flexDirection:"column",children:[y.jsxs(T.Box,{flexGrow:1,alignItems:"center",children:[y.jsx(T.Icon,{size:"small",name:"cloud",color:"grey11"}),y.jsx(T.Box,{flexGrow:1,flexDirection:"column",ref:n,children:y.jsx(T.TextInput,{id:"id",ref:t,value:i,variant:cc(i)?"link":"normal",placeholder:"Paste your link here",onValueChange:o,onKeyDown:r})})]}),cc(i)&&y.jsx(JK,{debouncedUrl:u,onContentChange:a})]})})})}const cM=Hn.create({name:"embed",group:"block",content:"block*",atom:!0,marks:"",addAttributes(){return{content:{default:void 0}}},addCommands(){return{setEmbed:()=>({tr:e,dispatch:t})=>{const n=this.type.create();return t&&e.replaceSelectionWith(n),!0}}},parseHTML(){return[{tag:"embed"}]},renderHTML({HTMLAttributes:e}){return["embed",It(e)]},addNodeView(){return zMe(Wke)}}),jke={fromPrismic(e){return function(t){var n;return(n=e.nodes[cM.name])==null?void 0:n.create({content:t.data})}},toPrismic(e){return e.attrs.content===void 0?{type:"embed",data:{type:"embed",embed_url:"",__TYPE__:"EmbedContent",all:[]}}:{type:"embed",data:{...e.attrs.content}}}},wH=new oRe([Pe.RichTextNodeType.embed],cM.name,cM,jke),Lke=Hn.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,It(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>gx({find:new RegExp(`^(#{1,${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),w_="heading",Pa={byLevel(e){switch(e){case 1:return Pe.RichTextNodeType.heading1;case 2:return Pe.RichTextNodeType.heading2;case 3:return Pe.RichTextNodeType.heading3;case 4:return Pe.RichTextNodeType.heading4;case 5:return Pe.RichTextNodeType.heading5;case 6:return Pe.RichTextNodeType.heading6}},default(e){return{fullName:this.byLevel(e),level:e}},fromPrismic(e,t=[1,2,3,4,5,6]){const n=new RegExp(`^heading([${t.join(",")}]){1}$`),r=e.match(n);if(!r||!r[1])return;const i=parseInt(r[1]);return{fullName:Pa.byLevel(i),level:i}},fromProsemirror(e,t){const n=e.level;if(t.includes(n))return{fullName:Pa.byLevel(n),level:n}}},Dke=e=>Lke.extend({name:w_,addAttributes(){return{level:{default:e[0]},label:{default:null}}},addOptions(){return{levels:[...e],HTMLAttributes:{}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`}))},renderHTML({node:t,HTMLAttributes:n}){const r=t.attrs.level,o={...t.attrs.label?{label:t.attrs.label}:{}};return[`h${r}`,It(this.options.HTMLAttributes,n,o),0]}}),Bke=e=>{const t=e[0];return{fromPrismic(n){return function(r){var a;const i=Fc.converter.fromPrismic(n)(w_,r),o=Pa.fromPrismic(r.type,e)||Pa.default(t);return(a=n.nodes[w_])==null?void 0:a.create({level:o.level,...Na.fromPrismic(r)},i)}},toPrismic(n){const{fullName:r}=Pa.fromProsemirror(n.attrs,e)||Pa.default(t);return Fc.converter.toPrismic(n,r,Na.toPrismic(n))}}};function Uke(e){if(!e)return[1,2,3,4,5,6];if(!e.size)return;const t=Array.from(e.values()).reduce((n,r)=>{const i=Pa.fromPrismic(r);return i?[...n,i.level]:n},[]).sort((n,r)=>n-r);return v(gd(t),$S(()=>{}))}const Nc={name:w_,build:e=>{const t=Uke(e);if(!t)return;const n=gd(t.map(r=>Pa.byLevel(r)));if(!je(n))return new aRe(n.value,Dke(t),t,Bke(t),r=>{const i=Pa.fromProsemirror(r,t);return i&&`Heading ${i.level}`})}},qke=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,zke=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,Kke=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,Vke=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,lM=tm.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",It(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Hb({find:qke,type:this.type}),Hb({find:Kke,type:this.type})]},addPasteRules(){return[Yb({find:zke,type:this.type}),Yb({find:Vke,type:this.type})]}}).extend({name:"em"}),Hke={fromPrismic(e){return function(){var t;return(t=e.marks[lM.name])==null?void 0:t.create()}},toPrismic(){}},EH=new F5([Pe.RichTextNodeType.em],lM.name,lM,Hke),Gke=Hn.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",It(this.options.HTMLAttributes,e),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)}}}),xH=tm.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["span",It(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:t})=>{const n=Kb(e,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:t.unsetMark(this.name)}}}}),MH=/^(\d+)\.\s$/,fM=Hn.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",It(this.options.HTMLAttributes,n),0]:["ol",It(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Gke.name,this.editor.getAttributes(xH.name)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Gb({find:MH,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Gb({find:MH,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(xH.name)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}).extend({name:"orderedList",addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1}}},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",It(this.options.HTMLAttributes,n),0]:["ol",It(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}}}).configure({itemTypeName:"listItem"}),Yke={fromPrismic(e){return function(t){var r;const n=rd.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[fM.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return y$(Rc.children.map(e,t=>Xi(n=>n!==void 0)(rd.converter.toPrismic(t,Pe.RichTextNodeType.orderedList))))}},E_=new Bx([Pe.RichTextNodeType.orderedList],fM.name,fM,Yke),RH=Yu;function Jke(e){return[Yu,C_,E_,Nc.build(e),OH,wH].filter(Tu)}const dM=[N5,EH],kH=e=>[...Jke(e),...dM],AH=[{nodeType:Pe.RichTextNodeType.paragraph,icon:y.jsx(T.Icon,{name:"textFields"}),isActive:e=>e.isActive(Yu.name)&&!e.isActive(C_.name)&&!e.isActive(E_.name),runCommands:hr((e,t)=>e.clearNodes().setDirection(ri(t))),shortText:"par",text:"Paragraph"},{nodeType:Pe.RichTextNodeType.heading1,icon:y.jsx(T.Icon,{name:"looks1"}),isActive:e=>e.isActive(Nc.name,{level:1}),runCommands:hr((e,t)=>e.setHeading({level:1}).setDirection(ri(t))),shortText:"h1",text:"Heading 1"},{nodeType:Pe.RichTextNodeType.heading2,icon:y.jsx(T.Icon,{name:"looks2"}),isActive:e=>e.isActive(Nc.name,{level:2}),runCommands:hr((e,t)=>e.setHeading({level:2}).setDirection(ri(t))),shortText:"h2",text:"Heading 2"},{nodeType:Pe.RichTextNodeType.heading3,icon:y.jsx(T.Icon,{name:"looks3"}),isActive:e=>e.isActive(Nc.name,{level:3}),runCommands:hr((e,t)=>e.setHeading({level:3}).setDirection(ri(t))),shortText:"h3",text:"Heading 3"},{nodeType:Pe.RichTextNodeType.heading4,icon:y.jsx(T.Icon,{name:"looks4"}),isActive:e=>e.isActive(Nc.name,{level:4}),runCommands:hr((e,t)=>e.setHeading({level:4}).setDirection(ri(t))),shortText:"h4",text:"Heading 4"},{nodeType:Pe.RichTextNodeType.heading5,icon:y.jsx(T.Icon,{name:"looks5"}),isActive:e=>e.isActive(Nc.name,{level:5}),runCommands:hr((e,t)=>e.setHeading({level:5}).setDirection(ri(t))),shortText:"h5",text:"Heading 5"},{nodeType:Pe.RichTextNodeType.heading6,icon:y.jsx(T.Icon,{name:"looks6"}),isActive:e=>e.isActive(Nc.name,{level:6}),runCommands:hr((e,t)=>e.setHeading({level:6}).setDirection(ri(t))),shortText:"h6",text:"Heading 6"},{nodeType:Pe.RichTextNodeType.list,icon:y.jsx(T.Icon,{name:"formatListBulleted"}),isActive:e=>e.isActive(C_.name),runCommands:hr((e,t)=>e.toggleBulletList().setDirection(ri(t))),shortText:"bull",text:"Bulleted list"},{nodeType:Pe.RichTextNodeType.orderedList,icon:y.jsx(T.Icon,{name:"formatListNumbered"}),isActive:e=>e.isActive(E_.name),runCommands:hr((e,t)=>e.toggleOrderedList().setDirection(ri(t))),shortText:"num",text:"Numbered list"},{nodeType:Pe.RichTextNodeType.preformatted,icon:y.jsx(T.Icon,{name:"dataObject"}),isActive:e=>e.isActive(OH.name),runCommands:hr((e,t)=>e.setCodeBlock().setDirection(ri(t))),shortText:"code",text:"Code"},{nodeType:Pe.RichTextNodeType.embed,icon:y.jsx(T.Icon,{name:"cloud"}),isActive:e=>e.isActive(wH.name),runCommands:hr((e,t)=>e.setEmbed().setDirection(ri(t))),shortText:"emb",text:"Embed"}],Zke=[{nodeType:Pe.RichTextNodeType.strong,icon:y.jsx(T.Icon,{name:"formatBold"}),isActive:e=>e.isActive(N5.name),runCommands:hr(e=>e.toggleBold())},{nodeType:Pe.RichTextNodeType.em,icon:y.jsx(T.Icon,{name:"formatItalic"}),isActive:e=>e.isActive(EH.name),runCommands:hr(e=>e.toggleItalic())}],Xke=[{nodeType:Pe.RichTextNodeType.rtl,icon:y.jsx(T.Icon,{name:"formatTextDirectionRToL"}),isActive:e=>e.isActive({[Fa]:SH.RightToLeft}),runCommands:hr((e,t)=>e.toggleDirection(ri(t)))}];function hr(e){return(t,n={})=>{let r=n.can===!0?t.can().chain():t.chain().focus();return n.deleteRange!==void 0&&(r=r.deleteRange(n.deleteRange)),e(r,t).run()}}function ri(e){const t=e.state.selection.$from.parent.attrs;return Na.parseNodeAttrsDirection(t)}function x_(e,t){return e.filter(n=>t.includes(n.nodeType))}const Qke={duration:100,hideOnClick:!0,offset:[-48,parseFloat(T.tokens.space[8])],placement:"top-start",zIndex:parseFloat(T.tokens.zIndex.toolbar)},eAe=({editor:e,nodeTypes:t})=>{var a;const n=x_(AH,t),r=x_(Zke,t),i=x_(Xke,t),o=[n.length>1?y.jsx(T.ToolbarSelect,{onValueChange:u=>{var s;(s=n.find(c=>c.nodeType===u))==null||s.runCommands(e)},value:((a=n.find(u=>u.isActive(e)))==null?void 0:a.nodeType)??"",children:n.map(u=>y.jsx(T.ToolbarSelectItem,{value:u.nodeType,children:u.text},u.nodeType))},"node"):null,r.length>0?y.jsx(T.ToolbarToggleButtonGroup,{onValueChange:u=>{r.forEach(s=>{(s.isActive(e)&&!u.includes(s.nodeType)||!s.isActive(e)&&u.includes(s.nodeType))&&s.runCommands(e)})},type:"multiple",value:r.filter(u=>u.isActive(e)).map(u=>u.nodeType),children:r.map(u=>y.jsx(T.ToolbarToggleButtonGroupItem,{disabled:!u.runCommands(e,{can:!0}),startIcon:u.icon,value:u.nodeType},u.nodeType))},"mark"):null,i.length>0?y.jsx(N.Fragment,{children:i.map(u=>y.jsx(T.ToolbarToggleButton,{disabled:!u.runCommands(e,{can:!0}),onPressedChange:()=>{u.runCommands(e)},pressed:u.isActive(e),startIcon:u.icon},u.nodeType))},"extra"):null,n.length+r.length+i.length>1?y.jsx(T.ToolbarButton,{onClick:()=>{e.chain().focus().clearNodes().unsetAllMarks().run()},startIcon:y.jsx(T.Icon,{name:"formatClear"})},"clear"):null].filter(Tu).map((u,s)=>y.jsxs(N.Fragment,{children:[s===0?null:y.jsx(T.ToolbarSeparator,{}),u]},u.key));return o.length>0?y.jsx(FMe,{editor:e,tippyOptions:Qke,children:y.jsx(T.Toolbar,{children:o})}):null},tAe=e=>{var c;const{content:t,field:n,id:r,readOnly:i,config:o}=e,a=t&&zx.converter(o.nodeExtensions).fromPrismic(o.schema,(c=o.defaultTextConverter)==null?void 0:c.call(o,o.schema))(t),u=eb(e.onContentChange),s=VMe({...a?{content:a.toJSON()}:{},editable:!i,editorProps:{attributes:{class:T.contentEditableClass,id:r,tabIndex:"0"}},extensions:o.allComponents,injectCSS:!1,onUpdate({editor:l}){if(l.isEmpty)return u(void 0);const f=zx.converter(o.nodeExtensions).toPrismic(l.state.doc);u(f)}},[r,i,u]);return y.jsxs(T.Field,{children:[y.jsx(T.FieldLabel,{htmlFor:r,children:Bn(n)}),y.jsx(T.FieldControl,{children:y.jsxs(y.Fragment,{children:[y.jsx(jMe,{editor:s,style:{flex:1}}),(s==null?void 0:s.isEditable)&&y.jsx(eAe,{editor:s,nodeTypes:o.names.concat(Ike)})]})})]})},nAe=e=>{const{field:t}=e,n=N.useMemo(()=>{const{extensions:r,defaultTextConverter:i}=dRe(t.config),o=Xi(f=>f.extType===Dx.Node)(r),a=r.flatMap(f=>f.richTextNodeTypes),u=r.map(f=>f.component),s=[...Mke(t,o),Cke.configure({supportedExtensionNames:Xi(f=>f.extType===Dx.Node&&f.nodeType===td.Text&&!f.lockedFormat)(r).map(f=>f.name)}),...u,QEe],c=s.map(f=>f.name),l=vEe(s);return{allComponents:s,extensionsNames:c,defaultTextConverter:i,nodeExtensions:o,names:a,schema:l}},[t]);return y.jsx(tAe,{...e,config:n},n.extensionsNames.join("-"))},rAe=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var s,c;const o=mo(t),a=iAe(t),u=(e==null?void 0:e.value)??a;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"arrowDropDownCircle"})}),y.jsx(T.FieldLabel,{htmlFor:n,children:Bn(t)}),y.jsx(T.FieldControl,{children:y.jsxs(T.Select,{id:n,onValueChange:l=>{i||r(oAe(l))},placeholder:o,...u===void 0?{}:{value:u},children:[u===void 0||a!==void 0?null:y.jsx(T.SelectItem,{value:"",children:o}),(c=(s=t.config)==null?void 0:s.options)==null?void 0:c.map(l=>y.jsx(T.SelectItem,{value:l,children:l},l))]})})]},u)};function iAe(e){var t,n;return((t=e.config)==null?void 0:t.default_value)===void 0||(n=e.config.options)==null?void 0:n[0]}function oAe(e){return e.length===0?void 0:{__TYPE__:"FieldContent",type:"Select",value:e}}const aAe=({id:e,readOnly:t,field:n,content:r,onContentChange:i})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"event"})}),y.jsx(T.FieldLabel,{id:e,children:Bn(n)}),y.jsx(T.FieldControl,{children:y.jsx(y.Fragment,{children:y.jsx(T.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:y.jsx(T.DateInput,{mode:"date-time","aria-labelledby":e,readOnly:t,value:r==null?void 0:r.value,onValueChange:o=>i(uAe(o))})})})})]}),uAe=e=>e===void 0?void 0:{__TYPE__:"FieldContent",type:"Timestamp",value:e};function M_(e){const{id:t,readOnly:n,content:r,nestableWidget:i}=e,o=eb(e.onContentChange);return N.useMemo(()=>{const a={id:t,readOnly:n,onContentChange:o};return i.type==="Boolean"?y.jsx(ASe,{...a,field:i,content:Qe.isBooleanContent(r)?r:void 0}):i.type==="Date"?y.jsx(jSe,{...a,field:i,content:Qe.isDateContent(r)?r:void 0}):i.type==="Timestamp"?y.jsx(aAe,{...a,field:i,content:Qe.isTimestampContent(r)?r:void 0}):i.type==="Image"?y.jsx(kIe,{...a,field:i,content:Qe.isImageContent(r)?r:void 0}):i.type==="Link"?y.jsx(n1e,{...a,field:i,content:Qe.isLinkContent(r)?r:void 0}):i.type==="Number"?y.jsx(s1e,{...a,field:i,content:Qe.isNumberContent(r)?r:void 0}):i.type==="StructuredText"?y.jsx(nAe,{...a,field:i,content:Qe.isRichTextContent(r)?r:void 0}):i.type==="Select"?y.jsx(rAe,{...a,field:i,content:Qe.isSelectContent(r)?r:void 0}):i.type==="Text"?y.jsx(WIe,{...a,field:i,content:Qe.isTextContent(r)?r:void 0}):i.type==="Embed"?y.jsx(jTe,{...a,field:i,content:Qe.isEmbedContent(r)?r:void 0}):i.type==="Color"?y.jsx(PSe,{...a,field:i,content:Qe.isColorContent(r)?r:void 0}):i.type==="GeoPoint"?y.jsx(KTe,{...a,field:i,content:Qe.isGeoPointContent(r)?r:void 0}):null},[r,t,i,o,n])}const FH=({content:e,id:t,nonRepeatableZone:n,onContentChange:r,readOnly:i})=>{const o=N.useMemo(()=>Object.entries(n),[n]);return y.jsx(y.Fragment,{children:o.map(([a,u])=>{const s=e[a];return y.jsx(M_,{id:`${t}.${a}`,readOnly:i,nestableWidget:u,content:Qe.isNestableContent(s)?s:void 0,onContentChange:c=>{r(sAe(e,a,c))}},a)})})};function sAe(e,t,n){return n===void 0?Km(t)(e):{...e,[t]:n}}function cAe(e,t){return e.filter((n,r)=>r!==t)}function lAe(e,t,n){const r=e.length;if(NH(t,r)||NH(n,r))return e;const i=[...e],o=i[t],a=i[n];return i[t]=a,i[n]=o,i}function NH(e,t){return e<0||e>=t}let fAe=0;function dAe(){return fAe++}const pM=({id:e,title:t,content:n,onContentChange:r,readOnly:i,repeatableZone:o})=>{const a=N.useMemo(()=>Object.entries(o),[o]),u=vAe(n),s=N.useRef(new Map);return pAe(s.current,u),Object.keys(o).length===0?null:y.jsx(T.Group,{title:"Repeatable zone"+(t?` • ${t}`:""),addItemButtonTitle:"Add item in group",items:u,getItemKey:c=>s.current.get(c)??"bugged",onAddItem:()=>r(u.concat(PH())),children:(c,l)=>{const f=new Map(c.value);return y.jsx(T.GroupItem,{index:l,title:"Item",onMove:({index:d,offset:p})=>{r(lAe(u,d,d+p))},onDelete:({index:d})=>r(cAe(u,d)),children:a.map(([d,p])=>{const h=f.get(d);return y.jsx(M_,{content:Qe.isNestableContent(h)?h:void 0,id:`${e}[${l}].${d}`,nestableWidget:p,onContentChange:m=>{const g=yAe(c,[d,m]),_=gAe(u,[l,g]);hAe(s.current,c,g),r(_)},readOnly:i},d)})})}})};function pAe(e,t){const n=new Set(t);t.forEach(r=>{e.has(r)||e.set(r,dAe())}),N.useLayoutEffect(()=>{for(const[r]of e)n.has(r)||e.delete(r)})}function hAe(e,t,n){const r=e.get(t);r!==void 0&&e.set(n,r)}const mAe={__TYPE__:"GroupItemContent",value:[]};function vAe(e){return e??[mAe]}function gAe(e,t){const[n,r]=t;return r?e.map((i,o)=>o===n?r:i):e.filter((i,o)=>o!==n)}function yAe(e,t){const[n,r]=t,i=(()=>r?Array.from(new Map(e.value).set(n,r)):e.value.filter(([o])=>o!==n))();return PH(i)}const PH=(e=[])=>({__TYPE__:"GroupItemContent",value:e}),bAe=({compositeSlice:e,content:t,onContentChange:n,...r})=>y.jsxs(T.FieldSet,{children:[y.jsx(T.FieldSetLegend,{children:_Ae(e)}),y.jsx(FH,{...r,nonRepeatableZone:e["non-repeat"]??{},content:t.nonRepeat,onContentChange:i=>{n({...t,nonRepeat:i})}}),y.jsx(pM,{...r,repeatableZone:e.repeat??{},content:t.repeat,onContentChange:i=>{n({...t,repeat:i})}})]});function _Ae(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}const WH=({group:e,content:t,onContentChange:n,...r})=>{var i;return y.jsx(pM,{...r,title:jH(e),repeatableZone:((i=e.config)==null?void 0:i.fields)??{},content:t==null?void 0:t.value,onContentChange:o=>{n({__TYPE__:"GroupContentType",value:o})}})};function jH(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}const $Ae=({content:e,legacySlice:t,...n})=>y.jsxs(T.FieldSet,{children:[y.jsx(T.FieldSetLegend,{children:t.type==="Group"?jH(t):Bn(t)}),t.type==="Group"?y.jsx(WH,{...n,group:t,content:Qe.isGroupContent(e)?e:void 0}):y.jsx(M_,{...n,nestableWidget:t,content:Qe.isNestableContent(e)?e:void 0,onContentChange:r=>{r&&n.onContentChange(r)}})]});function LH(e){const{config:t,content:n,sliceKey:r,selected:i=!1,readOnly:o=!1,sharedSlice:a,onContentChange:u,...s}=e,c=SAe(a,n.variation),l=N.useId();if(c===void 0)return null;const d={id:s.id??l,readOnly:o};return y.jsx(N0.Provider,{value:t,children:y.jsxs(T.FieldSet,{id:r,selected:i,children:[y.jsx(T.FieldSetLegend,{children:TAe(a,c)}),y.jsx(FH,{...d,nonRepeatableZone:c.primary??{},content:n.primary,onContentChange:p=>{u({...n,primary:p})}}),y.jsx(pM,{...d,repeatableZone:c.items??{},content:n.items,onContentChange:p=>{u({...n,items:p})}})]})})}function SAe(e,t){return N.useMemo(()=>e.variations.find(n=>n.id===t),[e,t])}function TAe(e,t){return[e.name,t.name].join(" • ")}function IAe(e){const{selectionId:t,content:n,id:r,onContentChange:i,readOnly:o,sliceZone:a}=e,u=Gi();return y.jsx(y.Fragment,{children:n==null?void 0:n.value.map((s,c)=>{var h,m;const l=(m=(h=a.config)==null?void 0:h.choices)==null?void 0:m[s.name];if(l===void 0)return null;const f=t===s.key,d=s.widget,p={id:`${r}[${c}]`,key:s.key,sliceKey:s.key,onContentChange:g=>{const _={...s,widget:g},S=CAe(n,[c,_]);i(S)},readOnly:o};if(l.type==="SharedSlice")return Qe.isSharedSliceContent(d)?y.jsx(LH,{...p,config:u,sharedSlice:l,content:d,selected:f}):null;if(l.type==="Slice")return Qe.isCompositeSliceContent(d)?y.jsx(bAe,{...p,compositeSlice:l,content:d}):null;{const g={...p,legacySlice:l};return Qe.isSimpleSliceContent(d)?y.jsx($Ae,{...g,content:d}):null}})})}function CAe(e,[t,n]){return{__TYPE__:"SliceContentType",value:e.value.map((r,i)=>i===t?n:r)}}const OAe=e=>{const n=e.replace(/ /g,"-").normalize("NFD").replace(/\p{M}/g,""),r=new RegExp("[^-_.\\w\\u0080-\\uFFFF]","g");return n.replace(r,"").replace(/[\u0300-\u036f]/g,"").toLowerCase()||""},wAe=e=>{const t=OAe(e);return t===""?void 0:{__TYPE__:"UIDContent",value:t}},EAe=({id:e,field:t,content:n,onContentChange:r})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"tag"})}),y.jsx(T.FieldLabel,{htmlFor:e,children:Bn(t)}),y.jsx(T.FieldControl,{children:y.jsx(T.TextInput,{id:e,variant:"success",placeholder:mo(t),value:(n==null?void 0:n.value)??"",onValueChange:i=>{r(wAe(i))},endAdornment:y.jsx(T.AnimatedElement,{enterDuration:150,children:!(n!=null&&n.value)&&y.jsx(T.Badge,{color:"tomato",title:"Required"})})})})]});function xAe(e){const{id:t,readOnly:n,staticZone:r,content:i,onContentChange:o}=e,a=N.useMemo(()=>Object.entries(r),[r]);return a.length===0?null:y.jsxs(T.FieldSet,{children:[y.jsx(T.FieldSetLegend,{children:"Page data"}),a.map(([u,s])=>{const c={id:`${t}.${u}`,onContentChange:f=>{const{[u]:d,...p}=i;o({...p,...f!==void 0&&{[u]:f}})},readOnly:n},l=i[u];return s.type==="UID"?N.createElement(EAe,{...c,content:Qe.isUIDContent(l)?l:void 0,key:u,field:s}):s.type==="Group"?N.createElement(WH,{...c,content:Qe.isGroupContent(l)?l:void 0,group:s,key:u}):N.createElement(M_,{...c,content:Qe.isNestableContent(l)?l:void 0,key:u,nestableWidget:s})})]})}function MAe(e){const{id:t,readOnly:n,selection:r,section:i,content:o,onContentChange:a}=e,[u,s]=kAe(i),[c,l]=AAe(o);return FAe(r),y.jsxs(T.Box,{display:"flex",flexDirection:"column",children:[y.jsx(xAe,{id:t,readOnly:n,staticZone:u,content:c,onContentChange:f=>a({...l,...f})}),s.map(([f,d])=>{const p=l[f];return y.jsx(IAe,{id:`${t}.${f}`,readOnly:n,selectionId:r==null?void 0:r.id,sliceZone:d,content:p,onContentChange:h=>a({...c,...l,[f]:h})},f)})]})}function RAe(e){return e.type==="Choice"||e.type==="Slices"}function kAe(e){return Object.entries(e).reduce(([t,n],[r,i])=>(RAe(i)?n.push([r,i]):Object.assign(t,{[r]:i}),[t,n]),[{},[]])}function AAe(e){return Object.entries(e).reduce(([t,n],[r,i])=>{const o={[r]:i};return Object.assign(Qe.isSlicesContent(i)?n:t,o),[t,n]},[{},{}])}function FAe(e){const{id:t,key:n,offset:r=0}=e??{};N.useLayoutEffect(()=>{if(!t)return;const i=setTimeout(()=>{const o=document.getElementById(t);if(!o)return;const a=o.getBoundingClientRect().y+window.scrollY;window.scrollTo({top:a-r,behavior:"smooth"})},100);return()=>clearTimeout(i)},[t,n,r])}const NAe=({config:e,readOnly:t=!1,customType:n,sectionName:r,selection:i,content:o,onContentChange:a})=>{const u=N.useId();if(di(n.json))return null;const s=PAe(n,r),[c,l]=WAe(s,o);return y.jsx(N0.Provider,{value:e,children:y.jsx(MAe,{id:u,readOnly:t,selection:i,section:s,content:c,onContentChange:f=>a({...l,...f})})})};function PAe(e,t){const n=e.json[t];if(n===void 0)throw new Error(`Cannot find a section with name '${t}'.`);return n}function WAe(e,t){return Object.entries(t).reduce(([n,r],[i,o])=>{const a=e[i]!==void 0,u={[i]:o};return[{...n,...a?u:{}},{...r,...a?{}:u}]},[{},{}])}bn.DocumentEditor=NAe,bn.SharedSliceEditor=LH,Object.defineProperty(bn,Symbol.toStringTag,{value:"Module"})});
144
+ `);return!o||!a?!1:e.chain().command(({tr:u})=>(u.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const u=i.after();return u===void 0||r.nodeAt(u)?!1:e.commands.exitCode()}}},addInputRules(){return[hx({find:Bke,type:this.type,getAttributes:e=>({language:e[1]})}),hx({find:Uke,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Rr({key:new Ni("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:a}=e.state;return a.replaceSelectionWith(this.type.create({language:o})),a.setSelection(Be.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.insertText(n.replace(/\r\n?/g,`
145
+ `)),a.setMeta("paste",!0),e.dispatch(a),!0}}})]}}).extend({name:"preformatted",addAttributes(){return{language:{default:null,parseHTML:e=>{var o;const{languageClassPrefix:t}=this.options,i=[...((o=e.firstElementChild)==null?void 0:o.classList)||[]].filter(a=>a.startsWith(t)).map(a=>a.replace(t,""))[0];return i||null},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:e}){return["pre",$t(this.options.HTMLAttributes),["code",e,0]]}}).configure({exitOnTripleEnter:!1}),qke={fromPrismic(e){return function(t){var r;const n=Fc.converter.fromPrismic(e)(C_.name,t,!0);return(r=e.nodes[C_.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return Fc.converter.toPrismic(e,Re.RichTextNodeType.preformatted,Na.toPrismic(e))}},M5=new dm([Re.RichTextNodeType.preformatted],C_.name,C_,qke,"",!0);function zke(e,t,n){const{node:r}=e,i=r.attrs.content,[o,a]=F.useState((i==null?void 0:i.embed_url)??""),u=Qy(e.updateAttributes);function s(h){u({content:h})}function c(h){a(h),cc(h)||s(void 0)}const[l,f]=F.useState(o),d=F.useCallback(h=>F.startTransition(()=>f(h)),[]);Tu(o,300,d);const{onKeyDown:p}=Kke(e,o,t,n);return{inputRef:t,containerRef:n,onKeyDown:p,url:o,urlChanged:c,onContentChange:s,debouncedUrl:l}}function Kke(e,t,n,r){const{editor:i,getPos:o,node:a}=e,[u,s]=F.useState(!0);F.useEffect(()=>{!u||!e.editor.isFocused||setTimeout(()=>{var l;return(l=n.current)==null?void 0:l.focus()})},[n,u,e.editor.isFocused]);function c(l){const f=o(),d=o()+a.nodeSize;l.code==="Enter"&&(s(!1),i.chain().insertContentAt(d,{type:"paragraph"}).focus(d+1).run()),l.code==="Backspace"&&t===""&&i.chain().deleteRange({from:f,to:d}).focus(d+1).run(),l.code==="ArrowUp"&&(s(!1),i.chain().focus(f-1).run()),l.code==="ArrowDown"&&(s(!1),i.chain().focus(d+1).run())}return{containerRef:r,inputRef:n,onKeyDown:c}}function Vke(e){const t=F.useRef(null),n=F.useRef(null),{onKeyDown:r,url:i,urlChanged:o,onContentChange:a,debouncedUrl:u}=zke(e,t,n);return y.jsx(xH,{className:"custom-embed",children:y.jsx("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:y.jsxs(T.Box,{flexDirection:"column",children:[y.jsxs(T.Box,{flexGrow:1,alignItems:"center",children:[y.jsx(T.Icon,{size:"small",name:"cloud",color:"grey11"}),y.jsx(T.Box,{flexGrow:1,flexDirection:"column",ref:n,children:y.jsx(T.TextInput,{id:"id",ref:t,value:i,variant:cc(i)?"link":"normal",placeholder:"Paste your link here",onValueChange:o,onKeyDown:r})})]}),cc(i)&&y.jsx(JK,{debouncedUrl:u,onContentChange:a})]})})})}const uM=Mn.create({name:"embed",group:"block",content:"block*",atom:!0,marks:"",addAttributes(){return{content:{default:void 0}}},addCommands(){return{setEmbed:()=>({tr:e,dispatch:t})=>{const n=this.type.create();return t&&e.replaceSelectionWith(n),!0}}},parseHTML(){return[{tag:"embed"}]},renderHTML({HTMLAttributes:e}){return["embed",$t(e)]},addNodeView(){return RH(Vke)}}),Hke={fromPrismic(e){return function(t){var n;return(n=e.nodes[uM.name])==null?void 0:n.create({content:t.data})}},toPrismic(e){return e.attrs.content===void 0?{type:"embed",data:{type:"embed",embed_url:"",__TYPE__:"EmbedContent",all:[]}}:{type:"embed",data:{...e.attrs.content}}}},R5=new lRe([Re.RichTextNodeType.embed],uM.name,uM,Hke),Gke=Mn.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,$t(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>hx({find:new RegExp(`^(#{1,${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),O_="heading",Pa={byLevel(e){switch(e){case 1:return Re.RichTextNodeType.heading1;case 2:return Re.RichTextNodeType.heading2;case 3:return Re.RichTextNodeType.heading3;case 4:return Re.RichTextNodeType.heading4;case 5:return Re.RichTextNodeType.heading5;case 6:return Re.RichTextNodeType.heading6}},default(e){return{fullName:this.byLevel(e),level:e}},fromPrismic(e,t=[1,2,3,4,5,6]){const n=new RegExp(`^heading([${t.join(",")}]){1}$`),r=e.match(n);if(!r||!r[1])return;const i=parseInt(r[1]);return{fullName:Pa.byLevel(i),level:i}},fromProsemirror(e,t){const n=e.level;if(t.includes(n))return{fullName:Pa.byLevel(n),level:n}}},Yke=e=>Gke.extend({name:O_,addAttributes(){return{level:{default:e[0]},label:{default:null}}},addOptions(){return{levels:[...e],HTMLAttributes:{}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`}))},renderHTML({node:t,HTMLAttributes:n}){const r=t.attrs.level,o={...t.attrs.label?{label:t.attrs.label}:{}};return[`h${r}`,$t(this.options.HTMLAttributes,n,o),0]}}),Jke=e=>{const t=e[0];return{fromPrismic(n){return function(r){var a;const i=Fc.converter.fromPrismic(n)(O_,r),o=Pa.fromPrismic(r.type,e)||Pa.default(t);return(a=n.nodes[O_])==null?void 0:a.create({level:o.level,...Na.fromPrismic(r)},i)}},toPrismic(n){const{fullName:r}=Pa.fromProsemirror(n.attrs,e)||Pa.default(t);return Fc.converter.toPrismic(n,r,Na.toPrismic(n))}}};function Zke(e){if(!e)return[1,2,3,4,5,6];if(!e.size)return;const t=Array.from(e.values()).reduce((n,r)=>{const i=Pa.fromPrismic(r);return i?[...n,i.level]:n},[]).sort((n,r)=>n-r);return v(md(t),yS(()=>{}))}const Nc={name:O_,build:e=>{const t=Zke(e);if(!t)return;const n=md(t.map(r=>Pa.byLevel(r)));if(!je(n))return new dRe(n.value,Yke(t),t,Jke(t),r=>{const i=Pa.fromProsemirror(r,t);return i&&`Heading ${i.level}`})}};function Xke(){return y.jsx(xH,{className:"custom-embed",children:y.jsx("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:y.jsx(T.Icon,{name:"image",size:"large"})})})}const sM=Mn.create({name:"image",group:"block",content:"block*",atom:!0,marks:"",addAttributes(){return{content:{default:void 0}}},addCommands(){return{setImage:()=>({tr:e,dispatch:t})=>{const n=this.type.create();return t&&e.replaceSelectionWith(n),!0}}},parseHTML(){return[{tag:"image"}]},renderHTML({HTMLAttributes:e}){return["image",$t(e)]},addNodeView(){return RH(Xke)}}),Qke={fromPrismic(e){return function(t){var n;return(n=e.nodes[sM.name])==null?void 0:n.create({content:t.data})}},toPrismic(){}},k5=new fRe([Re.RichTextNodeType.image],sM.name,sM,Qke),eAe=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,tAe=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,nAe=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,rAe=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,cM=Qh.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Vb({find:eAe,type:this.type}),Vb({find:nAe,type:this.type})]},addPasteRules(){return[Gb({find:tAe,type:this.type}),Gb({find:rAe,type:this.type})]}}).extend({name:"em"}),iAe={fromPrismic(e){return function(){var t;return(t=e.marks[cM.name])==null?void 0:t.create()}},toPrismic(){}},A5=new PH([Re.RichTextNodeType.em],cM.name,cM,iAe),oAe=Mn.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",$t(this.options.HTMLAttributes,e),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)}}}),F5=Qh.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["span",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:t})=>{const n=zb(e,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:t.unsetMark(this.name)}}}}),N5=/^(\d+)\.\s$/,lM=Mn.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",$t(this.options.HTMLAttributes,n),0]:["ol",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(oAe.name,this.editor.getAttributes(F5.name)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Hb({find:N5,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Hb({find:N5,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(F5.name)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}).extend({name:"orderedList",addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1}}},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",$t(this.options.HTMLAttributes,n),0]:["ol",$t(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}}}).configure({itemTypeName:"listItem"}),aAe={fromPrismic(e){return function(t){var r;const n=td.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[lM.name])==null?void 0:r.create(Na.fromPrismic(t),n)}},toPrismic(e){return Rc.children.map(e,t=>td.converter.toPrismic(t,Re.RichTextNodeType.orderedList).filter(ho)).flat()}},w_=new jx([Re.RichTextNodeType.orderedList],lM.name,lM,aAe),P5=Yu,fM=[jH,A5];function W5(e){return[Yu,I_,w_,Nc.build(e),M5,R5,k5,...fM].filter(ho)}const j5=[{nodeType:Re.RichTextNodeType.paragraph,icon:y.jsx(T.Icon,{name:"textFields"}),isActive:e=>e.isActive(Yu.name)&&!e.isActive(I_.name)&&!e.isActive(w_.name),runCommands:Gn((e,t)=>e.clearNodes().setDirection(Bi(t))),shortText:"par",text:"Paragraph"},{nodeType:Re.RichTextNodeType.heading1,icon:y.jsx(T.Icon,{name:"looks1"}),isActive:e=>e.isActive(Nc.name,{level:1}),runCommands:Gn((e,t)=>e.setHeading({level:1}).setDirection(Bi(t))),shortText:"h1",text:"Heading 1"},{nodeType:Re.RichTextNodeType.heading2,icon:y.jsx(T.Icon,{name:"looks2"}),isActive:e=>e.isActive(Nc.name,{level:2}),runCommands:Gn((e,t)=>e.setHeading({level:2}).setDirection(Bi(t))),shortText:"h2",text:"Heading 2"},{nodeType:Re.RichTextNodeType.heading3,icon:y.jsx(T.Icon,{name:"looks3"}),isActive:e=>e.isActive(Nc.name,{level:3}),runCommands:Gn((e,t)=>e.setHeading({level:3}).setDirection(Bi(t))),shortText:"h3",text:"Heading 3"},{nodeType:Re.RichTextNodeType.heading4,icon:y.jsx(T.Icon,{name:"looks4"}),isActive:e=>e.isActive(Nc.name,{level:4}),runCommands:Gn((e,t)=>e.setHeading({level:4}).setDirection(Bi(t))),shortText:"h4",text:"Heading 4"},{nodeType:Re.RichTextNodeType.heading5,icon:y.jsx(T.Icon,{name:"looks5"}),isActive:e=>e.isActive(Nc.name,{level:5}),runCommands:Gn((e,t)=>e.setHeading({level:5}).setDirection(Bi(t))),shortText:"h5",text:"Heading 5"},{nodeType:Re.RichTextNodeType.heading6,icon:y.jsx(T.Icon,{name:"looks6"}),isActive:e=>e.isActive(Nc.name,{level:6}),runCommands:Gn((e,t)=>e.setHeading({level:6}).setDirection(Bi(t))),shortText:"h6",text:"Heading 6"},{nodeType:Re.RichTextNodeType.list,icon:y.jsx(T.Icon,{name:"formatListBulleted"}),isActive:e=>e.isActive(I_.name),runCommands:Gn((e,t)=>e.toggleBulletList().setDirection(Bi(t))),shortText:"bull",text:"Bulleted list"},{nodeType:Re.RichTextNodeType.orderedList,icon:y.jsx(T.Icon,{name:"formatListNumbered"}),isActive:e=>e.isActive(w_.name),runCommands:Gn((e,t)=>e.toggleOrderedList().setDirection(Bi(t))),shortText:"num",text:"Numbered list"},{nodeType:Re.RichTextNodeType.preformatted,icon:y.jsx(T.Icon,{name:"dataObject"}),isActive:e=>e.isActive(M5.name),runCommands:Gn((e,t)=>e.setCodeBlock().setDirection(Bi(t))),shortText:"code",text:"Code"},{nodeType:Re.RichTextNodeType.embed,icon:y.jsx(T.Icon,{name:"cloud"}),isActive:e=>e.isActive(R5.name),runCommands:Gn(e=>e.setEmbed()),shortText:"emb",text:"Embed"},{nodeType:Re.RichTextNodeType.image,icon:y.jsx(T.Icon,{name:"image"}),isActive:e=>e.isActive(k5.name),runCommands:Gn(e=>e.setImage()),shortText:"img",text:"Image"}],uAe=[{nodeType:Re.RichTextNodeType.strong,icon:y.jsx(T.Icon,{name:"formatBold"}),isActive:e=>e.isActive(jH.name),runCommands:Gn(e=>e.toggleBold())},{nodeType:Re.RichTextNodeType.em,icon:y.jsx(T.Icon,{name:"formatItalic"}),isActive:e=>e.isActive(A5.name),runCommands:Gn(e=>e.toggleItalic())}],sAe=[{nodeType:Re.RichTextNodeType.rtl,icon:y.jsx(T.Icon,{name:"formatTextDirectionRToL"}),isActive:e=>e.isActive({[Fa]:O5.RightToLeft}),runCommands:Gn((e,t)=>e.toggleDirection(Bi(t)))}];function Gn(e){return(t,n={})=>{let r=n.can===!0?t.can().chain():t.chain().focus();return n.deleteRange!==void 0&&(r=r.deleteRange(n.deleteRange)),e(r,t).run()}}function Bi(e){const t=e.state.selection.$from.parent.attrs;return Na.parseNodeAttrsDirection(t)}function E_(e,t){return e.filter(n=>t.includes(n.nodeType))}const cAe={duration:100,hideOnClick:!0,offset:[-48,parseFloat(T.tokens.space[8])],placement:"top-start",zIndex:parseFloat(T.tokens.zIndex.toolbar)},lAe=({editor:e,nodeTypes:t})=>{var a;const n=E_(j5,t),r=E_(uAe,t),i=E_(sAe,t),o=[n.length>1?y.jsx(T.ToolbarSelect,{onValueChange:u=>{var s;(s=n.find(c=>c.nodeType===u))==null||s.runCommands(e)},value:((a=n.find(u=>u.isActive(e)))==null?void 0:a.nodeType)??"",children:n.map(u=>y.jsx(T.ToolbarSelectItem,{value:u.nodeType,children:u.text},u.nodeType))},"node"):null,r.length>0?y.jsx(T.ToolbarToggleButtonGroup,{onValueChange:u=>{r.forEach(s=>{(s.isActive(e)&&!u.includes(s.nodeType)||!s.isActive(e)&&u.includes(s.nodeType))&&s.runCommands(e)})},type:"multiple",value:r.filter(u=>u.isActive(e)).map(u=>u.nodeType),children:r.map(u=>y.jsx(T.ToolbarToggleButtonGroupItem,{disabled:!u.runCommands(e,{can:!0}),startIcon:u.icon,value:u.nodeType},u.nodeType))},"mark"):null,i.length>0?y.jsx(F.Fragment,{children:i.map(u=>y.jsx(T.ToolbarToggleButton,{disabled:!u.runCommands(e,{can:!0}),onPressedChange:()=>{u.runCommands(e)},pressed:u.isActive(e),startIcon:u.icon},u.nodeType))},"extra"):null,n.length+r.length+i.length>1?y.jsx(T.ToolbarButton,{onClick:()=>{e.chain().focus().clearNodes().unsetAllMarks().run()},startIcon:y.jsx(T.Icon,{name:"formatClear"})},"clear"):null].filter(ho).map((u,s)=>y.jsxs(F.Fragment,{children:[s===0?null:y.jsx(T.ToolbarSeparator,{}),u]},u.key));return o.length>0?y.jsx(BMe,{editor:e,tippyOptions:cAe,children:y.jsx(T.Toolbar,{children:o})}):null},fAe=e=>{var c;const{content:t,field:n,id:r,readOnly:i,config:o}=e,a=t&&Ux.converter(o.nodeExtensions).fromPrismic(o.schema,(c=o.defaultTextConverter)==null?void 0:c.call(o,o.schema))(t),u=Qy(e.onContentChange),s=ZMe({...a?{content:a.toJSON()}:{},editable:!i,editorProps:{attributes:{class:T.contentEditableClass,id:r,tabIndex:"0"}},extensions:o.allComponents,injectCSS:!1,onUpdate({editor:l}){if(l.isEmpty)return u(void 0);const f=Ux.converter(o.nodeExtensions).toPrismic(l.state.doc);u(f)}},[r,i,u]);return y.jsxs(T.Field,{children:[y.jsx(T.FieldLabel,{htmlFor:r,children:Un(n)}),y.jsx(T.FieldControl,{children:y.jsxs(y.Fragment,{children:[y.jsx(KMe,{editor:s,style:{flex:1}}),(s==null?void 0:s.isEditable)&&y.jsx(lAe,{editor:s,nodeTypes:o.names.concat(Ake)})]})})]})},dAe=e=>{const{field:t}=e,{env:n}=di(),r=F.useMemo(()=>{const{extensions:i,defaultTextConverter:o}=gRe(t.config),a=i.filter(h=>!(n!=="dev"&&h.name==="image")),u=a.filter(pAe),s=a.flatMap(h=>h.richTextNodeTypes),c=a.map(h=>h.component),l=a.filter(hAe).map(h=>h.name),f=[...c,...Lke(t,u),Fke.configure({supportedExtensionNames:l}),axe],d=f.map(h=>h.name),p=TEe(f);return{allComponents:f,extensionsNames:d,defaultTextConverter:o,nodeExtensions:u,names:s,schema:p}},[n,t]);return y.jsx(fAe,{...e,config:r},r.extensionsNames.join("-"))};function pAe(e){return e.extType===Wx.Node}function hAe(e){return!(e.extType!==Wx.Node||e.nodeType!==ed.Text||e.lockedFormat)}const mAe=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var s,c;const o=Ca(t),a=vAe(t),u=(e==null?void 0:e.value)??a;return y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"arrowDropDownCircle"})}),y.jsx(T.FieldLabel,{htmlFor:n,children:Un(t)}),y.jsx(T.FieldControl,{children:y.jsxs(T.Select,{id:n,onValueChange:l=>{i||r(gAe(l))},placeholder:o,...u===void 0?{}:{value:u},children:[u===void 0||a!==void 0?null:y.jsx(T.SelectItem,{value:"",children:o}),(c=(s=t.config)==null?void 0:s.options)==null?void 0:c.map(l=>y.jsx(T.SelectItem,{value:l,children:l},l))]})})]},u)};function vAe(e){var t,n;return((t=e.config)==null?void 0:t.default_value)===void 0||(n=e.config.options)==null?void 0:n[0]}function gAe(e){return e.length===0?void 0:{__TYPE__:"FieldContent",type:"Select",value:e}}const yAe=({id:e,readOnly:t,field:n,content:r,onContentChange:i})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"event"})}),y.jsx(T.FieldLabel,{id:e,children:Un(n)}),y.jsx(T.FieldControl,{children:y.jsx(y.Fragment,{children:y.jsx(T.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:y.jsx(T.DateInput,{mode:"date-time","aria-labelledby":e,readOnly:t,value:r==null?void 0:r.value,onValueChange:o=>i(bAe(o))})})})})]}),bAe=e=>e===void 0?void 0:{__TYPE__:"FieldContent",type:"Timestamp",value:e};function x_(e){const{id:t,readOnly:n,content:r,nestableWidget:i}=e,o=Qy(e.onContentChange);return F.useMemo(()=>{const a={id:t,readOnly:n,onContentChange:o};return i.type==="Boolean"?y.jsx(DSe,{...a,field:i,content:Qe.isBooleanContent(r)?r:void 0}):i.type==="Date"?y.jsx(KSe,{...a,field:i,content:Qe.isDateContent(r)?r:void 0}):i.type==="Timestamp"?y.jsx(yAe,{...a,field:i,content:Qe.isTimestampContent(r)?r:void 0}):i.type==="Image"?y.jsx(LIe,{...a,field:i,content:Qe.isImageContent(r)?r:void 0}):i.type==="Link"?y.jsx(c1e,{...a,field:i,content:Qe.isLinkContent(r)?r:void 0}):i.type==="Number"?y.jsx(m1e,{...a,field:i,content:Qe.isNumberContent(r)?r:void 0}):i.type==="StructuredText"?y.jsx(dAe,{...a,field:i,content:Qe.isRichTextContent(r)?r:void 0}):i.type==="Select"?y.jsx(mAe,{...a,field:i,content:Qe.isSelectContent(r)?r:void 0}):i.type==="Text"?y.jsx(zIe,{...a,field:i,content:Qe.isTextContent(r)?r:void 0}):i.type==="Embed"?y.jsx(ZTe,{...a,field:i,content:Qe.isEmbedContent(r)?r:void 0}):i.type==="Color"?y.jsx(qSe,{...a,field:i,content:Qe.isColorContent(r)?r:void 0}):i.type==="GeoPoint"?y.jsx(XTe,{...a,field:i,content:Qe.isGeoPointContent(r)?r:void 0}):null},[r,t,i,o,n])}const L5=({content:e,id:t,nonRepeatableZone:n,onContentChange:r,readOnly:i})=>{const o=F.useMemo(()=>Object.entries(n),[n]);return y.jsx(y.Fragment,{children:o.map(([a,u])=>{const s=e[a];return y.jsx(x_,{id:`${t}.${a}`,readOnly:i,nestableWidget:u,content:Qe.isNestableContent(s)?s:void 0,onContentChange:c=>{r(_Ae(e,a,c))}},a)})})};function _Ae(e,t,n){return n===void 0?zm(t)(e):{...e,[t]:n}}function $Ae(e,t){return e.filter((n,r)=>r!==t)}function SAe(e,t,n){if(t===n||D5(e,t)||D5(e,n))return e;const r=e.slice(),i=r.splice(t,1)[0];return r.splice(n,0,i),r}function D5(e,t){return t<0||t>=e.length}let TAe=0;function IAe(){return TAe++}const dM=({id:e,title:t,content:n,onContentChange:r,readOnly:i,repeatableZone:o})=>{const a=F.useMemo(()=>Object.entries(o),[o]),u=EAe(n),s=F.useRef(new Map);return CAe(s.current,u),Object.keys(o).length===0?null:y.jsx(T.Group,{title:"Repeatable zone"+(t?` • ${t}`:""),addItemButtonTitle:"Add item in group",items:u,getItemKey:c=>s.current.get(c)??"bugged",onAddItem:()=>r(u.concat(B5())),children:(c,l)=>{const f=new Map(c.value);return y.jsx(T.GroupItem,{index:l,title:"Item",onMove:({index:d,offset:p})=>{r(SAe(u,d,d+p))},onDelete:({index:d})=>r($Ae(u,d)),children:a.map(([d,p])=>{const h=f.get(d);return y.jsx(x_,{content:Qe.isNestableContent(h)?h:void 0,id:`${e}[${l}].${d}`,nestableWidget:p,onContentChange:m=>{const g=MAe(c,[d,m]),_=xAe(u,[l,g]);OAe(s.current,c,g),r(_)},readOnly:i},d)})})}})};function CAe(e,t){const n=new Set(t);t.forEach(r=>{e.has(r)||e.set(r,IAe())}),F.useLayoutEffect(()=>{for(const[r]of e)n.has(r)||e.delete(r)})}function OAe(e,t,n){const r=e.get(t);r!==void 0&&e.set(n,r)}const wAe={__TYPE__:"GroupItemContent",value:[]};function EAe(e){return e??[wAe]}function xAe(e,t){const[n,r]=t;return r?e.map((i,o)=>o===n?r:i):e.filter((i,o)=>o!==n)}function MAe(e,t){const[n,r]=t,i=(()=>r?Array.from(new Map(e.value).set(n,r)):e.value.filter(([o])=>o!==n))();return B5(i)}const B5=(e=[])=>({__TYPE__:"GroupItemContent",value:e}),RAe=({compositeSlice:e,content:t,onContentChange:n,...r})=>y.jsxs(T.FieldSet,{children:[y.jsx(T.FieldSetLegend,{children:kAe(e)}),y.jsx(L5,{...r,nonRepeatableZone:e["non-repeat"]??{},content:t.nonRepeat,onContentChange:i=>{n({...t,nonRepeat:i})}}),y.jsx(dM,{...r,repeatableZone:e.repeat??{},content:t.repeat,onContentChange:i=>{n({...t,repeat:i})}})]});function kAe(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}const U5=({group:e,content:t,onContentChange:n,...r})=>{var i;return y.jsx(dM,{...r,title:q5(e),repeatableZone:((i=e.config)==null?void 0:i.fields)??{},content:t==null?void 0:t.value,onContentChange:o=>{n({__TYPE__:"GroupContentType",value:o})}})};function q5(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}const AAe=({content:e,legacySlice:t,...n})=>y.jsxs(T.FieldSet,{children:[y.jsx(T.FieldSetLegend,{children:t.type==="Group"?q5(t):Un(t)}),t.type==="Group"?y.jsx(U5,{...n,group:t,content:Qe.isGroupContent(e)?e:void 0}):y.jsx(x_,{...n,nestableWidget:t,content:Qe.isNestableContent(e)?e:void 0,onContentChange:r=>{r&&n.onContentChange(r)}})]});function z5(e){const{config:t,content:n,sliceKey:r,selected:i=!1,readOnly:o=!1,sharedSlice:a,onContentChange:u,...s}=e,c=FAe(a,n.variation),l=F.useId();if(c===void 0)return null;const d={id:s.id??l,readOnly:o};return y.jsx(F0.Provider,{value:t,children:y.jsxs(T.FieldSet,{id:r,selected:i,children:[y.jsx(T.FieldSetLegend,{children:NAe(a,c)}),y.jsx(L5,{...d,nonRepeatableZone:c.primary??{},content:n.primary,onContentChange:p=>{u({...n,primary:p})}}),y.jsx(dM,{...d,repeatableZone:c.items??{},content:n.items,onContentChange:p=>{u({...n,items:p})}})]})})}function FAe(e,t){return F.useMemo(()=>e.variations.find(n=>n.id===t),[e,t])}function NAe(e,t){return[e.name,t.name].join(" • ")}function PAe(e){const{selectionId:t,content:n,id:r,onContentChange:i,readOnly:o,sliceZone:a}=e,u=di();return y.jsx(y.Fragment,{children:n==null?void 0:n.value.map((s,c)=>{var h,m;const l=(m=(h=a.config)==null?void 0:h.choices)==null?void 0:m[s.name];if(l===void 0)return null;const f=t===s.key,d=s.widget,p={id:`${r}[${c}]`,key:s.key,sliceKey:s.key,onContentChange:g=>{const _={...s,widget:g},S=WAe(n,[c,_]);i(S)},readOnly:o};if(l.type==="SharedSlice")return Qe.isSharedSliceContent(d)?y.jsx(z5,{...p,config:u,sharedSlice:l,content:d,selected:f}):null;if(l.type==="Slice")return Qe.isCompositeSliceContent(d)?y.jsx(RAe,{...p,compositeSlice:l,content:d}):null;{const g={...p,legacySlice:l};return Qe.isSimpleSliceContent(d)?y.jsx(AAe,{...g,content:d}):null}})})}function WAe(e,[t,n]){return{__TYPE__:"SliceContentType",value:e.value.map((r,i)=>i===t?n:r)}}const jAe=e=>{const n=e.replace(/ /g,"-").normalize("NFD").replace(/\p{M}/g,""),r=new RegExp("[^-_.\\w\\u0080-\\uFFFF]","g");return n.replace(r,"").replace(/[\u0300-\u036f]/g,"").toLowerCase()||""},LAe=e=>{const t=jAe(e);return t===""?void 0:{__TYPE__:"UIDContent",value:t}},DAe=({id:e,field:t,content:n,onContentChange:r})=>y.jsxs(T.Field,{children:[y.jsx(T.FieldIcon,{children:y.jsx(T.Icon,{name:"tag"})}),y.jsx(T.FieldLabel,{htmlFor:e,children:Un(t)}),y.jsx(T.FieldControl,{children:y.jsx(T.TextInput,{id:e,variant:"success",placeholder:Ca(t),value:(n==null?void 0:n.value)??"",onValueChange:i=>{r(LAe(i))},endAdornment:y.jsx(T.AnimatedElement,{enterDuration:150,children:!(n!=null&&n.value)&&y.jsx(T.Badge,{color:"tomato",title:"Required"})})})})]});function BAe(e){const{id:t,readOnly:n,staticZone:r,content:i,onContentChange:o}=e,a=F.useMemo(()=>Object.entries(r),[r]);return a.length===0?null:y.jsxs(T.FieldSet,{children:[y.jsx(T.FieldSetLegend,{children:"Page data"}),a.map(([u,s])=>{const c={id:`${t}.${u}`,onContentChange:f=>{const{[u]:d,...p}=i;o({...p,...f!==void 0&&{[u]:f}})},readOnly:n},l=i[u];return s.type==="UID"?F.createElement(DAe,{...c,content:Qe.isUIDContent(l)?l:void 0,key:u,field:s}):s.type==="Group"?F.createElement(U5,{...c,content:Qe.isGroupContent(l)?l:void 0,group:s,key:u}):F.createElement(x_,{...c,content:Qe.isNestableContent(l)?l:void 0,key:u,nestableWidget:s})})]})}function UAe(e){const{id:t,readOnly:n,selection:r,section:i,content:o,onContentChange:a}=e,[u,s]=zAe(i),[c,l]=KAe(o);return VAe(r),y.jsxs(T.Box,{display:"flex",flexDirection:"column",children:[y.jsx(BAe,{id:t,readOnly:n,staticZone:u,content:c,onContentChange:f=>a({...l,...f})}),s.map(([f,d])=>{const p=l[f];return y.jsx(PAe,{id:`${t}.${f}`,readOnly:n,selectionId:r==null?void 0:r.id,sliceZone:d,content:p,onContentChange:h=>a({...c,...l,[f]:h})},f)})]})}function qAe(e){return e.type==="Choice"||e.type==="Slices"}function zAe(e){return Object.entries(e).reduce(([t,n],[r,i])=>(qAe(i)?n.push([r,i]):Object.assign(t,{[r]:i}),[t,n]),[{},[]])}function KAe(e){return Object.entries(e).reduce(([t,n],[r,i])=>{const o={[r]:i};return Object.assign(Qe.isSlicesContent(i)?n:t,o),[t,n]},[{},{}])}function VAe(e){const{id:t,key:n,offset:r=0}=e??{};F.useLayoutEffect(()=>{if(!t)return;const i=setTimeout(()=>{const o=document.getElementById(t);if(!o)return;const a=o.getBoundingClientRect().y+window.scrollY;window.scrollTo({top:a-r,behavior:"smooth"})},100);return()=>clearTimeout(i)},[t,n,r])}const HAe=({config:e,readOnly:t=!1,customType:n,sectionName:r,selection:i,content:o,onContentChange:a})=>{const u=F.useId();if(fi(n.json))return null;const s=GAe(n,r),[c,l]=YAe(s,o);return y.jsx(F0.Provider,{value:e,children:y.jsx(UAe,{id:u,readOnly:t,selection:i,section:s,content:c,onContentChange:f=>a({...l,...f})})})};function GAe(e,t){const n=e.json[t];if(n===void 0)throw new Error(`Cannot find a section with name '${t}'.`);return n}function YAe(e,t){return Object.entries(t).reduce(([n,r],[i,o])=>{const a=e[i]!==void 0,u={[i]:o};return[{...n,...a?u:{}},{...r,...a?{}:u}]},[{},{}])}bn.DocumentEditor=HAe,bn.SharedSliceEditor=z5,Object.defineProperty(bn,Symbol.toStringTag,{value:"Module"})});