PageSourceSearch

https://regattagrove.com/_next/static/chunks/0cs3i_23zdy3p.js?dpl=dpl_RgWWMVRWpo6dYvjL15ZPG3Hu7mp8

js regattagrove.com collected 2026-10-05 05:40:43 UTC 1,358,621 bytes, 171 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,26999,81140,30030,34620,10772,69340,48425,30207,26330,65491,74606,96626,3536,85369,86312,88227,e=>{"use strict";let t,r,n,i;var s,o,a,l,h,c,u,d,f=e.i(71645);function p(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}"u">typeof window&&window.document&&window.document.createElement,e.s(["composeEventHandlers",0,p],81140);var m=e.i(20783),g=e.i(43476);function y(e,t){let r=f.createContext(t),n=e=>{let{children:t,...n}=e,i=f.useMemo(()=>n,Object.values(n));return(0,g.jsx)(r.Provider,{value:i,children:t})};return n.displayName=e+"Provider",[n,function(n){let i=f.useContext(r);if(i)return i;if(void 0!==t)return t;throw Error(`\`${n}\` must be used within \`${e}\``)}]}function v(e,t=[]){let r=[],n=()=>{let t=r.map(e=>f.createContext(e));return function(r){let n=r?.[e]||t;return f.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=f.createContext(n),s=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,a=r?.[e]?.[s]||i,l=f.useMemo(()=>o,Object.values(o));return(0,g.jsx)(a.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let a=o?.[e]?.[s]||i,l=f.useContext(a);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}e.s(["createContext",0,y,"createContextScope",0,v],30030);var b=globalThis?.document?f.useLayoutEffect:()=>{};e.s(["useLayoutEffect",0,b],34620);var w=f[" useId ".trim().toString()]||(()=>void 0),x=0;function k(e){let[t,r]=f.useState(w());return b(()=>{e||r(e=>e??String(x++))},[e]),e||(t?`radix-${t}`:"")}e.s(["useId",0,k],10772),f[" useEffectEvent ".trim().toString()],f[" useInsertionEffect ".trim().toString()];var S=f[" useInsertionEffect ".trim().toString()]||b;function C({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[i,s,o]=function({defaultProp:e,onChange:t}){let[r,n]=f.useState(e),i=f.useRef(r),s=f.useRef(t);return S(()=>{s.current=t},[t]),f.useEffect(()=>{i.current!==r&&(s.current?.(r),i.current=r)},[r,i]),[r,n,s]}({defaultProp:t,onChange:r}),a=void 0!==e,l=a?e:i;{let t=f.useRef(void 0!==e);f.useEffect(()=>{let e=t.current;if(e!==a){let t=a?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=a},[a,n])}return[l,f.useCallback(t=>{if(a){let r="function"==typeof t?t(e):t;r!==e&&o.current?.(r)}else s(t)},[a,e,s,o])]}Symbol("RADIX:SYNC_STATE"),e.s(["useControllableState",0,C],69340);var A=e.i(74080),E=Symbol("radix.slottable");function T(e){return f.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===E}var O=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,o,a=(n=r=`Primitive.${t}`,(i=f.forwardRef((e,t)=>{let{children:r,...n}=e;if(f.isValidElement(r)){var i;let e,s,o=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==f.Fragment&&(a.ref=t?(0,m.composeRefs)(t,o):o),f.cloneElement(r,a)}return f.Children.count(r)>1?f.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(o=f.forwardRef((e,t)=>
1{let{children:r,...n}=e,i=f.Children.toArray(r),o=i.find(T);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:f.Children.count(e)>1?f.Children.only(null):f.isValidElement(e)?e.props.children:null);return(0,g.jsx)(s,{...n,ref:t,children:f.isValidElement(e)?f.cloneElement(e,void 0,r):null})}return(0,g.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=f.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,g.jsx)(n?a:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{});function M(e,t){e&&A.flushSync(()=>e.dispatchEvent(t))}function R(e){let t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...e)=>t.current?.(...e),[])}e.s(["Primitive",0,O,"dispatchDiscreteCustomEvent",0,M],48425),e.s(["useCallbackRef",0,R],30207);var N="dismissableLayer.update",P=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_=f.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,h=f.useContext(P),[c,d]=f.useState(null),y=c?.ownerDocument??globalThis?.document,[,v]=f.useState({}),b=(0,m.useComposedRefs)(t,e=>d(e)),w=Array.from(h.layers),[x]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(x),S=c?w.indexOf(c):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,A=S>=k,E=function(e,t=globalThis?.document){let r=R(e),n=f.useRef(!1),i=f.useRef(()=>{});return f.useEffect(()=>{let e=e=>{if(e.target&&!n.current){let n=function(){I("dismissableLayer.pointerDownOutside",r,s,{discrete:!0})},s={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=n,t.addEventListener("click",i.current,{once:!0})):n()}else t.removeEventListener("click",i.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{let t=e.target,r=[...h.branches].some(e=>e.contains(t));A&&!r&&(i?.(e),o?.(e),e.defaultPrevented||a?.())},y),T=function(e,t=globalThis?.document){let r=R(e),n=f.useRef(!1);return f.useEffect(()=>{let e=e=>{e.target&&!n.current&&I("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{let t=e.target;![...h.branches].some(e=>e.contains(t))&&(s?.(e),o?.(e),e.defaultPrevented||a?.())},y);return!function(e,t=globalThis?.document){let r=R(e);f.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{S===h.layers.size-1&&(n?.(e),!e.defaultPrevented&&a&&(e.preventDefault(),a()))},y),f.useEffect(()=>{if(c)return r&&(0===h.layersWithOutsidePointerEventsDisabled.size&&(u=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(c)),h.layers.add(c),D(),()=>{r&&1===h.layersWithOutsidePointerEventsDisabled.size&&(y.body.style.pointerEvents=u)}},[c,y,r,h]),f.useEffect(()=>()=>{c&&(h.layers.delete(c),h.layersWithOutsidePointerEventsDisabled.delete(c),D())},[c,h]),f.useEffect(()=>{let e=()=>v({});return document.addEventListener(N,e),()=>document.removeEventListener(N,e)},[]),(0,g.jsx)(O.div,{...l,ref:b,style:{pointerEvents:C?A?"auto":"none":void 0,...e.style},onFocusCapture:p(e.onFocusCapture,T.onFocusCapture),onBlurCapture:p(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:p(e.onPointerDownCapture,E.onPointerDownCapture)})});function D(){let e=new CustomEvent(N);document.dispatchEvent(e)}function I(e,t,r,{discrete:n}){let i=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?M(i,s):i.dispatchEvent(s)}_.displayName="DismissableLayer",f.forwardRef((e,t)=>{let r=f.useContext(P),n=f.useRef(null),i=(0,m.useComposedRefs)(t,n);return f.useEffect(()=>{let e=n.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,g.jsx)(O.div,{...e,ref:i})}
1).displayName="DismissableLayerBranch",e.s(["DismissableLayer",0,_],26330);var j="focusScope.autoFocusOnMount",L="focusScope.autoFocusOnUnmount",B={bubbles:!1,cancelable:!0},$=f.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=f.useState(null),h=R(i),c=R(s),u=f.useRef(null),d=(0,m.useComposedRefs)(t,e=>l(e)),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(n){let e=function(e){if(p.paused||!a)return;let t=e.target;a.contains(t)?u.current=t:H(u.current,{select:!0})},t=function(e){if(p.paused||!a)return;let t=e.relatedTarget;null!==t&&(a.contains(t)||H(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&H(a)});return a&&r.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,a,p.paused]),f.useEffect(()=>{if(a){W.add(p);let e=document.activeElement;if(!a.contains(e)){let t=new CustomEvent(j,B);a.addEventListener(j,h),a.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(H(n,{select:t}),document.activeElement!==r)return}(z(a).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&H(a))}return()=>{a.removeEventListener(j,h),setTimeout(()=>{let t=new CustomEvent(L,B);a.addEventListener(L,c),a.dispatchEvent(t),t.defaultPrevented||H(e??document.body,{select:!0}),a.removeEventListener(L,c),W.remove(p)},0)}}},[a,h,c,p]);let y=f.useCallback(e=>{if(!r&&!n||p.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){var s;let t,n=e.currentTarget,[o,a]=[F(t=z(s=n),s),F(t.reverse(),s)];o&&a?e.shiftKey||i!==a?e.shiftKey&&i===o&&(e.preventDefault(),r&&H(a,{select:!0})):(e.preventDefault(),r&&H(o,{select:!0})):i===n&&e.preventDefault()}},[r,n,p.paused]);return(0,g.jsx)(O.div,{tabIndex:-1,...o,ref:d,onKeyDown:y})});function z(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function F(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function H(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}$.displayName="FocusScope";var W=(n=[],{add(e){let t=n[0];e!==t&&t?.pause(),(n=U(n,e)).unshift(e)},remove(e){n=U(n,e),n[0]?.resume()}});function U(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}e.s(["FocusScope",0,$],65491);var V=f.forwardRef((e,t)=>{let{container:r,...n}=e,[i,s]=f.useState(!1);b(()=>s(!0),[]);let o=r||i&&globalThis?.document?.body;return o?A.default.createPortal((0,g.jsx)(O.div,{...n,ref:t}),o):null});V.displayName="Portal",e.s(["Portal",0,V],74606);var q=e=>{var t;let r,n,{present:i,children:s}=e,o=function(e){var t,r;let[n,i]=f.useState(),s=f.useRef(null),o=f.useRef(e),a=f.useRef("none"),[l,h]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},f.useReducer((e,t)=>r[e][t]??e,t));return f.useEffect(()=>{let e=K(s.current);a.current="mounted"===l?e:"none"},[l]),b(()=>{let t=s.current,r=o.current;if(r!==e){let n=a.current,i=K(t);e?h("MOUNT"):"none"===i||t?.display==="none"?h("UNMOUNT"):r&&n!==i?h("ANIMATION_OUT"):h("UNMOUNT"),o.current=e}},[e,h]),b(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=r=>{let i=K(s.current).includes(CSS.escape(r.animationName));if(r.target===n&&i&&(h("ANIMATION_END"),!o.current)){let r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},i=e=>{e.target===n&&(a.current=K(s.current))};return n.addEventListener("animationstart",i),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",i),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}h("ANIMATION_END")},[n,h]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(e=>{s.current=e?getComputedStyle(e):null,i(e)},[])}}(i),a="function"==typeof s?s({present:o.isPresent}):f.Children.only(s),l=(0,m.useComposedRefs)(o.ref,(t=a,(n=(r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof s||o.isPresent?f.cloneElement(a,{ref:l}):null};function K(e){return e?.animationName||"none"}
1q.displayName="Presence",e.s(["Presence",0,q],96626);var J=0;function G(){f.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Y()),document.body.insertAdjacentElement("beforeend",e[1]??Y()),J++,()=>{1===J&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),J--}},[])}function Y(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}e.s(["useFocusGuards",0,G],3536);var X=e.i(90571),Q="right-scroll-bar-position",Z="width-before-scroll-bar";function ee(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var et="u">typeof window?f.useLayoutEffect:f.useEffect,er=new WeakMap,en=(void 0===s&&(s={}),(void 0===o&&(o=function(e){return e}),a=[],l=!1,h={read:function(){if(l)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return a.length?a[a.length-1]:null},useMedium:function(e){var t=o(e,l);return a.push(t),function(){a=a.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(l=!0;a.length;){var t=a;a=[],t.forEach(e)}a={push:function(t){return e(t)},filter:function(){return a}}},assignMedium:function(e){l=!0;var t=[];if(a.length){var r=a;a=[],r.forEach(e),t=a}var n=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(n)};i(),a={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),a}}}}).options=(0,X.__assign)({async:!0,ssr:!1},s),h),ei=function(){},es=f.forwardRef(function(e,t){var r,n,i,s,o=f.useRef(null),a=f.useState({onScrollCapture:ei,onWheelCapture:ei,onTouchMoveCapture:ei}),l=a[0],h=a[1],c=e.forwardProps,u=e.children,d=e.className,p=e.removeScrollBar,m=e.enabled,g=e.shards,y=e.sideCar,v=e.noRelative,b=e.noIsolation,w=e.inert,x=e.allowPinchZoom,k=e.as,S=e.gapMode,C=(0,X.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=(r=[o,t],n=function(e){return r.forEach(function(t){return ee(t,e)})},(i=(0,f.useState)(function(){return{value:null,callback:n,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=n,s=i.facade,et(function(){var e=er.get(s);if(e){var t=new Set(e),n=new Set(r),i=s.current;t.forEach(function(e){n.has(e)||ee(e,null)}),n.forEach(function(e){t.has(e)||ee(e,i)})}er.set(s,r)},[r]),s),E=(0,X.__assign)((0,X.__assign)({},C),l);return f.createElement(f.Fragment,null,m&&f.createElement(y,{sideCar:en,removeScrollBar:p,shards:g,noRelative:v,noIsolation:b,inert:w,setCallbacks:h,allowPinchZoom:!!x,lockRef:o,gapMode:S}),c?f.cloneElement(f.Children.only(u),(0,X.__assign)((0,X.__assign)({},E),{ref:A})):f.createElement(void 0===k?"div":k,(0,X.__assign)({},E,{className:d,ref:A}),u))});es.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},es.classNames={fullWidth:Z,zeroRight:Q};var eo=function(e){var t=e.sideCar,r=(0,X.__rest)(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return f.createElement(n,(0,X.__assign)({},r))};eo.isSideCarExport=!0;var ea=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=d||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var n,i;(n=t).styleSheet?n.styleSheet.cssText=r:n.appendChild(document.createTextNode(r)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},el=function(){var e=ea();return function(t,r){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},eh=function(){var e=el();return function(t){return e(t.styles,t.dynamic),null}},ec={left:0,top:0,right:0,gap:0},eu=function(e){return parseInt(e||"",10)||0},ed=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[eu(r),eu(n),eu(i)]},ef=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return ec;var t=ed(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},ep=eh(),em="data-scroll-locked",eg=function(e,t,r,n){var i=e.left,s=e.top,o=e.right,a=e.gap;return void 0===r&&(r="margin"),"\n  .".concat("with-scroll-bars-hidden"," {\n   overflow: hidden ").concat(n,";\n   padding-right: ").concat(a,"px ").concat(n,";\n  }\n  body[").concat(em,"] {\n    overflow: hidden ").concat(n,";\n    overscroll-behavior: contain;\n    ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n    padding-left: ".concat(i,"px;\n    padding-top: ").concat(s,"px;\n    padding-right: ").concat(o,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(a,"px ").concat(n,";\n    "),"padding"===r&&"padding-right: ".concat(a,"px ").concat(n,";
1")].filter(Boolean).join(""),"\n  }\n  \n  .").concat(Q," {\n    right: ").concat(a,"px ").concat(n,";\n  }\n  \n  .").concat(Z," {\n    margin-right: ").concat(a,"px ").concat(n,";\n  }\n  \n  .").concat(Q," .").concat(Q," {\n    right: 0 ").concat(n,";\n  }\n  \n  .").concat(Z," .").concat(Z," {\n    margin-right: 0 ").concat(n,";\n  }\n  \n  body[").concat(em,"] {\n    ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n  }\n")},ey=function(){var e=parseInt(document.body.getAttribute(em)||"0",10);return isFinite(e)?e:0},ev=function(){f.useEffect(function(){return document.body.setAttribute(em,(ey()+1).toString()),function(){var e=ey()-1;e<=0?document.body.removeAttribute(em):document.body.setAttribute(em,e.toString())}},[])},eb=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=void 0===n?"margin":n;ev();var s=f.useMemo(function(){return ef(i)},[i]);return f.createElement(ep,{styles:eg(s,!t,i,r?"":"!important")})},ew=!1;if("u">typeof window)try{var ex=Object.defineProperty({},"passive",{get:function(){return ew=!0,!0}});window.addEventListener("test",ex,ex),window.removeEventListener("test",ex,ex)}catch(e){ew=!1}var ek=!!ew&&{passive:!1},eS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&(r.overflowY!==r.overflowX||"TEXTAREA"===e.tagName||"visible"!==r[t])},eC=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),eA(e,n)){var i=eE(e,n);if(i[1]>i[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},eA=function(e,t){return"v"===e?eS(t,"overflowY"):eS(t,"overflowX")},eE=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},eT=function(e,t,r,n,i){var s,o=(s=window.getComputedStyle(t).direction,"h"===e&&"rtl"===s?-1:1),a=o*n,l=r.target,h=t.contains(l),c=!1,u=a>0,d=0,f=0;do{if(!l)break;var p=eE(e,l),m=p[0],g=p[1]-p[2]-o*m;(m||g)&&eA(e,l)&&(d+=g,f+=m);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!h&&l!==document.body||h&&(t.contains(l)||t===l))return u&&(i&&1>Math.abs(d)||!i&&a>d)?c=!0:!u&&(i&&1>Math.abs(f)||!i&&-a>f)&&(c=!0),c},eO=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},eM=function(e){return[e.deltaX,e.deltaY]},eR=function(e){return e&&"current"in e?e.current:e},eN=0,eP=[];let e_=(c=function(e){var t=f.useRef([]),r=f.useRef([0,0]),n=f.useRef(),i=f.useState(eN++)[0],s=f.useState(eh)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(0,X.__spreadArray)([e.lockRef.current],(e.shards||[]).map(eR),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var i,s=eO(e),a=r.current,l="deltaX"in e?e.deltaX:a[0]-s[0],h="deltaY"in e?e.deltaY:a[1]-s[1],c=e.target,u=Math.abs(l)>Math.abs(h)?"h":"v";if("touches"in e&&"h"===u&&"range"===c.type)return!1;var d=window.getSelection(),f=d&&d.anchorNode;if(f&&(f===c||f.contains(c)))return!1;var p=eC(u,c);if(!p)return!0;if(p?i=u:(i="v"===u?"h":"v",p=eC(u,c)),!p)return!1;if(!n.current&&"changedTouches"in e&&(l||h)&&(n.current=i),!i)return!0;var m=n.current||i;return eT(m,t,e,"h"===m?l:h,!0)},[]),l=f.useCallback(function(e){if(eP.length&&eP[eP.length-1]===s){var r="deltaY"in e?eM(e):eO(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta,n[0]===r[0]&&n[1]===r[1])})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var i=(o.current.shards||[]).map(eR).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),h=f.useCallback(function(e,r,n,i){var s={name:e,delta:r,target:n,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),c=f.useCallback(function(e){r.current=eO(e),n.current=void 0},[]),u=f.useCallback(function(t){h(t.type,eM(t),t.target,a(t,e.lockRef.current))},[]),d=f.useCallback(function(t){h(t.type,eO(t),t.target,a(t,e.lockRef.current))},[]);f.useEffect(function(){return eP.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:d}),document.addEventListener("wheel",l,ek),document.addEventListener("touchmove",l,ek),document.addEventListener("touchstart",c,ek),function(){eP=eP.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,ek),document.removeEventListener("touchmove",l,ek),document.removeEventListener("touchstart",c,ek)}},[]);var p=e.removeScrollBar,m=e.inert;return f.createElement(f.Fragment,null,m?f.createElement(s,{styles:"\n  .block-interactivity-".concat(i," {pointer-events: none;}\n  .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,p?f.createElement(eb,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},en.useMedium(c),eo);var eD=f.forwardRef(function(e,t){return f.createElement(es,(0,X.__assign)({},e,{ref:t,sideCar:e_}))});eD.classNames=es.classNames,e.s(["RemoveScroll",0,eD],85369);var eI=new WeakMap,ej=new WeakMap,eL={},eB=0,e$=function(e){return e&&(e.host||e$(e.parentNode))},ez=function(e,t,r,n){var i=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=e$(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});eL[r]||(eL[r]=new WeakMap);var s=eL[r],o=[],a=new Set,l=new Set(i),h=function(e){!e||a.has(e)||(a.add(e),h(e.parentNode))};
1i.forEach(h);var c=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(a.has(e))c(e);else try{var t=e.getAttribute(n),i=null!==t&&"false"!==t,l=(eI.get(e)||0)+1,h=(s.get(e)||0)+1;eI.set(e,l),s.set(e,h),o.push(e),1===l&&i&&ej.set(e,!0),1===h&&e.setAttribute(r,"true"),i||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return c(t),a.clear(),eB++,function(){o.forEach(function(e){var t=eI.get(e)-1,i=s.get(e)-1;eI.set(e,t),s.set(e,i),t||(ej.has(e)||e.removeAttribute(n),ej.delete(e)),i||e.removeAttribute(r)}),--eB||(eI=new WeakMap,eI=new WeakMap,ej=new WeakMap,eL={})}},eF=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),ez(n,i,r,"aria-hidden")):function(){return null}};e.s(["hideOthers",0,eF],86312);var eH=Symbol("radix.slottable");function eW(e){return f.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===eH}var eU="Dialog",[eV,eq]=v(eU),[eK,eJ]=eV(eU),eG=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,a=f.useRef(null),l=f.useRef(null),[h,c]=C({prop:n,defaultProp:i??!1,onChange:s,caller:eU});return(0,g.jsx)(eK,{scope:t,triggerRef:a,contentRef:l,contentId:k(),titleId:k(),descriptionId:k(),open:h,onOpenChange:c,onOpenToggle:f.useCallback(()=>c(e=>!e),[c]),modal:o,children:r})};eG.displayName=eU;var eY="DialogTrigger",eX=f.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=eJ(eY,r),s=(0,m.useComposedRefs)(t,i.triggerRef);return(0,g.jsx)(O.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ta(i.open),...n,ref:s,onClick:p(e.onClick,i.onOpenToggle)})});eX.displayName=eY;var eQ="DialogPortal",[eZ,e0]=eV(eQ,{forceMount:void 0}),e1=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:i}=e,s=eJ(eQ,t);return(0,g.jsx)(eZ,{scope:t,forceMount:r,children:f.Children.map(n,e=>(0,g.jsx)(q,{present:r||s.open,children:(0,g.jsx)(V,{asChild:!0,container:i,children:e})}))})};e1.displayName=eQ;var e2="DialogOverlay",e3=f.forwardRef((e,t)=>{let r=e0(e2,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=eJ(e2,e.__scopeDialog);return s.modal?(0,g.jsx)(q,{present:n||s.open,children:(0,g.jsx)(e4,{...i,ref:t})}):null});e3.displayName=e2;var e5=((i=f.forwardRef((e,t)=>{let{children:r,...n}=e;if(f.isValidElement(r)){var i;let e,s,o=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==f.Fragment&&(a.ref=t?(0,m.composeRefs)(t,o):o),f.cloneElement(r,a)}return f.Children.count(r)>1?f.Children.only(null):null})).displayName="DialogOverlay.RemoveScroll.SlotClone",t=i,(r=f.forwardRef((e,r)=>{let{children:n,...i}=e,s=f.Children.toArray(n),o=s.find(eW);if(o){let e=o.props.children,n=s.map(t=>t!==o?t:f.Children.count(e)>1?f.Children.only(null):f.isValidElement(e)?e.props.children:null);return(0,g.jsx)(t,{...i,ref:r,children:f.isValidElement(e)?f.cloneElement(e,void 0,n):null})}return(0,g.jsx)(t,{...i,ref:r,children:n})})).displayName="DialogOverlay.RemoveScroll.Slot",r),e4=f.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=eJ(e2,r);return(0,g.jsx)(eD,{as:e5,allowPinchZoom:!0,shards:[i.contentRef],children:(0,g.jsx)(O.div,{"data-state":ta(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),e6="DialogContent",e8=f.forwardRef((e,t)=>{let r=e0(e6,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=eJ(e6,e.__scopeDialog);return(0,g.jsx)(q,{present:n||s.open,children:s.modal?(0,g.jsx)(e9,{...i,ref:t}):(0,g.jsx)(e7,{...i,ref:t})})});e8.displayName=e6;var e9=f.forwardRef((e,t)=>
1{let r=eJ(e6,e.__scopeDialog),n=f.useRef(null),i=(0,m.useComposedRefs)(t,r.contentRef,n);return f.useEffect(()=>{let e=n.current;if(e)return eF(e)},[]),(0,g.jsx)(te,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),e7=f.forwardRef((e,t)=>{let r=eJ(e6,e.__scopeDialog),n=f.useRef(!1),i=f.useRef(!1);return(0,g.jsx)(te,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||r.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let s=t.target;r.triggerRef.current?.contains(s)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),te=f.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,a=eJ(e6,r),l=f.useRef(null),h=(0,m.useComposedRefs)(t,l);return G(),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)($,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:(0,g.jsx)(_,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ta(a.open),...o,ref:h,onDismiss:()=>a.onOpenChange(!1)})}),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(tu,{titleId:a.titleId}),(0,g.jsx)(td,{contentRef:l,descriptionId:a.descriptionId})]})]})}),tt="DialogTitle",tr=f.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=eJ(tt,r);return(0,g.jsx)(O.h2,{id:i.titleId,...n,ref:t})});tr.displayName=tt;var tn="DialogDescription",ti=f.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=eJ(tn,r);return(0,g.jsx)(O.p,{id:i.descriptionId,...n,ref:t})});ti.displayName=tn;var ts="DialogClose",to=f.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=eJ(ts,r);return(0,g.jsx)(O.button,{type:"button",...n,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});function ta(e){return e?"open":"closed"}to.displayName=ts;var tl="DialogTitleWarning",[th,tc]=y(tl,{contentName:e6,titleName:tt,docsSlug:"dialog"}),tu=({titleId:e})=>{let t=tc(tl),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
3If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
5For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},td=({contentRef:e,descriptionId:t})=>{let r=tc("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return f.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null};e.s(["Close",0,to,"Content",0,e8,"Description",0,ti,"Overlay",0,e3,"Portal",0,e1,"Root",0,eG,"Title",0,tr,"Trigger",0,eX],26999);let tf={objectWrapSection:!1,enablePush:!1,enablePageSettings:!1,eventsCptType:"events"},tp=Symbol.for("cms.host.registry.v2");function tm(){let e,t=globalThis,r=t[tp];return r&&r.listeners instanceof Set||(t[tp]=(e={revision:0,listeners:new Set,hydrators:new Map,pickerFetchers:new Map,saveHandlers:new Map,fetchForEditHandlers:new Map,deleteHandlers:new Map,editorSlots:new Map,editorDefaults:new Map,drawerSections:new Map,shopifyFetcher:null,videoComponent:null,hostOptions:{...tf}},r&&"object"==typeof r?{revision:"number"==typeof r.revision?r.revision:e.revision,listeners:r.listeners instanceof Set?r.listeners:e.listeners,hydrators:r.hydrators instanceof Map?r.hydrators:e.hydrators,pickerFetchers:r.pickerFetchers instanceof Map?r.pickerFetchers:e.pickerFetchers,saveHandlers:r.saveHandlers instanceof Map?r.saveHandlers:e.saveHandlers,fetchForEditHandlers:r.fetchForEditHandlers instanceof Map?r.fetchForEditHandlers:e.fetchForEditHandlers,deleteHandlers:r.deleteHandlers instanceof Map?r.deleteHandlers:e.deleteHandlers,editorSlots:r.editorSlots instanceof Map?r.editorSlots:e.editorSlots,editorDefaults:r.editorDefaults instanceof Map?r.editorDefaults:e.editorDefaults,drawerSections:r.drawerSections instanceof Map?r.drawerSections:e.drawerSections,shopifyFetcher:r.shopifyFetcher??e.shopifyFetcher,videoComponent:r.videoComponent??e.videoComponent,hostOptions:{...tf,...r.hostOptions}}:e)),t[tp]}function tg(){return{...tf,...tm().hostOptions}}function ty(e){return tm().saveHandlers.get(e.trim().toLowerCase())}function tv(e){let t=tg().eventsCptType,r=e.trim().toLowerCase();return r===t||"event"===r}e.s(["applyCptEditorDraftUi",0,function(e,t,r){let n=e._ui&&"object"==typeof e._ui&&!Array.isArray(e._ui)?e._ui.sections:null;return Array.isArray(n)&&n.length>0||r._ui&&"object"==typeof r._ui&&(e._ui=r._ui),e},"getCmsHostOptions",0,tg,"getCmsRegistryRevision",0,function(){return tm().revision},"getCptDeleteHandler",0,function(e){return tm().deleteHandlers.get(e.trim().toLowerCase())},"getCptEditorSlot",0,function(e){return tm().editorSlots.get(e)},"getCptHydrator",0,function(e){return tm().hydrators.get(e.trim().toLowerCase())},"getCptSaveHandler",0,ty,"getVideoComponent",0,function(){return tm().videoComponent},"isEventsCptType",0,tv,"isReadOnlyCptType",0,function(e){return!!tv(e)&&!ty(tg().eventsCptType)},"registerCptHydrator",0,function(e,t){tm().hydrators.set(e.trim().toLowerCase(),t),tm().revision+=1,function(){let{listeners:e}=tm();
5e.forEach(e=>e())}()},"registerVideoComponent",0,function(e){tm().videoComponent=e},"resolveCptEditorTemplate",0,function(e,t){let r=tm().editorDefaults.get(e.trim().toLowerCase());return r||(t&&"object"==typeof t?t:{})},"setCmsHostOptions",0,function(e){let t=tm();t.hostOptions={...tf,...t.hostOptions,...e}},"subscribeCmsRegistry",0,function(e){let t=tm();return t.listeners.add(e),()=>t.listeners.delete(e)}],88227)},75254,e=>{"use strict";var t=e.i(71645);let r=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),n=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,t.forwardRef)(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:l,iconNode:h,...c},u)=>(0,t.createElement)("svg",{ref:u,...i,width:n,height:n,stroke:e,strokeWidth:o?24*Number(s)/Number(n):s,className:r("lucide",a),...!l&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(c)&&{"aria-hidden":"true"},...c},[...h.map(([e,r])=>(0,t.createElement)(e,r)),...Array.isArray(l)?l:[l]]));e.s(["default",0,(e,i)=>{let o=(0,t.forwardRef)(({className:o,...a},l)=>(0,t.createElement)(s,{ref:l,iconNode:i,className:r(`lucide-${n(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,o),...a}));return o.displayName=n(e),o}],75254)},37727,41947,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",0,t],41947),e.s(["X",0,t],37727)},49652,e=>{"use strict";e.s(["resolveElements",0,function(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let n=document;t&&(n=t.current);let i=r?.[e]??n.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>null!=e)}])},87652,e=>{"use strict";var t=e.i(71645),r=e.i(49652);let n={some:0,all:1};e.s(["useInView",0,function(e,{root:i,margin:s,amount:o,once:a=!1,initial:l=!1}={}){let[h,c]=(0,t.useState)(l);return(0,t.useEffect)(()=>{if(!e.current||a&&h)return;let t={root:i&&i.current||void 0,margin:s,amount:o};return function(e,t,{root:i,margin:s,amount:o="some"}={}){let a=(0,r.resolveElements)(e),l=new WeakMap,h=new IntersectionObserver(e=>{e.forEach(e=>{let r=l.get(e.target);if(!!r!==e.isIntersecting)if(e.isIntersecting){let r=t(e.target,e);"function"==typeof r?l.set(e.target,r):h.unobserve(e.target)}else"function"==typeof r&&(r(e),l.delete(e.target))})},{root:i,rootMargin:s,threshold:"number"==typeof o?o:n[o]});return a.forEach(e=>h.observe(e)),()=>h.disconnect()}(e.current,()=>(c(!0),a?void 0:()=>c(!1)),t)},[i,e,s,a,o]),h}],87652)},20783,e=>{"use strict";var t=e.i(71645);function r(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function n(...e){return t=>{let n=!1,i=e.map(e=>{let i=r(e,t);return n||"function"!=typeof i||(n=!0),i});if(n)return()=>{for(let t=0;t<i.length;t++){let n=i[t];"function"==typeof n?n():r(e[t],null)}}}}e.s(["composeRefs",0,n,"useComposedRefs",0,function(...e){return t.useCallback(n(...e),e)}])},90571,e=>{"use strict";var t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError,e.s(["__assign",()=>t,"__awaiter",0,function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},"__rest",0,function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},"__spreadArray",0,function(e,t,r){if(r||2==arguments.length)for(var n,i=0,s=t.length;i<s;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}])},7670,19056,e=>{"use strict";e.s(["clsx",0,function(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=function e(t){var r,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(n=e(t[r]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}(e))&&(n&&(n+=" "),n+=t);return n}],7670);let t=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),r=[],n=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let i=e[t],s=r.nextPart.get(i);if(s){let r=n(e,t+1,s);if(r)return r}let o=r.validators;if(null===o)return;let a=0===t?e.join("-"):e.slice(t).join("-"),l=o.length;for(let e=0;e<l;
5e++){let t=o[e];if(t.validator(a))return t.classGroupId}},i=(e,r)=>{let n=t();for(let t in e)s(e[t],n,t,r);return n},s=(e,t,r,n)=>{let i=e.length;for(let s=0;s<i;s++)o(e[s],t,r,n)},o=(e,t,r,n)=>{"string"==typeof e?a(e,t,r):"function"==typeof e?l(e,t,r,n):h(e,t,r,n)},a=(e,t,r)=>{(""===e?t:c(t,e)).classGroupId=r},l=(e,t,r,n)=>{u(e)?s(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},h=(e,t,r,n)=>{let i=Object.entries(e),o=i.length;for(let e=0;e<o;e++){let[o,a]=i[e];s(a,c(t,o),r,n)}},c=(e,r)=>{let n=e,i=r.split("-"),s=i.length;for(let e=0;e<s;e++){let r=i[e],s=n.nextPart.get(r);s||(s=t(),n.nextPart.set(r,s)),n=s}return n},u=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,d=[],f=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),p=/\s+/,m=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=m(e[n]))&&(r&&(r+=" "),r+=t);return r},g=[],y=e=>{let t=t=>t[e]||g;return t.isThemeGetter=!0,t},v=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,b=/^\((?:(\w[\w-]*):)?(.+)\)$/i,w=/^\d+\/\d+$/,x=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,k=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,C=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,E=e=>w.test(e),T=e=>!!e&&!Number.isNaN(Number(e)),O=e=>!!e&&Number.isInteger(Number(e)),M=e=>e.endsWith("%")&&T(e.slice(0,-1)),R=e=>x.test(e),N=()=>!0,P=e=>k.test(e)&&!S.test(e),_=()=>!1,D=e=>C.test(e),I=e=>A.test(e),j=e=>!B(e)&&!U(e),L=e=>X(e,et,_),B=e=>v.test(e),$=e=>X(e,er,P),z=e=>X(e,en,T),F=e=>X(e,Z,_),H=e=>X(e,ee,I),W=e=>X(e,es,D),U=e=>b.test(e),V=e=>Q(e,er),q=e=>Q(e,ei),K=e=>Q(e,Z),J=e=>Q(e,et),G=e=>Q(e,ee),Y=e=>Q(e,es,!0),X=(e,t,r)=>{let n=v.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Q=(e,t,r=!1)=>{let n=b.exec(e);return!!n&&(n[1]?t(n[1]):r)},Z=e=>"position"===e||"percentage"===e,ee=e=>"image"===e||"url"===e,et=e=>"length"===e||"size"===e||"bg-size"===e,er=e=>"length"===e,en=e=>"number"===e,ei=e=>"family-name"===e,es=e=>"shadow"===e,eo=((e,...t)=>{let s,o,a,l,h=e=>{let t=o(e);if(t)return t;let r=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],a=e.trim().split(p),l="";for(let e=a.length-1;e>=0;e-=1){let t=a[e],{isExternal:h,modifiers:c,hasImportantModifier:u,baseClassName:d,maybePostfixModifierPosition:f}=r(t);if(h){l=t+(l.length>0?" "+l:l);continue}let p=!!f,m=n(p?d.substring(0,f):d);if(!m){if(!p||!(m=n(d))){l=t+(l.length>0?" "+l:l);continue}p=!1}let g=0===c.length?"":1===c.length?c[0]:s(c).join(":"),y=u?g+"!":g,v=y+m;if(o.indexOf(v)>-1)continue;o.push(v);let b=i(m,p);for(let e=0;e<b.length;++e){let t=b[e];o.push(y+t)}l=t+(l.length>0?" "+l:l)}return l})(e,s);return a(e,r),r};return l=c=>{var u;let p;return o=(s={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),i=(i,s)=>{r[i]=s,++t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set(e,t){e in r?r[e]=t:i(e,t)}}})((u=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,i=0,s=0,o=e.length;for(let a=0;a<o;a++){let o=e[a];if(0===n&&0===i){if(":"===o){r.push(e.slice(s,a)),s=a+1;continue}if("/"===o){t=a;continue}}"["===o?n++:"]"===o?n--:"("===o?i++:")"===o&&i--}let a=0===r.length?e:e.slice(s),l=a,h=!1;return a.endsWith("!")?(l=a.slice(0,-1),h=!0):a.startsWith("!")&&(l=a.slice(1),h=!0),f(r,h,l,t&&t>s?t-s:void 0)};if(t){let e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):f(d,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n})(u),sortModifiers:(p=new Map,u.orderSensitiveModifiers.forEach((e,t)=>{p.set(e,1e6+t)}),e=>{let t=[],r=[];for(let n=0;n<e.length;n++){let i=e[n],s="["===i[0],o=p.has(i);s||o?(r.length>0&&(r.sort(),t.push(...r),r=[]),t.push(i)):r.push(i)}return r.length>0&&(r.sort(),t.push(...r)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:r}=e;return i(r,t)})(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var r;let t,n,i;return -1===(r=e).slice(1,-1).indexOf(":")?void 0:(n=(t=r.slice(1,-1)).indexOf(":"),(i=t.slice(0,n))?"arbitrary.."+i:void 0)}let i=e.split("-"),s=+(""===i[0]&&i.length>1);return n(i,s,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=o[e],n=s[e];if(t){if(n){let e=Array(n.length+t.length);for(let t=0;t<n.length;t++)e[t]=n[t];for(let r=0;r<t.length;r++)e[n.length+r]=t[r];return e}return t}return n||r}return s[e]||r}}})(u)}).cache.get,a=s.cache.set,l=h,h(c)},(...e)=>l(((...e)=>{let t,r,n=0,i="";for(;n<e.length;)(t=e[n++])&&(r=m(t))&&(i&&(i+=" "),i+=r);return i})(...e))})(()=>{let e=y("color"),t=y("font"),r=y("text"),n=y("font-weight"),i=y("tracking"),s=y("leading"),o=y("breakpoint"),a=y("container"),l=y("spacing"),h=y("radius"),c=y("shadow"),u=y("inset-shadow"),d=y("text-shadow"),f=y("drop-shadow"),p=y("blur"),m=y("perspective"),g=y("aspect"),v=y("ease"),b=y("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...x(),U,B],S=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],A=()=>[U,B,l],P=()=>[E,"full","auto",...A()],_=()=>[O,"none","subgrid",U,B],D=()=>["auto",{span:["full",O,U,B]},O,U,B],I=()=>[O,"auto",U,B],X=()=>["auto","min","max","fr",U,B],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],ee=()=>["auto",...A()],et=()=>[E,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],er=()=>[e,U,B],en=()=>[...x(),K,F,{position:[U,B]}],ei=()=>["no-repeat",{repeat:["","x","y","space","round"]}],es=()=>["auto","cover","contain",J,L,{size:[U,B]}],eo=()=>[M,V,$],ea=()=>["","none","full",h,U,B],el=()=>["",T,V,$],eh=()=>["solid","dashed","dotted","double"],ec=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],eu=()=>[T,M,K,F],ed=()=>["","none",p,U,B],ef=()=>["none",T,U,B],ep=()=>["none",T,U,B],em=()=>[T,U,B],eg=()=>[E,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[R],breakpoint:[R],color:[N],container:[R],"drop-shadow":[R],ease:["in","out","in-out"],font:[j],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[R],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[R],shadow:[R],spacing:["px",T],text:[R],"text-shadow":[R],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",E,B,U,g]}
vendor: 12,796 bytes, line 5
5],container:["container"],columns:[{columns:[T,B,U,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[O,"auto",U,B]}],basis:[{basis:[E,"full","auto",a,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[T,E,"auto","initial","none",B]}],grow:[{grow:["",T,U,B]}],shrink:[{shrink:["",T,U,B]}],order:[{order:[O,"first","last","none",U,B]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":X()}],"auto-rows":[{"auto-rows":X()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:ee()}],mx:[{mx:ee()}],my:[{my:ee()}],ms:[{ms:ee()}],me:[{me:ee()}],mt:[{mt:ee()}],mr:[{mr:ee()}],mb:[{mb:ee()}],ml:[{ml:ee()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:et()}],w:[{w:[a,"screen",...et()]}],"min-w":[{"min-w":[a,"screen","none",...et()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...et()]}],h:[{h:["screen","lh",...et()]}],"min-h":[{"min-h":["screen","lh","none",...et()]}],"max-h":[{"max-h":["screen","lh",...et()]}],"font-size":[{text:["base",r,V,$]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,U,z]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",M,B]}],"font-family":[{font:[q,B,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,U,B]}],"line-clamp":[{"line-clamp":[T,"none",U,z]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",U,B]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",U,B]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:er()}],"text-color":[{text:er()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...eh(),"wavy"]}],"text-decoration-thickness":[{decoration:[T,"from-font","auto",U,$]}],"text-decoration-color":[{decoration:er()}],"underline-offset":[{"underline-offset":[T,"auto",U,B]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",U,B]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",U,B]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:en()}],"bg-repeat":[{bg:ei()}],"bg-size":[{bg:es()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},O,U,B],radial:["",U,B],conic:[O,U,B]},G,H]}],"bg-color":[{bg:er()}],"gradient-from-pos":[{from:eo()}],"gradient-via-pos":[{via:eo()}],"gradient-to-pos":[{to:eo()}],"gradient-from":[{from:er()}],"gradient-via":[{via:er()}],"gradient-to":[{to:er()}],rounded:[{rounded:ea()}],"rounded-s":[{"rounded-s":ea()}],"rounded-e":[{"rounded-e":ea()}],"rounded-t":[{"rounded-t":ea()}],"rounded-r":[{"rounded-r":ea()}],"rounded-b":[{"rounded-b":ea()}],"rounded-l":[{"rounded-l":ea()}],"rounded-ss":[{"rounded-ss":ea()}],"rounded-se":[{"rounded-se":ea()}],"rounded-ee":[{"rounded-ee":ea()}],"rounded-es":[{"rounded-es":ea()}],"rounded-tl":[{"rounded-tl":ea()}],"rounded-tr":[{"rounded-tr":ea()}],"rounded-br":[{"rounded-br":ea()}],"rounded-bl":[{"rounded-bl":ea()}],"border-w":[{border:el()}],"border-w-x":[{"border-x":el()}],"border-w-y":[{"border-y":el()}],"border-w-s":[{"border-s":el()}],"border-w-e":[{"border-e":el()}],"border-w-t":[{"border-t":el()}],"border-w-r":[{"border-r":el()}],"border-w-b":[{"border-b":el()}],"border-w-l":[{"border-l":el()}],"divide-x":[{"divide-x":el()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":el()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...eh(),"hidden","none"]}],"divide-style":[{divide:[...eh(),"hidden","none"]}],"border-color":[{border:er()}],"border-color-x":[{"border-x":er()}],"border-color-y":[{"border-y":er()}],"border-color-s":[{"border-s":er()}],"border-color-e":[{"border-e":er()}],"border-color-t":[{"border-t":er()}],"border-color-r":[{"border-r":er()}],"border-color-b":[{"border-b":er()}],"border-color-l":[{"border-l":er()}],"divide-color":[{divide:er()}],"outline-style":[{outline:[...eh(),"none","hidden"]}],"outline-offset":[{"outline-offset":[T,U,B]}],"outline-w":[{outline:["",T,V,$]}],"outline-color":[{outline:er()}],shadow:[{shadow:["","none",c,Y,W]}],"shadow-color":[{shadow:er()}],"inset-shadow":[{"inset-shadow":["none",u,Y,W]}],"inset-shadow-color":[{"inset-shadow":er()}],"ring-w":[{ring:el()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:er()}],"ring-offset-w":[{"ring-offset":[T,$]}],"ring-offset-color":[{"ring-offset":er()}],"inset-ring-w":[{"inset-ring":el()}],"inset-ring-color":[{"inset-ring":er()}],"text-shadow":[{"text-shadow":["none",d,Y,W]}],"text-shadow-color":[{"text-shadow":er()}],opacity:[{opacity:[T,U,B]}],"mix-blend":[{"mix-blend":[...ec(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ec()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[T]}],"mask-image-linear-from-pos":[{"mask-linear-from":eu()}],"mask-image-linear-to-pos":[{"mask-linear-to":eu()}],"mask-image-linear-from-color":[{"mask-linear-from":er()}],"mask-image-linear-to-color":[{"mask-linear-to":er()}],"mask-image-t-from-pos":[{"mask-t-from":eu()}],"mask-image-t-to-pos":[{"mask-t-to":eu()}],"mask-image-t-from-color":[{"mask-t-from":er()}],"mask-image-t-to-color":[{"mask-t-to":er()}],"mask-image-r-from-pos":[{"mask-r-from":eu()}],"mask-image-r-to-pos":[{"mask-r-to":eu()}],"mask-image-r-from-color":[{"mask-r-from":er()}],"mask-image-r-to-color":[{"mask-r-to":er()}],"mask-image-b-from-pos":[{"mask-b-from":eu()}],"mask-image-b-to-pos":[{"mask-b-to":eu()}],"mask-image-b-from-color":[{"mask-b-from":er()}],"mask-image-b-to-color":[{"mask-b-to":er()}],"mask-image-l-from-pos":[{"mask-l-from":eu()}],"mask-image-l-to-pos":[{"mask-l-to":eu()}],"mask-image-l-from-color":[{"mask-l-from":er()}],"mask-image-l-to-color":[{"mask-l-to":er()}],"mask-image-x-from-pos":[{"mask-x-from":eu()}],"mask-image-x-to-pos":[{"mask-x-to":eu()}],"mask-image-x-from-color":[{"mask-x-from":er()}],"mask-image-x-to-color":[{"mask-x-to":er()}],"mask-image-y-from-pos":[{"mask-y-from":eu()}],"mask-image-y-to-pos":[{"mask-y-to":eu()}],"mask-image-y-from-color":[{"mask-y-from":er()}],"mask-image-y-to-color":[{"mask-y-to":er()}],"mask-image-radial":[{"mask-radial":[U,B]}],"mask-image-radial-from-pos":[{"mask-radial-from":eu()}],"mask-image-radial-to-pos":[{"mask-radial-to":eu()}],"mask-image-radial-from-color":[{"mask-radial-from":er()}],"mask-image-radial-to-color":[{"mask-radial-to":er()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[T]}],"mask-image-conic-from-pos":[{"mask-conic-from":eu()}],"mask-image-conic-to-pos":[{"mask-conic-to":eu()}],"mask-image-conic-from-color":[{"mask-conic-from":er()}],"mask-image-conic-to-color":[{"mask-conic-to":er()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:en()}],"mask-repeat":[{mask:ei()}],"mask-size":[{mask:es()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",U,B]}],filter:[{filter:["","none",U,B]}],blur:[{blur:ed()}],brightness:[{brightness:[T,U,B]}],contrast:[{contrast:[T,U,B]}],"drop-shadow":[{"drop-shadow":["","none",f,Y,W]}],"drop-shadow-color":[{"drop-shadow":er()}],grayscale:[{grayscale:["",T,U,B]}],"hue-rotate":[{"hue-rotate":[T,U,B]}],invert:[{invert:["",T,U,B]}],saturate:[{saturate:[T,U,B]}],sepia:[{sepia:["",T,U,B]}],"backdrop-filter":[{"backdrop-filter":["","none",U,B]}],"backdrop-blur":[{"backdrop-blur":ed()}],"backdrop-brightness":[{"backdrop-brightness":[T,U,B]}],"backdrop-contrast":[{"backdrop-contrast":[T,U,B]}],"backdrop-grayscale":[{"backdrop-grayscale":["",T,U,B]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[T,U,B]}],"backdrop-invert":[{"backdrop-invert":["",T,U,B]}],"backdrop-opacity":[{"backdrop-opacity":[T,U,B]}],"backdrop-saturate":[{"backdrop-saturate":[T,U,B]}],"backdrop-sepia":[{"backdrop-sepia":["",T,U,B]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",U,B]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[T,"initial",U,B]}],ease:[{ease:["linear","initial",v,U,B]}],delay:[{delay:[T,U,B]}],animate:[{animate:["none",b,U,B]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,U,B]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ef()}],"rotate-x":[{"rotate-x":ef()}],"rotate-y":[{"rotate-y":ef()}],"rotate-z":[{"rotate-z":ef()}],scale:[{scale:ep()}],"scale-x":[{"scale-x":ep()}],"scale-y":[{"scale-y":ep()}],"scale-z":[{"scale-z":ep()}],"scale-3d":["scale-3d"],skew:[{skew:em()}],"skew-x":[{"skew-x":em()}],"skew-y":[{"skew-y":em()}],transform:[{transform:[U,B,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:eg()}],"translate-x":[{"translate-x":eg()}],"translate-y":[{"translate-y":eg()}],"translate-z":[{"translate-z":eg()}],"translate-none":["translate-none"],accent:[{accent:er()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:er()}
5],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",U,B]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",U,B]}],fill:[{fill:["none",...er()]}],"stroke-w":[{stroke:[T,V,$,z]}],stroke:[{stroke:["none",...er()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});e.s(["twMerge",0,eo],19056)},47163,e=>{"use strict";var t=e.i(7670),r=e.i(19056);e.s(["cn",0,function(...e){return(0,r.twMerge)((0,t.clsx)(e))}])},67423,(e,t,r)=>{"use strict";function n({widthInt:e,heightInt:t,blurWidth:r,blurHeight:i,blurDataURL:s,objectFit:o}
5){let a=r?40*r:e,l=i?40*i:t,h=a&&l?`viewBox='0 0 ${a} ${l}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${h}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${h?"none":"contain"===o?"xMidYMid":"cover"===o?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${s}'/%3E%3C/svg%3E`}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImageBlurSvg",{enumerable:!0,get:function(){return n}})},87690,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={VALID_LOADERS:function(){return s},imageConfigDefault:function(){return o}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s=["default","imgix","cloudinary","akamai","custom"],o={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},8927,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImgProps",{enumerable:!0,get:function(){return h}}),e.r(33525);let n=e.r(43369),i=e.r(67423),s=e.r(87690),o=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function l(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function h({src:e,sizes:t,unoptimized:r=!1,priority:c=!1,preload:u=!1,loading:d,className:f,quality:p,width:m,height:g,fill:y=!1,style:v,overrideSrc:b,onLoad:w,onLoadingComplete:x,placeholder:k="empty",blurDataURL:S,fetchPriority:C,decoding:A="async",layout:E,objectFit:T,objectPosition:O,lazyBoundary:M,lazyRoot:R,...N},P){var _;let D,I,j,{imgConf:L,showAltText:B,blurComplete:$,defaultLoader:z}=P,F=L||s.imageConfigDefault;if("allSizes"in F)D=F;else{let e=[...F.deviceSizes,...F.imageSizes].sort((e,t)=>e-t),t=F.deviceSizes.sort((e,t)=>e-t),r=F.qualities?.sort((e,t)=>e-t);D={...F,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===z)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let H=N.loader||z;delete N.loader,delete N.srcSet;let W="__next_img_default"in H;if(W){if("custom"===D.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
6Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=H;H=t=>{let{config:r,...n}=t;return e(n)}}if(E){"fill"===E&&(y=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[E];e&&(v={...v,...e});let r={responsive:"100vw",fill:"100vw"}[E];r&&!t&&(t=r)}let U="",V=l(m),q=l(g);if((_=e)&&"object"==typeof _&&(a(_)||void 0!==_.src)){let t=a(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}
6`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(I=t.blurWidth,j=t.blurHeight,S=S||t.blurDataURL,U=t.src,!y)if(V||q){if(V&&!q){let e=V/t.width;q=Math.round(t.height*e)}else if(!V&&q){let e=q/t.height;V=Math.round(t.width*e)}}else V=t.width,q=t.height}let K=!c&&!u&&("lazy"===d||void 0===d);(!(e="string"==typeof e?e:U)||e.startsWith("data:")||e.startsWith("blob:"))&&(r=!0,K=!1),D.unoptimized&&(r=!0),W&&!D.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(r=!0);let J=l(p),G=Object.assign(y?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:T,objectPosition:O}:{},B?{}:{color:"transparent"},v),Y=$||"empty"===k?null:"blur"===k?`url("data:image/svg+xml;charset=utf-8,${(0,i.getImageBlurSvg)({widthInt:V,heightInt:q,blurWidth:I,blurHeight:j,blurDataURL:S||"",objectFit:G.objectFit})}")`:`url("${k}")`,X=o.includes(G.objectFit)?"fill"===G.objectFit?"100% 100%":"cover":G.objectFit,Q=Y?{backgroundSize:X,backgroundPosition:G.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Y}:{},Z=function({config:e,src:t,unoptimized:r,width:i,quality:s,sizes:o,loader:a}){if(r){if(t.startsWith("/")&&!t.startsWith("//")){let e=(0,n.getDeploymentId)();if(e){let r=t.indexOf("?");if(-1!==r){let n=new URLSearchParams(t.slice(r+1));n.get("dpl")||(n.append("dpl",e),t=t.slice(0,r)+"?"+n.toString())}else t+=`?dpl=${e}`}}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:l,kind:h}=function({deviceSizes:e,allSizes:t},r,n){if(n){let r=/(^|\s)(1?\d?\d)vw/g,i=[];for(let e;e=r.exec(n);)i.push(parseInt(e[2]));if(i.length){let r=.01*Math.min(...i);return{widths:t.filter(t=>t>=e[0]*r),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof r?{widths:e,kind:"w"}:{widths:[...new Set([r,2*r].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,i,o),c=l.length-1;return{sizes:o||"w"!==h?o:"100vw",srcSet:l.map((r,n)=>`${a({config:e,src:t,quality:s,width:r})} ${"w"===h?r:n+1}${h}`).join(", "),src:a({config:e,src:t,quality:s,width:l[c]})}}({config:D,src:e,unoptimized:r,width:V,quality:J,sizes:t,loader:H}),ee=K?"lazy":d;return{props:{...N,loading:ee,fetchPriority:C,width:V,height:q,decoding:A,className:f,style:{...G,...Q},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:r,preload:u||c,placeholder:k,fill:y}}}},98879,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return a}});let n=e.r(71645),i="u"<typeof window,s=i?()=>{}:n.useLayoutEffect,o=i?()=>{}:n.useEffect;function a(e){let{headManager:t,reduceComponentsToState:r}=e;function a(){if(t&&t.mountedInstances){let e=n.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(r(e))}}return i&&(t?.mountedInstances?.add(e.children),a()),s(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),s(()=>(t&&(t._pendingUpdate=a),()=>{t&&(t._pendingUpdate=a)})),o(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},25633,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return m},defaultHead:function(){return u}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s=e.r(55682),o=e.r(90809),a=e.r(43476),l=o._(e.r(71645)),h=s._(e.r(98879)),c=e.r(42732);function u(){return[(0,a.jsx)("meta",{charSet:"utf-8"},"charset"),(0,a.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function d(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===l.default.Fragment?e.concat(l.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}e.r(33525);let f=["name","httpEquiv","charSet","itemProp"];function p(e){let t,r,n,i;return e.reduce(d,[]).reverse().concat(u().reverse()).filter((t=new Set,r=new Set,n=new Set,i={},e=>{let s=!0,o=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){o=!0;let r=e.key.slice(e.key.indexOf("$")+1);t.has(r)?s=!1:t.add(r)}switch(e.type){case"title":case"base":r.has(e.type)?s=!1:r.add(e.type);break;case"meta":for(let t=0,r=f.length;t<r;t++){let r=f[t];if(e.props.hasOwnProperty(r))if("charSet"===r)n.has(r)?s=!1:n.add(r);else{let t=e.props[r],n=i[r]||new Set;("name"!==r||!o)&&n.has(t)?s=!1:(n.add(t),i[r]=n)}}}return s})).reverse().map((e,t)=>{let r=e.key||t;return l.default.cloneElement(e,{key:r})})}let m=function({children:e}){let t=(0,l.useContext)(c.HeadManagerContext);return(0,a.jsx)(h.default,{reduceComponentsToState:p,headManager:t,children:e})};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esMo
6dule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},18556,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ImageConfigContext",{enumerable:!0,get:function(){return s}});let n=e.r(55682)._(e.r(71645)),i=e.r(87690),s=n.default.createContext(i.imageConfigDefault)},65856,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"RouterContext",{enumerable:!0,get:function(){return n}});let n=e.r(55682)._(e.r(71645)).default.createContext(null)},70965,(e,t,r)=>{"use strict";function n(e,t){let r=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e,t.qualities[0]):r}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"findClosestQuality",{enumerable:!0,get:function(){return n}})},1948,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return o}});let n=e.r(70965),i=e.r(43369);function s({config:e,src:t,width:r,quality:o}){let a=(0,i.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//")){let e=t.indexOf("?");if(-1!==e){let r=new URLSearchParams(t.slice(e+1)),n=r.get("dpl");if(n){a=n,r.delete("dpl");let i=r.toString();t=t.slice(0,e)+(i?"?"+i:"")}}}if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
7Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let l=(0,n.findClosestQuality)(o,e);return`${e.path}?url=${encodeURIComponent(t)}&w=${r}&q=${l}${t.startsWith("/")&&a?`&dpl=${a}`:""}`}s.__next_img_default=!0;let o=s},18581,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return i}});let n=e.r(71645);function i(e,t){let r=(0,n.useRef)(null),i=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=i.current;t&&(i.current=null,t())}else e&&(r.current=s(e,n)),t&&(i.current=s(t,n))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},85437,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"Image",{enumerable:!0,get:function(){return w}});let n=e.r(55682),i=e.r(90809),s=e.r(43476),o=i._(e.r(71645)),a=n._(e.r(74080)),l=n._(e.r(25633)),h=e.r(8927),c=e.r(87690),u=e.r(18556);e.r(33525);let d=e.r(65856),f=n._(e.r(1948)),p=e.r(18581),m={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,r,n,i,s,o){let a=e?.src;e&&e["data-loaded-src"]!==a&&(e["data-loaded-src"]=a,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),r?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,i=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}n?.current&&n.current(e)}}))}function y(e){return o.use?{fetchPriority:e}:{fetchpriority:e}}"u"<typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let v=(0,o.forwardRef)(({src:e,srcSet:t,sizes:r,height:n,width:i,decoding:a,className:l,style:h,fetchPriority:c,placeholder:u,loading:d,unoptimized:f,fill:m,onLoadRef:v,onLoadingCompleteRef:b,setBlurComplete:w,setShowAltText:x,sizesInput:k,onLoad:S,onError:C,...A},E)=>{let T=(0,o.useCallback)(e=>{e&&(C&&(e.src=e.src),e.complete&&g(e,u,v,b,w,f,k))},[e,u,v,b,w,C,f,k]),O=(0,p.useMergedRef)(E,T);return(0,s.jsx)("img",{...A,...y(c),loading:d,width:i,height:n,decoding:a,"data-nimg":m?"fill":"1",className:l,style:h,sizes:r,srcSet:t,src:e,ref:O,onLoad:e=>{g(e.currentTarget,u,v,b,w,f,k)},onError:e=>{x(!0),"empty"!==u&&w(!0),C&&C(e)}})});function b({isAppRouter:e,imgAttributes:t}){let r={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...y(t.fetchPriority)};return e&&a.default.preload?(a.default.preload(t.src,r),null):(0,s.jsx)(l.default,{children:(0,s.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...r},"__nimg-"+t.src+t.srcSet+t.sizes)})}let w=(0,o.forwardRef)((e,t)=>{let r=(0,o.useContext)(d.RouterContext),n=(0,o.useContext)(u.ImageConfigContext),i=(0,o.useMemo)(()=>{let e=m||n||c.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>
7e-t),r=e.deviceSizes.sort((e,t)=>e-t),i=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r,qualities:i,localPatterns:"u"<typeof window?n?.localPatterns:e.localPatterns}},[n]),{onLoad:a,onLoadingComplete:l}=e,p=(0,o.useRef)(a);(0,o.useEffect)(()=>{p.current=a},[a]);let g=(0,o.useRef)(l);(0,o.useEffect)(()=>{g.current=l},[l]);let[y,w]=(0,o.useState)(!1),[x,k]=(0,o.useState)(!1),{props:S,meta:C}=(0,h.getImgProps)(e,{defaultLoader:f.default,imgConf:i,blurComplete:y,showAltText:x});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v,{...S,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:p,onLoadingCompleteRef:g,setBlurComplete:w,setShowAltText:k,sizesInput:e.sizes,ref:t}),C.preload?(0,s.jsx)(b,{isAppRouter:!r,imgAttributes:S}):null]})});("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},94909,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return c},getImageProps:function(){return h}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s=e.r(55682),o=e.r(8927),a=e.r(85437),l=s._(e.r(1948));function h(e){let{props:t}=(0,o.getImgProps)(e,{defaultLoader:l.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let c=a.Image},57688,(e,t,r)=>{t.exports=e.r(94909)},35223,e=>{"use strict";var t=e.i(43476),r=e.i(57688),n=e.i(71645);function i(){return(i=Object.assign.bind()).apply(this,arguments)}var s=function(e){var t=(0,n.useRef)(e);return t.current=e,t},o=function(e,t){var r="",n=-1;return Object.keys(e).forEach(function(i){var s=e[i];t>=s&&s>n&&(r=i,n=s)}),r},a=function(e){var t=void 0===e?{}:e,r=t.useBorderBoxSize,a=t.breakpoints,l=t.updateOnBreakpointChange,h=t.shouldUpdate,c=t.onResize,u=t.polyfill,d=(0,n.use
7State)({currentBreakpoint:"",width:null,height:null}),f=d[0],p=d[1],m=(0,n.useRef)({}),g=(0,n.useRef)(),y=(0,n.useRef)(),v=(0,n.useRef)(!1),b=(0,n.useRef)(),w=s(c),x=s(h),k=(0,n.useCallback)(function(){y.current&&y.current.disconnect()},[]),S=(0,n.useCallback)(function(e){e&&e!==b.current&&(k(),b.current=e,p({currentBreakpoint:"",width:e.clientWidth,height:e.clientHeight})),y.current&&b.current&&y.current.observe(b.current)},[k]);return(0,n.useEffect)(function(){if((!("ResizeObserver"in window)||!("ResizeObserverEntry"in window))&&!u)return console.error("💡 react-cool-dimensions: the browser doesn't support Resize Observer, please use polyfill: https://github.com/wellyshen/react-cool-dimensions#resizeobserver-polyfill"),function(){return null};var e=null;return y.current=new(u||ResizeObserver)(function(t){var n=t[0];e=requestAnimationFrame(function(){var e=n.contentBoxSize,t=n.borderBoxSize,i=n.contentRect,s=e;r&&(t?s=t:v.current||(console.warn("💡 react-cool-dimensions: the browser doesn't support border-box size, fallback to content-box size. Please see: https://github.com/wellyshen/react-cool-dimensions#border-box-size-measurement"),v.current=!0));var h=(s=Array.isArray(s)?s[0]:s)?s.inlineSize:i.width,c=s?s.blockSize:i.height;if(h!==m.current.width||c!==m.current.height){m.current={width:h,height:c};var u={currentBreakpoint:"",width:h,height:c,entry:n,observe:S,unobserve:k};a?(u.currentBreakpoint=o(a,h),u.currentBreakpoint!==g.current&&(w.current&&w.current(u),g.current=u.currentBreakpoint)):w.current&&w.current(u);var d={currentBreakpoint:u.currentBreakpoint,width:h,height:c,entry:n};if(!x.current||x.current(d)){if(!x.current&&a&&l)return void p(function(e){return e.currentBreakpoint!==d.currentBreakpoint?d:e});p(d)}}})}),S(),function(){k(),e&&cancelAnimationFrame(e)}},[JSON.stringify(a),r,S,k,l]),i({},f,{observe:S,unobserve:k})};e.s(["LoadImage",0,({src:e,width:i,height:s,realDimmensions:o=!1,quality:l=75,qualityMobile:h,sizes:c,alt:u="",title:d,className:f,placeholder:p,blurDataURL:m,priority:g,fetchPriority:y,loading:v="lazy",noloader:b=!1,bg:w,contain:x=!1,theme:k="dark",animation:S="fade"})=>
7{let[C,A]=(0,n.useState)(!0),{observe:E,width:T,height:O}=a(),M=Math.max(T,Math.floor(O*i/s)),[R,N]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=window.matchMedia("(max-width: 767px)"),t=()=>N(e.matches);return t(),e.addEventListener?.("change",t),()=>e.removeEventListener?.("change",t)},[]);let P=Number(l),_=void 0!==h?Number(h):Math.max(1,P-20);return(0,t.jsxs)("div",{ref:E,className:`overflow-hidden ${f||""} ${w?"absolute w-full h-full inset-0":""}`,style:o?{aspectRatio:`${i}/${s}`}:{},children:[(0,t.jsx)(r.default,{src:e,width:i,height:s,quality:R?_:P,sizes:g?c||`${Math.round(Math.max(640,M||0))}px`:void 0!==M&&M>0&&!c?`${Math.round(M)}px`:c||"0",alt:u||"background asset",title:d,placeholder:p,blurDataURL:p&&m?m:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBkZWZhdWx0IHF1YWxpdHkK/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgACAAIAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A5GS4g0OK1ayRpGAPnSN0PtRRRUxpxkryHKpKLtFn/9k=",priority:g,loading:g?"eager":v,fetchPriority:y||(g?"high":"auto"),className:`
8					w-full h-full max-h-[calc(100svh_+_50vw)]
9					${"fade"===S?"transition duration-1000 opacity-0":""}
10					${"fade"===S&&!C?"opacity-100":""}
11					${"fade-fast"===S?"transition duration-300 opacity-0":""}
12					${"fade-fast"===S&&!C?"opacity-100":""}
13					${x?"object-contain":"object-cover"} object-center`,onLoad:e=>A(!1)}),"fade"!==S&&"none"!==S&&(0,t.jsx)("div",{className:`cover
14				z-80 absolute top-0 left-0 w-full h-full
15				transition duration-1000 ease-in-out
16				${"reveal-up"===S?`
17					${C?"translate-y-0":"translate-y-[-100%]"}
18				`:""}
19				${"reveal-down"===S?`
20					${C?"translate-y-0":"translate-y-[100%]"}
21				`:""}
22				${"reveal-left"===S?`
23					${C?"translate-x-0":"translate-x-[-100%]"}
24				`:""}
25				${"reveal-right"===S?`
26					${C?"translate-x-0":"translate-x-[100%]"}
27				`:""}
28				
29			`}),!b&&(0,t.jsx)("div",{className:`loader z-100 absolute top-0 left-0 w-full h-full bg-no-repeat bg-center transition-opacity duration-1000 ease-in-out delay-1000
30					${"dark"===k?"bg-loader-dark opacity-50":"bg-loader-light"}
31					${!C?"bg-none hidden":""}`})]})}],35223)},18566,(e,t,r)=>{t.exports=e.r(76562)},8341,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={cancelIdleCallback:function(){return o},requestIdleCallback:function(){return s}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s="u">typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},o="u">typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},19083,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ESCAPE_REGEX:function(){return o},htmlEscapeAttributeString:function(){return c},htmlEscapeJsonString:function(){return h}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},o=/[&><\u2028\u2029]/g,a={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;"},l=/[&"'<>]/g;function h(e){return e.replace(o,e=>s[e])}function c(e){return e.replace(l,e=>a[e])}},79520,(e,t,r)=>{"use strict";
31Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return w},handleClientScriptLoad:function(){return y},initScriptLoader:function(){return v}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s=e.r(55682),o=e.r(90809),a=e.r(43476),l=s._(e.r(74080)),h=o._(e.r(71645)),c=e.r(42732),u=e.r(22737),d=e.r(8341),f=e.r(19083),p=new Map,m=new Set,g=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:i=null,dangerouslySetInnerHTML:s,children:o="",strategy:a="afterInteractive",onError:h,stylesheets:c}=e,d=r||t;if(d&&m.has(d))return;if(p.has(t)){m.add(d),p.get(t).then(n,h);return}let f=()=>{i&&i(),m.add(d)},g=document.createElement("script"),y=new Promise((e,t)=>{g.addEventListener("load",function(t){e(),n&&n.call(this,t),f()}),g.addEventListener("error",function(e){t(e)})}).catch(function(e){h&&h(e)});s?(g.innerHTML=s.__html||"",f()):o?(g.textContent="string"==typeof o?o:Array.isArray(o)?o.join(""):"",f()):t&&(g.src=t,p.set(t,y)),(0,u.setAttributesFromProps)(g,e),"worker"===a&&g.setAttribute("type","text/partytown"),g.setAttribute("data-nscript",a),c&&(e=>{if(l.default.preinit)return e.forEach(e=>{l.default.preinit(e,{as:"style"})});if("u">typeof window){let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(c),document.body.appendChild(g)};function y(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,d.requestIdleCallback)(()=>g(e))}):g(e)}function v(e){e.forEach(y),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");m.add(t)})}function b(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:i=null,strategy:s="afterInteractive",onError:o,stylesheets:u,...p}=e,{updateScripts:y,scripts:v,getIsSsr:b,appDir:w,nonce:x}=(0,h.useContext)(c.HeadManagerContext);x=p.nonce||x;let k=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=t||r;k.current||(i&&e&&m.has(e)&&i(),k.current=!0)},[i,t,r]);let S=(0,h.useRef)(!1);if((0,h.useEffect)(()=>{if(!S.current){if("afterInteractive"===s)g(e);else"lazyOnload"===s&&("complete"===document.readyState?(0,d.requestIdleCallback)(()=>g(e)):window.addEventListener("load",()=>{(0,d.requestIdleCallback)(()=>g(e))}));S.current=!0}},[e,s]),("beforeInteractive"===s||"worker"===s)&&(y?(v[s]=(v[s]||[]).concat([{id:t,src:r,onLoad:n,onReady:i,onError:o,...p,nonce:x}]),y(v)):b&&b()?m.add(t||r):b&&!b()&&g({...e,nonce:x})),w){if(u&&u.forEach(e=>{l.default.preinit(e,{as:"style"})}),"beforeInteractive"===s)if(!r)return p.dangerouslySetInnerHTML&&(p.children=p.dangerouslySetInnerHTML.__html,delete p.dangerouslySetInnerHTML),(0,a.jsx)("script",{nonce:x,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${(0,f.htmlEscapeJsonString)(JSON.stringify([0,{...p,id:t}]))})`}});else return l.default.preload(r,p.integrity?{as:"script",integrity:p.integrity,nonce:x,crossOrigin:p.crossOrigin}:{as:"script",nonce:x,crossOrigin:p.crossOrigin}),(0,a.jsx)("script",{nonce:x,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${(0,f.htmlEscapeJsonString)(JSON.stringify([r,{...p,id:t}]))})`}});"afterInteractive"===s&&r&&l.default.preload(r,p.integrity?{as:"script",integrity:p.integrity,nonce:x,crossOrigin:p.crossOrigin}:{as:"script",nonce:x,crossOrigin:p.crossOrigin})}return null}Object.defineProperty(b,"__nextScript",{value:!0});let w=b;("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},3303,(e,t,r)=>{t.exports=e.r(79520)},83956,51974,e=>{"use strict";var t=e.i(43476),r=e.i(3303),n=e.i(71645);let i={venueId:"regattagrove",trackingSlug:"website",widgetType:"events",embedScript:"https://www.sevenrooms.com/widget/embed.js",embedUrl:"https://www.sevenrooms.com/events/regattagrove/website"};e.s(["SEVENROOMS_CONFIG",0,i,"SEVENROOMS_EVENTS_BOOK_URL",0,"https://www.sevenrooms.com/events/regattagrove","sevenRoomsTriggerId",0,function(e,t){return`sevenrooms-${e}-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`}],51974);let s=(0,n.createContext)(null),o=new Set;function a(){for(let e of document.body.children)e instanceof HTMLElement&&"9999998"===e.style.zIndex&&(e.style.position="fixed",e.style.inset="0",e.style.width="100%",e.style.height="100%",e.style.margin="0")}e.s(["SevenRoomsProvider",0,function({children:e}
31){let[o,l]=(0,n.useState)(!1),h=(0,n.useMemo)(()=>({isReady:o}),[o]);return(0,n.useEffect)(()=>{let e=new MutationObserver(a);return e.observe(document.body,{childList:!0}),()=>e.disconnect()},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.default,{src:i.embedScript,strategy:"lazyOnload",onLoad:()=>l(!0)}),(0,t.jsx)(s.Provider,{value:h,children:e})]})},"initSevenRoomsTrigger",0,function(e,t=i.widgetType){o.has(e)||document.getElementById(e)&&window.SevenroomsWidget&&(window.SevenroomsWidget.init({venueId:i.venueId,triggerId:e,type:t,trackingSlug:i.trackingSlug}),o.add(e))},"isSevenRoomsTriggerInitialized",0,function(e){return o.has(e)},"releaseSevenRoomsTrigger",0,function(e){o.delete(e)},"useSevenRooms",0,function(){let e=(0,n.useContext)(s);if(!e)throw Error("useSevenRooms must be used within SevenRoomsProvider");return e}],83956)},7386,e=>{"use strict";var t=e.i(43476),r=e.i(71645);let n=(0,r.createContext)(void 0);e.s(["ComponentRegistryProvider",0,function({children:e}){let[i,s]=(0,r.useState)([]),o=(0,r.useCallback)(e=>{s(t=>t.find(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e])},[]),a=(0,r.useCallback)(e=>{s(t=>t.filter(t=>t.id!==e))},[]),l=(0,r.useCallback)(()=>{s([])},[]),h=(0,r.useCallback)(e=>i.filter(t=>t.type===e),[i]),c=(0,r.useCallback)(e=>{let t=i.find(t=>t.id===e);t&&t.openDialog&&t.openDialog()},[i]);return(0,t.jsx)(n.Provider,{value:{components:i,registerComponent:o,unregisterComponent:a,clearRegistry:l,getComponentsByType:h,openComponentDialog:c},children:e})},"useComponentRegistry",0,function(){let e=(0,r.useContext)(n);if(void 0===e)throw Error("useComponentRegistry must be used within a ComponentRegistryProvider");return e}])},18655,e=>{"use strict";var t=e.i(43476),r=e.i(71645);let n="konamiState",i=(0,r.createContext)(void 0);e.s(["KonamiProvider",0,function({children:e}){let[s,o]=(0,r.useState)(!1),a="",l=Date.now();return(0,r.useEffect)(()=>{let e=localStorage.getItem(n);e&&o("true"===e)},[]),(0,r.useEffect)(()=>{let e=e=>{if(!e.key)return;let t=Date.now();if(t-l>1e3&&(a=""),l=t,(a+=e.key.toLowerCase()).includes("hyperlink")){let e=!s;o(e),localStorage.setItem(n,String(e)),a=""}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[s]),(0,t.jsx)(i.Provider,{value:{isVisible:s},children:e})},"useKonami",0,function(){let e=(0,r.useContext)(i);if(void 0===e)throw Error("useKonami must be used within a KonamiProvider");return e}])},67034,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,s=l(e),o=s[0],a=s[1],h=new i((o+a)*3/4-a),c=0,u=a>0?o-4:o;for(r=0;r<u;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],h[c++]=t>>16&255,h[c++]=t>>8&255,h[c++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,h[c++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,h[c++]=t>>8&255,h[c++]=255&t),h},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=0,a=n-i;o<a;o+=16383)s.push(function(e,t,n){for(var i,s=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)r[o]=s[o],n[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|f(n,i),l=o(s),h=l.write(n,i);return h!==s&&(l=l.slice(0,h)),l}if(ArrayBuffer.isView(e))return u(e);
vendor: 17,965 bytes, line 31
31if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(M(e,ArrayBuffer)||e&&M(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(M(e,SharedArrayBuffer)||e&&M(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return a.from(c,t,r);var p=function(e){if(a.isBuffer(e)){var t=0|d(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(p)return p;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return h(e),o(e<0?0:0|d(e))}function u(e){for(var t=e.length<0?0:0|d(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(h(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)};function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||M(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return T(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var i,s,o,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=R[e[s]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,s=t,o=r,0===s&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(s,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var s,o=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,r/=2}function h(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=r;s<a;s++)if(h(e,s)===h(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*o}else -1!==c&&(s-=s-c),c=-1}else for(r+l>a&&(r=a-l),s=r;s>=0;s--){for(var u=!0,d=0;d<l;d++)if(h(e,s+d)!==h(t,d)){u=!1;break}if(u)return s}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(M(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),M(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(M(s,Uint8Array)&&(s=a.from(s)),!a.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},a.byteLength=f,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):p.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(M(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,o=r-t,l=Math.min(s,o),h=this.slice(n,i),c=e.slice(t,r),u=0;u<l;++u)if(h[u]!==c[u]){s=h[u],o=c[u];break}return s<o?-1:+(o<s)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function v(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,o,a,l,h=e[i],c=null,u=h>239?4:h>223?3:h>191?2:1;if(i+u<=r)switch(u){case 1:h<128&&(c=h);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&h)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],o=e[i+2],(192&s)==128&&(192&o)==128&&(l=(15&h)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(l=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,u=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=u}var d=n,f=d.length;if(f<=4096)return String.fromCharCode.apply(String,d);for(var p="",m=0;m<f;)p+=String.fromCharCode.apply(String,d.slice(m,m+=4096));return p}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function x(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,s){return t*=1,r>>>=0,s||x(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function S(e,t,r,n,s){return t*=1,r>>>=0,s||x(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,o,a,l,h,c,u,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var f=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;n>s/2&&(n=s/2);for(var o=0;o<n;++o){var a,l=parseInt(t.substr(2*o,2),16);if((a=l)!=a)break;e[r+o]=l}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,O(A(e,this.length-i),this,i,s);case"ascii":return o=t,a=r,O(E(e),this,o,a);case"latin1":case"binary":return function(e,t,r,n){return O(E(t),e,r,n)}(this,e,t,r);case"base64":return l=t,h=r,O(T(e),this,l,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,u=r,O(function(e,t){for(var r,n,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,u);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var s=1,o=0;for(this[t]=255&e;++o<r&&(s*=256);)this[t+o]=e/s&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var s=r-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var s=i-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=a.isBuffer(e)?e:a.from(e,n),l=o.length;
31if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var C=/[^+/0-9A-Za-z-_]/g;function A(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function E(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function T(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function M(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var R=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,h=l>>1,c=-7,u=r?i-1:0,d=r?-1:1,f=e[t+u];for(u+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+u],u+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+u],u+=d,c-=8);if(0===s)s=1-h;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=h}return(f?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,l,h=8*s-i-1,c=(1<<h)-1,u=c>>1,d=5960464477539062e-23*(23===i),f=n?0:s-1,p=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?t+=d/l:t+=d*Math.pow(2,1-u),t*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(t*l-1)*Math.pow(2,i),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,h+=i;h>0;e[r+f]=255&o,f+=p,o/=256,h-=8);e[r+f-p]|=128*m}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},o=!0;try{n[e](r,r.exports,s),o=!1}finally{o&&delete i[e]}return r.exports}s.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=s(72)},88715,e=>{"use strict";let t,r,n,i=Symbol.for("@supabase/supabase-js.traceContextExtractor");class s extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class o extends s{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class a extends s{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class l extends s{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}(p=m||(m={})).Any="any",p.ApNortheast1="ap-northeast-1",p.ApNortheast2="ap-northeast-2",p.ApSouth1="ap-south-1",p.ApSoutheast1="ap-southeast-1",p.ApSoutheast2="ap-southeast-2",p.CaCentral1="ca-central-1",p.EuCentral1="eu-central-1",p.EuWest1="eu-west-1",p.EuWest2="eu-west-2",p.EuWest3="eu-west-3",p.SaEast1="sa-east-1",p.UsEast1="us-east-1",p.UsWest1="us-west-1",p.UsWest2="us-west-2";var h,c,u,d,f,p,m,g,y,v,b,w,x,k,S=e.i(90571);class C{constructor(e,{headers:t={},customFetch:r,region:n=m.Any}={}){this.url=e,this.headers=t,this.region=n,this.fetch=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return(0,S.__awaiter)(this,arguments,void 0,function*(e,t={}){var r,n;let i,s,h;try{let n,{headers:c,method:u,body:d,signal:f,timeout:p}=t,m={},{region:g}=t;g||(g=this.region);let y=new URL(`${this.url}/${e}`);g&&"any"!==g&&(m["x-region"]=g,y.searchParams.set("forceFunctionRegion",g));let v=!!c&&Object.keys(c).some(e=>"content-type"===e.toLowerCase());d&&!v?"u">typeof Blob&&d instanceof Blob||d instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",n=d):"string"==typeof d?(m["Content-Type"]="text/plain",n=d):"u">typeof FormData&&d instanceof FormData?n=d:(m["Content-Type"]="application/json",n=JSON.stringify(d)):n=!d||"string"==typeof d||"u">typeof Blob&&d instanceof Blob||d instanceof ArrayBuffer||"u">typeof FormData&&d instanceof FormData?d:JSON.stringify(d);let b=f;p&&(s=new AbortController,i=setTimeout(()=>s.abort(),p),f?(b=s.signal,h=()=>s.abort(),f.addEventListener("abort",h)):b=s.signal);let w=yield this.fetch(y.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),c),body:n,signal:b}).catch(e=>{throw new o(e)}),x=w.headers.get("x-relay-error");
31if(x&&"true"===x)throw new a(w);if(!w.ok)throw new l(w);let k=(null!=(r=w.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim().toLowerCase();return{data:"application/json"===k?yield w.json():"application/octet-stream"===k||"application/pdf"===k?yield w.blob():"text/event-stream"===k?w:"multipart/form-data"===k?yield w.formData():yield w.text(),error:null,response:w}}catch(e){return{data:null,error:e,response:e instanceof l||e instanceof a?e.context:void 0}}finally{i&&clearTimeout(i),h&&(null==(n=t.signal)||n.removeEventListener("abort",h))}})}}let A=e=>Math.min(1e3*2**e,3e4),E=[520,503],T=["GET","HEAD","OPTIONS"];var O=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=M(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=M(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==M(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function P(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();let n=setTimeout(()=>{null==t||t.removeEventListener("abort",i),r()},e);function i(){clearTimeout(n),r()}null==t||t.addEventListener("abort",i)})}var _=class{constructor(e){var t,r,n,i,s;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!=(t=e.shouldThrowOnError)&&t,this.signal=e.signal,this.isMaybeSingle=null!=(r=e.isMaybeSingle)&&r,this.shouldStripNulls=null!=(n=e.shouldStripNulls)&&n,this.urlLengthLimit=null!=(i=e.urlLengthLimit)?i:8e3,this.retryEnabled=null==(s=e.retry)||s,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){let e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}let n=this.fetch,i=(async()=>{let e=0;for(;;){var t,i,s,o,a;let l,h={};r.headers.forEach((e,t)=>{h[t]=e}),e>0&&(h["X-Retry-Count"]=String(e));try{l=await n(r.url.toString(),{method:r.method,headers:h,body:JSON.stringify(r.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:r.signal})}catch(t){if((null==t?void 0:t.name)==="AbortError"||(null==t?void 0:t.code)==="ABORT_ERR"||!T.includes(r.method))throw t;if(r.retryEnabled&&e<3){let t=A(e);e++,await P(t,r.signal);continue}throw t}if(t=r.method,i=l.status,s=e,r.retryEnabled&&!(s>=3)&&T.includes(t)&&E.includes(i)&&1){let t=null!=(o=null==(a=l.headers)?void 0:a.get("Retry-After"))?o:null,n=null!==t?1e3*Math.max(0,parseInt(t,10)||0):A(e);await l.text(),e++,await P(n,r.signal);continue}return await r.processResponse(l)}})();return this.shouldThrowOnError||(i=i.catch(e=>{var t,r,n,i,s,o;let a="",l="",h="",c=null==e?void 0:e.cause;if(c){let t=null!=(r=null==c?void 0:c.message)?r:"",o=null!=(n=null==c?void 0:c.code)?n:"";a=`${null!=(i=null==e?void 0:e.name)?i:"FetchError"}: ${null==e?void 0:e.message}
32
33Caused by: ${null!=(s=null==c?void 0:c.name)?s:"Error"}: ${t}`,o&&(a+=` (${o})`),(null==c?void 0:c.stack)&&(a+=`
34${c.stack}`)}else a=null!=(o=null==e?void 0:e.stack)?o:"";let u=this.url.toString().length;return(null==e?void 0:e.name)==="AbortError"||(null==e?void 0:e.code)==="ABORT_ERR"?(h="",l="Request was aborted (timeout or manual cancellation)",u>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${u} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((null==c?void 0:c.name)==="HeadersOverflowError"||(null==c?void 0:c.code)==="UND_ERR_HEADERS_OVERFLOW")&&(h="",l="HTTP headers exceeded server limits (typically 16KB)",u>this.urlLengthLimit&&(l+=`. Your request URL is ${u} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!=(t=null==e?void 0:e.name)?t:"FetchError"}: ${null==e?void 0:e.message}`,details:a,hint:l,code:h},data:null,count:null,status:0,statusText:""}}
34)),i.then(e,t)}async processResponse(e){var t,r,n,i;let s=null,o=null,a=null,l=e.status,h=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();if(""===t);else if("text/csv"===this.headers.get("Accept"))o=t;else if(this.headers.get("Accept")&&(null==(n=this.headers.get("Accept"))?void 0:n.includes("application/vnd.pgrst.plan+text")))o=t;else try{o=JSON.parse(t)}catch(e){if(s={message:t},o=null,this.shouldThrowOnError)throw new O({message:t,details:"",hint:"",code:""})}}let c=null==(t=this.headers.get("Prefer"))?void 0:t.match(/count=(exact|planned|estimated)/),u=null==(r=e.headers.get("content-range"))?void 0:r.split("/");if(c&&u&&u.length>1&&(a=parseInt(u[1])),this.isMaybeSingle&&Array.isArray(o))if(o.length>1){if(s={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,a=null,l=406,h="Not Acceptable",this.shouldThrowOnError)throw new O(N(N({},s),{},{hint:null!=(i=s.hint)?i:""}))}else o=1===o.length?o[0]:null}else{let t=await e.text();try{s=JSON.parse(t),Array.isArray(s)&&404===e.status&&(o=[],s=null,l=200,h="OK")}catch(r){404===e.status&&""===t?(l=204,h="No Content"):s={message:t}}if(s&&this.shouldThrowOnError)throw new O(s)}return{success:null===s,error:s,data:o,count:a,status:l,statusText:h}}returns(){return this}overrideTypes(){return this}},D=class extends _{throwOnError(){return super.throwOnError()}select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){let s=i?`${i}.order`:"order",o=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let i=void 0===n?"offset":`${n}.offset`,s=void 0===n?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(s,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:s="text"}={}){var o;let a=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=null!=(o=this.headers.get("Accept"))?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${a};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};let I=RegExp("[,()]");var j=class extends D{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&I.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&I.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let i="";"plain"===n?i="pl":"phrase"===n?i="ph":"websearch"===n&&(i="w");let s=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${s}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},L=class{constructor(e,{headers:t={},schema:r,fetch:n,urlLengthLimit:i=8e3,retry:s}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n,this.urlLengthLimit=i,this.retry=s}
34cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:r=!1,count:n}=null!=t?t:{},i=!1,s=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e)).join(""),{url:o,headers:a}=this.cloneRequestState();return o.searchParams.set("select",s),n&&a.append("Prefer",`count=${n}`),new j({method:r?"HEAD":"GET",url:o,headers:a,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;let{url:i,headers:s}=this.cloneRequestState();if(t&&s.append("Prefer",`count=${t}`),r||s.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);i.searchParams.set("columns",e.join(","))}}return new j({method:"POST",url:i,headers:s,schema:this.schema,body:e,fetch:null!=(n=this.fetch)?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:i=!0}={}){var s;let{url:o,headers:a}=this.cloneRequestState();if(a.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&o.searchParams.set("on_conflict",t),n&&a.append("Prefer",`count=${n}`),i||a.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);o.searchParams.set("columns",e.join(","))}}return new j({method:"POST",url:o,headers:a,schema:this.schema,body:e,fetch:null!=(s=this.fetch)?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;let{url:n,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new j({method:"PATCH",url:n,headers:i,schema:this.schema,body:e,fetch:null!=(r=this.fetch)?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;let{url:r,headers:n}=this.cloneRequestState();return e&&n.append("Prefer",`count=${e}`),new j({method:"DELETE",url:r,headers:n,schema:this.schema,fetch:null!=(t=this.fetch)?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},B=class e{constructor(e,{headers:t={},schema:r,fetch:n,timeout:i,urlLengthLimit:s=8e3,retry:o}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.urlLengthLimit=s;const a=null!=n?n:globalThis.fetch;void 0!==i&&i>0?this.fetch=(e,t)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),i),s=null==t?void 0:t.signal;if(s){if(s.aborted)return clearTimeout(n),a(e,t);let i=()=>{clearTimeout(n),r.abort()};return s.addEventListener("abort",i,{once:!0}),a(e,N(N({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(n),s.removeEventListener("abort",i)})}return a(e,N(N({},t),{},{signal:r.signal})).finally(()=>clearTimeout(n))}:this.fetch=a,this.retry=o}from(e){if(!e||"string"!=typeof e||""===e.trim())throw Error("Invalid relation name: relation must be a non-empty string.");return new L(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:n=!1,count:i}={}){var s;let o,a,l=new URL(`${this.url}/rpc/${e}`),h=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(h)),c=r&&Object.values(t).some(h);c?(o="POST",a=t):r||n?(o=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{l.searchParams.append(e,t)})):(o="POST",a=t);let u=new Headers(this.headers);return c?u.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&u.set("Prefer",`count=${i}`),new j({method:o,url:l,headers:u,schema:this.schemaName,body:a,fetch:null!=(s=this.fetch)?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};let $=class{static detectEnvironment(){var t;if("u">typeof WebSocket)return{type:"native",wsConstructor:WebSocket};let r=globalThis;if("u">typeof globalThis&&void 0!==r.WebSocket)return{type:"native",wsConstructor:r.WebSocket};let n=e.g;if(n&&void 0!==n.WebSocket)return{type:"native",wsConstructor:n.WebSocket};if("u">typeof globalThis&&void 0!==r.WebSocketPair&&void 0===globalThis.WebSocket)return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if("u">typeof globalThis&&r.EdgeRuntime||"u">typeof navigator&&(null==(t=navigator.userAgent)?void 0:t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let i=globalThis.process;if(i){let e=i.versions;if(e&&e.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
35
36Suggested solution: ${e.workaround}`),Error(t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return"native"===e.type}catch(e){return!1}}},z="2.0.0",F="errored",H="joined",W={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave",access_token:"access_token"};class U{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=e?e:[]}encode(e,t){return e.event!==this.BROADCAST_EVENT||e.payload instanceof ArrayBuffer||"string"!=typeof e.payload.event?t(JSON.stringify([e.join_ref,e.ref,e.topic,e.event,e.payload])):t(this._binaryEncodeUserBroadcastPush(e))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer(null==(t=e.payload)?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,r;let n=null!=(r=null==(t=e.payload)?void 0:t.payload)?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var t,r;let n=null!=(r=null==(t=e.payload)?void 0:t.payload)?r:{},i=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,i)}_encodeUserBroadcastPush(e,t,r){let n=new TextEncoder,i=n.encode(e.topic),s=n.encode(null!=(m=e.ref)?m:""),o=n.encode(null!=(g=e.join_ref)?g:""),a=n.encode(e.payload.event),l=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=n.encode(0===Object.keys(l).length?"":JSON.stringify(l));if(o.length>255)throw Error(`joinRef length ${o.length} exceeds maximum of 255`);if(s.length>255)throw Error(`ref length ${s.length} exceeds maximum of 255`);if(i.length>255)throw Error(`topic length ${i.length} exceeds maximum of 255`);if(a.length>255)throw Error(`userEvent length ${a.length} exceeds maximum of 255`);if(h.length>255)throw Error(`metadata length ${h.length} exceeds maximum of 255`);let c=this.USER_BROADCAST_PUSH_META_LENGTH+o.length+s.length+i.length+a.length+h.length,u=new ArrayBuffer(this.HEADER_LENGTH+c),d=new DataView(u),f=new Uint8Array(u),p=0;d.setUint8(p++,this.KINDS.userBroadcastPush),d.setUint8(p++,o.length),d.setUint8(p++,s.length),d.setUint8(p++,i.length),d.setUint8(p++,a.length),d.setUint8(p++,h.length),d.setUint8(p++,t),f.set(o,p),p+=o.length,f.set(s,p),p+=s.length,f.set(i,p),p+=i.length,f.set(a,p),p+=a.length,f.set(h,p),p+=h.length;var m,g,y=new Uint8Array(u.byteLength+r.byteLength);return y.set(new Uint8Array(u),0),y.set(new Uint8Array(r),u.byteLength),y.buffer}decode(e,t){if(this._isArrayBuffer(e))return t(this._binaryDecode(e));if("string"==typeof e){let[r,n,i,s,o]=JSON.parse(e);return t({join_ref:r,ref:n,topic:i,event:s,payload:o})}return t({})}_binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,t,n)}_decodeUserBroadcast(e,t,r){let n=t.getUint8(1),i=t.getUint8(2),s=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+4,l=r.decode(e.slice(a,a+n));a+=n;let h=r.decode(e.slice(a,a+i));a+=i;let c=r.decode(e.slice(a,a+s));a+=s;let u=e.slice(a,e.byteLength),d=o===this.JSON_ENCODING?JSON.parse(r.decode(u)):u,f={type:this.BROADCAST_EVENT,event:h,payload:d};return s>0&&(f.meta=JSON.parse(c)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:f}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||(null==(t=null==e?void 0:e.constructor)?void 0:t.name)==="ArrayBuffer"}_pick(e,t){return e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e))):{}}}(h=g||(g={})).abstime="abstime",h.bool="bool",h.date="date",h.daterange="daterange",h.float4="float4",h.float8="float8",h.int2="int2",h.int4="int4",h.int4range="int4range",h.int8="int8",h.int8range="int8range",h.json="json",h.jsonb="jsonb",h.money="money",h.numeric="numeric",h.oid="oid",h.reltime="reltime",h.text="text",h.time="time",h.timestamp="timestamp",h.timestamptz="timestamptz",h.timetz="timetz",h.tsrange="tsrange",h.tstzrange="tstzrange";let V=(e,t,r={})=>{var n;let i=null!=(n=r.skipTypes)?n:[];return t?Object.keys(t).reduce((r,n)=>(r[n]=q(n,e,t,i),r),{}):{}},q=(e,t,r,n)=>{let i=t.find(t=>t.name===e),s=null==i?void 0:i.type,o=r[e];return s&&!n.includes(s)?K(s,o):J(o)},K=(e,t)=>{if("_"===e.charAt(0))return Q(t,e.slice(1,e.length));switch(e){case g.bool:return G(t);case g.float4:case g.float8:case g.int2:case g.int4:case g.int8:case g.numeric:case g.oid:return Y(t);case g.json:case g.jsonb:return X(t);case g.timestamp:return Z(t);case g.abstime:case g.date:case g.daterange:case g.int4range:case g.int8range:case g.money:case g.reltime:case g.text:case g.time:case g.timestamptz:case g.timetz:case g.tsrange:case g.tstzrange:default:return J(t)}},J=e=>e,G=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Y=e=>{if("string"==typeof e){let t=parseFloat(e);
36if(!Number.isNaN(t))return t}return e},X=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},Q=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,n=e[r];if("{"===e[0]&&"}"===n){let n,i=e.slice(1,r);try{n=JSON.parse("["+i+"]")}catch(e){n=i?i.split(","):[]}return n.map(e=>K(t,e))}return e},Z=e=>"string"==typeof e?e.replace(" ","T"):e,ee=e=>{let t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),""===t.pathname||"/"===t.pathname?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var et=e=>"function"==typeof e?e:function(){return e},er="u">typeof window?window:null,en=("u">typeof self?self:null)||er||globalThis,ei="closed",es="errored",eo="joined",ea="joining",el="leaving",eh="phx_close",ec="phx_error",eu="phx_reply",ed="phx_leave",ef="websocket",ep="base64url.bearer.phx.",em=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},eg=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},ey=class{constructor(e,t,r){this.state=ei,this.topic=e,this.params=et(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new em(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new eg(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=eo,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=es,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=ei,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=es,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new em(this,ed,et({}),this.timeout).send(),this.state=es,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(eu,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(!this.joinedOnce)return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush;throw Error("tried to join multiple times. 'join' can only be called a single time per channel instance")}
36teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ei,this.bindings=[]}onClose(e){this.on(eh,e)}onError(e){return this.on(ec,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>r.event!==e||void 0!==t&&t!==r.ref)}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new em(this,e,function(){return t},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=el;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(eh,"leave")},r=new em(this,ed,et({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,n){return this.topic===e&&(!n||n===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=ea,this.joinPush.resend(e))}trigger(e,t,r,n){let i=this.onMessage(e,t,r,n);if(t&&!i)throw Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter(n=>n.event===e&&this.filterBindings(n,t,r));for(let e=0;e<s.length;e++)s[e].callback(i,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===ei}isErrored(){return this.state===es}isJoined(){return this.state===eo}isJoining(){return this.state===ea}isLeaving(){return this.state===el}},ev=class{static request(e,t,r,n,i,s,o){if(en.XDomainRequest){let r=new en.XDomainRequest;return this.xdomainRequest(r,e,t,n,i,s,o)}if(en.XMLHttpRequest){let a=new en.XMLHttpRequest;return this.xhrRequest(a,e,t,r,n,i,s,o)}if(en.fetch&&en.AbortController)return this.fetchRequest(e,t,r,n,i,s,o);throw Error("No suitable XMLHttpRequest implementation found")}static fetchRequest(e,t,r,n,i,s,o){let a={method:e,headers:r,body:n},l=null;return i&&(l=new AbortController,setTimeout(()=>l.abort(),i),a.signal=l.signal),en.fetch(t,a).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>o&&o(e)).catch(e=>{"AbortError"===e.name&&s?s():o&&o(null)}),l}static xdomainRequest(e,t,r,n,i,s,o){return e.timeout=i,e.open(t,r),e.onload=()=>{let t=this.parseJSON(e.responseText);o&&o(t)},s&&(e.ontimeout=s),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,i,s,o,a){for(let[i,o]of(e.open(t,r,!0),e.timeout=s,Object.entries(n)))e.setRequestHeader(i,o);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{4===e.readyState&&a&&a(this.parseJSON(e.responseText))},o&&(e.ontimeout=o),e.send(i),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let i=t?`${t}[${n}]`:n,s=e[n];"object"==typeof s?r.push(this.serialize(s,i)):r.push(encodeURIComponent(i)+"="+encodeURIComponent(s))}return r.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},eb=class{constructor(e,t){t&&2===t.length&&t[1].startsWith(ep)&&(this.authToken=atob(t[1].slice(ep.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(RegExp("(.*)/"+ef),"$1/longpoll")}endpointURL(){return ev.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=0}
36ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return 1===this.readyState||0===this.readyState}poll(){let e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:r,messages:n}=e;if(410===t&&null!==this.token){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else t=0;switch(t){case 200:n.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=(e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let e=0;e<n;e++)t+=String.fromCharCode(r[e]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e,t=0){this.awaitingBatchAck=!0;let r=t+100,n=e.slice(t,r);this.ajax("POST",{"Content-Type":"application/x-ndjson"},n.join("\n"),()=>
36this.onerror("timeout"),t=>{t&&200===t.status?r<e.length?this.batchSend(e,r):this.batchBuffer.length>0?(this.batchSend(this.batchBuffer),this.batchBuffer=[]):this.awaitingBatchAck=!1:(this.awaitingBatchAck=!1,this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,r){for(let e of this.reqs)e.abort();this.readyState=3;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"u">typeof CloseEvent?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,r,n,i){let s,o=()=>{this.reqs.delete(s),n()};s=ev.request(e,this.endpointURL(),t,r,this.timeout,o,e=>{this.reqs.delete(s),this.isActive()&&i(e)}),this.reqs.add(s)}},ew=class e{constructor(t,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state=Object.create(null),this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,t=>{let{onJoin:r,onLeave:n,onSync:i}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,r,n),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,r,n)}),this.pendingDiffs=[],i()}),this.channel.on(n.diff,t=>{let{onJoin:r,onLeave:n,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,r,n),i())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,r,n){let i=this.toNullProtoObj(this.clone(e));t=this.toNullProtoObj(t);let s=Object.create(null),o=Object.create(null);return this.map(i,(e,r)=>{t[e]||(o[e]=r)}),this.map(t,(e,t)=>{let r=i[e];if(r){let n=t.metas.map(e=>e.phx_ref),i=r.metas.map(e=>e.phx_ref),a=t.metas.filter(e=>0>i.indexOf(e.phx_ref)),l=r.metas.filter(e=>0>n.indexOf(e.phx_ref));a.length>0&&(s[e]=t,s[e].metas=a),l.length>0&&(o[e]=this.clone(r),o[e].metas=l)}else s[e]=t}),this.syncDiff(i,{joins:s,leaves:o},r,n)}static syncDiff(e,t,r,n){e=this.toNullProtoObj(e);let{joins:i,leaves:s}=this.clone(t);return r||(r=function(){}),n||(n=function(){}),this.map(i,(t,n)=>{let i=e[t];if(e[t]=this.clone(n),i){let r=e[t].metas.map(e=>e.phx_ref),n=i.metas.filter(e=>0>r.indexOf(e.phx_ref));e[t].metas.unshift(...n)}r(t,i,n)}),this.map(s,(t,r)=>{let i=e[t];if(!i)return;let s=r.metas.map(e=>e.phx_ref);i.metas=i.metas.filter(e=>0>s.indexOf(e.phx_ref)),n(t,i,r),0===i.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,r)=>t(e,r))}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static toNullProtoObj(e){if(null===Object.getPrototypeOf(e))return e;let t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t}static clone(e){return JSON.parse(JSON.stringify(e))}},ex={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){return e.payload.constructor===ArrayBuffer?t(this.binaryEncode(e)):t(JSON.stringify([e.join_ref,e.ref,e.topic,e.event,e.payload]))},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,i,s,o]=JSON.parse(e);return t({join_ref:r,ref:n,topic:i,event:s,payload:o})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:i,payload:s}=e,o=new TextEncoder,a=o.encode(t),l=o.encode(r),h=o.encode(i),c=o.encode(n);this.assertFieldSize(a.byteLength,"join_ref"),this.assertFieldSize(l.byteLength,"ref"),this.assertFieldSize(h.byteLength,"topic"),this.assertFieldSize(c.byteLength,"event");let u=this.META_LENGTH+a.byteLength+l.byteLength+h.byteLength+c.byteLength,d=new ArrayBuffer(this.HEADER_LENGTH+u),f=new Uint8Array(d),p=new DataView(d),m=0;p.setUint8(m++,this.KINDS.push),p.setUint8(m++,a.byteLength),p.setUint8(m++,l.byteLength),p.setUint8(m++,h.byteLength),p.setUint8(m++,c.byteLength),f.set(a,m),m+=a.byteLength,f.set(l,m),m+=l.byteLength,f.set(h,m),m+=h.byteLength,f.set(c,m),m+=c.byteLength;var g=new Uint8Array(d.byteLength+s.byteLength);return g.set(f,0),g.set(new Uint8Array(s),d.byteLength),g.buffer},assertFieldSize(e,t){if(e>255)throw Error(`unable to convert ${t} to binary: must be less than or equal to 255 bytes, but is ${e} bytes`)},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;
36switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),i=t.getUint8(2),s=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(e.slice(o,o+n));o+=n;let l=r.decode(e.slice(o,o+i));o+=i;let h=r.decode(e.slice(o,o+s));return o+=s,{join_ref:a,ref:null,topic:l,event:h,payload:e.slice(o,e.byteLength)}},decodeReply(e,t,r){let n=t.getUint8(1),i=t.getUint8(2),s=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(e.slice(a,a+n));a+=n;let h=r.decode(e.slice(a,a+i));a+=i;let c=r.decode(e.slice(a,a+s));a+=s;let u=r.decode(e.slice(a,a+o));return a+=o,{join_ref:l,ref:h,topic:c,event:eu,payload:{status:u,response:e.slice(a,e.byteLength)}}},decodeBroadcast(e,t,r){let n=t.getUint8(1),i=t.getUint8(2),s=this.HEADER_LENGTH+2,o=r.decode(e.slice(s,s+n));s+=n;let a=r.decode(e.slice(s,s+i));return s+=i,{join_ref:null,ref:null,topic:o,event:a,payload:e.slice(s,e.byteLength)}}},ek=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||1e4,this.transport=t.transport||en.WebSocket||eb,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=en&&en.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=ex.encode.bind(ex),this.defaultDecoder=ex.decode.bind(ex),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==eb?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;er&&er.addEventListener&&(er.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),n=this.connectClock)}),er.addEventListener("pageshow",e=>{n===this.connectClock&&(n=null,this.connect())}),er.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,r)=>{console.log(`${e}: ${t}`,r)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=et(t.params||{}),this.endPoint=`${e}/${ef}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new eg(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken&&et(t.authToken)}getLongPollTransport(){return eb}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=ev.appendParams(ev.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=et(e)),(!this.conn||this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==eb?this.connectWithF
36allback(eb,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(i=>{i.ref===t&&(this.off([n]),e(Date.now()-r))});return!0}transportName(e){return e===eb?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${ep}${btoa(this.authToken()).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){let r,n;clearTimeout(this.fallbackTimer);let i=!1,s=!0,o=this.transportName(e),a=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([r,n]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),n=this.onError(e=>{this.log("transport","error",e),s&&!i&&(clearTimeout(this.fallbackTimer),a(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!s){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();let n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){5!==r&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r):t()}waitForSocketClosed(e,t,r=1){5===r||3===e.readyState?t():setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError(e)}
36triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(ec,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let r=new ey(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:i,join_ref:s}=e;this.log("push",`${t} ${r} (${s}, ${i})`,n)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef)return void this.heartbeatTimeout();this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:r,payload:n,ref:i,join_ref:s}=e;if(i&&i===this.pendingHeartbeatRef){let e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===n.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${n.status||""} ${t} ${r} ${i&&"("+i+")"||""}`.trim(),n);for(let e=0;e<this.channels.length;e++){let o=this.channels[e];o.isMember(t,r,n,s)&&o.trigger(r,n,i,s)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,n])=>{try{n(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class eS{constructor(e,t){const r=function(e){return(null==e?void 0:e.events)&&{events:e.events}}(t);this.presence=new ew(e.getChannel(),r),this.presence.onJoin((t,r,n)=>{let i=eS.onJoinPayload(t,r,n);e.getChannel().trigger("presence",i)}),this.presence.onLeave((t,r,n)=>{let i=eS.onLeavePayload(t,r,n);e.getChannel().trigger("presence",i)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return eS.transformState(this.presence.state)}static transformState(e){return Object.getOwnPropertyNames(e=JSON.parse(JSON.stringify(e))).reduce((t,r)=>{let n=e[r];return t[r]=eC(n),t},{})}static onJoinPayload(e,t,r){return{event:"join",key:e,currentPresences:eA(t),newPresences:eC(r)}}static onLeavePayload(e,t,r){return{event:"leave",key:e,currentPresences:eA(t),leftPresences:eC(r)}}}function eC(e){return e.metas.map(e=>{let t=Object.defineProperties({},Object.getOwnPropertyDescriptors(e));return t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t})}function eA(e){return(null==e?void 0:e.metas)?eC(e):[]}(c=y||(y={})).SYNC="sync",c.JOIN="join",c.LEAVE="leave";class eE{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new eS(this.channel.channelAdapter,t)}}class eT{constructor(e,t,r){const n=function(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}(r);this.channel=e.getSocket().channel(t,n),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,t){return this.channel.on(e,t)}off(e,t){this.channel.off(e,t)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,t,r){let n;try{n=this.channel.push(e,t,r)}catch(t){throw Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>100){let e=this.channel.pushBuffer.shift();e.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload())}return n}updateJoinPayload(e){let t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),e)}canPush(){return this.socket.isConnected()&&this.state===H}isJoined(){return this.state===H}isJoining(){return"joining"===this.state}isClosed(){return"closed"===this.state}isLeaving(){return"leaving"===this.state}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}let eO=/[,()"\\]/,eM=e=>{let t=null===e?"null":String(e);return eO.test(t)||t!==t.trim()?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t};class eR{constructor(){this.filters=[]}add(e,t,r,n=!1){return this.filters.push(`${e}=${n?"not.":""}${((e,t)=>{if("in"===e){let e=Array.isArray(t)?t:[t];if(0===e.length)throw Error("Realtime `in` filter requires at least one value.");let r=Array.from(new Set(e)).map(e=>eM(e)).join(",");return`in.(${r})`}if("is"===e)return`is.${null===t?"null":String(t)}`;return`${e}.${eM(t)}`})(t,r)}`),this}eq(e,t){return this.add(e,"eq",t)}neq(e,t){return this.add(e,"neq",t)}gt(e,t){return this.add(e,"gt",t)}gte(e,t){return this.add(e,"gte",t)}lt(e,t){return this.add(e,"lt",t)}lte(e,t){return this.add(e,"lte",t)}in(e,t){return this.add(e,"in",t)}like(e,t){return this.add(e,"like",t)}ilike(e,t){return this.add(e,"ilike",t)}match(e,t){return this.add(e,"match",t)}imatch(e,t){return this.add(e,"imatch",t)}is(e,t){return this.add(e,"is",t)}isDistinct(e,t){return this.add(e,"isdistinct",t)}not(e,t,r){return this.add(e,t,r,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}(u=v||(v={})).ALL="*",u.INSERT="INSERT",u.UPDATE="UPDATE",u.DELETE="DELETE",(d=b||(b={})).BROADCAST="broadcast",d.PRESENCE="presence",d.POSTGRES_CHANGES="postgres_changes",d.SYSTEM="system",(f=w||(w={})).SUBSCRIBED="SUBSCRIBED",f.TIMED_OUT="TIMED_OUT",f.CLOSED="CLOSED",f.CHANNEL_ERROR="CHANNEL_ERROR";class eN{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},r){var n,i;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.channelAdapter=new eT(this.socket.socketAdapter,e,this.params),this.presence=new eE(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=ee(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null==(i=null==(n=this.params.config)?void 0:n.broadcast)?void 0:i.replay))throw Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,n,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){let{config:{broadcast:s,presence:o,private:a}}=this.params,l=null!=(n=null==(r=this.bindings.postgres_changes)?void 0:r.map(e=>e.filter))?n:[],h=!!this.bindings[b.PRESENCE]&&this.bindings[b.PRESENCE].length>0||(null==(i=this.params.config.presence)?void 0:i.enabled)===!0,c={},u={broadcast:s,presence:Object.assign(Object.assign({},o),{enabled:h}),postgres_changes:l,private:a};this.socket.accessTokenValue&&(c.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(w.CHANNEL_ERROR,function(e){if(e instanceof Error)return e;if("string"==typeof e)return Error(e);
36if(e&&"object"==typeof e){if("number"==typeof e.code){let t="string"==typeof e.reason&&e.reason?` (${e.reason})`:"";return Error(`socket closed: ${e.code}${t}`,{cause:e})}return Error("channel error: transport failure",{cause:e})}return Error("channel error: connection lost")}(t))}),this._onClose(()=>null==e?void 0:e(w.CLOSED)),this.updateJoinPayload(Object.assign({config:u},c)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive("ok",async({postgres_changes:t})=>{if(this.socket._isManualToken()||this.socket.setAuth(),void 0===t){null==e||e(w.SUBSCRIBED);return}this._updatePostgresBindings(t,e)}).receive("error",t=>{this.state=F;let r=Object.values(t).join(", ")||"error";null==e||e(w.CHANNEL_ERROR,Error(r,{cause:t}))}).receive("timeout",()=>{null==e||e(w.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var r;let n=this.bindings.postgres_changes,i=null!=(r=null==n?void 0:n.length)?r:0,s=[];for(let r=0;r<i;r++){let i=n[r],{filter:{event:o,schema:a,table:l,filter:h}}=i,c=e&&e[r];if(c&&c.event===o&&eN.isFilterValueEqual(c.schema,a)&&eN.isFilterValueEqual(c.table,l)&&eN.isFilterValueEqual(c.filter,h))s.push(Object.assign(Object.assign({},i),{id:c.id}));else{this.unsubscribe(),this.state=F,null==t||t(w.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=s,this.state!=F&&t&&t(w.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){let n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===b.PRESENCE||e===b.POSTGRES_CHANGES;if(n&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,t,r)}async httpSend(e,t,r={}){var n;if(null==t)return Promise.reject(Error("Payload is required for httpSend()"));let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t),s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":i?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);let o=new URL(this.broadcastEndpointURL);o.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&o.searchParams.set("private","true");let a={method:"POST",headers:s,body:i?t:JSON.stringify(t)},l=await this._fetchWithTimeout(o.toString(),a,null!=(n=r.timeout)?n:this.timeout);if(202===l.status)return{success:!0};if(404===l.status)return Promise.reject(Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let h=l.statusText;try{let e=await l.json();h=e.error||e.message||h}catch(e){}return Promise.reject(Error(h))}async send(e,t={}){var r,n;if(this.channelAdapter.canPush()||"broadcast"!==e.type)return new Promise(r=>{var n,i,s;let o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null==(s=null==(i=null==(n=this.params)?void 0:n.config)?void 0:i.broadcast)?void 0:s.ack)||r("ok"),o.receive("ok",()=>r("ok")),o.receive("error",()=>r("error")),o.receive("timeout",()=>r("timed out"))});{let i="Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
36in the future. Please use httpSend() explicitly for REST delivery.";this.socket.hasLogger()?this.socket.log("channel",i):console.warn(i);let{event:s,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);let l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,l,null!=(r=t.timeout)?r:this.timeout);return await (null==(n=e.body)?void 0:n.cancel()),e.ok?"ok":"error"}catch(e){if(e instanceof Error&&"AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>t("ok")).receive("timeout",()=>t("timed out")).receive("error",()=>t("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,r){let n=new AbortController,i=setTimeout(()=>n.abort(),r),s=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(i),s}_on(e,t,r){var n;let i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;if((s instanceof eR||"object"==typeof s&&null!==s&&"function"==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()})),i===b.POSTGRES_CHANGES&&(null==(n=this.bindings[i])?void 0:n.find(e=>eN.isSamePostgresFilter(e.filter,t))))return this.socket.log("error",`duplicate \`postgres_changes\` binding for ${this.topic} ignored`,t),this;let o=this.channelAdapter.on(e,r),a={type:i,filter:t,callback:r,ref:o};return this.bindings[i]?this.bindings[i].push(a):this.bindings[i]=[a],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,r)=>{var n,i,s,o,a,l,h;let c=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(c,r))return!1;let u=null==(n=this.bindings[c])?void 0:n.find(t=>t.ref===e.ref);if(!u)return!0;if(!["broadcast","presence","postgres_changes"].includes(c))return u.type.toLocaleLowerCase()===c;if("id"in u){let e=u.id,r=null==(i=u.filter)?void 0:i.event;return e&&(null==(s=t.ids)?void 0:s.includes(e))&&("*"===r||(null==r?void 0:r.toLocaleLowerCase())===(null==(o=t.data)?void 0:o.type.toLocaleLowerCase()))}{let e=null==(l=null==(a=null==u?void 0:u.filter)?void 0:a.event)?void 0:l.toLocaleLowerCase();return"*"===e||e===(null==(h=null==t?void 0:t.event)?void 0:h.toLocaleLowerCase())}})}_notThisChannelEvent(e,t){let{close:r,error:n,leave:i,join:s}=W;return t&&[r,n,i,s].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,r)=>{if("object"==typeof t&&"ids"in t){let e=t.data,{schema:r,table:n,commit_timestamp:i,type:s,errors:o}=e;return Object.assign(Object.assign({},{schema:r,table:n,commit_timestamp:i,eventType:s,new:{},old:{},errors:o}),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw Error("cannot copy bindings into joined channel");for(let t in e.bindings)for(let r of e.bindings[t])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}static isSamePostgresFilter(e,t){var r,n,i,s;let o=null!=(n=null==(r=null==e?void 0:e.select)?void 0:r.join())?n:void 0,a=null!=(s=null==(i=null==t?void 0:t.select)?void 0:i.join())?s:void 0;return(null==e?void 0:e.event)===(null==t?void 0:t.event)&&eN.isFilterValueEqual(null==e?void 0:e.schema,null==t?void 0:t.schema)&&eN.isFilterValueEqual(null==e?void 0:e.table,null==t?void 0:t.table)&&eN.isFilterValueEqual(null==e?void 0:e.filter,null==t?void 0:t.filter)&&o===a}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=V(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=V(e.columns,e.old_record)),t}}class eP{constructor(e,t){this.socket=new ek(e,t)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,t,r,n=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),n),this.socket.disconnect(()=>{e(),i("ok")},t,r)})}push(e){this.socket.push(e)}log(e,t,r){this.socket.log(e,t,r)}hasLogger(){return this.socket.hasLogger()}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return"connecting"==this.socket.connectionState()}isDisconnecting(){return"closing"==this.socket.connectionState()}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}let e_=[1e3,2e3,5e3,1e4],eD=`
37  addEventListener("message", (e) => {
38    if (e.data.event === "start") {
39      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
40    }
41  });`;class eI{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var r;if(this.channels=[],this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
41,this.ref=0,this.serializer=new U,this._manuallySetToken=!1,this._authPromise=null,this._authGeneration=0,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null==(r=null==t?void 0:t.params)?void 0:r.apikey))throw Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey;const n=this._initializeOptions(t);this.socketAdapter=new eP(e,n),this.httpEndpoint=ee(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){let e=t.message;throw Error(`WebSocket not available: ${e}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return(this._cancelPendingDisconnect(),this.isDisconnecting())?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return"ok"===t&&e.teardown(),t}async removeAllChannels(){let e=this.channels.map(async e=>{let t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,r){this.socketAdapter.log(e,t,r)}hasLogger(){return this.socketAdapter.hasLogger()}connectionState(){return this.socketAdapter.connectionState()||"closed"}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){let r=`realtime:${e}`,n=this.getChannels().find(e=>e.topic===r);if(n)return n;{let r=new eN(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(r),r}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){let t=++this._authGeneration,r=this._performAuth(e,t);t===this._authGeneration&&(this._authPromise=r);try{await r}finally{this._authPromise===r&&(this._authPromise=null)}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
41this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e,t){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(e){this.log("error","Error fetching access token from callback",e),r=this.accessTokenValue}else r=this.accessTokenValue;t===this._authGeneration&&(this.accessToken?this._manuallySetToken=!1:n&&(this._manuallySetToken=!0),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(e=>{let t={access_token:r,version:"realtime-js/2.112.4"};e.updateJoinPayload(t),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(W.access_token,{access_token:r})})))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log("error","error waiting for auth on connect",e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,r)=>{"disconnected"!==t&&("sent"==t&&this._setAuthSafely(),e&&e(t,r))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([eD],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var t,r,n,i,s,o,a,l,h,c,u,d;let f,p;this.worker=null!=(t=null==e?void 0:e.worker)&&t,this.accessToken=null!=(r=null==e?void 0:e.accessToken)?r:null;let m={};m.timeout=null!=(n=null==e?void 0:e.timeout)?n:1e4,m.heartbeatIntervalMs=null!=(i=null==e?void 0:e.heartbeatIntervalMs)?i:25e3,this._disconnectOnEmptyChannelsAfterMs=null!=(s=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)?s:2*(null!=(o=null==e?void 0:e.heartbeatIntervalMs)?o:25e3),m.transport=null!=(a=null==e?void 0:e.transport)?a:$.getWebSocketConstructor(),m.params=null==e?void 0:e.params,m.logger=null==e?void 0:e.logger,m.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),m.sessionStorage=null!=(l=null==e?void 0:e.sessionStorage)?l:function(){let e;try{if("u">typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return e=new Map,{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var r;return null!=(r=Array.from(e.keys())[t])?r:null},removeItem(t){e.delete(t)},setItem(t,r){e.set(t,String(r))}}}(),m.reconnectAfterMs=null!=(h=null==e?void 0:e.reconnectAfterMs)?h:e=>e_[e-1]||1e4;let g=null!=(c=null==e?void 0:e.vsn)?c:z;switch(g){case"1.0.0":f=(e,t)=>t(JSON.stringify(e)),p=(e,t)=>t(JSON.parse(e));break;case z:f=this.serializer.encode.bind(this.serializer),p=this.serializer.decode.bind(this.serializer);break;default:throw Error(`Unsupported serializer version: ${m.vsn}`)}if(m.vsn=g,m.encode=null!=(u=null==e?void 0:e.encode)?u:f,m.decode=null!=(d=null==e?void 0:e.decode)?d:p,m.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,m.params=Object.assign(Object.assign({},m.params),{log_level:this.logLevel})),this.worker){if("u">typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl,m.autoSendHeartbeat=!this.worker}return m}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
41var ej=e.i(67034),eL=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown="CommitStateUnknownException"===t.icebergType||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};async function eB(e){return e&&"none"!==e.type?"bearer"===e.type?{Authorization:`Bearer ${e.token}`}:"header"===e.type?{[e.name]:e.value}:"custom"===e.type?await e.getHeaders():{}:{}}function e$(e){return e.join("\x1f")}var ez=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){let t=e?{parent:e$(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){let r={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${e$(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${e$(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${e$(e.namespace)}`}),!0}catch(e){if(e instanceof eL&&404===e.status)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof eL&&409===e.status)return;throw e}}};function eF(e){return e.join("\x1f")}var eH=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${eF(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){let r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${eF(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){let r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${eF(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${eF(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){let t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${eF(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){let t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${eF(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof eL&&404===e.status)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof eL&&409===r.status)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},eW=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=function(e){let t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:i,body:s,headers:o}){let a=function(e,t,r){let n=new URL(t,e);if(r)for(let[e,t]of Object.entries(r))void 0!==t&&n.searchParams.set(e,t);return n.toString()}(e.baseUrl,n,i),l=await eB(e.auth),h=await t(a,{method:r,headers:{...s?{"Content-Type":"application/json"}:{},...l,...o},body:s?JSON.stringify(s):void 0}),c=await h.text(),u=(h.headers.get("content-type")||"").includes("application/json"),d=u&&c?JSON.parse(c):c;if(!h.ok){let e=u?d:void 0,t=e?.error;throw new eL(t?.message??`Request failed with status ${h.status}`,{status:h.status,icebergType:t?.type,icebergCode:t?.code,details:e})}return{status:h.status,headers:h.headers,data:d}}}}({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new ez(this.client,t),this.tableOps=new eH(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
41async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function eU(e){return(eU="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function eV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function eq(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?eV(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=eU(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=eU(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==eU(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eV(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var eK=class extends Error{constructor(e,t="storage",r,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name="vectors"===t?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function eJ(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}var eG=class extends eK{constructor(e,t,r,n="storage",i){super(e,n,t,r),this.name="vectors"===n?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r,this.co
41de=i}toJSON(){return eq(eq({},super.toJSON()),{},{code:this.code})}},eY=class extends eK{constructor(e,t,r="storage"){super(e,r),this.name="vectors"===r?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function eX(e,t,r){let n=eq({},e),i=t.toLowerCase();for(let e of Object.keys(n))e.toLowerCase()===i&&delete n[e];return n[i]=r,n}let eQ=e=>{if(Array.isArray(e))return e.map(e=>eQ(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,r])=>{t[e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=eQ(r)}),t},eZ=e=>e.split("/").map(encodeURIComponent).join("/"),e0=e=>{if("object"==typeof e&&null!==e){if("string"==typeof e.msg)return e.msg;if("string"==typeof e.message)return e.message;if("string"==typeof e.error_description)return e.error_description;if("string"==typeof e.error)return e.error;if("object"==typeof e.error&&null!==e.error){let t=e.error;if("string"==typeof t.message)return t.message}}return JSON.stringify(e)},e1=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){let r=parseInt(String(e.status),10);Number.isFinite(r)||(r=500),e.json().then(e=>{let i=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||r+"";t(new eG(e0(e),r,i,n,null==e?void 0:e.code))}).catch(()=>{let i=r+"";t(new eG(e.statusText||`HTTP ${r} error`,r,i,n))})}else t(new eY(e0(e),e,n))};async function e2(e,t,r,n,i,s,o){return new Promise((a,l)=>{e(r,((e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return eq(eq({},i),r);if((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(n)){var s;let e,r=(null==t?void 0:t.headers)||{};for(let[t,n]of Object.entries(r))"content-type"===t.toLowerCase()&&(e=n);i.headers=eX(r,"Content-Type",null!=(s=e)?s:"application/json"),i.body=JSON.stringify(n)}else i.body=n;return(null==t?void 0:t.duplex)&&(i.duplex=t.duplex),eq(eq({},i),r)})(t,n,i,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===o){let t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status||!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>a(e)).catch(e=>e1(e,l,n,o))})}function e3(e="storage"){return{get:async(t,r,n,i)=>e2(t,"GET",r,n,i,void 0,e),post:async(t,r,n,i,s)=>e2(t,"POST",r,i,s,n,e),put:async(t,r,n,i,s)=>e2(t,"PUT",r,i,s,n,e),head:async(t,r,n,i)=>e2(t,"HEAD",r,eq(eq({},n),{},{noResolveJson:!0}),i,void 0,e),remove:async(t,r,n,i,s)=>e2(t,"DELETE",r,i,s,n,e)}}let{get:e5,post:e4,put:e6,head:e8,remove:e9}=e3("storage"),e7=e3("vectors");var te=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=function(e){let t={};for(let[r,n]of Object.entries(e))t[r.toLowerCase()]=n;return t}(t),this.fetch=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=eX(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(eJ(e))return{data:null,error:e};throw e}}};t=Symbol.toStringTag;var tt=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[t]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(eJ(e))return{data:null,error:e};throw e}}};r=Symbol.toStringTag;var tr=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[r]="BlobDownloadBuilder",this.promise=null}asStream(){return new tt(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await (await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(eJ(e))return{data:null,error:e};throw e}}};let tn={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ti={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var ts=class extends te{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var i=this;return i.handleOperation(async()=>{let s,o=eq(eq({},ti),n),a=eq(eq({},i.headers),"POST"===e&&{"x-upsert":String(o.upsert)}),l=o.metadata;if("u">typeof Blob&&r instanceof Blob?((s=new FormData).append("cacheControl",o.cacheControl),l&&s.append("metadata",i.encodeMetadata(l)),s.append("",r)):"u">typeof FormData&&r instanceof FormData?((s=r).has("cacheControl")||s.append("cacheControl",o.cacheControl),l&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(l))):(s=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=i.toBase64(i.encodeMetadata(l))),("u">typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!o.duplex&&(o.duplex="half")),null==n?void 0:n.headers)for(let[e,t]of Object.entries(n.headers))a=eX(a,e,t);let h=i._removeEmptyFolders(t),c=i._getFinalPath(h),u=await ("PUT"==e?e6:e4)(i.fetch,`${i.url}/object/${c}`,s,eq({headers:a},(null==o?void 0:o.duplex)?{duplex:o.duplex}:{}));return{path:h,id:u.Id,fullPath:u.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var i=this;let s=i._removeEmptyFolders(e),o=i._getFinalPath(s),a=new URL(i.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),i.handleOperation(async()=>{let e,t=eq(eq({},ti),n),o=eq(eq({},i.headers),{"x-upsert":String(t.upsert)}),l=t.metadata;if("u">typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),l&&e.append("metadata",i.encodeMetadata(l)),e.append("",r)):"u">typeof FormData&&r instanceof FormData?((e=r).has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",i.encodeMetadata(l))):(e=r,o["cache-control"]=`max-age=${t.cacheControl}`,o["content-type"]=t.contentType,l&&(o["x-metadata"]=i.toBase64(i.encodeMetadata(l))),("u">typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(let[e,t]of Object.entries(n.headers))o=eX(o,e,t);
41return{path:s,fullPath:(await e6(i.fetch,a.toString(),e,eq({headers:o},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e),i=eq({},r.headers);(null==t?void 0:t.upsert)&&(i["x-upsert"]="true");let s=await e4(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(r.url+s.url),a=o.searchParams.get("token");if(!a)throw new eK("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await e4(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await e4(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let i=n._getFinalPath(e),s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0,o=await e4(n.fetch,`${n.url}/object/sign/${i}`,eq({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers}),a=new URLSearchParams;(null==r?void 0:r.download)&&a.set("download",!0===r.download?"":r.download),(null==r?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));let l=a.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{let i=await e4(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),(null==r?void 0:r.cacheNonce)!=null&&s.set("cacheNonce",String(r.cacheNonce));let o=s.toString();return i.map(e=>eq(eq({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,r){let n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",i=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(i,t.transform),(null==t?void 0:t.cacheNonce)!=null&&i.set("cacheNonce",String(t.cacheNonce));let s=i.toString(),o=this._getFinalPath(e);return new tr(()=>e5(this.fetch,`${this.url}/${n}/${o}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;let r=t._getFinalPath(e);return t.handleOperation(async()=>eQ(await e5(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t;let r=this._getFinalPath(e);try{return await e8(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(eJ(e)){let r=e instanceof eG?e.status:e instanceof eY?null==(t=e.originalError)?void 0:t.status:void 0;if(void 0!==r&&[400,404].includes(r))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){let r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),(null==t?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));let i=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(i?`?${i}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await e9(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{let i=eZ(n._getFinalPath(e)),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");let o=s.toString();return await e9(n.fetch,`${n.url}/cdn/${i}${o?`?${o}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{let i=(null==t?void 0:t.sortBy)?eq(eq({},tn.sortBy),t.sortBy):tn.sortBy,s=eq(eq(eq({},tn),t),{},{sortBy:i,prefix:e||""});return await e4(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{let n=eq({},e);return await e4(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ej.Buffer?ej.Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("qual
41ity",t.quality.toString()),e}};let to={"X-Client-Info":"storage-js/2.112.4"};var ta=class extends te{constructor(e,t={},r,n){const i=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),super(i.href.replace(/\/$/,""),eq(eq({},to),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{let r=t.listBucketOptionsToQueryString(e);return await e5(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await e5(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await e4(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await e6(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await e4(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await e9(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{let i=new URLSearchParams;(null==t?void 0:t.transformations)&&i.set("transformations","true");let s=i.toString();return await e9(n.fetch,`${n.url}/cdn/${eZ(e)}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){let t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},tl=class extends te{constructor(e,t={},r){super(e.replace(/\/$/,""),eq(eq({},to),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await e4(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{let r=new URLSearchParams;(null==e?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(null==e?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);let n=r.toString(),i=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await e5(t.fetch,i,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await e9(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!(!(!e||"string"!=typeof e||0===e.length||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\"))&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))throw new eK("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let r=new eW({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(e,t){let r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(n)throw e;return{data:null,error:e}}}}})}},th=class extends te{constructor(e,t={},r){super(e.replace(/\/$/,""),eq(eq({},to),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await e7.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await e7.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},tc=class extends te{constructor(e,t={},r){super(e.replace(/\/$/,""),eq(eq({},to),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw Error("segmentCount must be between 1 and 16");
41if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},tu=class extends te{constructor(e,t={},r){super(e.replace(/\/$/,""),eq(eq({},to),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await e7.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},td=class extends tu{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new tf(this.url,this.headers,e,this.fetch)}async createBucket(e){return super.createBucket.call(this,e)}async getBucket(e){return super.getBucket.call(this,e)}async listBuckets(e={}){return super.listBuckets.call(this,e)}async deleteBucket(e){return super.deleteBucket.call(this,e)}},tf=class extends th{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return super.createIndex.call(this,eq(eq({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return super.listIndexes.call(this,eq(eq({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return super.getIndex.call(this,this.vectorBucketName,e)}async deleteIndex(e){return super.deleteIndex.call(this,this.vectorBucketName,e)}index(e){return new tp(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},tp=class extends tc{constructor(e,t,r,n,i){super(e,t,i),this.vectorBucketName=r,this.indexName=n}async putVectors(e){return super.putVectors.call(this,eq(eq({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async getVectors(e){return super.getVectors.call(this,eq(eq({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async listVectors(e={}){return super.listVectors.call(this,eq(eq({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async queryVectors(e){return super.queryVectors.call(this,eq(eq({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async deleteVectors(e){return super.deleteVectors.call(this,eq(eq({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}},tm=class extends ta{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new ts(this.url,this.headers,e,this.fetch)}get vectors(){return new td(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new tl(this.url+"/iceberg",this.headers,this.fetch)}};let tg="2.112.4",ty={"X-Client-Info":`gotrue-js/${tg}`},tv="X-Supabase-Api-Version",tb={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},tw=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,tx="sb_flow_id";class tk extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function tS(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class tC extends tk{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}function tA(e){return tS(e)&&"AuthApiError"===e.name}class tE extends tk{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class tT extends tk{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class tO extends tT{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function tM(e){return tS(e)&&"AuthSessionMissingError"===e.name}class tR extends tT{constructor(){super("Auth session or user missing","AuthInvalidToken
41ResponseError",500,void 0)}}class tN extends tT{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class tP extends tT{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class t_ extends tT{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class tD extends tT{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class tI extends tT{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function tj(e){return tS(e)&&"AuthRetryableFetchError"===e.name}class tL extends tT{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}class tB extends tT{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class t$ extends tT{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}let tz="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),tF=" 	\n\r=".split(""),tH=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<tF.length;t+=1)e[tF[t].charCodeAt(0)]=-2;for(let t=0;t<tz.length;t+=1)e[tz[t].charCodeAt(0)]=t;return e})();function tW(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(tz[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)r(tz[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function tU(e,t,r){let n=tH[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===n)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function tV(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=e=>{!function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,n,r)};for(let t=0;t<e.length;t+=1)tU(e.charCodeAt(t),i,s);return t.join("")}function tq(e){let t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)tU(e.charCodeAt(t),r,n);return new Uint8Array(t)}function tK(e){let t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};return e.forEach(e=>tW(e,r,n)),tW(null,r,n),t.join("")}let tJ=()=>"u">typeof window&&"u">typeof document,tG={tested:!1,writable:!1},tY=()=>{if(!tJ())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(tG.tested)return tG.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),tG.tested=!0,tG.writable=!0}catch(e){tG.tested=!0,tG.writable=!1}return tG.writable};function tX(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEach((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}let tQ=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),tZ=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},t0=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return null}},t1=async(e,t)=>{await e.removeItem(t)};class t2{constructor(){this.promise=new t2.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function t3(e){let t=e.split(".");if(3!==t.length)throw new t$("Invalid JWT structure");for(let e=0;e<t.length;e++)if(!tw.test(t[e]))throw new t$("JWT not in base64url format");return{header:JSON.parse(tV(t[0])),payload:JSON.parse(tV(t[1])),signature:tq(t[2]),raw:{header:t[0],payload:t[1]}}}async function t5(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function t4(e){return("0"+e.toString(16)).substr(-2)}async function t6(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>String.fromCharCode(e)).join("")}async function t8(e){return"u">typeof crypto&&void 0!==crypto.subtle&&"u">typeof TextEncoder?btoa(await t6(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):(console.warn("WebCrypto API is not supported. Code 
41challenge method will default to use plain instead of sha256."),e)}t2.promiseConstructor=Promise;let t9=/^[a-zA-Z0-9_-]{8,64}$/;function t7(e){return"string"==typeof e&&t9.test(e)?e:null}let re=(e,t)=>`${e}-flow-${t}-code-verifier`,rt=e=>`${e}-flows-code-verifier`;async function rr(e,t){let r=await t0(e,rt(t));return Array.isArray(r)?r.filter(e=>null!==t7(e)):[]}async function rn(e,t,r,n,i){await tZ(e,re(t,r),n);let s=(await rr(e,t)).filter(e=>e!==r);for(s.push(r);s.length>5;){let r=s.shift();await t1(e,re(t,r)),null==i||i(r)}await tZ(e,rt(t),s),await tZ(e,`${t}-code-verifier`,n)}async function ri(e,t,r){if(r){let n=await t0(e,re(t,r));return{verifier:"string"==typeof n?n:null,flowId:r}}let n=await t0(e,`${t}-code-verifier`);return{verifier:"string"==typeof n?n:null,flowId:null}}async function rs(e,t,r){let n=`${t}-code-verifier`;if(!r)return void await t1(e,n);let i=re(t,r),s=await t0(e,i);await t1(e,i);let o=await rr(e,t),a=o.filter(e=>e!==r);a.length!==o.length&&(a.length>0?await tZ(e,rt(t),a):await t1(e,rt(t))),null!=s&&s===await t0(e,n)&&await t1(e,n)}async function ro(e,t){for(let r of(await rr(e,t)))await t1(e,re(t,r));await t1(e,rt(t)),await t1(e,`${t}-code-verifier`)}async function ra(e,t,r=!1,n){let i=function(){let e=new Uint32Array(56);if("u"<typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let n=0;n<56;n++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,t4).join("")}(),s=i;r&&(s+="/recovery");let o=function(){if("u">typeof crypto&&"function"==typeof crypto.getRandomValues){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,t4).join("")}let e="";for(let t=0;t<32;t++)e+=Math.floor(16*Math.random()).toString(16);return e}();await rn(e,t,o,s,n);let a=await t8(i),l=i===a?"plain":"s256";return[a,l,o]}let rl=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,rh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rc(e){if(!rh.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ru(e){if(!e.passkey)throw Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function rd(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){let e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function rf(e){return JSON.parse(JSON.stringify(e))}let rp=e=>{if("object"==typeof e&&null!==e){if("string"==typeof e.msg)return e.msg;if("string"==typeof e.message)return e.message;if("string"==typeof e.error_description)return e.error_description;if("string"==typeof e.error)return e.error}return JSON.stringify(e)},rm=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function rg(e){var t;let r,n;if(!("object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new tI(rp(e),0);try{r=await e.json()}catch(t){if(rm.includes(e.status))throw new tI(e.statusText||`HTTP ${e.status}`,e.status);throw new tE(rp(t),t)}if(rm.includes(e.status))throw new tI(rp(r),e.status);let i=function(e){let t=e.headers.get(tv);if(!t||!t.match(rl))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(i&&i.getTime()>=tb["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?n=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(n=r.error_code),n){if("weak_password"===n)throw new tB(rp(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===n)throw new tO}else if("object"==typeof r&&r&&"object"==typeof r.weak_password&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((e,t)=>
41e&&"string"==typeof t,!0))throw new tB(rp(r),e.status,r.weak_password.reasons);throw new tC(rp(r),e.status||500,n)}async function ry(e,t,r,n){var i;let s=Object.assign({},null==n?void 0:n.headers);s[tv]||(s[tv]=tb["2024-01-01"].name),(null==n?void 0:n.jwt)&&(s.Authorization=`Bearer ${n.jwt}`);let o=null!=(i=null==n?void 0:n.query)?i:{};(null==n?void 0:n.redirectTo)&&(o.redirect_to=n.redirectTo);let a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await rv(e,t,r+a,{headers:s,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function rv(e,t,r,n,i,s){let o,a,l=(a={method:t,headers:(null==n?void 0:n.headers)||{}},"GET"===t?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==n?void 0:n.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),i)));try{o=await e(r,Object.assign({},l))}catch(e){throw new tI(rp(e),0)}if(o.ok||await rg(o),null==n?void 0:n.noResolveJson)return o;try{return await o.json()}catch(e){await rg(e)}}function rb(e){var t,r,n;let i=null;(n=e).access_token&&n.refresh_token&&n.expires_in&&(i=Object.assign({},e),e.expires_at||(i.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:i,user:null!=(t=e.user)?t:"string"==typeof(null==e?void 0:e.id)?e:null},error:null}}function rw(e){let t=rb(e);return!t.error&&e.weak_password&&"object"==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function rx(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function rk(e){return{data:e,error:null}}function rS(e){let{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s},user:Object.assign({},(0,S.__rest)(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function rC(e){return e}let rA=["global","local","others"];class rE{constructor({url:e="",headers:t={},fetch:r,experimental:n}){this.url=e,this.headers=t,this.fetch=tQ(r),this.experimental=null!=n?n:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,t=rA[0]){if(0>rA.indexOf(t))throw Error(`@supabase/auth-js: Parameter scope must be one of ${rA.join(", ")}`);try{return await ry(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(tS(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await ry(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:rx})}catch(e){if(tS(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=(0,S.__rest)(e,["options"]),n=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(n.new_email=null==r?void 0:r.newEmail,delete n.newEmail),await ry(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:rS,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(tS(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await ry(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:rx})}catch(e){if(tS(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,n,i,s,o,a;try{let l={nextPage:null,lastPage:0,total:0},h=await ry(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(i=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?i:""},xform:rC});if(h.error)throw h.error;let c=await h.json(),u=null!=(s=h.headers.get("x-total-count"))?s:0,d=null!=(a=null==(o=h.headers.get("link"))?void 0:o.split(","))?a:[];return d.length>
410&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(u)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(tS(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){rc(e);try{return await ry(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:rx})}catch(e){if(tS(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){rc(e);try{return await ry(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:rx})}catch(e){if(tS(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){rc(e);try{return await ry(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:rx})}catch(e){if(tS(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){rc(e.userId);try{let{data:t,error:r}=await ry(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _deleteFactor(e){rc(e.userId),rc(e.id);try{return{data:await ry(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){var t,r,n,i,s,o,a;try{let l={nextPage:null,lastPage:0,total:0},h=await ry(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(i=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?i:""},xform:rC});if(h.error)throw h.error;let c=await h.json(),u=null!=(s=h.headers.get("x-total-count"))?s:0,d=null!=(a=null==(o=h.headers.get("link"))?void 0:o.split(","))?a:[];return d.length>0&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(u)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(tS(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await ry(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{return await ry(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _updateOAuthClient(e,t){try{return await ry(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{return await ry(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{return await ry(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _listCustomProviders(e){try{let t={};return(null==e?void 0:e.type)&&(t.type=e.type),await ry(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:t,xform:e=>{var t;return{data:{providers:null!=(t=null==e?void 0:e.providers)?t:[]},error:null}}})}catch(e){if(tS(e))return{data:{providers:[]},error:e};throw e}}async _createCustomProvider(e){try{return await ry(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _getCustomProvider(e){try{return await ry(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _updateCustomProvider(e,t){try{return await ry(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _deleteCustomProvider(e){try{return await ry(this.fetch,"DELET
41E",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _adminListPasskeys(e){ru(this.experimental),rc(e.userId);try{return await ry(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tS(e))return{data:null,error:e};throw e}}async _adminDeletePasskey(e){ru(this.experimental),rc(e.userId),rc(e.passkeyId);try{return await ry(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(tS(e))return{data:null,error:e};throw e}}}function rT(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}globalThis&&tY()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class rO extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function rM(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}class rR extends Error{constructor({message:e,code:t,cause:r,name:n}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=null!=(i=null!=n?n:r instanceof Error?r.name:void 0)?i:"Unknown Error",this.code=t}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class rN extends rR{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}let rP=new class{createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};function r_(e){if(!e)throw Error("Credential creation options are required");if("u">typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:t,user:r,excludeCredentials:n}=e,i=(0,S.__rest)(e,["challenge","user","excludeCredentials"]),s=tq(t).buffer,o=Object.assign(Object.assign({},r),{id:tq(r.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(n&&n.length>0){a.excludeCredentials=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e];a.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:tq(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return a}function rD(e){if(!e)throw Error("Credential request options are required");if("u">typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);let{challenge:t,allowCredentials:r}=e,n=(0,S.__rest)(e,["challenge","allowCredentials"]),i=tq(t).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e];s.allowCredentials[e]=Object.assign(Object.assign({},t),{id:tq(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return s}function rI(e){var t;return"toJSON"in e&&"function"==typeof e.toJSON?e.toJSON():{id:e.id,rawId:e.id,response:{attestationObject:tK(new Uint8Array(e.response.attestationObject)),clientDataJSON:tK(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}function rj(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();let r=e.getClientExtensionResults(),n=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:tK(new Uint8Array(n.authenticatorData)),clientDataJSON:tK(new Uint8Array(n.clientDataJSON)),signature:tK(new Uint8Array(n.signature)),userHandle:n.userHandle?tK(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}function rL(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function rB(){var e,t;return!!(tJ()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null==(e=null==navigator?void 0:navigator.credentials)?void 0:e.create)&&"function"==typeof(null==(t=null==navigator?void 0:navigator.credentials)?void 0:t.get))}async function r$(e){try{let t=await navigator.credentials.create(e);if(!t)return{data:null,error:new rN("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new rN("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){var r,n,i;let{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new rR({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if((null==(r=s.authenticatorSelection)?void 0:r.requireResidentKey)===!0)return new rR({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&(null==(n=s.authenticatorSelection)?void 0:n.userVerification)==="required")return new rR({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if((null==(i=s.authenticatorSelection)?void 0:i.userVerification)==="required")return new rR({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new rR({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new rR({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new rR(0===s.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!rL(t))return new rR({message:`${window.location.hostname}
41 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(s.rp.id!==t)return new rR({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new rR({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new rR({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new rR({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}async function rz(e){try{let t=await navigator.credentials.get(e);if(!t)return{data:null,error:new rN("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new rN("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new rR({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new rR({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!rL(t))return new rR({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new rR({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new rR({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new rR({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}let rF={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},rH={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function rW(...e){let t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),n={};for(let i of e)if(i)for(let e in i){let s=i[e];if(void 0!==s)if(Array.isArray(s))n[e]=s;else if(r(s))n[e]=s;else if(t(s)){let r=n[e];t(r)?n[e]=rW(r,s):n[e]=rW(s)}else n[e]=s}return n}class rU{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:n},i){var s,o,a,l,h;try{let{data:c,error:u}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!c)return{data:null,error:u};let d=null!=n?n:rP.createNewAbortSignal();if("create"===c.webauthn.type){let{user:e}=c.webauthn.credential_options.publicKey;if(!e.name)if(r)e.name=`${e.id}:${r}`;else{let t=(await this.client.getUser()).data.user,r=(null==(s=null==t?void 0:t.user_metadata)?void 0:s.name)||(null==t?void 0:t.email)||(null==t?void 0:t.id)||"User";e.name=`${e.id}:${r}`}e.displayName||(e.displayName=e.name)}switch(c.webauthn.type){case"create":{let t=(o=c.webauthn.credential_options.publicKey,a=null==i?void 0:i.create,rW(rF,o,a||{})),{data:r,error:n}=await r$({publicKey:t,signal:d});if(r)return{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:r}},error:null};return{data:null,error:n}}case"request":{let t=(l=c.webauthn.credential_options.publicKey,h=null==i?void 0:i.request,rW(rH,l,h||{})),{data:r,error:n}=await rz(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:t,signal:d}));if(r)return{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:r}},error:null};return{data:null,error:n}}}}catch(e){if(tS(e))return{data:null,error:e};return{data:null,error:new tE("Unexpected error in challenge",e)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t="u">typeof window?window.location.hostname:void 0,rpOrigins:r="u">typeof window?[window.location.origin]:void 0,signal:n}={}},i){if(!t)return{data:null,error:new tk("rpId is required for WebAuthn authentication")};try{if(!rB())return{data:null,error:new tE("Browser does not support WebAuthn",null)};let{data:s,error:o}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:n},{request:i});if(!s)return{data:null,error:o};let{webauthn:a}=s;return this._verify({factorId:e,challengeId:s.challengeId,webauthn:{type:a.type,rpId:t,rpOrigins:r,credential_response:a.credential_response}})}catch(e){if(tS(e))return{data:null,error:e};return{data:null,error:new tE("Unexpected error in authenticate",e)}}}async _register({friendlyName:e,webauthn:{rpId:t="u">typeof window?window.location.hostname:void 0,rpOrigins:r="u">typeof window?[window.location.origin]:void 0,signal:n}={}},i){if(!t)return{data:null,error:new tk("rpId is required for WebAuthn registration")};try{if(!rB())return{data:null,error:new tE("Browser does not support WebAuthn",null)};let{data:s,error:o}=await this._enroll({friendlyName:e});if(!s)return await this.client.mfa.listFactors().then(t=>{var r;return null==(r=t.data)?void 0:r.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:o};let{data:a,error:l}=await this._challenge({factorId:s.id,friendlyName:s.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:n},{create:i});if(!a)return{data:null,error:l};return this._verify({factorId:s.id,challengeId:a.challengeId,webauthn:{rpId:t,rpOrigins:r,type:a.webauthn.type,credential_response:a.webauthn.credential_response}})}catch(e){if(tS(e))return{data:null,error:e};return{data:null,error:new tE("Unexpected error in register",e)}}}}if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"u">typeof self&&(self.globalThis=self)}let rV={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ty,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},rq={},rK=!1;class rJ{get jwks(){var e,t;return null!=(t=null==(e=rq[this.storageKey])?void 0:e.jwks)?t:{keys:[]}}set jwks(e){rq[this.storageKey]=Object.assign(Object.assign({},rq[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!=(t=null==(e=rq[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){rq[this.storageKey]=Object.assign(Object.assign({},rq[this.storageKey]),{cachedAt:e})}constructor(e){var t,r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this._pendingInitNotifications=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},rV),e);if(this.storageKey=i.storageKey,this.instanceID=null!=(t=rJ.nextInstanceID[this.storageKey])?t:0,rJ.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,"function"==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&tJ()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!=(r=i.experimental)?r:{},this.admin=new rE({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=tQ(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock,rK||(rK=!0,console.warn(`${this._logPrefix()} The "lock" option is deprecated and will be removed in v3. The client now coordinates session refreshes without a lock, so most apps can drop the option. See https://github.com/supabase/supabase-js/blob/master/packages/core/auth-js/migrations/lockless-coordination.md`))),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new rU(this)}
41,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:tY()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=rT(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=rT(this.memoryStorage)),tJ()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null==(n=this.broadcastChannel)||n.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),("TOKEN_REFRESHED"===e.data.event||"SIGNED_IN"===e.data.event)&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug("#broadcastChannel","error",e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug("#initialize()","error",e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${tg}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){var e;if(this.initializePromise)return await this.initializePromise;this._pendingInitNotifications=[],this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())();let t=await this.initializePromise,r=null!=(e=this._pendingInitNotifications)?e:[];for(let e of(this._pendingInitNotifications=null,r))await this._notifyAllSubscribers(e.event,e.session,e.broadcast);return t}async _initialize(){var e;try{let t={},r="none";if(tJ()&&(t=tX(window.location.href),this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce")),tJ()&&this.detectSessionInUrl&&"none"!==r){let{data:n,error:i}=await this._getSessionFromURL(t,r);if(i){(this._debug("#_initialize()","error detecting session from URL",i),tS(i)&&"AuthImplicitGrantRedirectError"===i.name)&&(null==(e=i.details)||e.code);return{error:i}}let{session:s,redirectType:o}=n;return this._debug("#_initialize()","detected session in URL",s,"redirect type",o),await this._saveSession(s),setTimeout(async()=>{"recovery"===o?await this._notifyAllSubscribers("PASSWORD_RECOVERY",s):await this._notifyAllSubscribers("SIGNED_IN",s)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(tS(e))return this._returnResult({error:e});return this._returnResult({error:new tE("Unexpected error during initialization",e)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{let{data:i,error:s}=await ry(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.data)?r:{},gotrue_meta_security:{captcha_token:null==(n=null==e?void 0:e.options)?void 0:n.captchaToken}},xform:rb});if(s||!i)return this._returnResult({data:{user:null,session:null},error:s});let o=i.session,a=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",o)),this._returnResult({data:{user:a,session:o},error:null})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,r,n;let i=null;try{let s;if("email"in e){let{email:r,password:n,options:o}=e,a=null,l=null;"pkce"===this.flowType&&([a,l,i]=await this._getCodeChallengeAndMethod()),s=await ry(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(null==o?void 0:o.emailRedirectTo,i),body:{email:r,password:n,data:null!=(t=null==o?void 0:o.data)?t:{},gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken},code_challenge:a,code_challenge_method:l},xform:rb})}else if("phone"in e){let{phone:t,password:i,options:o}=e;s=await ry(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:i,data:null!=(r=null==o?void 0:o.data)?r:{},channel:null!=(n=null==o?void 0:o.channel)?n:"sms",gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:rb})}else throw new tN("You must provide either an email or phone number and a password");let{data:o,error:a}=s;
41if(a||!o)return await rs(this.storage,this.storageKey,i),this._returnResult({data:{user:null,session:null},error:a});let l=o.session,h=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:h,session:l},error:null})}catch(e){if(await rs(this.storage,this.storageKey,i),tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:n,options:i}=e;t=await ry(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:rw})}else if("phone"in e){let{phone:r,password:n,options:i}=e;t=await ry(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:rw})}else throw new tN("You must provide either an email or phone number and a password");let{data:r,error:n}=t;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!r||!r.session||!r.user){let e=new tR;return this._returnResult({data:{user:null,session:null},error:e})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,r,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(r=e.options)?void 0:r.scopes,queryParams:null==(n=e.options)?void 0:n.queryParams,skipBrowserRedirect:null==(i=e.options)?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e,t){return(await this.initializePromise,null!=this.lock)?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e,t)):this._exchangeCodeForSession(e,t)}async signInWithWeb3(e){let{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,n,i,s,o,a,l,h,c,u,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{let c,{chain:u,wallet:m,statement:g,options:y}=e;if(tJ())if("object"==typeof m)c=m;else{let e=window;if("ethereum"in e&&"object"==typeof e.ethereum&&"request"in e.ethereum&&"function"==typeof e.ethereum.request)c=e.ethereum;else throw Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof m||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");c=m}let v=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href),b=await c.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let w=rM(b[0]),x=null==(r=null==y?void 0:y.signInWithEthereum)?void 0:r.chainId;x||(x=parseInt(await c.request({method:"eth_chainId"}),16)),f=function(e){var t;let{chainId:r,domain:n,expirationTime:i,issuedAt:s=new Date,nonce:o,notBefore:a,requestId:l,resources:h,scheme:c,uri:u,version:d}=e;if(!Number.isInteger(r))throw Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!u)throw Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==d)throw Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(null==(t=e.statement)?void 0:t.includes("\n"))throw Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);let f=rM(e.address),p=c?`${c}://${n}`:n,m=e.statement?`${e.statement}
42`:"",g=`${p} wants you to sign in with your Ethereum account:
43${f}
44
45${m}`,y=`URI: ${u}
46Version: ${d}
47Chain ID: ${r}${o?`
48Nonce: ${o}`:""}
49Issued At: ${s.toISOString()}`;if(i&&(y+=`
50Expiration Time: ${i.toISOString()}`),a&&(y+=`
51Not Before: ${a.toISOString()}`),l&&(y+=`
52Request ID: ${l}`),h){let e="\nResources:";for(let t of h){if(!t||"string"!=typeof t)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`
53- ${t}`}y+=e}return`${g}
54${y}`}({domain:v.host,address:w,statement:g,uri:v.href,version:"1",chainId:x,nonce:null==(n=null==y?void 0:y.signInWithEthereum)?void 0:n.nonce,issuedAt:null!=(s=null==(i=null==y?void 0:y.signInWithEthereum)?void 0:i.issuedAt)?s:new Date,expirationTime:null==(o=null==y?void 0:y.signInWithEthereum)?void 0:o.expirationTime,notBefore:null==(a=null==y?void 0:y.signInWithEthereum)?void 0:a.notBefore,requestId:null==(l=null==y?void 0:y.signInWithEthereum)?void 0:l.requestId,resources:null==(h=null==y?void 0:y.signInWithEthereum)?void 0:h.resources}),p=await c.request({method:"personal_sign",params:[(d=f,"0x"+Array.from(new TextEncoder().encode(d),e=>e.toString(16).padStart(2,"0")).join("")),w]})}try{let{data:t,error:r}=await ry(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},(null==(c=e.options)?void 0:c.captchaToken)?{gotrue_meta_security:{captcha_token:null==(u=e.options)?void 0:u.captchaToken}}:null),xform:rb});if(r)throw r;if(!t||!t.session||!t.user){let e=new tR;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,r,n,i,s,o,a,l,h,c,u,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{let u,{chain:d,wallet:m,statement:g,options:y}=e;if(tJ())if("object"==typeof m)u=m;else{let e=window;if("solana"in e&&"object"==typeof e.solana&&("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))u=e.solana;else throw Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof m||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");u=m}let v=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href);if("signIn"in u&&u.signIn){let e,t=await u.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==y?void 0:y.signInWithSolana),{version:"1",domain:v.host,uri:v.href}),g?{statement:g}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)f="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),p=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in u)||"function"!=typeof u.signMessage||!("publicKey"in u)||"object"!=typeof u||!u.publicKey||!("toBase58"in u.publicKey)||"function"!=typeof u.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");f=[`${v.host} wants you to sign in with your Solana account:`,u.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${v.href}`,`Issued At: ${null!=(n=null==(r=null==y?void 0:y.signInWithSolana)?void 0:r.issuedAt)?n:new Date().toISOString()}`,...(null==(i=null==y?void 0:y.signInWithSolana)?void 0:i.notBefore)?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...(null==(s=null==y?void 0:y.signInWithSolana)?void 0:s.expirationTime)?[`Expiration Time: ${y.signInWithSolana.expirationTime}`]:[],...(null==(o=null==y?void 0:y.signInWithSolana)?void 0:o.chainId)?[`Chain ID: ${y.signInWithSolana.chainId}`]:[],...(null==(a=null==y?void 0:y.signInWithSolana)?void 0:a.nonce)?[`Nonce: ${y.signInWithSolana.nonce}`]:[],...(null==(l=null==y?void 0:y.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${y.signInWithSolana.requestId}`]:[],...(null==(c=null==(h=null==y?void 0:y.signInWithSolana)?void 0:h.resources)?void 0:c.length)?["Resources",...y.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await u.signMessage(new TextEncoder().encode(f),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=e}}try{let{data:t,error:r}=await ry(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:f,signature:tK(p)},(null==(u=e.options)?void 0:u.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:rb});if(r)throw r;if(!t||!t.session||!t.user){let e=new tR;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e,t){let r=(null==t?void 0:t.flowId)!=null,n=r?t7(null==t?void 0:t.flowId):tJ(
54)?t7(tX(window.location.href)[tx]):null;r&&!n&&this._debug("#_exchangeCodeForSession()","provided flowId is not a valid flow id",null==t?void 0:t.flowId);let{verifier:i,flowId:s}=r&&!n?{verifier:null,flowId:null}:await ri(this.storage,this.storageKey,n),[o,a]=(null!=i?i:"").split("/");try{if(!o&&"pkce"===this.flowType)throw new tD;let{data:t,error:r}=await ry(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:o},xform:rb});if(await rs(this.storage,this.storageKey,s),r)throw r;if(!t||!t.session||!t.user){let e=new tR;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("recovery"===a?"PASSWORD_RECOVERY":"SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=a?a:null}),error:r})}catch(e){if(await rs(this.storage,this.storageKey,s),tS(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:n,access_token:i,nonce:s}=e,{data:o,error:a}=await ry(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:i,nonce:s,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:rb});if(a)return this._returnResult({data:{user:null,session:null},error:a});if(!o||!o.session||!o.user){let e=new tR;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),this._returnResult({data:o,error:a})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,r,n,i,s;let o=null;try{if("email"in e){let{email:n,options:i}=e,s=null,a=null;"pkce"===this.flowType&&([s,a,o]=await this._getCodeChallengeAndMethod());let{error:l}=await ry(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!=(t=null==i?void 0:i.data)?t:{},create_user:null==(r=null==i?void 0:i.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:s,code_challenge_method:a},redirectTo:this._maybeAppendFlowIdToRedirect(null==i?void 0:i.emailRedirectTo,o)});return this._returnResult({data:{user:null,session:null},error:l})}if("phone"in e){let{phone:t,options:r}=e,{data:o,error:a}=await ry(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(n=null==r?void 0:r.data)?n:{},create_user:null==(i=null==r?void 0:r.shouldCreateUser)||i,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(s=null==r?void 0:r.channel)?s:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==o?void 0:o.message_id},error:a})}throw new tN("You must provide either an email or phone number.")}catch(e){if(await rs(this.storage,this.storageKey,o),tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,r;try{let n,i;"options"in e&&(n=null==(t=e.options)?void 0:t.redirectTo,i=null==(r=e.options)?void 0:r.captchaToken);let{data:s,error:o}=await ry(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:rb});if(o)throw o;if(!s)throw Error("An error occurred on token verification.");let a=s.session,l=s.user;return(null==a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),this._returnResult({data:{user:l,session:a},error:null})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,r,n,i;let s=null;try{let o=null,a=null;"pkce"===this.flowType&&([o,a,s]=await this._getCodeChallengeAndMethod());let l=await ry(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:this._maybeAppendFlowIdToRedirect(null==(t=e.options)?void 0:t.redirectTo,s)}),(null==(r=null==e?void 0:e.options)?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}
54:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:a}),headers:this.headers,xform:rk});return(null==(n=l.data)?void 0:n.url)&&tJ()&&!(null==(i=e.options)?void 0:i.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await rs(this.storage,this.storageKey,s),tS(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return(await this.initializePromise,null!=this.lock)?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new tO;let{error:n}=await ry(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){let t=null;try{let r=`${this.url}/resend`;if("email"in e){let{email:n,type:i,options:s}=e,o=null,a=null;"pkce"===this.flowType&&([o,a,t]=await this._getCodeChallengeAndMethod());let{error:l}=await ry(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:o,code_challenge_method:a},redirectTo:this._maybeAppendFlowIdToRedirect(null==s?void 0:s.emailRedirectTo,t)});return l&&await rs(this.storage,this.storageKey,t),this._returnResult({data:{user:null,session:null},error:l})}if("phone"in e){let{phone:t,type:n,options:i}=e,{data:s,error:o}=await ry(this.fetch,"POST",r,{headers:this.headers,body:{phone:t,type:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==s?void 0:s.message_id},error:o})}throw new tN("You must provide either an email or phone number and a type")}catch(e){if(await rs(this.storage,this.storageKey,t),tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return(await this.initializePromise,null!=this.lock)?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),null==this.lock||this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let t=null,r=await t0(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),null!==r&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};let n=!!t.expires_at&&1e3*t.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){let e=await t0(this.userStorage,this.storageKey+"-user");(null==e?void 0:e.user)?t.user=e.user:t.user=rd()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){var e;let r={value:this.suppressGetSessionWarning};t.user=(e=t.user,new Proxy(e,{get:(e,t,n)=>{if("__isInsecureUserWarningProxy"===t)return!0;
54if("symbol"==typeof t){let r=t.toString();if("Symbol(Symbol.toPrimitive)"===r||"Symbol(Symbol.toStringTag)"===r||"Symbol(util.inspect.custom)"===r||"Symbol(nodejs.util.inspect.custom)"===r)return Reflect.get(e,t,n)}return r.value||"string"!=typeof t||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),r.value=!0),Reflect.get(e,t,n)}})),r.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}let{data:i,error:s}=await this._callRefreshToken(t.refresh_token);if(s){if(t.expires_at&&1e3*t.expires_at>Date.now()){let e=await t0(this.storage,this.storageKey);if(e&&e.refresh_token===t.refresh_token)return this._returnResult({data:{session:t},error:null})}return this._returnResult({data:{session:null},error:s})}return this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){let t;return e?await this._getUser(e):(await this.initializePromise,(t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser()).data.user&&(this.suppressGetSessionWarning=!0),t)}async _getUser(e){try{if(e)return await ry(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:rx});return await this._useSession(async e=>{var t,r,n;let{data:i,error:s}=e;if(s)throw s;return(null==(t=i.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await ry(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(n=null==(r=i.session)?void 0:r.access_token)?n:void 0,xform:rx}):{data:{user:null},error:new tO}})}catch(e){if(tS(e))return tM(e)&&await this._removeSession(),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return(await this.initializePromise,null!=this.lock)?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){let r=null;try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new tO;let o=i.session,a=null,l=null;"pkce"===this.flowType&&null!=e.email&&([a,l,r]=await this._getCodeChallengeAndMethod());let{data:h,error:c}=await ry(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(null==t?void 0:t.emailRedirectTo,r),body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:rx});if(c)throw c;return o.user=h.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(e){if(await rs(this.storage,this.storageKey,r),tS(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return(await this.initializePromise,null!=this.lock)?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new tO;let t=Date.now()/1e3,r=t,n=!0,i=null,{payload:s}=t3(e.access_token);if(s.exp&&(n=(r=s.exp)<=t),n){let{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!t)return{data:{user:null,session:null},error:null};i=t}else{let{data:n,error:s}=await this._getUser(e.access_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});i={access_token:e.access_token,refresh_token:e.refresh_token,user:n.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if(tS(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return(await this.initializePromise,null!=this.lock)?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:n,error:i}=t;if(i)throw i;e=null!=(r=n.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new tO;let{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var r;try{if(!tJ())throw new tP("No browser detected.");
54if(e.error||e.error_description||e.error_code)throw new tP(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new t_("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new tP("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new t_("No code detected.");let{data:t,error:n}=await this._exchangeCodeForSession(e.code,{flowId:e[tx]});if(n)throw n;let i=new URL(window.location.href);return i.searchParams.delete("code"),i.searchParams.delete(tx),window.history.replaceState(window.history.state,"",i.toString()),{data:{session:t.session,redirectType:null!=(r=t.redirectType)?r:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:l,token_type:h}=e;if(!s||!a||!o||!h)throw new tP("No session defined in URL");let c=Math.round(Date.now()/1e3),u=parseInt(a),d=c+u;l&&(d=parseInt(l));let f=d-c;1e3*f<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${u}s`);let p=d-u;c-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,d,c):c-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,d,c);let{data:m,error:g}=await this._getUser(s);if(g)throw g;let y={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:u,expires_at:d,refresh_token:o,token_type:h,user:m.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:y,redirectType:e.type},error:null})}catch(e){if(tS(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){if(!e.code)return!1;let t=t7(e[tx]);return!!(t&&await t0(this.storage,re(this.storageKey,t)))||!!await t0(this.storage,`${this.storageKey}-code-verifier`)}async signOut(e={scope:"global"}){return(await this.initializePromise,null!=this.lock)?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let n=async()=>{await this._removeSession()},{data:i,error:s}=t;if(s&&!tM(s))return this._returnResult({error:s});let o=null==(r=i.session)?void 0:r.access_token;if(o){let{error:t}=await this.admin.signOut(o,e);if(t&&!(tA(t)&&(404===t.status||401===t.status||403===t.status)||tM(t)))return"others"!==e&&await n(),this._returnResult({error:t})}return"others"!==e&&await n(),this._returnResult({error:null})})}onAuthStateChange(e){let t=Symbol("auth-callback"),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,n;try{let{data:{session:n},error:i}=t;if(i)throw i;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(t){await (null==(n=this.stateChangeEmitters.get(e))?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),tM(t)||tj(t)||tA(t)&&("refresh_token_not_found"===t.code||"refresh_token_already_used"===t.code||"session_expired"===t.code)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null,i=null;"pkce"===this.flowType&&([r,n,i]=await this._getCodeChallengeAndMethod(!0));try{return await ry(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(t.redirectTo,i)})}catch(e){if(await rs(this.storage,this.storageKey,i),tS(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:null!=(e=t.user.identities)?e:[]},error:null})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;let r=null;try{let{data:n,error:i}=await this._useSession(async t=>{var n,i,s,o,a;let{data:l,error:h}=t;if(h)throw h;let{url:c,flowId:u}=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(n=e.options)?void 0:n.redirectTo,scopes:null==(i=e.options)?void 0:i.scopes,queryParams:null==(s=e.options)?void 0:s.queryParams,skipBrowserRedirect:!0});return r=u,await ry(this.fetch,"GET",c,{headers:this.headers,jwt:null!=(a=null==(o=l.session)?void 0:o.access_token)?a:void 0})});if(i)throw i;return!tJ()||(null==(t=e.options)?void 0:t.skipBrowserRedirect)||window.location.assign(null==n?void 0:n.url),this._returnResult({data:{provider:e.provider,url:null==n?void 0:n.url,flowId:r},error:null})}catch(t){if(tS(t))return this._returnResult({data:{provider:e.provider,url:null,flowId:r},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{let{error:n,data:{session:i}}=t;if(n)throw n;let{options:s,provider:o,token:a,access_token:l,nonce:h}=e,{data:c,error:u}=await ry(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==i?void 0:i.access_token)?r:void 0,body:{provider:o,id_token:a,access_token:l,nonce:h,link_identity:!0,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:rb});if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user)return this._returnResult({data:{user:null,session:null},error:new tR});return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("USER_UPDATED",c.session)),this._returnResult({data:c,error:u})}catch(e){if(await rs(this.storage,this.storageKey,null),tS(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)throw s;
54return await ry(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(n=null==(r=i.session)?void 0:r.access_token)?n:void 0})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){let t="#_refreshAccessToken()";this._debug(t,"begin");try{var r,n;let i=Date.now();return await (r=async r=>(r>0&&await t5(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await ry(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:rb})),n=(e,t)=>{let r=200*Math.pow(2,e);return t&&tj(t)&&Date.now()+r-i<3e4},new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{let t=await r(i);if(!n(i,null,t))return void e(t)}catch(e){if(!n(i,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),tS(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let{url:r,flowId:n}=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),tJ()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r,flowId:n},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let n=await t0(this.storage,this.storageKey);if(n&&this.userStorage){let t=await t0(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:n.user},await tZ(this.userStorage,this.storageKey+"-user",t)),n.user=null!=(e=null==t?void 0:t.user)?e:rd()}else if(n&&!n.user&&!n.user){let e=await t0(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(n.user=e.user,await t1(this.storage,this.storageKey+"-user"),await tZ(this.storage,this.storageKey,n)):n.user=rd()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),null!==n&&await this._removeSession();return}let i=(null!=(t=n.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${i?"":" not"} expired with margin of 90000s`),i){if(this.autoRefreshToken&&n.refresh_token){let{error:e}=await this._callRefreshToken(n.refresh_token);e&&(tS(e)&&"AuthRefreshDiscardedError"===e.name?this._debug(r,"refresh discarded by commit guard",e):this._debug(r,"refresh failed",e))}}else if(n.user&&!0===n.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(n.access_token);!t&&(null==e?void 0:e.user)?(n.user=e.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(e){this._debug(r,"error",e),tj(e)?console.warn(e):console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new tO;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;let n="#_callRefreshToken()";this._debug(n,"begin");try{this.refreshingDeferred=new t2,this.refreshingDeferred.promise.then(void 0,()=>{});let t=await t0(this.storage,this.storageKey),{data:r,error:i}=await this._refreshAccessToken(e);if(i)throw i;if(!r.session)throw new tO;let s=await t0(this.storage,this.storageKey);if(null!==t&&(null===s||s.refresh_token!==t.refresh_token)){this._debug(n,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:s?"replaced":"cleared"});let e={data:null,error:new tL};return this.refreshingDeferred.resolve(e),e}let o=this._sessionRemovalEpoch;if(await this._saveSession(r.session),this._sessionRemovalEpoch!==o){this._debug(n,"commit guard (post-save): _removeSession ran during _saveSession, und
54oing write"),await t1(this.storage,this.storageKey),this.userStorage&&await t1(this.userStorage,this.storageKey+"-user");let e={data:null,error:new tL};return this.refreshingDeferred.resolve(e),e}await this._notifyAllSubscribers("TOKEN_REFRESHED",r.session);let a={data:r.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(n,"error",i),tS(i)){let r={data:null,error:i};if(!tj(i)){let e=await t0(this.storage,this.storageKey);(null==e?void 0:e.expires_at)&&1e3*e.expires_at>Date.now()?this._debug(n,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:r,expiresAt:Date.now()+6e4},null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){if(null!==this._pendingInitNotifications&&r)return void this._pendingInitNotifications.push({event:e,session:t,broadcast:r});let n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let n=[],i=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){n.push(e)}});if(await Promise.all(i),n.length>0){for(let e=0;e<n.length;e+=1)console.error(n[e]);throw n[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await tZ(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let n=rf(e);await tZ(this.storage,this.storageKey,n)}else{let e=rf(t);await tZ(this.storage,this.storageKey,e)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await t1(this.storage,this.storageKey),await ro(this.storage,this.storageKey),await t1(this.storage,this.storageKey+"-user"),this.userStorage&&await t1(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&tJ()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&"object"==typeof t&&"function"==typeof t.unref?t.unref():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null==(e=this.broadcastChannel)||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),null!=this.lock){try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let n=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof rO)this._debug("auto refresh token tick lock not available");else throw e}return}if(null!==this.refreshingDeferred)return void this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");try{let e=Date.now();try{await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let n=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!tJ()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;if(this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{"visible"!==document.visibilityState?this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting"):await this._recoverAndRefresh()});else{if("visible"!==document.visibilityState)return void this._debug(t,"visibilityState is no longer visible, skipping recovery");await this._recoverAndRefresh()}}else"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let n=null==r?void 0:r.redirectTo,i=null,s=null,o=null;"pkce"===this.flowType&&([i,s,o]=await this._getCodeChallengeAndMethod(),n=this._maybeAppendFlowIdToRedirect(n,o));let a=[`provider=${encodeURIComponent(t)}`];if(n&&a.push(`redirect_to=${encodeURIComponent(n)}`),(null==r?void 0:r.scopes)&&a.push(`scopes=${encodeURIComponent(r.scopes)}`),null!=i&&null!=s){let e=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(s)}`});a.push(e.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);a.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&a.push(`skip_http_redirect=${r.skipBrowserRedirect}`),{url:`${e}?${a.join("&")}`,flowId:o}}_maybeAppendFlowIdToRedirect(e,t){return e&&t&&this.experimental.appendPkceFlowIdToRedirects?function(e,t){let r=e.indexOf("#"),n=-1===r?e:e.slice(0,r),i=-1===r?"":e.slice(r),s=n.indexOf("?");if(-1!==s){let e=n.slice(0,s),t=n.slice(s+1).split("&").filter(e=>""!==e&&e!==tx&&!e.startsWith(`${tx}=`));n=t.length>0?`${e}?${t.join("&")}`:e}let o=n.includes("?")?"&":"?";return`${n}${o}${tx}=${encodeURIComponent(t)}${i}`}(e,t):null!=e?e:void 0}async _getCodeChallengeAndMethod(e=!1){return ra(this.storage,this.storageKey,e,e=>this._debug("#_getCodeChallengeAndMethod()","evicted oldest pending PKCE verifier slot",e))}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;return i?this._returnResult({data:null,error:i}
54):await ry(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)return this._returnResult({data:null,error:s});let o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:a,error:l}=await ry(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):("totp"===e.factorType&&"totp"===a.type&&(null==(n=null==a?void 0:a.totp)?void 0:n.qr_code)&&(a.totp.qr_code=`data:image/svg+xml;utf-8,${a.totp.qr_code}`),this._returnResult({data:a,error:null}))})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){let t=async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;if(i)return this._returnResult({data:null,error:i});let s=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?rI(e.webauthn.credential_response):rj(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:a}=await ry(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:s,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});return a?this._returnResult({data:null,error:a}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:a}))})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){let t=async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;if(i)return this._returnResult({data:null,error:i});let s=await ry(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});if(s.error)return s;let{data:o}=s;if("webauthn"!==o.type)return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:r_(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:rD(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let n={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])n.all.push(r),"verified"===r.status&&n[r.factor_type].push(r);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,r,n,i;if(e)try{let{payload:n}=t3(e),i=null;n.aal&&(i=n.aal);let s=i,{data:{user:o},error:a}=await this.getUser(e);if(a)return this._returnResult({data:null,error:a});(null!=(r=null==(t=null==o?void 0:o.factors)?void 0:t.filter(e=>"verified"===e.status))?r:[]).length>0&&(s="aal2");let l=n.amr||[];return{data:{currentLevel:i,nextLevel:s,currentAuthenticationMethods:l},error:null}}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}let{data:{session:s},error:o}
54=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:a}=t3(s.access_token),l=null;a.aal&&(l=a.aal);let h=l;return(null!=(i=null==(n=s.user.factors)?void 0:n.filter(e=>"verified"===e.status))?i:[]).length>0&&(h="aal2"),{data:{currentLevel:l,nextLevel:h,currentAuthenticationMethods:a.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await ry(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new tO})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new tO});let s=await ry(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url&&tJ()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(s.data.redirect_url),s})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new tO});let s=await ry(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url&&tJ()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(s.data.redirect_url),s})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;return r?this._returnResult({data:null,error:r}):t?await ry(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new tO})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?(await ry(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new tO})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let n=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>n)return r;let{data:i,error:s}=await ry(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(s)throw s;return i.keys&&0!==i.keys.length&&(this.jwks=i,this.jwks_cached_at=n,r=i.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{let i,s=e;if(!s){let{data:e,error:t}
54=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}let{header:o,payload:a,signature:l,raw:{header:h,payload:c}}=t3(s);if(!(null==t?void 0:t.allowExpired))try{var r,n=a.exp;if(!n)throw Error("Missing exp claim");if(n<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}catch(e){throw new t$(e instanceof Error?e.message:"JWT validation failed")}let u=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!u){let{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:a,header:o,signature:l},error:null}}let d=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(o.alg),f=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,f,l,(r=`${h}.${c}`,i=[],!function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(n,t)}}(r,e=>i.push(e)),new Uint8Array(i))))throw new t$("Invalid JWT signature");return{data:{claims:a,header:o,signature:l},error:null}}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,r,n;ru(this.experimental);try{if(!rB())return this._returnResult({data:null,error:new tE("Browser does not support WebAuthn",null)});let{data:i,error:s}=await this._startPasskeyAuthentication({options:{captchaToken:null==(t=null==e?void 0:e.options)?void 0:t.captchaToken}});if(s||!i)return this._returnResult({data:null,error:s});let o=rD(i.options),a=null!=(n=null==(r=null==e?void 0:e.options)?void 0:r.signal)?n:rP.createNewAbortSignal(),{data:l,error:h}=await rz({publicKey:o,signal:a});if(h||!l)return this._returnResult({data:null,error:null!=h?h:new tE("WebAuthn ceremony failed",null)});let c=rj(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:c})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,r;ru(this.experimental);try{if(!rB())return this._returnResult({data:null,error:new tE("Browser does not support WebAuthn",null)});let{data:n,error:i}=await this._startPasskeyRegistration();if(i||!n)return this._returnResult({data:null,error:i});let s=r_(n.options),o=null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.signal)?r:rP.createNewAbortSignal(),{data:a,error:l}=await r$({publicKey:s,signal:o});if(l||!a)return this._returnResult({data:null,error:null!=l?l:new tE("WebAuthn ceremony failed",null)});let h=rI(a);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:h})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){ru(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new tO});let{data:n,error:i}=await ry(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){ru(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new tO});let{data:i,error:s}=await ry(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:i,error:null})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;ru(this.experimental);try{let{data:r,error:n}=await ry(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null==(t=null==e?void 0:e.options)?void 0:t.captchaToken}}});if(n)return this._returnResult({data:null,error:n});return this._returnResult({data:r,error:null})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){ru(this.experimental);try{let{data:t,error:r}=await ry(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:rb});if(r)return this._returnResult({data:null,error:r});return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:t,error:null})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){ru(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new tO});let{data:n,error:i}=await ry(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){ru(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new tO});let{data:i,error:s}=await ry(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:i,error:null})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){ru(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new tO});let{error:i}
54=await ry(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if(tS(e))return this._returnResult({data:null,error:e});throw e}}}rJ.nextInstanceID={};let rG=rJ,rY="";if("u">typeof Deno)rY="deno",n=null==(x=Deno.version)?void 0:x.deno;else if("u">typeof document)rY="web";else if("u">typeof navigator&&"ReactNative"===navigator.product)rY="react-native";else{rY="node";let e=globalThis.process;n=null==e||null==(k=e.version)?void 0:k.replace(/^v/,"")}let rX=[`runtime=${rY}`];n&&rX.push(`runtime-version=${n}`);let rQ={headers:{"X-Client-Info":`supabase-js/2.112.4; ${rX.join("; ")}`}},rZ={schema:"public"},r0={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},r1={},r2={enabled:!1,respectSamplingDecision:!0};function r3(e){return(r3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function r4(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?r5(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=r3(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=r3(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==r3(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):r5(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}let r6=e=>e.startsWith("sb_publishable_")||e.startsWith("sb_secret_"),r8=new Set,r9=(e,t,r,n,s,o)=>{let a=n?(...e)=>n(...e):(...e)=>fetch(...e),l=Headers,h=(null==s?void 0:s.enabled)===!0,c=(null==s?void 0:s.respectSamplingDecision)!==!1,u=h?function(e){let t=[];try{let r=new URL(e);t.push(r.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}(t):null,d=!((null==o?void 0:o.omitApiKeyAsBearer)&&r6(e));return async(t,n)=>{let s=await r(),o=new l(null==n?void 0:n.headers);if(o.has("apikey")||o.set("apikey",e),!o.has("Authorization")){let t=null!=s?s:d?e:null;t&&o.set("Authorization",`Bearer ${t}`)}if(u){let e=function(e,t,r){let n=globalThis[i];if(!n)return r7||(r7=!0,console.warn("@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at your application entry point (requires the OpenTelemetry API package to be installed). The CDN/UMD build does not support trace propagation.")),null;if(!function(e,t){let r;if(!e||!t||0===t.length)return!1;if(e instanceof URL)r=e;else try{r=new URL(e)}catch(e){return!1}for(let e of t)try{if("string"==typeof e){if(function(e,t){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}(r.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(r.hostname))return!0}else if("function"==typeof e&&e(r))return!0}catch(e){continue}return!1}("string"==typeof e||e instanceof URL?e:e.url,t))return null;let s=n();if(!s||!s.traceparent){var o;if((null==s||null==(o=s.carrierKeys)?void 0:o.length)&&!ne){ne=!0;let e=s.carrierKeys.includes("sentry-trace")?" Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it.":" Configure your tracing SDK to emit W3C trace context on outgoing requests.";console.warn(`@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its propagator wrote [${s.carrierKeys.join(", ")}] and no W3C traceparent header, so trace headers will not be attached.`+e)}return null}if(r){let e=function(e){if(!e||"string"!=typeof e)return null;let t=e.split("-");if(4!==t.length)return null;let[r,n,i,s]=t;if(2!==r.length||32!==n.length||16!==i.length||2!==s.length)return null;let o=/^[0-9a-f]+$/i;return o.test(r)&&o.test(n)&&o.test(i)&&o.test(s)&&"00000000000000000000000000000000"!==n&&"0000000000000000"!==i?{version:r,traceId:n,parentId:i,traceFlags:s,isSampled:(1&parseInt(s,16))==1}:null}(s.traceparent);if(e&&!e.isSampled)return{traceparent:s.traceparent}}return s}(t,u,c);e&&(e.traceparent&&!o.has("traceparent")&&o.set("traceparent",e.traceparent),e.tracestate&&!o.has("tracestate")&&o.set("tracestate",e.tracestate),e.baggage&&!o.has("baggage")&&o.set("baggage",e.baggage))}return a(t,r4(r4({},n),{},{headers:o}))}},r7=!1,ne=!1;function nt(e){return"boolean"==typeof e?{enabled:e}:e}var nr=class extends rG{constructor(e){super(e)}},nn=class{constructor(e,t,r){var n,i,s;this.supabaseUrl=e,this.supabaseKey=t;const o=function(e){let t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");
54if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(e);if(!t)throw Error("supabaseKey is required.");(e=>{var t,r;if(!e.startsWith("sb_")||r6(e)||e.startsWith("sb_temp_"))return;let n=null!=(t=null==(r=e.match(/^sb_[a-zA-Z0-9]+_/))?void 0:r[0])?t:"unknown";r8.has(n)||(r8.add(n),console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type."))})(t),this.realtimeUrl=new URL("realtime/v1",o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",o),this.storageUrl=new URL("storage/v1",o),this.functionsUrl=new URL("functions/v1",o);const a=`sb-${o.hostname.split(".")[0]}-auth-token`,l=function(e,t){var r,n,i,s,o,a;let{db:l,auth:h,realtime:c,global:u}=e,{db:d,auth:f,realtime:p,global:m}
54=t,g=nt(e.tracePropagation),y=nt(t.tracePropagation),v={db:r4(r4({},d),l),auth:r4(r4({},f),h),realtime:r4(r4({},p),c),storage:{},global:r4(r4(r4({},m),u),{},{headers:r4(r4({},null!=(r=null==m?void 0:m.headers)?r:{}),null!=(n=null==u?void 0:u.headers)?n:{})}),tracePropagation:{enabled:null!=(i=null!=(s=null==g?void 0:g.enabled)?s:null==y?void 0:y.enabled)&&i,respectSamplingDecision:null==(o=null!=(a=null==g?void 0:g.respectSamplingDecision)?a:null==y?void 0:y.respectSamplingDecision)||o},accessToken:async()=>""};return e.accessToken?v.accessToken=e.accessToken:delete v.accessToken,v}(null!=r?r:{},{db:rZ,realtime:r1,auth:r4(r4({},r0),{},{storageKey:a}),global:rQ,tracePropagation:r2});this.settings=l,this.storageKey=null!=(n=l.auth.storageKey)?n:"",this.headers=null!=(i=l.global.headers)?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(s=l.auth)?s:{},this.headers,l.global.fetch),this.fetch=r9(t,e,this._getSessionToken.bind(this),l.global.fetch,l.tracePropagation),this.functionsFetch=r9(t,e,this._getSessionToken.bind(this),l.global.fetch,l.tracePropagation,{omitApiKeyAsBearer:!0}),this.realtime=this._initRealtimeClient(r4({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new B(new URL("rest/v1",o).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit,retry:l.db.retry}),this.storage=new tm(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new C(this.functionsUrl.href,{headers:this.headers,customFetch:this.functionsFetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getSessionToken(){var e,t;if(this.accessToken)return await this.accessToken();let{data:r}=await this.auth.getSession();return null!=(e=null==(t=r.session)?void 0:t.access_token)?e:null}async _getAccessToken(){var e;return null!=(e=await this._getSessionToken())?e:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:i,storageKey:s,flowType:o,lock:a,debug:l,throwOnError:h,experimental:c,lockAcquireTimeout:u,skipAutoInitialize:d},f,p){let m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new nr({url:this.authUrl.href,headers:r4(r4({},m),f),storageKey:s,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:i,flowType:o,lock:a,debug:l,throwOnError:h,experimental:c,fetch:p,lockAcquireTimeout:u,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new eI(this.realtimeUrl.href,r4(r4({},e),{},{params:r4(r4({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e||"INITIAL_SESSION"===e)&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}};(function(){if("u">typeof window||void 0!==globalThis.Deno)return!1;let e=globalThis.process;if(!e)return!1;let t=e.version;if(null==t)return!1;let r=t.match(/^v(\d+)\./);return!!r&&20>=parseInt(r[1],10)})()&&console.warn("⚠️  Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
54ode.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715"),e.s(["createClient",0,(e,t,r)=>new nn(e,t,r)],88715)},9156,(e,t,r)=>{"use strict";let n;Object.defineProperty(r,"__esModule",{value:!0}),r.parseCookie=u,r.parse=u,r.stringifyCookie=function(e,t){let r=t?.encode||encodeURIComponent,n=[];for(let t of Object.keys(e)){let o=e[t];if(void 0===o)continue;if(!i.test(t))throw TypeError(`cookie name is invalid: ${t}`);let a=r(o);if(!s.test(a))throw TypeError(`cookie val is invalid: ${o}`);n.push(`${t}=${a}`)}return n.join("; ")},r.stringifySetCookie=d,r.serialize=d,r.parseSetCookie=function(e,t){let r=t?.decode||g,n=e.length,i=f(e,0,n),s=p(e,0,i),o=-1===s?{name:"",value:r(m(e,0,i))}:{name:m(e,0,s),value:r(m(e,s+1,i))},a=i+1;for(;a<n;){let t=f(e,a,n),r=p(e,a,t),i=-1===r?m(e,a,t):m(e,a,r),s=-1===r?void 0:m(e,r+1,t);switch(i.toLowerCase()){case"httponly":o.httpOnly=!0;break;case"secure":o.secure=!0;break;case"partitioned":o.partitioned=!0;break;case"domain":o.domain=s;break;case"path":o.path=s;break;case"max-age":s&&l.test(s)&&(o.maxAge=Number(s));break;case"expires":if(!s)break;let h=new Date(s);Number.isFinite(h.valueOf())&&(o.expires=h);break;case"priority":if(!s)break;let c=s.toLowerCase();("low"===c||"medium"===c||"high"===c)&&(o.priority=c);break;case"samesite":if(!s)break;let u=s.toLowerCase();("lax"===u||"strict"===u||"none"===u)&&(o.sameSite=u)}a=t+1}return o},r.stringifySetCookie=d,r.serialize=d;let i=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,s=/^[\u0021-\u003A\u003C-\u007E]*$/,o=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,a=/^[\u0020-\u003A\u003D-\u007E]*$/,l=/^-?\d+$/,h=Object.prototype.toString,c=((n=function(){}).prototype=Object.create(null),n);function u(e,t){let r=new c,n=e.length;if(n<2)return r;let i=t?.decode||g,s=0;do{let t=p(e,s,n);if(-1===t)break;let o=f(e,s,n);if(t>o){s=e.lastIndexOf(";",t-1)+1;continue}let a=m(e,s,t);void 0===r[a]&&(r[a]=i(m(e,t+1,o))),s=o+1}while(s<n)return r}function d(e,t,r){let n="object"==typeof e?e:{...r,name:e,value:String(t)},l=("object"==typeof t?t:r)?.encode||encodeURIComponent;if(!i.test(n.name))throw TypeError(`argument name is invalid: ${n.name}`);let c=n.value?l(n.value):"";if(!s.test(c))throw TypeError(`argument val is invalid: ${n.value}`);let u=n.name+"="+c;if(void 0!==n.maxAge){if(!Number.isInteger(n.maxAge))throw TypeError(`option maxAge is invalid: ${n.maxAge}`);u+="; Max-Age="+n.maxAge}if(n.domain){if(!o.test(n.domain))throw TypeError(`option domain is invalid: ${n.domain}`);u+="; Domain="+n.domain}if(n.path){if(!a.test(n.path))throw TypeError(`option path is invalid: ${n.path}`);u+="; Path="+n.path}if(n.expires){var d;if(d=n.expires,"[object Date]"!==h.call(d)||!Number.isFinite(n.expires.valueOf()))throw TypeError(`option expires is invali
54d: ${n.expires}`);u+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(u+="; HttpOnly"),n.secure&&(u+="; Secure"),n.partitioned&&(u+="; Partitioned"),n.priority)switch("string"==typeof n.priority?n.priority.toLowerCase():void 0){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${n.priority}`)}if(n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"none":u+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${n.sameSite}`)}return u}function f(e,t,r){let n=e.indexOf(";",t);return -1===n?r:n}function p(e,t,r){let n=e.indexOf("=",t);return n<r?n:-1}function m(e,t,r){let n=t,i=r;do{let t=e.charCodeAt(n);if(32!==t&&9!==t)break}while(++n<i)for(;i>n;){let t=e.charCodeAt(i-1);if(32!==t&&9!==t)break;i--}return e.slice(n,i)}function g(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}},3949,91536,e=>{"use strict";let t;var r=e.i(47167),n=e.i(43476),i=e.i(71645),s=e.i(88715),o=e.i(9156);let a={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4},l=/^(.*)[.](0|[1-9][0-9]*)$/;function h(e,t){if(e===t)return!0;let r=e.match(l);return!!r&&r[1]===t}function c(e,t,r){let n=r??3180,i=encodeURIComponent(t);if(i.length<=n)return[{name:e,value:t}];let s=[];for(;i.length>0;){let e=i.slice(0,n),t=e.lastIndexOf("%");t>n-3&&(e=e.slice(0,t));let r="";for(;e.length>0;)try{r=decodeURIComponent(e);break}catch(t){if(t instanceof URIError&&"%"===e.at(-3)&&e.length>3)e=e.slice(0,e.length-3);else throw t}s.push(r),i=i.slice(e.length)}return s.map((t,r)=>({name:`${e}.${r}`,value:t}))}async function u(e,t){let r=await t(e);if(r)return r;let n=[];for(let r=0;;r++){let i=`${e}.${r}`,s=await t(i);if(!s)break;n.push(s)}return n.length>0?n.join(""):null}function d(){return"u">typeof window&&void 0!==window.document}o.parse,o.serialize;let f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),p=" 	\n\r=".split(""),m=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<p.length;t+=1)e[p[t].charCodeAt(0)]=-2;for(let t=0;t<f.length;t+=1)e[f[t].charCodeAt(0)]=t;return e})();function g(e){let t=[],r=0,n=0;if(function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(n,t)}}(e,e=>{for(r=r<<8|e,n+=8;n>=6;){let e=r>>n-6&63;t.push(f[e]),n-=6}}),n>0)for(r<<=6-n,n=6;n>=6;){let e=r>>n-6&63;t.push(f[e]),n-=6}return t.join("")}let y="base64-",v=/-flow-[A-Za-z0-9_-]{8,64}-code-verifier$/;function b(e){let t;if(!e.startsWith(y))return e;try{t=function(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},i=0,s=0;for(let t=0;t<e.length;t+=1){let o=m[e.charCodeAt(t)];if(o>-1)for(i=i<<6|o,s+=6;s>=8;)(function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}})(i>>s-8&255,n,r),s-=8;else if(-2===o)continue;else throw Error(`Invalid Base64-URL character "${e.at(t)}" at position ${t}`)}return t.join("")}(e.substring(y.length))}catch(e){return console.warn("@supabase/ssr: could not base64url-decode chunked cookie value, treating as absent. Cookie chunks may have been written partially across responses.",e),null}try{JSON.parse(t)}catch{return console.warn("@supabase/ssr: chunked cookie decoded to invali
54d JSON, treating as absent. This usually indicates that cookie chunks from different writes were combined (e.g. response committed before all Set-Cookie headers were sent)."),null}return t}async function w({getAll:e,setAll:t,setItems:r,removedItems:n},i){let s=i.cookieEncoding,o=i.cookieOptions??null,l=await e([...r?Object.keys(r):[],...n?Object.keys(n):[]]),u=l?.map(({name:e})=>e)||[],d=new Map(l?.map(({name:e,value:t})=>[e,t])||[]),f=Object.keys(n).flatMap(e=>u.filter(t=>h(t,e))),p=Object.keys(r).flatMap(e=>{let t=new Set(u.filter(t=>h(t,e))),n=r[e];"base64url"===s&&(n=y+g(n));let i=c(e,n);return i.forEach(e=>{t.delete(e.name)}),f.push(...t),i}).filter(({name:e,value:t})=>d.get(e)!==t),m=f.filter(e=>d.has(e)),v={...a,...o,maxAge:0},b={...a,...o,maxAge:a.maxAge};delete v.name,delete b.name;let x=v.domain&&m.length>0?(()=>{let{domain:e,...t}=v;return t})():null;(0!==m.length||0!==p.length)&&await t([...x?m.map(e=>({name:e,value:"",options:x})):[],...m.map(e=>({name:e,value:"",options:v})),...p.map(({name:e,value:t})=>({name:e,value:t,options:b}))],{"Cache-Control":"private, no-cache, no-store, must-revalidate, max-age=0",Expires:"0",Pragma:"no-cache"})}let x=!1,k=["@supabase/auth-helpers-nextjs","@supabase/auth-helpers-react","@supabase/auth-helpers-remix","@supabase/auth-helpers-sveltekit"],S=()=>(function(e,n){!function(){if(x||void 0===r.default||!r.default.env?.npm_package_name)return;let e=r.default.env.npm_package_name;k.includes(e)&&(x=!0,console.warn(`
55╔════════════════════════════════════════════════════════════════════════════╗
56║ ⚠️  IMPORTANT: Package Consolidation Notice                                ║
57║                                                                            ║
58║ The ${e.padEnd(35)} package name is deprecated.  ║
59║                                                                            ║
60║ You are now using @supabase/ssr - a unified solution for all frameworks.  ║
61║                                                                            ║
62║ The auth-helpers packages have been consolidated into @supabase/ssr       ║
63║ to provide better maintenance and consistent APIs across frameworks.      ║
64║                                                                            ║
65║ Please update your package.json to use @supabase/ssr directly:            ║
66║   npm uninstall ${e.padEnd(42)} ║
67║   npm install @supabase/ssr                                               ║
68║                                                                            ║
69║ For more information, visit:                                              ║
70║ https://supabase.com/docs/guides/auth/server-side                         ║
71╚════════════════════════════════════════════════════════════════════════════╝
72    `))}();let i=d();if(i&&t)return t;if(!e||!n)throw Error(`@supabase/ssr: Your project's URL and API key are required to create a Supabase client!
73
74Check your Supabase project's API settings to find these values
75
76https://supabase.com/dashboard/project/_/settings/api`);let{storage:l}=function(e,t){let r,n,i=e.cookies??null,s=e.cookieEncoding,l={},f={},p=()=>{let e=(0,o.parse)(document.cookie);return Object.keys(e).map(t=>({name:t,value:e[t]??""}))},m=e=>{e.forEach(({name:e,value:t,options:r})=>{document.cookie=(0,o.serialize)(e,t,r)})};if(i)if("get"in i){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>`${e}.${r}`)]),r=[];for(let e=0;e<t.length;e+=1){let n=await i.get(t[e]);(n||"string"==typeof n)&&r.push({name:t[e],value:n})}return r};if(r=async t=>await e(t),"set"in i&&"remove"in i)n=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:n,options:s}=e[t];n?await i.set(r,n,s):await i.remove(r,s)}};else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for c
76orrectness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in i)if(r=async()=>await i.getAll(),"setAll"in i)n=i.setAll;else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else if(!t&&d())r=()=>p(),n=m;else throw Error(`@supabase/ssr: ${t?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${d()?" As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""}`);else if(!t&&d())r=()=>p(),n=m;else if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else r=()=>[],n=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};return t?{getAll:r,setAll:n,setItems:l,removedItems:f,storage:{isServer:!0,getItem:async e=>{if("string"==typeof l[e])return l[e];if(f[e])return null;let t=await r([e]),n=await u(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return n?"string"!=typeof n?n:b(n):null},setItem:async(t,i)=>{t.endsWith("-code-verifier")&&await w({getAll:r,setAll:n,setItems:{[t]:i},removedItems:{}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:s}),l[t]=i,delete f[t]},removeItem:async t=>{(v.test(t)||t.endsWith("-flows-code-verifier"))&&await w({getAll:r,setAll:n,setItems:{},removedItems:{[t]:!0}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:s}),delete l[t],f[t]=!0}}}:{getAll:r,setAll:n,setItems:l,removedItems:f,storage:{isServer:!1,getItem:async e=>{let t=await r([e]),n=await u(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return n?b(n):null},setItem:async(t,i)=>{let o=await r([t]),l=new Set((o?.map(({name:e})=>e)||[]).filter(e=>h(e,t))),u=i;"base64url"===s&&(u=y+g(i));let d=c(t,u);d.forEach(({name:e})=>{l.delete(e)});let f={...a,...e?.cookieOptions,maxAge:0},p={...a,...e?.cookieOptions,maxAge:a.maxAge};delete f.name,delete p.name;let m=f.domain?(()=>{let{domain:e,...t}=f;return t})():null,v=[...m?[...l].map(e=>({name:e,value:"",options:m})):[],...[...l].map(e=>({name:e,value:"",options:f})),...d.map(({name:e,value:t})=>({name:e,value:t,options:p}))];v.length>0&&await n(v,{})},removeItem:async t=>{let i=await r([t]),s=(i?.map(({name:e})=>e)||[]).filter(e=>h(e,t));if(0===s.length)return;let o={...a,...e?.cookieOptions,maxAge:0};delete o.name;let l=o.domain?(()=>{let{domain:e,...t}=o;return t})():null,c=[...l?s.map(e=>({name:e,value:"",options:l})):[],...s.map(e=>({name:e,value:"",options:o}))];await n(c,{})}}}}({...void 0,cookieEncoding:(void 0)??"base64url"},!1),f=(0,s.createClient)(e,n,{...void 0,global:{...void 0,headers:{...void 0,"X-Client-Info":"supabase-ssr/0.12.5 createBrowserClient"}},auth:{...void 0,...null,flowType:"pkce",autoRefreshToken:(void 0)??d(),detectSessionInUrl:(void 0)??d(),persistSession:(void 0)??!0,storage:l,...null}});return i&&(t=f),f})("https://tvyjwdcrchhgrlqvcnmz.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR2eWp3ZGNyY2hoZ3JscXZjbm16Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODc5NDE5NDYsImV4cCI6MjEwMzUxNzk0Nn0.oSWfWHXULhpEe8JMZCPjNM0x8HoW9W7DNX6ddeKiqaE");e.s(["createClient",0,S],91536);let C=(0,i.createContext)({user:null,isLoading:!0,hasSiteAccess:!1});e.s(["AuthProvider",0,function({children:e}){let[t,r]=(0,i.useState)(null),[s,o]=(0,i.useState)(!0),[a,l]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let e=S();(async()=>{try{let{data:t}=await e.auth.getUser(),n=t.user;r(n)}catch(e){console.error("Error checking auth:",e),r(null),l(!1)}finally{o(!1)}})();let{data:{subscription:t}}=e.auth.onAuthStateChange(async(e,t)=>{r(t?.user||null),o(!1)});return()=>{t.unsubscribe()}},[]),(0,i.useEffect)(()=>{let e=S();(async()=>
76{if(!t)return l(!1);try{let{data:t,error:r}=await e.rpc("can_edit_site",{target_site_id:"regattagrove"});l(!r&&!!t)}catch{l(!1)}})()},[t]),(0,n.jsx)(C.Provider,{value:{user:t,isLoading:s,hasSiteAccess:a},children:e})},"useAuth",0,()=>(0,i.useContext)(C)],3949)},91918,e=>{"use strict";var t=e.i(71645),r=e.i(20783),n=e.i(43476),i=Symbol.for("react.lazy"),s=t[" use ".trim().toString()];function o(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===i&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function a(e){var i;let a,l=(i=e,(a=t.forwardRef((e,n)=>{let{children:i,...a}=e;if(o(i)&&"function"==typeof s&&(i=s(i._payload)),t.isValidElement(i)){var l;let e,s,o=(l=i,(s=(e=Object.getOwnPropertyDescriptor(l.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?l.ref:(s=(e=Object.getOwnPropertyDescriptor(l,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?l.props.ref:l.props.ref||l.ref),h=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(a,i.props);return i.type!==t.Fragment&&(h.ref=n?(0,r.composeRefs)(n,o):o),t.cloneElement(i,h)}return t.Children.count(i)>1?t.Children.only(null):null})).displayName=`${i}.SlotClone`,a),h=t.forwardRef((e,r)=>{let{children:i,...a}=e;o(i)&&"function"==typeof s&&(i=s(i._payload));let h=t.Children.toArray(i),u=h.find(c);if(u){let e=u.props.children,i=h.map(r=>r!==u?r:t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null);return(0,n.jsx)(l,{...a,ref:r,children:t.isValidElement(e)?t.cloneElement(e,void 0,i):null})}return(0,n.jsx)(l,{...a,ref:r,children:i})});return h.displayName=`${e}.Slot`,h}var l=a("Slot"),h=Symbol("radix.slottable");function c(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===h}e.s(["Slot",0,l,"createSlot",0,a])},25913,e=>{"use strict";var t=e.i(7670);let r=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=t.clsx;e.s(["cva",0,(e,t)=>i=>{var s;if((null==t?void 0:t.variants)==null)return n(e,null==i?void 0:i.class,null==i?void 0:i.className);let{variants:o,defaultVariants:a}=t,l=Object.keys(o).map(e=>{let t=null==i?void 0:i[e],n=null==a?void 0:a[e];if(null===t)return null;let s=r(t)||r(n);return o[e][s]}),h=i&&Object.entries(i).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return n(e,l,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:n,...i}=t;return Object.entries(i).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...a,...h}[t]):({...a,...h})[t]===r})?[...e,r,n]:e},[]),null==i?void 0:i.class,null==i?void 0:i.className)}])},38155,8311,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(91918),i=e.i(25913),s=e.i(7670),o=e.i(19056);function a(...e){return(0,o.twMerge)((0,s.clsx)(e))}e.s(["cn",0,a],8311);let l=(0,i.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),h=r.forwardRef(({className:e,variant:r,size:i,asChild:s=!1,...o},h)=>{let c=s?n.Slot:"button";return(0,t.jsx)(c,{className:a(l({variant:r,size:i,className:e})),ref:h,...o})});h.displayName="Button",e.s(["Button",0,h],38155)},91101,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(38155);let i=(0,r.createContext)({drafts:{},setDraft:()=>{},openId:null,requestOpen:()=>{},requestClose:()=>{},setDirty:()=>{}}),s=(0,r.createContext)(""),o=e=>{let t="regattagrove";return(t&&e.startsWith(`${t}-`)?e.slice(t.length+1):e).replace(/faqs/i,"FAQs").replace(/[-_]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())};e.s(["ObjectDraftProvider",0,function({children:e}){let[s,a]=(0,r.useState)({}),[l,h]=(0,r.useState)(null),[c,u]=(0,r.useState)(null),d=(0,r.useRef)(null),f=(0,r.useRef)({});d.current=l;let p=(0,r.useCallback)((e,t)=>{a(r=>{if(null==t){if(!(e in r))return r;let t={...r};return delete t[e],t}return{...r,[e]:t}})},[]),m=(0,r.useCallback)((e,t)=>{f.current[e]=t},[]),g=(0,r.useCallback)(e=>{let t=d.current;if(t!==e){if(t&&f.current[t])return void u(e);u(null),h(e)}},[]),y=(0,r.useCallback)(e=>{if(d.current===e){if(f.current[e])return void u(!1);f.current[e]=!1,u(null),h(null)}},[]),v=()=>u(null);(0,r.useEffect)(()=>(document.documentElement.classList.toggle("cms-object-drawer-open",!!l),()=>document.documentElement.classList.remove("cms-object-drawer-open")),[l]),(0,r.useEffect)(()=>
76{if(!l)return;let e=e=>{let t=e.target;document.documentElement.classList.contains("cms-left-drawer-open")||t.closest(".zero, [data-radix-popper-content-wrapper], [data-radix-select-content], [data-radix-focus-guard]")||t.closest(`#${CSS.escape(l)}`)||t.closest("button")||y(l)};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[l,y]);let b=(0,r.useMemo)(()=>({drafts:s,setDraft:p,openId:l,requestOpen:g,requestClose:y,setDirty:m}),[s,p,l,g,y,m]);return(0,t.jsxs)(i.Provider,{value:b,children:[e,null!==c&&l&&(0,t.jsx)("div",{className:"zero fixed inset-0 z-[500] flex items-center justify-center bg-black/70 p-4",onClick:v,children:(0,t.jsxs)("div",{className:"w-full max-w-sm rounded-lg border bg-background p-4 text-foreground shadow-lg",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("p",{className:"text-lg font-semibold",children:"Unsaved changes"}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-muted-foreground",children:[o(l)," has edits that are not saved."," ",c?`Discard them and edit ${o(c)}?`:"Discard them and close?"]}),(0,t.jsxs)("div",{className:"mt-4 flex justify-end gap-2",children:[(0,t.jsx)(n.Button,{variant:"outline",onClick:v,children:"Keep editing"}),(0,t.jsx)(n.Button,{variant:"destructive",onClick:()=>{let e=d.current;e&&(f.current[e]=!1),h(c||null),u(null)},children:"Discard"})]})]})})]})},"ObjectIdProvider",0,function({id:e,children:r}){return(0,t.jsx)(s.Provider,{value:e,children:r})},"useLiveObject",0,function(e){let t=(0,r.useContext)(s);return(0,r.useContext)(i).drafts[t]??e},"useObjectDrawer",0,function(){let{openId:e,requestOpen:t,requestClose:n,setDirty:s}=(0,r.useContext)(i);return{openId:e,requestOpen:t,requestClose:n,setDirty:s}},"useSetObjectDraft",0,function(){return(0,r.useContext)(i).setDraft}])},95187,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={callServer:function(){return s.callServer},createServerReference:function(){return a.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s=e.r(32120),o=e.r(92245),a=e.r(35326)},86925,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(26999),i=e.i(25913),s=e.i(37727),o=e.i(8311);let a=n.Root;n.Trigger,n.Close;let l=n.Portal,h=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Overlay,{className:(0,o.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r,ref:i}));h.displayName=n.Overlay.displayName;let c=(0,i.cva)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),u=r.forwardRef(({side:e="right",className:r,children:i,hideOverlay:a,...u},d)=>(0,t.jsxs)(l,{children:[!a&&(0,t.jsx)(h,{}),(0,t.jsxs)(n.Content,{ref:d,className:(0,o.cn)(c({side:e}),r),...u,children:[i,(0,t.jsxs)(n.Close,{className:"absolute right-4 top-4 roun
76ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,t.jsx)(s.X,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));u.displayName=n.Content.displayName;let d=({className:e,...r})=>(0,t.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...r});d.displayName="SheetHeader";let f=({className:e,...r})=>(0,t.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});f.displayName="SheetFooter";let p=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Title,{ref:i,className:(0,o.cn)("text-lg font-semibold text-foreground",e),...r}));p.displayName=n.Title.displayName;let m=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Description,{ref:i,className:(0,o.cn)("text-sm text-muted-foreground",e),...r}));m.displayName=n.Description.displayName,e.s(["Sheet",0,a,"SheetContent",0,u,"SheetDescription",0,m,"SheetFooter",0,f,"SheetHeader",0,d,"SheetTitle",0,p])},65725,75830,86318,70152,30774,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(81140),i=e.i(30030),s=e.i(20783);function o(e){var n;let i,o=(n=e,(i=r.forwardRef((e,t)=>{let{children:n,...i}=e;if(r.isValidElement(n)){var o;let e,a,l=(o=n,(a=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(a=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),h=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(i,n.props);return n.type!==r.Fragment&&(h.ref=t?(0,s.composeRefs)(t,l):l),r.cloneElement(n,h)}return r.Children.count(n)>1?r.Children.only(null):null})).displayName=`${n}.SlotClone`,i),a=r.forwardRef((e,n)=>{let{children:i,...s}=e,a=r.Children.toArray(i),h=a.find(l);if(h){let e=h.props.children,i=a.map(t=>t!==h?t:r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null);return(0,t.jsx)(o,{...s,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return(0,t.jsx)(o,{...s,ref:n,children:i})});return a.displayName=`${e}.Slot`,a}var a=Symbol("radix.slottable");function l(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===a}function h(e){let n=e+"CollectionProvider",[a,l]=(0,i.createContextScope)(n),[h,c]=a(n,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:n,children:i}=e,s=r.default.useRef(null),o=r.default.useRef(new Map).current;return(0,t.jsx)(h,{scope:n,itemMap:o,collectionRef:s,children:i})};u.displayName=n;let d=e+"CollectionSlot",f=o(d),p=r.default.forwardRef((e,r)=>{let{scope:n,children:i}=e,o=c(d,n),a=(0,s.useComposedRefs)(r,o.collectionRef);return(0,t.jsx)(f,{ref:a,children:i})});p.displayName=d;let m=e+"CollectionItemSlot",g="data-radix-collection-item",y=o(m),v=r.default.forwardRef((e,n)=>{let{scope:i,children:o,...a}=e,l=r.default.useRef(null),h=(0,s.useComposedRefs)(n,l),u=c(m,i);return r.default.useEffect(()=>(u.itemMap.set(l,{ref:l,...a}),()=>void u.itemMap.delete(l))),(0,t.jsx)(y,{...{[g]:""},ref:h,children:o})});return v.displayName=m,[{Provider:u,Slot:p,ItemSlot:v},function(t){let n=c(e+"CollectionConsumer",t);return r.default.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[n.collectionRef,n.itemMap])},l]}var c=new WeakMap;function u(e,t){var r,n;let i,s,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(r=e,n=t,i=r.length,(o=(s=d(n))>=0?s:i+s)<0||o>=i?-1:o);return -1===a?void 0:e[a]}function d(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],c.set(this,!0)}set(e,t){return c.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,i=this.has(t),s=this.#e.length,o=d(e),a=o>=0?o:s+o,l=a<0||a>=s?-1:a;if(l===this.size||i&&l===this.size-1||-1===l)return this.set(t,r),this;let h=this.size+ +!i;o<0&&a++;let c=[...this.#e],u=!1;for(let e=a;
76e<h;e++)if(a===e){let s=c[e];c[e]===t&&(s=c[e+1]),i&&this.delete(t),n=this.get(s),this.set(t,r)}else{u||c[e-1]!==t||(u=!0);let r=c[u?e:e-1],i=n;n=this.get(r),this.delete(r),this.set(r,i)}return this}with(t,r,n){let i=new e(this);return i.insert(t,r,n),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=u(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=u(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return u(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],i=0;for(let e of this)Reflect.apply(t,r,[e,i,this])&&n.push(e),i++;return new e(n)}map(t,r){let n=[],i=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,i,this])]),i++;return new e(n)}reduce(...e){let[t,r]=e,n=0,i=r??this.at(0);for(let r of this)i=0===n&&1===e.length?r:Reflect.apply(t,this,[i,r,n,this]),n++;return i}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let i=this.at(r);n=r===this.size-1&&1===e.length?i:Reflect.apply(t,this,[n,i,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,i=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(i=r-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}}),e.s(["createCollection",0,h],75830);var f=e.i(10772),p=e.i(48425),m=e.i(30207),g=e.i(69340),y=r.createContext(void 0);function v(e){let t=r.useContext(y);return e||t||"ltr"}e.s(["useDirection",0,v],86318);var b="rovingFocusGroup.onEntryFocus",w={bubbles:!1,cancelable:!0},x="RovingFocusGroup",[k,S,C]=h(x),[A,E]=(0,i.createContextScope)(x,[C]),[T,O]=A(x),M=r.forwardRef((e,r)=>(0,t.jsx)(k.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(k.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(R,{...e,ref:r})})}));M.displayName=x;var R=r.forwardRef((e,i)=>{let{__scopeRovingFocusGroup:o,orientation:a,loop:l=!1,dir:h,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:y=!1,...k}=e,C=r.useRef(null),A=(0,s.useComposedRefs)(i,C),E=v(h),[O,M]=(0,g.useControllableState)({prop:c,defaultProp:u??null,onChange:d,caller:x}),[R,N]=r.useState(!1),P=(0,m.useCallbackRef)(f),_=S(o),I=r.useRef(!1),[j,L]=r.useState(0);return r.useEffect(()=>{let e=C.current;if(e)return e.addEventListener(b,P),()=>e.removeEventListener(b,P)},[P]),(0,t.jsx)(T,{scope:o,orientation:a,dir:E,loop:l,currentTabStopId:O,onItemFocus:r.useCallback(e=>M(e),[M]),onItemShiftTab:r.useCallback(()=>N(!0),[]),onFocusableItemAdd:r.useCallback(()=>L(e=>e+1),[]),onFocusableItemRemove:r.useCallback(()=>L(e=>e-1),[]),children:(0,t.jsx)(p.Primitive.div,{tabIndex:R||0===j?-1:0,"data-orientation":a,...k,ref:A,style:{outline:"none",...e.style},onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,()=>
76{I.current=!0}),onFocus:(0,n.composeEventHandlers)(e.onFocus,e=>{let t=!I.current;if(e.target===e.currentTarget&&t&&!R){let t=new CustomEvent(b,w);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=_().filter(e=>e.focusable);D([e.find(e=>e.active),e.find(e=>e.id===O),...e].filter(Boolean).map(e=>e.ref.current),y)}}I.current=!1}),onBlur:(0,n.composeEventHandlers)(e.onBlur,()=>N(!1))})})}),N="RovingFocusGroupItem",P=r.forwardRef((e,i)=>{let{__scopeRovingFocusGroup:s,focusable:o=!0,active:a=!1,tabStopId:l,children:h,...c}=e,u=(0,f.useId)(),d=l||u,m=O(N,s),g=m.currentTabStopId===d,y=S(s),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:w}=m;return r.useEffect(()=>{if(o)return v(),()=>b()},[o,v,b]),(0,t.jsx)(k.ItemSlot,{scope:s,id:d,focusable:o,active:a,children:(0,t.jsx)(p.Primitive.span,{tabIndex:g?0:-1,"data-orientation":m.orientation,...c,ref:i,onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,e=>{o?m.onItemFocus(d):e.preventDefault()}),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>m.onItemFocus(d)),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let i=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return _[i]}(e,m.orientation,m.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=y().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&i.reverse();let s=i.indexOf(e.currentTarget);i=m.loop?(r=i,n=s+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(s+1)}setTimeout(()=>D(i))}}),children:"function"==typeof h?h({isCurrentTabStop:g,hasTabStop:null!=w}):h})})});P.displayName=N;var _={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function D(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var I=e.i(96626),j="Tabs",[L,B]=(0,i.createContextScope)(j,[E]),$=E(),[z,F]=L(j),H=r.forwardRef((e,r)=>{let{__scopeTabs:n,value:i,onValueChange:s,defaultValue:o,orientation:a="horizontal",dir:l,activationMode:h="automatic",...c}=e,u=v(l),[d,m]=(0,g.useControllableState)({prop:i,onChange:s,defaultProp:o??"",caller:j});return(0,t.jsx)(z,{scope:n,baseId:(0,f.useId)(),value:d,onValueChange:m,orientation:a,dir:u,activationMode:h,children:(0,t.jsx)(p.Primitive.div,{dir:u,"data-orientation":a,...c,ref:r})})});H.displayName=j;var W="TabsList",U=r.forwardRef((e,r)=>{let{__scopeTabs:n,loop:i=!0,...s}=e,o=F(W,n),a=$(n);return(0,t.jsx)(M,{asChild:!0,...a,orientation:o.orientation,dir:o.dir,loop:i,children:(0,t.jsx)(p.Primitive.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:r})})});U.displayName=W;var V="TabsTrigger",q=r.forwardRef((e,r)=>{let{__scopeTabs:i,value:s,disabled:o=!1,...a}=e,l=F(V,i),h=$(i),c=G(l.baseId,s),u=Y(l.baseId,s),d=s===l.value;return(0,t.jsx)(P,{asChild:!0,...h,focusable:!o,active:d,children:(0,t.jsx)(p.Primitive.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...a,ref:r,onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,e=>{o||0!==e.button||!1!==e.ctrlKey?e.preventDefault():l.onValueChange(s)}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&l.onValueChange(s)}),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==l.activationMode;d||o||!e||l.onValueChange(s)})})})});q.displayName=V;var K="TabsContent",J=r.forwardRef((e,n)=>{let{__scopeTabs:i,value:s,forceMount:o,children:a,...l}=e,h=F(K,i),c=G(h.baseId,s),u=Y(h.baseId,s),d=s===h.value,f=r.useRef(d);return r.useEffect(()=>{let e=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,t.jsx)(I.Presence,{present:o||d,children:({present:r})=>(0,t.jsx)(p.Primitive.div,{"data-state":d?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":c,hidden:!r,id:u,tabIndex:0,...l,ref:n,style:{...e.style,animationDuration:f.current?"0s":void 0},children:r&&a})})});function G(e,t){return`${e}-trigger-${t}`}function Y(e,t){return`${e}-content-${t}`}J.displayName=K;var X=e.i(8311);let Q=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(U,{ref:n,className:(0,X.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...r}));Q.displayName=U.displayName;let Z=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(q,{ref:n,className:(0,X.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...r}));Z.displayName=q.displayName;let ee=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(J,{ref:n,className:(0,X.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...r}));ee.displayName=J.displayName,e.s(["Tabs",0,H,"TabsContent",0,ee,"TabsList",0,Q,"TabsTrigger",0,Z],65725);var et=e.i(34620);function er(e,[t,r]){return Math.min(r,Math.max(t,e))}e.s(["clamp",0,er],70152);var en="ScrollArea",[ei,es]=(0,i.createContextScope)(en),[eo,ea]=ei(en),el=r.forwardRef((e,n
76)=>{let{__scopeScrollArea:i,type:o="hover",dir:a,scrollHideDelay:l=600,...h}=e,[c,u]=r.useState(null),[d,f]=r.useState(null),[m,g]=r.useState(null),[y,b]=r.useState(null),[w,x]=r.useState(null),[k,S]=r.useState(0),[C,A]=r.useState(0),[E,T]=r.useState(!1),[O,M]=r.useState(!1),R=(0,s.useComposedRefs)(n,e=>u(e)),N=v(a);return(0,t.jsx)(eo,{scope:i,type:o,dir:N,scrollHideDelay:l,scrollArea:c,viewport:d,onViewportChange:f,content:m,onContentChange:g,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:E,onScrollbarXEnabledChange:T,scrollbarY:w,onScrollbarYChange:x,scrollbarYEnabled:O,onScrollbarYEnabledChange:M,onCornerWidthChange:S,onCornerHeightChange:A,children:(0,t.jsx)(p.Primitive.div,{dir:N,...h,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});el.displayName=en;var eh="ScrollAreaViewport",ec=r.forwardRef((e,n)=>{let{__scopeScrollArea:i,children:o,nonce:a,...l}=e,h=ea(eh,i),c=r.useRef(null),u=(0,s.useComposedRefs)(n,c,h.onViewportChange);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),(0,t.jsx)(p.Primitive.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:h.scrollbarXEnabled?"scroll":"hidden",overflowY:h.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,t.jsx)("div",{ref:h.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});ec.displayName=eh;var eu="ScrollAreaScrollbar",ed=r.forwardRef((e,n)=>{let{forceMount:i,...s}=e,o=ea(eu,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:l}=o,h="horizontal"===e.orientation;return r.useEffect(()=>(h?a(!0):l(!0),()=>{h?a(!1):l(!1)}),[h,a,l]),"hover"===o.type?(0,t.jsx)(ef,{...s,ref:n,forceMount:i}):"scroll"===o.type?(0,t.jsx)(ep,{...s,ref:n,forceMount:i}):"auto"===o.type?(0,t.jsx)(em,{...s,ref:n,forceMount:i}):"always"===o.type?(0,t.jsx)(eg,{...s,ref:n}):null});ed.displayName=eu;var ef=r.forwardRef((e,n)=>{let{forceMount:i,...s}=e,o=ea(eu,e.__scopeScrollArea),[a,l]=r.useState(!1);return r.useEffect(()=>{let e=o.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),l(!0)},n=()=>{t=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[o.scrollArea,o.scrollHideDelay]),(0,t.jsx)(I.Presence,{present:i||a,children:(0,t.jsx)(em,{"data-state":a?"visible":"hidden",...s,ref:n})})}),ep=r.forwardRef((e,i)=>{var s;let{forceMount:o,...a}=e,l=ea(eu,e.__scopeScrollArea),h="horizontal"===e.orientation,c=eD(()=>d("SCROLL_END"),100),[u,d]=(s={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},r.useReducer((e,t)=>s[e][t]??e,"hidden"));return r.useEffect(()=>{if("idle"===u){let e=window.setTimeout(()=>d("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(e)}},[u,l.scrollHideDelay,d]),r.useEffect(()=>{let e=l.viewport,t=h?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[l.viewport,h,d,c]),(0,t.jsx)(I.Presence,{present:o||"hidden"!==u,children:(0,t.jsx)(eg,{"data-state":"hidden"===u?"hidden":"visible",...a,ref:i,onPointerEnter:(0,n.composeEventHandlers)(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:(0,n.composeEventHandlers)(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),em=r.forwardRef((e,n)=>{let i=ea(eu,e.__scopeScrollArea),{forceMount:s,...o}=e,[a,l]=r.useState(!1),h="horizontal"===e.orientation,c=eD(()=>{if(i.viewport){let e=i.viewport.offsetWidth<i.viewport.scrollWidth,t=i.viewport.offsetHeight<i.viewport.scrollHeight;l(h?e:t)}},10);return eI(i.viewport,c),eI(i.content,c),(0,t.jsx)(I.Presence,{present:s||a,children:(0,t.jsx)(eg,{"data-state":a?"visible":"hidden",...o,ref:n})})}
76),eg=r.forwardRef((e,n)=>{let{orientation:i="vertical",...s}=e,o=ea(eu,e.__scopeScrollArea),a=r.useRef(null),l=r.useRef(0),[h,c]=r.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=eM(h.viewport,h.content),d={...s,sizes:h,onSizesChange:c,hasThumb:!!(u>0&&u<1),onThumbChange:e=>a.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function f(e,t){return function(e,t,r,n="ltr"){let i=eR(r),s=t||i/2,o=r.scrollbar.paddingStart+s,a=r.scrollbar.size-r.scrollbar.paddingEnd-(i-s),l=r.content-r.viewport;return eP([o,a],"ltr"===n?[0,l]:[-1*l,0])(e)}(e,l.current,h,t)}return"horizontal"===i?(0,t.jsx)(ey,{...d,ref:n,onThumbPositionChange:()=>{if(o.viewport&&a.current){let e=eN(o.viewport.scrollLeft,h,o.dir);a.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=f(e,o.dir))}}):"vertical"===i?(0,t.jsx)(ev,{...d,ref:n,onThumbPositionChange:()=>{if(o.viewport&&a.current){let e=eN(o.viewport.scrollTop,h);a.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=f(e))}}):null}),ey=r.forwardRef((e,n)=>{let{sizes:i,onSizesChange:o,...a}=e,l=ea(eu,e.__scopeScrollArea),[h,c]=r.useState(),u=r.useRef(null),d=(0,s.useComposedRefs)(n,u,l.onScrollbarXChange);return r.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),(0,t.jsx)(ex,{"data-orientation":"horizontal",...a,ref:d,sizes:i,style:{bottom:0,left:"rtl"===l.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===l.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":eR(i)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(l.viewport){var n,i;let s=l.viewport.scrollLeft+t.deltaX;e.onWheelScroll(s),n=s,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{u.current&&l.viewport&&h&&o({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:eO(h.paddingLeft),paddingEnd:eO(h.paddingRight)}})}})}),ev=r.forwardRef((e,n)=>{let{sizes:i,onSizesChange:o,...a}=e,l=ea(eu,e.__scopeScrollArea),[h,c]=r.useState(),u=r.useRef(null),d=(0,s.useComposedRefs)(n,u,l.onScrollbarYChange);return r.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),(0,t.jsx)(ex,{"data-orientation":"vertical",...a,ref:d,sizes:i,style:{top:0,right:"ltr"===l.dir?0:void 0,left:"rtl"===l.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":eR(i)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(l.viewport){var n,i;let s=l.viewport.scrollTop+t.deltaY;e.onWheelScroll(s),n=s,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{u.current&&l.viewport&&h&&o({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:eO(h.paddingTop),paddingEnd:eO(h.paddingBottom)}})}})}),[eb,ew]=ei(eu),ex=r.forwardRef((e,i)=>{let{__scopeScrollArea:o,sizes:a,hasThumb:l,onThumbChange:h,onThumbPointerUp:c,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:g,onResize:y,...v}=e,b=ea(eu,o),[w,x]=r.useState(null),k=(0,s.useComposedRefs)(i,e=>x(e)),S=r.useRef(null),C=r.useRef(""),A=b.viewport,E=a.content-a.viewport,T=(0,m.useCallbackRef)(g),O=(0,m.useCallbackRef)(d),M=eD(y,10);function R(e){S.current&&f({x:e.clientX-S.current.left,y:e.clientY-S.current.top})}return r.useEffect(()=>{let e=e=>{let t=e.target;w?.contains(t)&&T(e,E)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[A,w,E,T]),r.useEffect(O,[a,O]),eI(w,M),eI(b.content,M),(0,t.jsx)(eb,{scope:o,scrollbar:w,hasThumb:l,onThumbChange:(0,m.useCallbackRef)(h),onThumbPointerUp:(0,m.useCallbackRef)(c),onThumbPositionChange:O,onThumbPointerDown:(0,m.useCallbackRef)(u),children:(0,t.jsx)(p.Primitive.div,{...v,ref:k,style:{position:"absolute",...v.style},onPointerDown:(0,n.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),S.current=w.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),R(e))}),onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,R),onPointerUp:(0,n.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=C.current,b.viewport&&(b.viewport.style.scrollBehavior=""),S.current=null})})})}),ek="ScrollAreaThumb",eS=r.forwardRef((e,r)=>{let{forceMount:n,...i}=e,s=ew(ek,e.__scopeScrollArea);return(0,t.jsx)(I.Presence,{present:n||s.hasThumb,children:(0,t.jsx)(eC,{ref:r,...i})})}),eC=r.forwardRef((e,i)=>{let{__scopeScrollArea:o,style:a,...l}=e,h=ea(ek,o),c=ew(ek,o),{onThumbPositionChange:u}=c,d=(0,s.useComposedRefs)(i,e=>c.onThumbChange(e)),f=r.useRef(void 0),m=eD(()=>{f.current&&(f.current(),f.current=void 0)},100);return r.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{m(),f.current||(f.current=e_(e,u),u())};return u(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[h.viewport,m,u]),(0,t.jsx)(p.Primitive.div,{"data-state":c.hasThumb?"visible":"hidden",...l,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:(0,n.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,n.composeEventHandlers)(e.onPointerUp,c.onThumbPointerUp)})});eS.displayName=ek;var eA="ScrollAreaCorner",eE=r.forwardRef((e,r)=>{let n=ea(eA,e.__scopeScrollArea),i=!!(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&i?(0,t.jsx)(eT,{...e,ref:r}):null});eE.displayName=eA;
76var eT=r.forwardRef((e,n)=>{let{__scopeScrollArea:i,...s}=e,o=ea(eA,i),[a,l]=r.useState(0),[h,c]=r.useState(0),u=!!(a&&h);return eI(o.scrollbarX,()=>{let e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),c(e)}),eI(o.scrollbarY,()=>{let e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),l(e)}),u?(0,t.jsx)(p.Primitive.div,{...s,ref:n,style:{width:a,height:h,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...e.style}}):null});function eO(e){return e?parseInt(e,10):0}function eM(e,t){let r=e/t;return isNaN(r)?0:r}function eR(e){let t=eM(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function eN(e,t,r="ltr"){let n=eR(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=er(e,"ltr"===r?[0,o]:[-1*o,0]);return eP([0,o],[0,s-n])(a)}function eP(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var e_=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function i(){let s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function eD(e,t){let n=(0,m.useCallbackRef)(e),i=r.useRef(0);return r.useEffect(()=>()=>window.clearTimeout(i.current),[]),r.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(n,t)},[n,t])}function eI(e,t){let r=(0,m.useCallbackRef)(t);(0,et.useLayoutEffect)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}let ej=r.forwardRef(({className:e,children:r,...n},i)=>(0,t.jsxs)(el,{ref:i,className:(0,X.cn)("relative overflow-hidden",e),...n,children:[(0,t.jsx)(ec,{className:"h-full w-full rounded-[inherit]",children:r}),(0,t.jsx)(eL,{}),(0,t.jsx)(eE,{})]}));ej.displayName=el.displayName;let eL=r.forwardRef(({className:e,orientation:r="vertical",...n},i)=>(0,t.jsx)(ed,{ref:i,orientation:r,className:(0,X.cn)("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-1.5 rounded-full bg-white/[0.08] p-px","horizontal"===r&&"h-1.5 flex-col rounded-full bg-white/[0.08] p-px",e),...n,children:(0,t.jsx)(eS,{className:"relative flex-1 rounded-full bg-primary"})}));eL.displayName=ed.displayName,e.s(["ScrollArea",0,ej],30774)},85170,e=>{"use strict";let t=(0,e.i(75254).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,t],85170)},95057,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return a},formatWithValidation:function(){return h},urlObjectKeys:function(){return l}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s=e.r(90809)._(e.r(98183)),o=/https?|ftp|gopher|file/;function a(e){let{auth:t,hostname:r}=e,n=e.protocol||"",i=e.pathname||"",a=e.hash||"",l=e.query||"",h=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?h=t+e.host:r&&(h=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(h+=":"+e.port)),l&&"object"==typeof l&&(l=String(s.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||o.test(n))&&!1!==h?(h="//"+(h||""),i&&"/"!==i[0]&&(i="/"+i)):h||(h=""),a&&"#"!==a[0]&&(a="#"+a),c&&"?"!==c[0]&&(c="?"+c),i=i.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${h}${i}${c}${a}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function h(e){return a(e)}},73668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return s}});let n=e.r(18967),i=e.r(52817);function s(e){if(!(0,n.isAbsoluteUrl)(e))return!0;
76try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,i.hasBasePath)(r.pathname)}catch(e){return!1}}},84508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},22016,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return y},useLinkStatus:function(){return b}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let s=e.r(90809),o=e.r(43476),a=s._(e.r(71645)),l=e.r(95057),h=e.r(8372),c=e.r(18581),u=e.r(18967),d=e.r(5550);e.r(33525);let f=e.r(88540),p=e.r(91949),m=e.r(73668),g=e.r(9396);function y(t){var r,n;let i,s,y,[b,w]=(0,a.useOptimistic)(p.IDLE_LINK_STATUS),x=(0,a.useRef)(null),{href:k,as:S,children:C,prefetch:A=null,passHref:E,replace:T,shallow:O,scroll:M,onClick:R,onMouseEnter:N,onTouchStart:P,legacyBehavior:_=!1,onNavigate:D,transitionTypes:I,ref:j,unstable_dynamicOnHover:L,...B}=t;i=C,_&&("string"==typeof i||"number"==typeof i)&&(i=(0,o.jsx)("a",{children:i}));let $=a.default.useContext(h.AppRouterContext),z=!1!==A,F=!1!==A?null===(n=A)||"auto"===n?g.FetchStrategy.PPR:g.FetchStrategy.Full:g.FetchStrategy.PPR,H="string"==typeof(r=S||k)?r:(0,l.formatUrl)(r);if(_){if(i?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});s=a.default.Children.only(i)}let W=_?s&&"object"==typeof s&&s.ref:j,U=a.default.useCallback(e=>(null!==$&&(x.current=(0,p.mountLinkInstance)(e,H,$,F,z,w)),()=>{x.current&&((0,p.unmountLinkForCurrentNavigation)(x.current),x.current=null),(0,p.unmountPrefetchableInstance)(e)}),[z,H,$,F,w]),V={ref:(0,c.useMergedRef)(U,W),onClick(t){_||"function"!=typeof R||R(t),_&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(t),!$||t.defaultPrevented||function(t,r,n,i,s,o,l){if("u">typeof window){let h,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((h=t.currentTarget.getAttribute("target"))&&"_self"!==h||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,m.isLocalURL)(r)){i&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),o){let e=!1;if(o({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:u}=e.r(99781);a.default.startTransition(()=>{u(r,i?"replace":"push",!1===s?f.ScrollBehavior.NoScroll:f.ScrollBehavior.Default,n.current,l)})}}(t,H,x,T,M,D,I)},onMouseEnter(e){_||"function"!=typeof N||N(e),_&&s.props&&"function"==typeof s.props.onMouseEnter&&s.props.onMouseEnter(e),$&&z&&(0,p.onNavigationIntent)(e.currentTarget,!0===L)},onTouchStart:function(e){_||"function"!=typeof P||P(e),_&&s.props&&"function"==typeof s.props.onTouchStart&&s.props.onTouchStart(e),$&&z&&(0,p.onNavigationIntent)(e.currentTarget,!0===L)}};return(0,u.isAbsoluteUrl)(H)?V.href=H:_&&!E&&("a"!==s.type||"href"in s.props)||(V.href=(0,d.addBasePath)(H)),y=_?a.default.cloneElement(s,V):(0,o.jsx)("a",{...B,...V,children:i}),(0,o.jsx)(v.Provider,{value:b,children:y})}e.r(84508);let v=(0,a.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,a.useContext)(v);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},2003,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(26999),i=e.i(37727),s=e.i(8311);let o=n.Root,a=n.Trigger,l=n.Portal;n.Close;let h=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Overlay,{ref:i,className:(0,s.cn)("fixed inset-0 z-[400] bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));h.displayName=n.Overlay.displayName;let c=r.forwardRef(({className:e,children:o,...a},c)=>{let f=r.Children.toArray(o),p=f.filter(e=>e?.type===u),m=f.filter(e=>e?.type===d),g=f.filter(e=>e?.type!==u&&e?.type!==d);return(0,t.jsxs)(l,{children:[(0,t.jsx)(h,{}),(0,t.jsxs)(n.Content,{ref:c,className:(0,s.cn)("fixed left-[50%] top-[50%] z-[410] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-0 border bg-background p-0 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg max-h-[calc(100vh-2rem)] overflow-y-auto",e),...a,children:[p,g.length>0&&(0,t.jsx)("div",{className:"min-h-0 h-full overflow-hidden px-3 py-3",children:g}
76),m,(0,t.jsxs)(n.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,t.jsx)(i.X,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});c.displayName=n.Content.displayName;let u=({className:e,...r})=>(0,t.jsx)("div",{className:(0,s.cn)("flex flex-col space-y-1.5 text-center sm:text-left p-3 pb-0",e),...r});u.displayName="DialogHeader";let d=({className:e,...r})=>(0,t.jsx)("div",{className:(0,s.cn)("sticky bottom-0 bg-background border-t px-3 py-3 flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});d.displayName="DialogFooter";let f=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Title,{ref:i,className:(0,s.cn)("text-lg font-semibold leading-none tracking-tight",e),...r}));f.displayName=n.Title.displayName;let p=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Description,{ref:i,className:(0,s.cn)("text-sm text-muted-foreground",e),...r}));p.displayName=n.Description.displayName,e.s(["Dialog",0,o,"DialogContent",0,c,"DialogDescription",0,p,"DialogFooter",0,d,"DialogHeader",0,u,"DialogTitle",0,f,"DialogTrigger",0,a])},61653,e=>{"use strict";let t=(0,e.i(75254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",0,t])},72591,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(8311);let i=r.forwardRef(({className:e,type:r,...i},s)=>(0,t.jsx)("input",{type:r,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...i}));i.displayName="Input",e.s(["Input",0,i])},49231,e=>{"use strict";var t=e.i(43476),r=e.i(71645);e.i(74080);var n=e.i(91918),i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,i)=>{let s=(0,n.createSlot)(`Primitive.${i}`),o=r.forwardRef((e,r)=>{let{asChild:n,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,t.jsx)(n?s:i,{...o,ref:r})});return o.displayName=`Primitive.${i}`,{...e,[i]:o}},{}),s=r.forwardRef((e,r)=>(0,t.jsx)(i.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var o=e.i(25913),a=e.i(8311);let l=(0,o.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),h=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(s,{ref:n,className:(0,a.cn)(l(),e),...r}));h.displayName=s.displayName,e.s(["Label",0,h],49231)},27389,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(8311);let i=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)("textarea",{className:(0,n.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:i,...r}));i.displayName="Textarea",e.s(["Textarea",0,i])},64659,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",0,t],64659)},55900,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["ChevronUp",0,t],55900)},6321,e=>{"use strict";let t=(0,e.i(75254).default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);e.s(["default",0,t])},12140,31989,15080,29359,49989,e=>{"use strict";let t,r;function n(){return(n=Object.assign.bind()).apply(null,arguments)}var i,s,o,a,l,h,c,u,d=e.i(71645);let f=[],p=[],m="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<m.length;e++)(e%2?p:f).push(t+=m[e]);function g(e){return e>=127462&&e<=127487}function y(e,t,r){if(t==e.length)return t;t&&b(e.charCodeAt(t))&&w(e.charCodeAt(t-1))&&t--;let n=v(e,t);for(t+=x(n);t<e.length;){let i=v(e,t);if(8205==n||8205==i||r&&function(e){if(e<768)return!1;for(let t=0,r=f.length;;){let n=t+r>>1;if(e<f[n])r=n;else{if(!(e>=p[n]))return!0;t=n+1}if(t==r)return!1}}(i))t+=x(i),n=i;else if(g(i)){let r=0,n=t-2;for(;n>=0&&g(v(e,n));)r++,n-=2;if(r%2==0)break;t+=2}else break}return t}function v(e,t){let r=e.charCodeAt(t);if(!w(r)||t+1==e.length)return r;let n=e.charCodeAt(t+1);return b(n)?(r-55296<<10)+(n-56320)+65536:r}function b(e){return e>=56320&&e<57344}function w(e){return e>=55296&&e<56320}function x(e){return e<65536?1:2}class k{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=R(this,e,t);let n=[];return this.decompose(0,e,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(t,this.length,n,1),C.from(n,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=R(this,e,t);let r=[];return this.decompose(e,t,r,0),C.from(r,t-e)}eq(e){if(e==this)return!0;
vendor: 4,138 bytes, line 76
76if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),n=new E(this),i=new E(e);for(let e=t,s=t;;){if(n.next(e),i.next(e),e=0,n.lineBreak!=i.lineBreak||n.done!=i.done||n.value!=i.value)return!1;if(s+=n.value.length,n.done||s>=r)return!0}}iter(e=1){return new E(this,e)}iterRange(e,t=this.length){return new T(this,e,t)}iterLines(e,t){let r;if(null==e)r=this.iter();else{null==t&&(t=this.lines+1);let n=this.line(e).from;r=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new O(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(0==e.length)throw RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new S(e):C.from(S.split(e,[])):k.empty}}class S extends k{constructor(e,t=function(e){let t=-1;for(let r of e)t+=r.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,n){for(let i=0;;i++){let s=this.text[i],o=n+s.length;if((t?r:o)>=e)return new M(n,o,r,s);n=o+1,r++}}decompose(e,t,r,n){var i;let s=e<=0&&t>=this.length?this:new S((i=this.text,A(i,[""],e,t)),Math.min(t,this.length)-Math.max(0,e));if(1&n){let e=r.pop(),t=A(s.text,e.text.slice(),0,s.length);if(t.length<=32)r.push(new S(t,e.length+s.length));else{let e=t.length>>1;r.push(new S(t.slice(0,e)),new S(t.slice(e)))}}else r.push(s)}replace(e,t,r){var n;if(!(r instanceof S))return super.replace(e,t,r);[e,t]=R(this,e,t);let i=A(this.text,A(r.text,(n=this.text,A(n,[""],0,e))),t),s=this.length+r.length-(t-e);return i.length<=32?new S(i,s):C.from(S.split(i,[]),s)}sliceString(e,t=this.length,r="\n"){[e,t]=R(this,e,t);let n="";for(let i=0,s=0;i<=t&&s<this.text.length;s++){let o=this.text[s],a=i+o.length;i>e&&s&&(n+=r),e<a&&t>i&&(n+=o.slice(Math.max(0,e-i),t-i)),i=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],n=-1;for(let i of e)r.push(i),n+=i.length+1,32==r.length&&(t.push(new S(r,n)),r=[],n=-1);return n>-1&&t.push(new S(r,n)),t}}class C extends k{constructor(e,t){for(let r of(super(),this.children=e,this.length=t,this.lines=0,e))this.lines+=r.lines}lineInner(e,t,r,n){for(let i=0;;i++){let s=this.children[i],o=n+s.length,a=r+s.lines-1;if((t?a:o)>=e)return s.lineInner(e,t,r,n);n=o+1,r=a+1}}decompose(e,t,r,n){for(let i=0,s=0;s<=t&&i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e<=a&&t>=s){let i=n&(s<=e|2*(a>=t));s>=e&&a<=t&&!i?r.push(o):o.decompose(e-s,t-s,r,i)}s=a+1}}replace(e,t,r){if([e,t]=R(this,e,t),r.lines<this.lines)for(let n=0,i=0;n<this.children.length;n++){let s=this.children[n],o=i+s.length;if(e>=i&&t<=o){let a=s.replace(e-i,t-i,r),l=this.lines-s.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let i=this.children.slice();return i[n]=a,new C(i,this.length-(t-e)+r.length)}return super.replace(i,o,a)}i=o+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r="\n"){[e,t]=R(this,e,t);let n="";for(let i=0,s=0;i<this.children.length&&s<=t;i++){let o=this.children[i],a=s+o.length;s>e&&i&&(n+=r),e<a&&t>s&&(n+=o.sliceString(e-s,t-s,r)),s=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof C))return 0;let r=0,[n,i,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,i+=t){if(n==s||i==o)return r;let a=this.children[n],l=e.children[i];if(a!=l)return r+a.scanIdentical(l,t);r+=a.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let t of e)r+=t.lines;if(r<32){let r=[];for(let t of e)t.flatten(r);return new S(r,t)}let n=Math.max(32,r>>5),i=n<<1,s=n>>1,o=[],a=0,l=-1,h=[];function c(){0!=a&&(o.push(1==h.length?h[0]:C.from(h,l)),l=-1,a=h.length=0)}for(let t of e)!function e(t){let r;if(t.lines>i&&t instanceof C)for(let r of t.children)e(r);else t.lines>s&&(a>s||!a)?(c(),o.push(t)):t instanceof S&&a&&(r=h[h.length-1])instanceof S&&t.lines+r.lines<=32?(a+=t.lines,l+=t.length+1,h[h.length-1]=new S(r.text.concat(t.text),r.length+1+t.length)):(a+t.lines>
76n&&c(),a+=t.lines,l+=t.length+1,h.push(t))}(t);return c(),1==o.length?o[0]:new C(o,t)}}function A(e,t,r=0,n=1e9){for(let i=0,s=0,o=!0;s<e.length&&i<=n;s++){let a=e[s],l=i+a.length;l>=r&&(l>n&&(a=a.slice(0,n-i)),i<r&&(a=a.slice(r-i)),o?(t[t.length-1]+=a,o=!1):t.push(a)),i=l+1}return t}k.empty=new S([""],0);class E{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof S?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],i=this.offsets[r],s=i>>1,o=n instanceof S?n.text.length:n.children.length;if(s==(t>0?o:0)){if(0==r)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[r]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(n instanceof S){let i=n.text[s+(t<0?-1:0)];if(this.offsets[r]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=n.children[s+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof S?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class T{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new E(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=r?n:t<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class O{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"u">typeof Symbol&&(k.prototype[Symbol.iterator]=function(){return this.iter()},E.prototype[Symbol.iterator]=T.prototype[Symbol.iterator]=O.prototype[Symbol.iterator]=function(){return this});class M{constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}get length(){return this.to-this.from}}function R(e,t,r){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,r))]}function N(e,t,r=!0,n=!0){return function(e,t,r=!0,n=!0){return(r?y:function(e,t,r){for(;t>1;){let n=y(e,t-2,r);if(n<t)return n;t--}return 0})(e,t,n)}(e,t,r,n)}function P(e,t){let r=e.charCodeAt(t);if(!(r>=55296&&r<56320)||t+1==e.length)return r;let n=e.charCodeAt(t+1);return n>=56320&&n<57344?(r-55296<<10)+(n-56320)+65536:r}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,(1023&e)+56320)}function D(e){return e<65536?1:2}let I=/\r\n?|\n/;var j=((i=j||(j={}))[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i);class L{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,n=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?(e(r,n,i),n+=i):n+=s,r+=i}}iterChangedRanges(e,t=!1){F(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];n<0?e.push(r,n):e.push(n,r)}return new L(e)}composeDesc(e){return this.empty?e:e.empty?this:W(this,e)}mapDesc(e,t=!1){return e.empty?this:H(this,e,t)}mapPos(e,t=-1,r=j.Simple){let n=0,i=0;for(let s=0;s<this.sections.length;){let o=this.sections[s++],a=this.sections[s++],l=n+o;if(a<0){if(l>e)return i+(e-n);i+=o}else{if(r!=j.Simple&&l>=e&&(r==j.TrackDel&&n<e&&l>e||r==j.TrackBefore&&n<e||r==j.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!o)return e==n||t<0?i:i+a;i+=a}n=l}if(e>n)throw RangeError(`Position ${e} is out of range for changeset of length ${n}`);return i}touchesRange(e,t=e){for(let r=0,n=0;r<this.sections.length&&n<=t;){let i=this.sections[r++],s=this.sections[r++],o=n+i;if(s>=0&&n<=t&&o>=e)return!(n<e)||!(o>t)||"cover";n=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+r+(n>
76=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw RangeError("Invalid JSON representation of ChangeDesc");return new L(e)}static create(e){return new L(e)}}class B extends L{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return F(this,(t,r,n,i,s)=>e=e.replace(n,n+(r-t),s),!1),e}mapDesc(e,t=!1){return H(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let n=0,i=0;n<t.length;n+=2){let s=t[n],o=t[n+1];if(o>=0){t[n]=o,t[n+1]=s;let a=n>>1;for(;r.length<a;)r.push(k.empty);r.push(s?e.slice(i,i+s):k.empty)}i+=s}return new B(t,r)}compose(e){return this.empty?e:e.empty?this:W(this,e,!0)}map(e,t=!1){return e.empty?this:H(this,e,t,!0)}iterChanges(e,t=!1){F(this,e,t)}get desc(){return L.create(this.sections)}filter(e){let t=[],r=[],n=[],i=new U(this);e:for(let s=0,o=0;;){let a=s==e.length?1e9:e[s++];for(;o<a||o==a&&0==i.len;){if(i.done)break e;let e=Math.min(i.len,a-o);$(n,e,-1);let s=-1==i.ins?-1:0==i.off?i.ins:0;$(t,e,s),s>0&&z(r,t,i.text),i.forward(e),o+=e}let l=e[s++];for(;o<l;){if(i.done)break e;let e=Math.min(i.len,l-o);$(t,e,-1),$(n,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),o+=e}}return{changes:new B(t,r),filtered:L.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],n=this.sections[t+1];n<0?e.push(r):0==n?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let n=[],i=[],s=0,o=null;function a(e=!1){if(!e&&!n.length)return;s<t&&$(n,t-s,-1);let r=new B(n,i);o=o?o.compose(r.map(o)):r,n=[],i=[],s=0}return!function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof B){if(l.length!=t)throw RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),o=o?o.compose(l.map(o)):l}else{let{from:e,to:o=e,insert:h}=l;if(e>o||e<0||o>t)throw RangeError(`Invalid change range ${e} to ${o} (in doc of length ${t})`);let c=h?"string"==typeof h?k.of(h.split(r||I)):h:k.empty,u=c.length;if(e==o&&0==u)return;e<s&&a(),e>s&&$(n,e-s,-1),$(n,o-e,u),z(i,n,c),s=o}}(e),a(!o),o}static empty(e){return new B(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let n=0;n<e.length;n++){let i=e[n];if("number"==typeof i)t.push(i,-1);else if(!Array.isArray(i)||"number"!=typeof i[0]||i.some((e,t)=>t&&"string"!=typeof e))throw RangeError("Invalid JSON representation of ChangeSet");else if(1==i.length)t.push(i[0],0);else{for(;r.length<n;)r.push(k.empty);r[n]=k.of(i.slice(1)),t.push(i[0],r[n].length)}}return new B(t,r)}static createSet(e,t){return new B(e,t)}}function $(e,t,r,n=!1){if(0==t&&r<=0)return;let i=e.length-2;i>=0&&r<=0&&r==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=r:n?(e[i]+=t,e[i+1]+=r):e.push(t,r)}function z(e,t,r){if(0==r.length)return;let n=t.length-2>>1;if(n<e.length)e[e.length-1]=e[e.length-1].append(r);else{for(;e.length<n;)e.push(k.empty);e.push(r)}}function F(e,t,r){let n=e.inserted;for(let i=0,s=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)i+=a,s+=a;else{let h=i,c=s,u=k.empty;for(;h+=a,c+=l,l&&n&&(u=u.append(n[o-2>>1])),!r&&o!=e.sections.length&&!(e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(i,h,s,c,u),i=h,s=c}}}function H(e,t,r,n=!1){let i=[],s=n?[]:null,o=new U(e),a=new U(t);for(let e=-1;;)if(o.done&&a.len||a.done&&o.len)throw Error("Mismatched change set lengths");else if(-1==o.ins&&-1==a.ins){let e=Math.min(o.len,a.len);$(i,e,-1),o.forward(e),a.forward(e)}else if(a.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(a.len<o.len||a.len==o.len&&!r))){let t=a.len;for($(i,a.ins,-1);t;){let r=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=r&&($(i,0,o.ins),s&&z(s,i,o.text),e=o.i),o.forward(r),t-=r}a.next()}else if(o.ins>=0){let t=0,r=o.len;for(;r;)if(-1==a.ins){let e=Math.min(r,a.len);t+=e,r-=e,a.forward(e)}else if(0==a.ins&&a.len<r)r-=a.len,a.next();else break;$(i,t,e<o.i?o.ins:0),s&&e<o.i&&z(s,i,o.text),e=o.i,o.forward(o.len-r)}else if(o.done&&a.done)return s?B.createSet(i,s):L.create(i);else throw Error("Mismatched change set lengths")}function W(e,t,r=!1){let n=[],i=r?[]:null,s=new U(e),o=new U(t);for(let e=!1;;)if(s.done&&o.done)return i?B.createSet(n,i):L.create(n);
vendor: 4,470 bytes, line 76
76else if(0==s.ins)$(n,s.len,0,e),s.next();else if(0!=o.len||o.done)if(s.done||o.done)throw Error("Mismatched change set lengths");else{let t=Math.min(s.len2,o.len),r=n.length;if(-1==s.ins){let r=-1==o.ins?-1:o.off?0:o.ins;$(n,t,r,e),i&&r&&z(i,n,o.text)}else -1==o.ins?($(n,s.off?0:s.len,t,e),i&&z(i,n,s.textBit(t))):($(n,s.off?0:s.len,o.off?0:o.ins,e),i&&!o.off&&z(i,n,o.text));e=(s.ins>t||o.ins>=0&&o.len>t)&&(e||n.length>r),s.forward2(t),o.forward(t)}else $(n,0,o.ins,e),i&&z(i,n,o.text),o.next()}class U{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return -2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?k.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?k.empty:t[r].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class V{constructor(e,t,r,n){this.from=e,this.to=t,this.flags=r,this.goalColumn=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get undirectional(){return(64&this.flags)>0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}map(e,t=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new V(r,n,this.flags,this.goalColumn)}extend(e,t=e,r=0){if(e<=this.anchor&&t>=this.anchor)return q.range(e,t,void 0,void 0,r);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return q.range(this.anchor,n,void 0,void 0,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw RangeError("Invalid JSON representation for SelectionRange");return q.range(e.anchor,e.head)}static create(e,t,r,n){return new V(e,t,r,n)}}class q{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:q.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new q([this.main],0)}addRange(e,t=!0){return q.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,q.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new q(e.ranges.map(e=>V.fromJSON(e)),e.main)}static single(e,t=e){return new q([q.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw RangeError("A selection needs at least one range");for(let r=0,n=0;n<e.length;n++){let i=e[n];if(i.empty?i.from<=r:i.from<r)return q.normalized(e.slice(),t);r=i.to}return new q(e,t)}static cursor(e,t=0,r,n){return V.create(e,e,(0==t?0:t<0?8:16)|(null==r?7:Math.min(6,r)),n)}static range(e,t,r,n,i){let s=null==n?7:Math.min(6,n);return i||e==t||(i=t<e?1:-1),i&&(s|=i<0?8:16),t<e?V.create(t,e,32|s,r):V.create(e,t,s,r)}static undirectionalRange(e,t){return V.create(e,t,64,void 0)}static normalized(e,t=0){let r=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(r);for(let r=1;r<e.length;r++){let n=e[r],i=e[r-1];if(n.empty?n.from<=i.to:n.from<i.to){let s=i.from,o=Math.max(n.to,i.to);r<=t&&t--,e.splice(--r,2,n.anchor>n.head?q.range(o,s):q.range(s,o))}}return new q(e,t)}}function K(e,t){for(let r of e.ranges)if(r.to>t)throw RangeError("Selection points outside of document")}let J=0;class G{constructor(e,t,r,n,i){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=n,this.id=J++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new G(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(!e.combine?Y:(e,t)=>
76e===t),!!e.static,e.enables)}of(e){return new X([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new X(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new X(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],r=>t(r.field(e)))}}function Y(e,t){return e==t||e.length==t.length&&e.every((e,r)=>e===t[r])}class X{constructor(e,t,r,n){this.dependencies=e,this.facet=t,this.type=r,this.value=n,this.id=J++}dynamicSlot(e){var t;let r=this.value,n=this.facet.compareInput,i=this.id,s=e[i]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let r of this.dependencies)"doc"==r?a=!0:"selection"==r?l=!0:((null!=(t=e[r.id])?t:1)&1)==0&&h.push(e[r.id]);return{create:e=>(e.values[s]=r(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Z(e,h)){let t=r(e);if(o?!Q(t,e.values[s],n):!n(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=eh(t,l);if(this.dependencies.every(r=>r instanceof G?t.facet(r)===e.facet(r):!(r instanceof et)||t.field(r,!1)==e.field(r,!1))||(o?Q(a=r(e),i,n):n(a=r(e),i)))return e.values[s]=i,0}else a=r(e);return e.values[s]=a,1}}}}function Q(e,t,r){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}function Z(e,t){let r=!1;for(let n of t)1&el(e,n)&&(r=!0);return r}let ee=G.define({static:!0});class et{constructor(e,t,r,n,i){this.id=e,this.createF=t,this.updateF=r,this.compareF=n,this.spec=i,this.provides=void 0}static define(e){let t=new et(J++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ee).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,r)=>{let n=e.values[t],i=this.updateF(n,r);return this.compareF(n,i)?0:(e.values[t]=i,1)},reconfigure:(e,r)=>{let n=e.facet(ee),i=r.facet(ee),s;return(s=n.find(e=>e.field==this))&&s!=i.find(e=>e.field==this)?(e.values[t]=s.create(e),1):null!=r.config.address[this.id]?(e.values[t]=r.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,ee.of({field:this,create:e})]}get extension(){return this}}function er(e){return t=>new ei(t,e)}let en={highest:er(0),high:er(1),default:er(2),low:er(3),lowest:er(4)};class ei{constructor(e,t){this.inner=e,this.prec=t}}class es{of(e){return new eo(this,e)}reconfigure(e){return es.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class eo{constructor(e,t){this.compartment=e,this.inner=t}}class ea{constructor(e,t,r,n,i,s){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=n,this.staticValues=i,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,r){var n,i,s;let o,a,l=[],h=Object.create(null),c=new Map;for(let r of(n=e,i=t,s=c,o=[[],[],[],[],[]],a=new Map,!function e(t,r){let n=a.get(t);if(null!=n){if(n<=r)return;let e=o[n].indexOf(t);e>-1&&o[n].splice(e,1),t instanceof eo&&s.delete(t.compartment)}if(a.set(t,r),Array.isArray(t))for(let n of t)e(n,r);else if(t instanceof eo){if(s.has(t.compartment))throw RangeError("Duplicate use of compartment in extensions");let n=i.get(t.compartment)||t.inner;s.set(t.compartment,n),e(n,r)}else if(t instanceof ei)e(t.inner,t.prec);else if(t instanceof et)o[r].push(t),t.provides&&e(t.provides,r);else if(t instanceof X)o[r].push(t),t.facet.extensions&&e(t.facet.extensions,2);else{let n=t.extension;if(!n)throw Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(n,r)}}(n,2),o.reduce((e,t)=>e.concat(t))))r instanceof et?l.push(r):(h[r.facet.id]||(h[r.facet.id]=[])).push(r);let u=Object.create(null),d=[],f=[];for(let e of l)u[e.id]=f.length<<1,f.push(t=>e.slot(t));let p=null==r?void 0:r.config.facets;for(let e in h){let t=h[e],n=t[0].facet,i=p&&p[e]||[];if(t.every(e=>0==e.type))if(u[n.id]=d.length<<1|1,Y(i,t))d.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));d.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}else{for(let e of t)0==e.type?(u[e.id]=d.length<<1|1,d.push(e.value)):(u[e.id]=f.length<<1,f.push(t=>e.dynamicSlot(t)));u[n.id]=f.length<<1,f.push(e=>(function(e,t,r){let n=r.map(t=>e[t.id]),i=r.map(e=>e.type),s=n.filter(e=>!(1&e)),o=e[t.id]>>1;function a(e){let r=[];for(let t=0;t<n.length;t++){let s=eh(e,n[t]);if(2==i[t])for(let e of s)r.push(e);else r.push(s)}return t.combine(r)}return{create(e){for(let t of n)el(e,t);return e.values[o]=a(e),1},update(e,r){if(!Z(e,s))return 0;let n=a(e);return t.compare(n,e.values[o])?0:(e.values[o]=n,1)},reconfigure(e,i){let s=Z(e,n),l=i.config.facets[t.id],h=i.facet(t);if(l&&!s&&Y(r,l))return e.values[o]=h,0;let c=a(e);return t.compare(c,h)?(e.values[o]=h,0):(e.values[o]=c,1)}}})(e,n,t))}}return new ea(e,c,f.map(e=>e(u)),u,d,h)}}function el(e,t){if(1&t)return 2;let r=t>>1,n=e.status[r];if(4==n)throw Error("Cyclic dependency between fields and/or facets");if(2&n)return n;e.status[r]=4;let i=e.computeSlot(e,e.config.dynamicSlots[r]);return e.status[r]=2|i}function eh(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}let ec=G.define(),eu=G.define({combine:e=>e.some(e=>e),static:!0}),ed=G.define({combine:e=>e.length?e[0]:void 0,static:!0}),ef=G.define(),ep=G.define(),em=G.define(),eg=G.define({combine:e=>!!e.length&&e[0]});class ey{constructor(e,t){this.type=e,this.value=t}static define(){return new ev}}class ev{of(e){return new ey(this,e)}}class eb{constructor(e){this.map=e}of(e){return new ew(this,e)}}class ew{constructor(e,t){this.type=e,this.value=t}
vendor: 1,979 bytes, line 76
76map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ew(this.type,t)}is(e){return this.type==e}static define(e={}){return new eb(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let n of e){let e=n.map(t);e&&r.push(e)}return r}}ew.reconfigure=ew.define(),ew.appendConfig=ew.define();class ex{constructor(e,t,r,n,i,s){this.startState=e,this.changes=t,this.selection=r,this.effects=n,this.annotations=i,this.scrollIntoView=s,this._doc=null,this._state=null,r&&K(r,t.newLength),i.some(e=>e.type==ex.time)||(this.annotations=i.concat(ex.time.of(Date.now())))}static create(e,t,r,n,i,s){return new ex(e,t,r,n,i,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ex.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function ek(e,t,r){var n;let i,s,o;return r?(i=t.changes,s=B.empty(t.changes.length),o=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),s=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(i)),{changes:o,selection:t.selection?t.selection.map(s):null==(n=e.selection)?void 0:n.map(i),effects:ew.mapEffects(e.effects,i).concat(ew.mapEffects(t.effects,s)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function eS(e,t,r){let n=t.selection,i=eA(t.annotations);return t.userEvent&&(i=i.concat(ex.userEvent.of(t.userEvent))),{changes:t.changes instanceof B?t.changes:B.of(t.changes||[],r,e.facet(ed)),selection:n&&(n instanceof q?n:q.single(n.anchor,
76n.head)),effects:eA(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}ex.time=ey.define(),ex.userEvent=ey.define(),ex.addToHistory=ey.define(),ex.remote=ey.define();let eC=[];function eA(e){return null==e?eC:Array.isArray(e)?e:[e]}var eE=((s=eE||(eE={}))[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s);let eT=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{t=RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class eO{constructor(e,t,r,n,i,s){this.config=e,this.doc=t,this.selection=r,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=i,s&&(s._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)el(this,e<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(null==r){if(t)throw RangeError("Field is not present in this state");return}return el(this,r),eh(this,r)}update(...e){return function e(t,r,n){let i=eS(t,r.length?r[0]:{},t.doc.length);r.length&&!1===r[0].filter&&(n=!1);for(let e=1;e<r.length;e++){!1===r[e].filter&&(n=!1);let s=!!r[e].sequential;i=ek(i,eS(t,r[e],s?i.changes.newLength:t.doc.length),s)}let s=ex.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,r=t.facet(em),n=e;for(let i=r.length-1;i>=0;i--){let s=r[i](e);s&&Object.keys(s).length&&(n=ek(n,eS(t,s,e.changes.newLength),!0))}return n==e?e:ex.create(t,e.changes,e.selection,n.effects,n.annotations,n.scrollIntoView)}(n?function(t){let r=t.startState,n=!0;for(let e of r.facet(ef)){let r=e(t);if(!1===r){n=!1;break}Array.isArray(r)&&(n=!0===n?r:function(e,t){let r=[];for(let n=0,i=0;;){let s,o;if(n<e.length&&(i==t.length||t[i]>=e[n]))s=e[n++],o=e[n++];else{if(!(i<t.length))return r;s=t[i++],o=t[i++]}!r.length||r[r.length-1]<s?r.push(s,o):r[r.length-1]<o&&(r[r.length-1]=o)}}(n,r))}if(!0!==n){let e,i;if(!1===n)i=t.changes.invertedDesc,e=B.empty(r.doc.length);else{let r=t.changes.filter(n);e=r.changes,i=r.filtered.mapDesc(r.changes).invertedDesc}t=ex.create(r,e,t.selection&&t.selection.map(i),ew.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let i=r.facet(ep);for(let n=i.length-1;n>=0;n--){let s=i[n](t);t=s instanceof ex?s:Array.isArray(s)&&1==s.length&&s[0]instanceof ex?s[0]:e(r,eA(s),!1)}return t}(s):s)}(this,e,!0)}applyTransaction(e){let t,r=this.config,{base:n,compartments:i}=r;for(let t of e.effects)t.is(es.reconfigure)?(r&&(i=new Map,r.compartments.forEach((e,t)=>i.set(t,e)),r=null),i.set(t.value.compartment,t.value.extension)):t.is(ew.reconfigure)?(r=null,n=t.value):t.is(ew.appendConfig)&&(r=null,n=eA(n).concat(t.value));t=r?e.startState.values.slice():new eO(r=ea.resolve(n,i,this),this.doc,this.selection,r.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values;let s=e.startState.facet(eu)?e.newSelection:e.newSelection.asSingle();new eO(r,e.newDoc,s,t,(t,r)=>r.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:q.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),n=this.changes(r.changes),i=[r.range],s=eA(r.effects);for(let r=1;r<t.ranges.length;r++){let o=e(t.ranges[r]),a=this.changes(o.changes),l=a.map(n);for(let e=0;e<r;e++)i[e]=i[e].map(l);let h=n.mapDesc(a,!0);i.push(o.range.map(h)),n=n.compose(l),s=ew.mapEffects(s,l).concat(ew.mapEffects(eA(o.effects),h))}return{changes:n,selection:q.create(i,t.mainIndex),effects:s}}changes(e=[]){return e instanceof B?e:B.of(e,this.doc.length,this.facet(eO.lineSeparator))}toText(e){return k.of(e.split(this.facet(eO.lineSeparator)||I))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(el(this,t),eh(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let n=e[r];n instanceof et&&null!=this.config.address[n.id]&&(t[r]=n.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||"string"!=typeof e.doc)throw RangeError("Invalid JSON representation for EditorState");let n=[];if(r){for(let t in r)if(Object.prototype.hasOwnProperty.call(e,t)){let i=r[t],s=e[t];n.push(i.init(e=>i.spec.fromJSON(s,e)))}}return eO.create({doc:e.doc,selection:q.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=ea.resolve(e.extensions||[],new Map),r=e.doc instanceof k?e.doc:k.of((e.doc||"").split(t.staticFacet(eO.lineSeparator)||I)),n=e.selection?e.selection instanceof q?e.selection:q.single(e.selection.anchor,e.selection.head):q.single(0);return K(n,r.length),t.staticFacet(eu)||(n=n.asSingle()),new eO(t,r,n,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(eO.tabSize)}get lineBreak(){return this.facet(eO.lineSeparator)||"\n"}get readOnly(){return this.facet(eg)}phrase(e,...t){for(let t of this.facet(eO.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,r)=>{if("$"==r)return"$";let n=+(r||1);return!n||n>t.length?e:t[n-1]})),e}languageDataAt(e,t,r=-1){let n=[];for(let i of this.facet(ec))for(let s of i(this,t,r))Object.prototype.hasOwnProperty.call(s,e)&&n.push(s[e]);return n}charCategorizer(e){var r;let n=this.languageDataAt("wordChars",e);return r=n.length?n[0]:"",e=>
vendor: 4,326 bytes, line 76
76{if(!/\S/.test(e))return eE.Space;if(function(e){if(t)return t.test(e);for(let t=0;t<e.length;t++){let r=e[t];if(/\w/.test(r)||r>"€"&&(r.toUpperCase()!=r.toLowerCase()||eT.test(r)))return!0}return!1}(e))return eE.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return eE.Word;return eE.Other}}wordAt(e){let{text:t,from:r,length:n}=this.doc.lineAt(e),i=this.charCategorizer(e),s=e-r,o=e-r;for(;s>0;){let e=N(t,s,!1);if(i(t.slice(e,s))!=eE.Word)break;s=e}for(;o<n;){let e=N(t,o);if(i(t.slice(o,e))!=eE.Word)break;o=e}return s==o?null:q.range(s+r,o+r)}}function eM(e,t,r={}){let n={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],s=n[e];if(void 0===s)n[e]=i;else if(s===i||void 0===i);else if(Object.hasOwnProperty.call(r,e))n[e]=r[e](s,i);else throw Error("Config merge conflict for field "+e)}for(let e in t)void 0===n[e]&&(n[e]=t[e]);return n}eO.allowMultipleSelections=eu,eO.tabSize=G.define({combine:e=>e.length?e[0]:4}),eO.lineSeparator=ed,eO.readOnly=eg,eO.phrases=G.define({compare(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length==n.length&&r.every(r=>e[r]==t[r])}}),eO.languageData=ec,eO.changeFilter=ef,eO.transactionFilter=ep,eO.transactionExtender=em,es.reconfigure=ew.define();class eR{eq(e){return this==e}range(e,t=e){return eP.create(e,t,this)}}function eN(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}eR.prototype.startSide=eR.prototype.endSide=0,eR.prototype.point=!1,eR.prototype.mapMode=j.TrackDel;class eP{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new eP(e,t,r)}}function e_(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class eD{constructor(e,t,r,n){this.from=e,this.to=t,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,n=0){let i=r?this.to:this.from;for(let s=n,o=i.length;;){if(s==o)return s;let n=s+o>>1,a=i[n]-e||(r?this.value[n].endSide:this.value[n].startSide)-t;if(n==s)return a>=0?s:o;a>=0?o=n:s=n+1}}between(e,t,r,n){for(let i=this.findIndex(t,-1e9,!0),s=this.findIndex(r,1e9,!1,i);i<s;i++)if(!1===n(this.from[i]+e,this.to[i]+e,this.value[i]))return!1}map(e,t){let r=[],n=[],i=[],s=-1,o=-1;for(let a=0;a<this.value.length;a++){let l=this.value[a],h=this.from[a]+e,c=this.to[a]+e,u,d;if(h==c){let e=t.mapPos(h,l.startSide,l.mapMode);if(null==e||(u=d=e,l.startSide!=l.endSide&&(d=t.mapPos(h,l.endSide))<u))continue}else if((u=t.mapPos(h,l.startSide))>(d=t.mapPos(c,l.endSide))||u==d&&l.startSide>0&&l.endSide<=0)continue;0>(d-u||l.endSide-l.startSide)||(s<0&&(s=u),l.point&&(o=Math.max(o,d-u)),r.push(l),n.push(u-s),i.push(d-s))}return{mapped:r.length?new eD(n,i,r,o):null,pos:s}}}class eI{constructor(e,t,r,n){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=n}static create(e,t,r,n){return new eI(e,t,r,n)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:n=0,filterTo:i=this.length}=e,s=e.filter;if(0==t.length&&!s)return this;if(r&&(t=t.slice().sort(e_)),this.isEmpty)return t.length?eI.of(t):this;let o=new eB(this,null,-1).goto(0),a=0,l=[],h=new ej;for(;o.value||a<t.length;)if(a<t.length&&(o.from-t[a].from||o.startSide-t[a].value.startSide)>=0){let e=t[a++];h.addInner(e.from,e.to,e.value)||l.push(e)}else 1==o.rangeIndex&&o.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(o.chunkIndex)<t[a].from)&&(!s||n>this.chunkEnd(o.chunkIndex)||i<this.chunkPos[o.chunkIndex])&&h.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!s||n>o.to||i<o.from||s(o.from,o.to,o.value))&&!h.addInner(o.from,o.to,o.value)&&l.push(eP.create(o.from,o.to,o.value)),o.next());return h.finishInner(this.nextLayer.isEmpty&&!l.length?eI.empty:this.nextLayer.update({add:l,filter:s,filterFrom:n,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],n=-1;for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i],a=e.touchesRange(s,s+o.length);if(!1===a)n=Math.max(n,o.maxPoint),t.push(o),r.push(e.mapPos(s));else if(!0===a){let{mapped:i,pos:a}=o.map(s,e);i&&(n=Math.max(n,i.maxPoint),t.push(i),r.push(a))}}let i=this.nextLayer.map(e);
vendor: 7,196 bytes, line 76
76return 0==t.length?i:new eI(r,t,i||eI.empty,n)}between(e,t,r){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let i=this.chunkPos[n],s=this.chunk[n];if(t>=i&&e<=i+s.length&&!1===s.between(i,e-i,t-i,r))return}this.nextLayer.between(e,t,r)}}iter(e=0){return e$.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return e$.from(e).goto(t)}static compare(e,t,r,n,i=-1){let s=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),a=eL(s,o,r),l=new eF(s,a,i),h=new eF(o,a,i);r.iterGaps((e,t,r)=>eH(l,e,h,t,r,n)),r.empty&&0==r.length&&eH(l,0,h,0,0,n)}static eq(e,t,r=0,n){null==n&&(n=0x3b9ac9ff);let i=e.filter(e=>!e.isEmpty&&0>t.indexOf(e)),s=t.filter(t=>!t.isEmpty&&0>e.indexOf(t));if(i.length!=s.length)return!1;if(!i.length)return!0;let o=eL(i,s),a=new eF(i,o,0).goto(r),l=new eF(s,o,0).goto(r);for(;;){if(a.to!=l.to||!eW(a.active,l.active)||a.point&&(!l.point||!eN(a.point,l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(e,t,r,n,i=-1){let s=new eF(e,null,i).goto(t),o=t,a=s.openStart;for(;;){let e=Math.min(s.to,r);if(s.point){let r=s.activeForPoint(s.to),i=s.pointFrom<t?r.length+1:s.point.startSide<0?r.length:Math.min(r.length,a);n.point(o,e,s.point,r,i,s.pointRank),a=Math.min(s.openEnd(e),r.length)}else e>o&&(n.span(o,e,s.active,a),a=s.openEnd(e));if(s.to>r)return a+(s.point&&s.to>r?1:0);o=s.to,s.next()}}static of(e,t=!1){let r=new ej;for(let n of e instanceof eP?[e]:t?function(e){if(e.length>1)for(let t=e[0],r=1;r<e.length;r++){let n=e[r];if(e_(t,n)>0)return e.slice().sort(e_);t=n}return e}(e):e)r.add(n.from,n.to,n.value);return r.finish()}static join(e){if(!e.length)return eI.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let n=e[r];n!=eI.empty;n=n.nextLayer)t=new eI(n.chunkPos,n.chunk,t,Math.max(n.maxPoint,t.maxPoint));return t}}eI.empty=new eI([],[],null,-1),eI.empty.nextLayer=eI.empty;class ej{finishChunk(e){this.chunks.push(new eD(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new ej)).add(e,t,r)}addInner(e,t,r){let n=e-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&0>(e-this.lastFrom||r.startSide-this.last.startSide))throw Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if(0>(e-this.lastTo||t.value[0].startSide-this.last.endSide))return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(eI.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=eI.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function eL(e,t,r){let n=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&n.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let s=n.get(e.chunk[t]);null==s||(r?r.mapPos(s):s)!=e.chunkPos[t]||(null==r?void 0:r.touchesRange(s,s+e.chunk[t].length))||i.add(e.chunk[t])}return i}class eB{constructor(e,t,r,n=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(e,t){0>(this.to-e||this.endSide-t)&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class e${constructor(e){this.heap=e}static from(e,t=null,r=-1){let n=[];for(let i=0;i<e.length;i++)for(let s=e[i];!s.isEmpty;s=s.nextLayer)s.maxPoint>=r&&n.push(new eB(s,t,r,i));return 1==n.length?n[0]:new e$(n)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)ez(this.heap,e);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)ez(this.heap,e);0>(this.to-e||this.value.endSide-t)&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),ez(this.heap,0)}}}function ez(e,t){for(let r=e[t];;){let n=(t<<1)+1;if(n>=e.length)break;let i=e[n];if(n+1<e.length&&i.compare(e[n+1])>=0&&(i=e[n+1],n++),0>r.compare(i))break;e[n]=r,e[t]=i,t=n}}class eF{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=e$.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&0>(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t);)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){eU(this.active,e),eU(this.activeTo,e),eU(this.activeRank,e),this.minActive=eq(this.active,this.activeTo)}
76addActive(e){let t=0,{value:r,to:n,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||n-this.activeTo[t])>0;)t++;eV(this.active,t,r),eV(this.activeTo,t,n),eV(this.activeRank,t,i),e&&eV(e,t,this.cursor.from),this.minActive=eq(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&0>(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&eU(r,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(e.point)if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}else this.addActive(r),this.cursor.next()}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let t=r.length-1;t>=0&&r[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function eH(e,t,r,n,i,s){e.goto(t),r.goto(n);let o=n+i,a=n,l=n-t,h=!!s.boundChange;for(let t=!1;;){let n=e.to+l-r.to,i=n||e.endSide-r.endSide,c=i<0?e.to+l:r.to,u=Math.min(c,o);if(e.point||r.point?(e.point&&r.point&&eN(e.point,r.point)&&eW(e.activeForPoint(e.to),r.activeForPoint(r.to))||s.comparePoint(a,u,e.point,r.point),t=!1):(t&&s.boundChange(a),u>a&&!eW(e.active,r.active)&&s.compareRange(a,u,e.active,r.active),h&&u<o&&(n||e.openEnd(c)!=r.openEnd(c))&&(t=!0)),c>o)break;a=c,i<=0&&e.next(),i>=0&&r.next()}}function eW(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r]&&!eN(e[r],t[r]))return!1;return!0}function eU(e,t){for(let r=t,n=e.length-1;r<n;r++)e[r]=e[r+1];e.pop()}function eV(e,t,r){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=r}function eq(e,t){let r=-1,n=1e9;for(let i=0;i<t.length;i++)0>(t[i]-n||e[i].endSide-e[r].endSide)&&(r=i,n=t[i]);return r}function eK(e,t,r=e.length){let n=0;for(let i=0;i<r&&i<e.length;)9==e.charCodeAt(i)?(n+=t-n%t,i++):(n++,i=N(e,i));return n}function eJ(e,t,r,n){for(let n=0,i=0;;){if(i>=t)return n;if(n==e.length)break;i+=9==e.charCodeAt(n)?r-i%r:1,n=N(e,n)}return!0===n?-1:e.length}let eG="u"<typeof Symbol?"__ͼ":Symbol.for("ͼ"),eY="u"<typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),eX="u">typeof globalThis?globalThis:"u">typeof window?window:{};class eQ{constructor(e,t){this.rules=[];let{finish:r}=t||{};function n(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}for(let t in e)!function e(t,i,s,o){let a=[],l=/^@(\w+)\b/.exec(t[0]),h=l&&"keyframes"==l[1];if(l&&null==i)return s.push(t[0]+";");for(let r in i){let o=i[r];if(/&/.test(r))e(r.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((e,t)=>e.concat(t)),o,s);else if(o&&"object"==typeof o){if(!l)throw RangeError("The value of a property ("+r+") should be a primitive value.");e(n(r),o,a,h)}else null!=o&&a.push(r.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+o+";")}(a.length||h)&&s.push((r&&!l&&!o?t.map(r):t).join(", ")+" {"+a.join(" ")+"}")}(n(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=eX[eG]||1;return eX[eG]=e+1,"ͼ"+e.toString(36)}static mount(e,t,r){let n=e[eY],i=r&&r.nonce;n?i&&n.setNonce(i):n=new e0(e,i),n.mount(Array.isArray(t)?t:[t],e)}}let eZ=new Map;class e0{constructor(e,t){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let t=eZ.get(r);if(t)return e[eY]=t;this.sheet=new n.CSSStyleSheet,eZ.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[eY]=this}mount(e,t){let r=this.sheet,n=0,i=0;for(let t=0;t<e.length;t++){let s=e[t],o=this.modules.indexOf(s);if(o<i&&o>-1&&(this.modules.splice(o,1),i--,o=-1),-1==o){if(this.modules.splice(i++,0,s),r)for(let e=0;e<s.rules.length;e++)r.insertRule(s.rules[e],n++)}else{for(;i<o;)n+=this.modules[i++].rules.length;n+=s.rules.length,i++}}if(r)0>t.adoptedStyleSheets.indexOf(this.sheet)&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let r=t.head||t;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var e1={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:"'"},e2={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},e3="u">typeof navigator&&/Mac/.test(navigator.platform),e5="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),e4=0;e4<10;e4++)e1[48+e4]=e1[96+e4]=String(e4);for(var e4=1;e4<=24;e4++)e1[e4+111]="F"+e4;for(var e4=65;e4<=90;e4++)e1[e4]=String.fromCharCode(e4+32),e2[e4]=String.fromCharCode(e4);for(var e6 in e1)e2.hasOwnProperty(e6)||(e2[e6]=e1[e6]);function e8(e){var t=!(e3&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||e5&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?e2:e1)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}function e9(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,r=arguments[1];if(r&&"object"==typeof r&&null==r.nodeType&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var i=r[n];"string"==typeof i?e.setAttribute(n,i):null!=i&&(e[n]=i)}t++}for(;t<arguments.length;t++)!function e(t,r){if("string"==typeof r)t.appendChild(document.createTextNode(r));else if(null==r);else if(null!=r.nodeType)t.appendChild(r);else if(Array.isArray(r))for(var n=0;n<r.length;n++)e(t,r[n]);else throw RangeError("Unsupported child node: "+r)}(e,arguments[t]);return e}e.s(["base",0,e1,"keyName",0,e8,"shift",0,e2],31989);let e7="u">typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},te="u">typeof document?document:{documentElement:{style:{}}},tt=/Edge\/(\d+)/.exec(e7.userAgent),tr=/MSIE \d/.test(e7.userAgent),tn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e7.userAgent),ti=!!(tr||tn||tt),ts=!ti&&/gecko\/(\d+)/i.test(e7.userAgent),to=!ti&&/Chrome\/(\d+)/.exec(e7.userAgent),ta="webkitFontSmoothing"in te.documentElement.style,tl=!ti&&/Apple Computer/.test(e7.vendor),th=tl&&(/Mobile\/\w+/.test(e7.userAgent)||e7.maxTouchPoints>2);var tc={mac:th||/Mac/.test(e7.platform),windows:/Win/.test(e7.platform),linux:/Linux|X11/.test(e7.platform),ie:ti,ie_version:tr?te.documentMode||6:tn?+tn[1]:tt?+tt[1]:0,gecko:ts,gecko_version:ts?+(/Firefox\/(\d+)/.exec(e7.userAgent)||[0,0])[1]:0,chrome:!!to,chrome_version:to?+to[1]:0,ios:th,android:/Android\b/.test(e7.userAgent),webkit:ta,webkit_version:ta?+(/\bAppleWebKit\/(\d+)/.exec(e7.userAgent)||[0,0])[1]:0,safari:tl,safari_version:tl?+(/\bVersion\/(\d+(\.\d+)?)/.exec(e7.userAgent)||[0,0])[1]:0,tabSize:null!=te.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function tu(e,t){for(let r in e)"class"==r&&t.class?t.class+=" "+e.class:"style"==r&&t.style?t.style+=";"+e.style:t[r]=e[r];return t}let td=Object.create(null);function tf(e,t,r){if(e==t)return!0;e||(e=td),t||(t=td);let n=Object.keys(e),i=Object.keys(t);if(n.length-(r&&n.indexOf(r)>-1?1:0)!=i.length-(r&&i.indexOf(r)>-1?1:0))return!1;for(let s of n)if(s!=r&&(-1==i.indexOf(s)||e[s]!==t[s]))return!1;return!0}function tp(e,t,r){let n=!1;if(t)for(let i in t)r&&i in r||(n=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(r)for(let i in r)t&&t[i]==r[i]||(n=!0,"style"==i?e.style.cssText=r[i]:e.setAttribute(i,r[i]));return n}class tm{eq(e){return!1}updateDOM(e,t,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return -1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var tg=((o=tg||(tg={}))[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o);class ty extends eR{constructor(e,t,r,n){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(e){return new tv(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new tw(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,n;if(e.isBlockGap)r=-5e8,n=4e8;else{let{start:i,end:s}=tx(e,t);r=(i?t?-3e8:-1:5e8)-1,n=(s?t?2e8:1:-6e8)+1}return new tw(e,r,n,t,e.widget||null,!0)}static line(e){return new tb(e)}static set(e,t=!1){return eI.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ty.none=eI.empty;class tv extends ty{constructor(e){let{start:t,end:r}=tx(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?tu(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||td}eq(e){return this==e||e instanceof tv&&this.tagName==e.tagName&&tf(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}}tv.prototype.point=!1;class tb extends ty{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof tb&&this.spec.class==e.spec.class&&tf(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}
76tb.prototype.mapMode=j.TrackBefore,tb.prototype.point=!0;class tw extends ty{constructor(e,t,r,n,i,s){super(t,r,i,e),this.block=n,this.isReplace=s,this.mapMode=n?t<=0?j.TrackBefore:j.TrackAfter:j.TrackDel}get type(){return this.startSide!=this.endSide?tg.WidgetRange:this.startSide<=0?tg.WidgetBefore:tg.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){var t,r;return e instanceof tw&&(t=this.widget,t==(r=e.widget)||!!(t&&r&&t.compare(r)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function tx(e,t=!1){let{inclusiveStart:r,inclusiveEnd:n}=e;return null==r&&(r=e.inclusive),null==n&&(n=e.inclusive),{start:null!=r?r:t,end:null!=n?n:t}}function tk(e,t,r,n=0){let i=r.length-1;i>=0&&r[i]+n>=e?r[i]=Math.max(r[i],t):r.push(e,t)}tw.prototype.point=!0;class tS extends eR{constructor(e,t,r){super(),this.tagName=e,this.attributes=t,this.rank=r}eq(e){return e==this||e instanceof tS&&this.tagName==e.tagName&&tf(this.attributes,e.attributes)}static create(e){return new tS(e.tagName,e.attributes||td,null==e.rank?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return eI.of(e,t)}}function tC(e){return(11==e.nodeType?e.getSelection?e:e.ownerDocument:e).getSelection()}function tA(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function tE(e,t){if(!t.anchorNode)return!1;try{return tA(e,t.anchorNode)}catch(e){return!1}}function tT(e){return 3==e.nodeType?t$(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function tO(e,t,r,n){return!!r&&(tN(e,t,r,n,-1)||tN(e,t,r,n,1))}function tM(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function tR(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function tN(e,t,r,n,i){for(;;){if(e==r&&t==n)return!0;if(t==(i<0?0:tP(e))){if("DIV"==e.nodeName)return!1;let r=e.parentNode;if(!r||1!=r.nodeType)return!1;t=tM(e)+(i<0?0:1),e=r}else{if(1!=e.nodeType||1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?tP(e):0}}}function tP(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function t_(e,t){let r=t?e.left:e.right;return{left:r,right:r,top:e.top,bottom:e.bottom}}function tD(e,t){let r=t.width/e.offsetWidth,n=t.height/e.offsetHeight;return(r>.995&&r<1.005||!isFinite(r)||1>Math.abs(t.width-e.offsetWidth))&&(r=1),(n>.995&&n<1.005||!isFinite(n)||1>Math.abs(t.height-e.offsetHeight))&&(n=1),{scaleX:r,scaleY:n}}function tI(e,t=!0){let r=e.ownerDocument,n=null,i=null;for(let s=e.parentNode;s;)if(s==r.body||(!t||n)&&i)break;else if(1==s.nodeType)!i&&s.scrollHeight>s.clientHeight&&(i=s),t&&!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(11==s.nodeType)s=s.host;else break;return{x:n,y:i}}tS.prototype.startSide=tS.prototype.endSide=-1;class tj{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?tP(t):0),r,Math.min(e.focusOffset,r?tP(r):0))}set(e,t,r,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=n}}let tL=null;function tB(e){if(e.setActive)return e.setActive();if(tL)return e.focus(tL);let t=[];for(let r=e;r&&(t.push(r,r.scrollTop,r.scrollLeft),r!=r.ownerDocument);r=r.parentNode);if(e.focus(null==tL?{get preventScroll(){return tL={preventScroll:!0},!0}}:void 0),!tL){tL=!1;for(let e=0;e<t.length;){let r=t[e++],n=t[e++],i=t[e++];r.scrollTop!=n&&(r.scrollTop=n),r.scrollLeft!=i&&(r.scrollLeft=i)}}}function t$(e,t,n=t){let i=r||(r=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function tz(e,t,r,n){let i={key:t,code:t,keyCode:r,which:r,cancelable:!0};n&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=n);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,e.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,e.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function tF(e){return e instanceof Window?e.pageYOffset>
76Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function tH(e,t){for(let r=e,n=t;;)if(3==r.nodeType&&n>0)return{node:r,offset:n};else if(1==r.nodeType&&n>0){if("false"==r.contentEditable)return null;n=tP(r=r.childNodes[n-1])}else{if(!r.parentNode||tR(r))return null;n=tM(r),r=r.parentNode}}function tW(e,t){for(let r=e,n=t;;)if(3==r.nodeType&&n<r.nodeValue.length)return{node:r,offset:n};else if(1==r.nodeType&&n<r.childNodes.length){if("false"==r.contentEditable)return null;r=r.childNodes[n],n=0}else{if(!r.parentNode||tR(r))return null;n=tM(r)+1,r=r.parentNode}}tc.safari&&tc.safari_version>=26&&(tL=!1);class tU{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new tU(e.parentNode,tM(e),t)}static after(e,t){return new tU(e.parentNode,tM(e)+1,t)}}var tV=((a=tV||(tV={}))[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a);let tq=tV.LTR,tK=tV.RTL;function tJ(e){let t=[];for(let r=0;r<e.length;r++)t.push(1<<e[r]);return t}let tG=tJ("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),tY=tJ("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),tX=Object.create(null),tQ=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),r=e.charCodeAt(1);tX[t]=r,tX[r]=-t}function tZ(e){return e<=247?tG[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?tY[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}let t0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class t1{get dir(){return this.level%2?tK:tq}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,n){let i=-1;for(let s=0;s<e.length;s++){let o=e[s];if(o.from<=t&&o.to>=t){if(o.level==r)return s;(i<0||(0!=n?n<0?o.from<t:o.to>t:e[i].level>o.level))&&(i=s)}}if(i<0)throw RangeError("Index out of range");return i}}let t2=[];function t3(e){return[new t1(0,e,0)]}let t5="",t4=G.define(),t6=G.define(),t8=G.define(),t9=G.define(),t7=G.define(),re=G.define(),rt=G.define(),rr=G.define(),rn=G.define(),ri=G.define({combine:e=>e.some(e=>e)}),rs=G.define({combine:e=>e.some(e=>e)}),ro=G.define();class ra{constructor(e,t,r,n,i,s=!1){this.range=e,this.y=t,this.x=r,this.yMargin=n,this.xMargin=i,this.isSnapshot=s}map(e){return e.empty?this:new ra(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ra(q.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}let rl=ew.define({map:(e,t)=>e.map(t)}),rh=ew.define();function rc(e,t,r){let n=e.facet(t9);n.length?n[0](t):window.onerror&&window.onerror(String(t),r,void 0,void 0,t)||(r?console.error(r+":",t):console.error(t))}let ru=G.define({combine:e=>!e.length||e[0]}),rd=0,rf=G.define({combine:e=>e.filter((t,r)=>{for(let n=0;n<r;n++)if(e[n].plugin==t.plugin)return!1;return!0})});class rp{constructor(e,t,r,n,i){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=n,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(rf.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(rf.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:r,eventObservers:n,provide:i,decorations:s}=t||{};return new rp(rd++,e,r,n,e=>{let t=[];return s&&t.push(rv.of(t=>{let r=t.plugin(e);return r?s(r):ty.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return rp.define((t,r)=>new e(t,r),t)}}class rm{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(rc(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){rc(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null==(t=this.value)?void 0:t.destroy)try{this.value.destroy()}catch(t){rc(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}let rg=G.define(),ry=G.define(),rv=G.define(),rb=G.define(),rw=G.define(),rx=G.define(),rk=G.define();function rS(e,t){let r=e.state.facet(rk);if(!r.length)return r;let n=r.map(t=>t instanceof Function?t(e):t),i=[];return eI.spans(n,t.from,t.to,{point(){},span(e,r,n,s){let o=e-t.from,a=r-t.from,l=i;for(let e=n.length-1;e>=0;e--,s--){let r=n[e].spec.bidiIsolate,i;if(null==r&&(r=function(e,t,r){for(let n=t;n<r;n++){let t=tZ(e.charCodeAt(n));if(1==t)break;
vendor: 8,740 bytes, line 76
76if(2==t||4==t)return tK}return tq}(t.text,o,a)),s>0&&l.length&&(i=l[l.length-1]).to==o&&i.direction==r)i.to=a,l=i.inner;else{let e={from:o,to:a,direction:r,inner:[]};l.push(e),l=e.inner}}}}),i}let rC=G.define();function rA(e){let t=0,r=0,n=0,i=0;for(let s of e.state.facet(rC)){let o=s(e);o&&(null!=o.left&&(t=Math.max(t,o.left)),null!=o.right&&(r=Math.max(r,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(i=Math.max(i,o.bottom)))}return{left:t,right:r,top:n,bottom:i}}let rE=G.define();class rT{constructor(e,t,r,n){this.fromA=e,this.toA=t,this.fromB=r,this.toB=n}join(e){return new rT(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>r.toA)){if(n.toA<r.fromA)break;r=r.join(n),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(0==t.length)return e;let r=[];for(let n=0,i=0,s=0;;){let o=Math.min(n<e.length?e[n].fromB:1e9,i<t.length?t[i]:1e9);if(1e9==o)break;let a=o+s,l=o,h=a;for(;;)if(i<t.length&&t[i]<=l){let r=t[i+1];i+=2,l=Math.max(l,r);for(let t=n;t<e.length&&e[t].fromB<=l;t++)s=e[t].toA-e[t].toB;h=Math.max(h,r+s)}else if(n<e.length&&e[n].fromB<=l){let t=e[n++];l=Math.max(l,t.toB),h=Math.max(h,t.toA),s=t.toA-t.toB}else break;r.push(new rT(a,h,o,l))}return r}}class rO{constructor(e,t,r){for(let n of(this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=B.empty(this.startState.doc.length),r))this.changes=this.changes.compose(n.changes);let n=[];this.changes.iterChangedRanges((e,t,r,i)=>n.push(new rT(e,t,r,i))),this.changedRanges=n}static create(e,t,r){return new rO(e,t,r)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}let rM=[];class rR{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return rM}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let r=e.attributes.length-1;r>=0;r--){let n=e.attributes[r].name;null==t[n]&&e.removeAttribute(n)}for(let r in t){let n=t[r];"style"==r?e.style.cssText=n:e.getAttribute(r)!=n&&e.setAttribute(r,n)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let r=t;for(let t of this.children){if(t==e)return r;r+=t.length+t.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let r=tM(this.dom),n=this.length?e>0:t>0;return new tU(this.parent.dom,r+ +!!n,0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof r_)return e;return null}static get(e){return e.cmTile}}class rN extends rR{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t=this.dom,r=null,n,i=(null==e?void 0:e.node)==t?e:null,s=0;for(let o of this.children){if(o.sync(e),s+=o.length+o.breakAfter,n=r?r.nextSibling:t.firstChild,i&&n!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;n&&n!=o.dom;)n=rP(n);else t.insertBefore(o.dom,n);r=o.dom}for(n=r?r.nextSibling:t.firstChild,i&&n&&(i.written=!0);n;)n=rP(n);this.length=s}}function rP(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class r_ extends rN{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=rR.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,n=0,i=0;;)if(n==r.children.length){if(!t.length)return;(r=r.parent).breakAfter&&i++,n=t.pop()}else{let s=r.children[n++];if(s instanceof rD)t.push(n),r=s,n=0;else{let t=i+s.length,r=e(s,i);if(void 0!==r)return r;i=t+s.breakAfter}}}resolveBlock(e,t){let r,n=-1,i,s=-1;if(this.blockTiles((o,a)=>{let l=a+o.length;if(e>=a&&e<=l){if(o.isWidget()&&t>=-1&&t<=1){if(32&o.flags)return!0;16&o.flags&&(r=void 0)}(a<e||e==l&&(t<-1?o.length:o.covers(1)))&&(!r||!o.isWidget()&&r.isWidget())&&(r=o,n=e-a),(l>e||e==a&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,s=e-a)}}),!r&&!i)throw Error("No tile at position "+e);return r&&t<0||!i?{tile:r,offset:n}:{tile:i,offset:s}}}class rD extends rN{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let r=new rD(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class rI extends rN{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let n=new rI(t||document.createElement("div"),e);return t&&r||(n.flags|=4),n}get domAttrs(){return this.attrs}resolveInline(e,t,r){let n=null,i=-1,s=null,o=-1;!function e(a,l){for(let h=0,c=0;h<a.children.length&&c<=l;h++){let u=a.children[h],d=c+u.length;d>=l&&(u.isComposite()?e(u,l-c):(!s||s.isHidden&&(t>0||r&&function(e,t){let r=e.coordsIn(0,1),n=t.coordsIn(0,1);return r&&n&&n.top<r.bottom}(s,u)))&&(d>l||32&u.flags)?(s=u,o=l-c):(c<l||16&u.flags&&!u.isHidden)&&(n=u,i=l-c)),c=d}}(this,e);let a=(t<0?n:s)||n||s;return a?{tile:a,offset:a==n?i:o}:null}coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let r=tT(t);return r[r.length-1]||null}(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:e,offset:n}=r;if(this.dom.contains(e.dom))return e.isText()?new tU(e.dom,Math.min(e.dom.nodeValue.length,n)):e.domPosFor(n,16&e.flags?1:32&e.flags?-1:t);let i=r.tile.parent,s=!1;for(let e of i.children){if(s)return new tU(e.dom,0);e==r.tile&&(s=!0)}}return new tU(this.dom,0)}}class rj extends rN{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new rj(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class rL extends rR{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let r=this.dom.nodeValue.length;e>r&&(e=r);let n=e,i=e,s=0;0==e&&t<0||e==r&&t>=0?!(tc.chrome||tc.gecko)&&(e?(n--,s=1):i<r&&(i++,s=-1)):t<0?n--:i<r&&i++;let o=t$(this.dom,n,i).getClientRects();if(!o.length)return null;let a=o[(s?s<0:t>=0)?0:o.length-1];return tc.safari&&!s&&0==a.width&&(a=Array.prototype.find.call(o,e=>e.width)||a),s?t_(a,s<0):a||null}static of(e,t){let r=new rL(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class rB extends rR{constructor(e,t,r,n){super(e,t,n),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,r){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;if(r)return t_(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),r=null;if(!t.length)return null;let n=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let i=n?t.length-1:0;r=t[i],e>0?0!=i:i!=t.length-1&&!(r.top<r.bottom);i+=n?-1:1);return t_(r,!n)}}get overrideDOMText(){if(!this.length)return k.empty;let{root:e}=this;if(!e)return k.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,r,n,i){return!i&&(i=e.toDOM(t),e.editable||(i.contentEditable="false")),new rB(i,r,e,n)}}class r$ extends rR{constructor(e){let t=document.createElement("img");
76t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return k.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class rz{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:n,index:i,beforeBreak:s,parents:o}=this;for(;e||t>0;)if(n.isComposite())if(s){if(!e)break;r&&r.break(),e--,s=!1}else if(i==n.children.length){if(!e&&!o.length)break;r&&r.leave(n),s=!!n.breakAfter,({tile:n,index:i}=o.pop()),i++}else{let a=n.children[i],l=a.breakAfter;(t>0?a.length<=e:a.length<e)&&(!r||!1!==r.skip(a,0,a.length)||!a.isComposite)?(s=!!l,i++,e-=a.length):(o.push({tile:n,index:i}),n=a,i=0,r&&a.isComposite()&&r.enter(a))}else if(i==n.length)s=!!n.breakAfter,({tile:n,index:i}=o.pop()),i++;else if(e){let t=Math.min(e,n.length-i);r&&r.skip(n,i,i+t),e-=t,i+=t}else break;return this.tile=n,this.index=i,this.beforeBreak=s,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class rF{constructor(e,t,r,n){this.from=e,this.to=t,this.wrapper=r,this.rank=n}}class rH{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,n){var i;this.flushBuffer();let s=this.ensureMarks(t,r),o=s.lastChild;o&&o.isText()&&!(8&o.flags)&&o.length+e.length<512?(this.cache.reused.set(o,2),(s.children[s.children.length-1]=new rL(o.dom,o.text+e)).parent=s):s.append(n||rL.of(e,null==(i=this.cache.find(rL))?void 0:i.dom)),this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?rG(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let n=r;for(let e=t.marks.length-1;e>=0;e--){let r=t.marks[e],i=n.lastChild;if(i instanceof rj&&i.mark.eq(r.mark))i.dom!=r.dom&&i.setDOM(rG(r.dom)),n=i;else{if(this.cache.reused.get(r)){let e=rR.get(r.dom);e&&e.setDOM(rG(r.dom))}let e=rj.of(r.mark,r.dom);n.append(e),n=e}this.cache.reused.set(r,2)}let i=rR.get(e.text);i&&this.cache.reused.set(i,2);let s=new rL(e.text,e.text.nodeValue);s.flags|=8,this.pos=e.range.toB,n.append(s)}addInlineWidget(e,t,r){let n=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);n||this.flushBuffer();let i=this.ensureMarks(t,r);n||16&e.flags||i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var r;e||(e=rJ);let n=rI.start(e,t||(null==(r=this.cache.find(rI))?void 0:r.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var r;let n=this.curLine;for(let i=e.length-1;i>=0;i--){let s=e[i],o;if(t>0&&(o=n.lastChild)&&o instanceof rj&&o.mark.eq(s))n=o,t--;else{let e=rj.of(s,null==(r=this.cache.find(rj,e=>e.mark.eq(s)))?void 0:r.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!rK(this.curLine,!1)||"BR"!=e.dom.nodeName&&e.isWidget()&&!(tc.ios&&rK(this.curLine,!0))
vendor: 4,258 bytes, line 76
76)&&this.curLine.append(this.cache.findWidget(rX,0,32)||new rB(rX.toDOM(),0,rX,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=102*e.rank+e.value.rank,r=new rF(e.from,e.to,e.value,t),n=this.wrappers.length;for(;n>0&&0>(this.wrappers[n-1].rank-r.rank||this.wrappers[n-1].to-r.to);)n--;this.wrappers.splice(n,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r of this.wrappers){let n=t.lastChild;if(r.from<this.pos&&n instanceof rD&&n.wrapper.eq(r.wrapper))t=n;else{let n=rD.of(r.wrapper,null==(e=this.cache.find(rD,e=>e.wrapper.eq(r.wrapper)))?void 0:e.dom);t.append(n),t=n}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(r$,void 0,1);return r&&(r.flags=t),r||new r$(t)}flushBuffer(){this.afterWidget&&!(32&this.afterWidget.flags)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class rW{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:r,done:n}=this.cursor.next(this.skipCount);if(this.skipCount=0,n)throw Error("Ran out of text content when drawing inline views");this.text=t;let i=this.textOff=Math.min(e,t.length);return r?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}let rU=[rB,rI,rL,rj,r$,rD,r_];for(let e=0;e<rU.length;e++)rU[e].bucket=e;class rV{constructor(e){this.view=e,this.buckets=rU.map(()=>[]),this.index=rU.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let n=e.bucket,i=this.buckets[n],s=this.index[n];for(let e=i.length-1;e>=0;e--){let o=(e+s)%i.length,a=i[o];if((!t||t(a))&&!this.reused.has(a))return i.splice(o,1),o<s&&this.index[n]--,this.reused.set(a,r),a}return null}findWidget(e,t,r){let n=this.buckets[0];if(n.length)for(let i=0,s=0;;i++){if(i==n.length){if(s)return null;s=1,i=0}let o=n[i];if(!this.reused.has(o)&&(0==s?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget))){if(n.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(497&o.flags)==r)return this.reused.set(o,1),o;return this.reused.set(o,2),new rB(o.dom,t,e,-498&o.flags|r)}}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class rq{constructor(e,t,r,n,i){this.view=e,this.decorations=n,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new rV(e),this.text=new rW(e.state.doc),this.builder=new rH(this.cache,new r_(e,e.contentDOM),eI.iter(r)),this.cache.reused.set(t,2),this.old=new rz(t),this.reuseWalker={skip:(e,t,r)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let r=t&&this.getCompositionContext(t.text);for(let n=0,i=0,s=0;;){let o=s<e.length?e[s++]:null,a=o?o.fromA:this.old.root.length;if(a>n){let e=a-n;this.preserve(e,!s,!o),n=a,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,n=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let n=function(e){let t=[];for(let r=e.parents.length;r>1;r--){let n=r==e.parents.length?e.tile:e.parents[r].tile;
76n instanceof rj&&t.push(n.mark)}return t}(this.old),i=this.openMarks;this.old.advance(e,r?1:-1,{skip:(e,t,r)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(r-t);else{let s=r>0||t<e.length?rB.of(e.widget,this.view,r-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&s.flags?(s.flags&=-2,this.builder.addBlockWidget(s)):(this.builder.ensureLine(null),this.builder.addInlineWidget(s,n,i),i=n.length)}else if(e.isText())this.builder.ensureLine(null),t||r!=e.length||this.cache.reused.has(e)?(this.cache.add(e),this.builder.addText(e.text.slice(t,r),n,i)):this.builder.addText(e.text,n,i,this.cache.reuse(e)),i=n.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof r$)this.cache.add(e);else{if(!(e instanceof rj))return!1;this.builder.ensureLine(null),this.builder.addMark(e,n,i),this.cache.reused.set(e,1),i=n.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof rj&&n.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?n.length&&(n.length=i=0):e instanceof rj&&(n.shift(),i=Math.min(i,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,n=this.builder,i=0,s=eI.spans(this.decorations,e,t,{point:(e,t,s,o,a,l)=>{var h,c,u;if(s instanceof tw){if(this.disallowBlockEffectsFor[l]){if(s.block)throw RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=o.length,a>o.length)n.continueWidget(t-e);else{let i,l=s.widget||(s.block?rY.block:rY.inline),c=(i=(h=s).isReplace?64*(h.startSide<0)|128*(h.endSide>0):h.startSide>0?32:16,h.block&&(i|=256),i),u=this.cache.findWidget(l,t-e,c)||rB.of(l,this.view,t-e,c);s.block?(s.startSide>0&&n.addLineStartIfNotCovered(r),n.addBlockWidget(u)):(n.ensureLine(r),n.addInlineWidget(u,o,a))}r=null}else{let e,t;c=r,e=(u=s).spec.attributes,t=u.spec.class,(e||t)&&(c||(c={class:"cm-line"}),e&&tu(e,c),t&&(c.class+=" "+t)),r=c}t>e&&this.text.skip(t-e)},span:(e,t,s,o)=>{for(let i=e;i<t;){let a=this.text.next(Math.min(512,t-i));null==a?(n.addLineStartIfNotCovered(r),n.addBreak(),i++):(n.ensureLine(r),n.addText(a,s,i==e?o:s.length),i+=a.length),r=null}i=s.length}});this.openWidget=s>i,this.openWidget||n.addLineStartIfNotCovered(r),this.openMarks=s}forward(e,t,r=1){t-e<=10?this.old.advance(t-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let n=e.parentNode;;n=n.parentNode){let e=rR.get(n);if(n==this.view.contentDOM)break;e instanceof rj?t.push(e):(null==e?void 0:e.isLine())?r=e:e instanceof rD||("DIV"!=n.nodeName||r||n==this.view.contentDOM?r||t.push(rj.of(new tv({tagName:n.nodeName.toLowerCase(),attributes:function(e){let t=Object.create(null);for(let r=0;r<e.attributes.length;r++){let n=e.attributes[r];t[n.name]=n.value}return t}(n)}),n)):r=new rI(n,rJ))}return{line:r,marks:t}}}function rK(e,t){let r=e=>{for(let n of e.children)if((t?n.isText():n.length)||r(n))return!0;return!1};return r(e)}let rJ={class:"cm-line"};function rG(e){let t=rR.get(e);return t&&t.setDOM(e.cloneNode()),e}class rY extends tm{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}rY.inline=new rY("span"),rY.block=new rY("div");let rX=new class extends tm{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class rQ{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ty.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new r_(e,e.contentDOM),this.updateInner([new rT(0,0,0,e.state.doc.length)],null)}update(e){var t,r,n,i,s,o,a,l,h;let c,u,d,f=e.changedRanges;this.minWidth>0&&f.length&&(f.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let p=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null==(t=this.domChanged)?void 0:t.newSel)?p=this.domChanged.newSel.head:(r=e.changes,n=this.hasComposition,c=!1,n&&r.iterChangedRanges((e,t)=>{e<n.to&&t>n.from&&(c=!0)}),c||e.selectionSet||(p=e.state.selection.main.head)));let m=p>-1?function(e,t,r){let n=r0(e,r);if(!n)return null;let{node:i,from:s,to:o}=n,a=i.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(n.from,n.to)!=a)return null;let l=t.invertedDesc;return{range:new rT(l.mapPos(s),l.mapPos(o),s,o),text:i}}(this.view,e.changes,p):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:r}=this.hasComposition;f=new rT(t,r,e.changes.mapPos(t,-1),e.changes.mapPos(r,1)).addToSet(f.slice())}this.hasComposition=m?{from:m.range.fromB,to:m.range.toB}:null,(tc.ie||tc.chrome)&&!m&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let g=this.decorations,y=this.blockWrappers;this.updateDeco();let v=(i=g,s=this.decorations,o=e.changes,u=new r1,eI.compare(i,s,o,u),u.changes);v.length&&(f=rT.extendWithRanges(f,v));let b=(a=y,l=this.blockWrappers,h=e.changes,d=new r2,eI.compare(a,l,h,d),d.changes);return b.length&&(f=rT.extendWithRanges(f,b)),m&&!f.some(e=>e.fromA<=m.range.fromA&&e.toA>=m.range.toA)&&(f=m.range.addToSet(f.slice())),(!(2&this.tile.flags)||0!=f.length)&&(this.updateInner(f,m),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let r=this.tile,n=new rq(this.view,r,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&rR.get(t.text)&&n.cache.reused.set(rR.get(t.text),2),this.tile=n.run(e,t),rZ(r,n.c
76ache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=tc.chrome||tc.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(n),n&&(n.written||r.selectionRange.focusNode!=n.node||!this.tile.dom.contains(n.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof r3&&n.push(e.dom);r.updateGaps(n)}updateEditContextFormatting(e){for(let t of(this.editContextFormatting=this.editContextFormatting.map(e.changes),e.transactions))for(let e of t.effects)e.is(rh)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){var r;(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,s=i==n,o=!s&&!(this.view.state.facet(ru)||n.tabIndex>-1)&&tE(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,h,c;if(l.empty?c=h=this.inlineDOMNearPos(l.anchor,l.assoc||1):(c=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),h=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),tc.gecko&&l.empty&&!this.hasComposition&&1==(r=h).node.nodeType&&r.node.firstChild&&(0==r.offset||"false"==r.node.childNodes[r.offset-1].contentEditable)&&(r.offset==r.node.childNodes.length||"false"==r.node.childNodes[r.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(e,h.node.childNodes[h.offset]||null)),h=c=new tU(e,0),a=!0}let u=this.view.observer.selectionRange;!a&&u.focusNode&&(tO(h.node,h.offset,u.anchorNode,u.anchorOffset)&&tO(c.node,c.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,l))||(this.view.observer.ignore(()=>{tc.android&&tc.chrome&&n.contains(u.focusNode)&&function(e,t){for(let r=e;r&&r!=t;r=r.assignedSlot||r.parentNode)if(1==r.nodeType&&"false"==r.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=tC(this.view.root);if(e)if(l.empty){if(tc.gecko){var t,r;let e=(t=h.node,r=h.offset,1!=t.nodeType?0:(r&&"false"==t.childNodes[r-1].contentEditable?1:0)|2*(r<t.childNodes.length&&"false"==t.childNodes[r].contentEditable));if(e&&3!=e){let t=(1==e?tH:tW)(h.node,h.offset);t&&(h=new tU(t.node,t.offset))}}e.collapse(h.node,h.offset),null!=l.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=l.bidiLevel)}else if(e.extend){e.collapse(h.node,h.offset);try{e.extend(c.node,c.offset)}catch(e){}}else{let t=document.createRange();l.anchor>l.head&&([h,c]=[c,h]),t.setEnd(c.node,c.offset),t.setStart(h.node,h.offset),e.removeAllRanges(),e.addRange(t)}
vendor: 5,074 bytes, line 76
76o&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new tU(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new tU(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&tO(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=tC(e.root),{anchorNode:n,anchorOffset:i}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let s=this.lineAt(t.head,t.assoc);if(!s)return;let o=s.posAtStart;if(t.head==o||t.head==o+s.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let h=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(h.node,h.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&r.collapse(n,i)}posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let n=r.posAtStart;if(r.isComposite()){let i;if(e==r.dom)i=r.dom.childNodes[t];else{let n=0==tP(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==r.dom)break;0==n&&t.firstChild!=t.lastChild&&(n=e==t.firstChild?-1:1),e=t}i=n<0?e:e.nextSibling}if(i==r.dom.firstChild)return n;for(;i&&!rR.get(i);)i=i.nextSibling;if(!i)return n+r.length;for(let e=0,t=n;;e++){let n=r.children[e];if(n.dom==i)return t;t+=n.length+n.breakAfter}}else if(r.isText())return e==r.dom?n+t:n+(t?r.length:0);else return n}domAtPos(e,t){let{tile:r,offset:n}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(e,t):r.domIn(n,t)}inlineDOMNearPos(e,t){let r,n=-1,i=!1,s,o=-1,a=!1;return(this.tile.blockTiles((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(i=!0)}else{let h=l+t.length;if(l<=e&&(r=t,n=e-l,i=h<e),h>=e&&!s&&(s=t,o=e-l,a=l>e),l>e&&s)return!0}}),r||s)?(i&&s?r=null:a&&r&&(s=null),r&&t<0||!s?r.domIn(n,t):s.domIn(o,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:r,offset:n}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof r3?null:r.coordsInWidget(n,t,!0):r.coordsIn(n,t)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,r){if(t.isComposite())for(let n of t.children){if(n.length>=r){let t=e(n,r);if(t)return t}if((r-=n.length)<0)break}else if(t.isText()&&r<t.length){let e=N(t.text,r);if(e==r)return null;let n=t$(t.dom,r,e).getClientRects();for(let e=0;e<n.length;e++){let t=n[e];if(e==n.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,r):null}measureVisibleLineHeights(e){let t=[],{from:r,to:n}=e,i=this.view.contentDOM.clientWidth,s=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==tV.LTR,l=0,h=(e,c,u)=>{for(let d=0;d<e.children.length&&!(c>n);d++){let n=e.children[d],f=c+n.length,p=n.dom.getBoundingClientRect(),{height:m}=p;if(u&&!d&&(l+=p.top-u.top),n instanceof rD)f>r&&h(n,c,p);else if(c>=r&&(l>0&&t.push(-l),t.push(m+l),l=0,s)){let e=n.dom.lastChild,t=e?tT(e):[];if(t.length){let e=t[t.length-1],r=a?e.right-p.left:p.right-e.left;r>o&&(o=r,this.minWidth=i,this.minWidthFrom=c,this.minWidthTo=f)}}u&&d==e.children.length-1&&(l+=u.bottom-p.bottom),c=f+n.breakAfter}};return h(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?tV.RTL:tV.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,r;for(let n of e.children){if(!n.isText()||/[^ -~]/.test(n.text))return;let e=tT(n.dom);if(1!=e.length)return;t+=e[0].width,r=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:r}}});if(e)return e;let t=document.createElement("div"),r,n,i;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=tT(t.firstChild)[0];r=t.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,i=e&&e.height?e.height:r,t.remove()}),{lineHeight:r,charWidth:n,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,n=0;;n++){let i=n==t.viewports.length?null:t.viewports[n],s=i?i.from-1:this.view.state.doc.length;if(s>r){let n=(t.lineBlockAt(s).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(ty.replace({widget:new r3(n),block:!0,inclusive:!0,isBlockGap:!0}).range(r,s))}if(!i)break;r=i.to+1}return ty.set(e)}updateDeco(){let e=1,t=this.view.state.facet(rv).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),r=!1,n=this.view.state.facet(rw).map((e,t)=>{let n="function"==typeof e;return n&&(r=!0),n?e(this.view):e});for(n.length&&(this.dynamicDecorationMap[e++]=r,t.push(eI.join(n))
76),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(rb).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){var t;if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(ro))try{if(t(this.view,e.range,e))return!0}catch(e){rc(this.view.state,e,"scroll handler")}let{range:r}=e,n=this.coordsAt(r.head,null!=(t=r.assoc)?t:r.empty?0:r.head>r.anchor?-1:1),i;if(!n)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let s=rA(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(!function(e,t,r,n,i,s,o,a){let l=e.ownerDocument,h=l.defaultView||window;for(let c=e,u=!1;c&&!u;)if(1==c.nodeType){let e,d=c==l.body,f=1,p=1;if(d)e=function(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let t=c.getBoundingClientRect();({scaleX:f,scaleY:p}=tD(c,t)),e={left:t.left,right:t.left+c.clientWidth*f,top:t.top,bottom:t.top+c.clientHeight*p}}let m=0,g=0;if("nearest"==i)t.top<e.top+o?(g=t.top-(e.top+o),r>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(g=t.bottom-e.bottom+o,r<0&&t.top-g<e.top&&(g=t.top-(e.top+o)));else{let n=t.bottom-t.top,s=e.bottom-e.top;g=("center"==i&&n<=s?t.top+n/2-s/2:"start"==i||"center"==i&&r<0?t.top-o:t.bottom-s+o)-e.top}if("nearest"==n?t.left<e.left+s?(m=t.left-(e.left+s),r>0&&t.right>e.right+m&&(m=t.right-e.right+s)):t.right>e.right-s&&(m=t.right-e.right+s,r<0&&t.left<e.left+m&&(m=t.left-(e.left+s))):m=("center"==n?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==n==a?t.left-s:t.right-(e.right-e.left)+s)-e.left,m||g)if(d)h.scrollBy(m,g);else{let e=0,r=0;if(g){let e=c.scrollTop;c.scrollTop+=g/p,r=(c.scrollTop-e)*p}if(m){let t=c.scrollLeft;c.scrollLeft+=m/f,e=(c.scrollLeft-t)*f}t={left:t.left-e,top:t.top-r,right:t.right-e,bottom:t.bottom-r},e&&1>Math.abs(e-m)&&(n="nearest"),r&&1>Math.abs(r-g)&&(i="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),c=c.assignedSlot||c.parentNode}else if(11==c.nodeType)c=c.host;else break}(this.view.scrollDOM,o,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==tV.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(r.head,1);e&&e.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){rZ(this.tile)}}function rZ(e,t){let r=null==t?void 0:t.get(e);if(1!=r)for(let n of(null==r&&e.destroy(),e.children))rZ(n,t)}function r0(e,t){let r=e.observer.selectionRange;if(!r.focusNode)return null;let n=tH(r.focusNode,r.focusOffset),i=tW(r.focusNode,r.focusOffset),s=n||i;if(i&&n&&i.node!=n.node){let t=rR.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)s=i;else if(e.docView.lastCompositionAfterCursor){let e=rR.get(n.node);!e||e.isText()&&e.text!=n.node.nodeValue||(s=i)}}if(e.docView.lastCompositionAfterCursor=s!=n,!s)return null;let o=t-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}let r1=class{constructor(){this.changes=[]}compareRange(e,t){tk(e,t,this.changes)}comparePoint(e,t){tk(e,t,this.changes)}boundChange(e){tk(e,e,this.changes)}};class r2{constructor(){this.changes=[]}compareRange(e,t){tk(e,t,this.changes)}comparePoint(){}boundChange(e){tk(e,e,this.changes)}}class r3 extends tm{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");
76return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function r5(e,t,r){let n=e.lineBlockAt(t);if(Array.isArray(n.type)){let e;for(let i of n.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==tg.Text&&(e.type!=i.type||(r<0?i.from<t:i.to>t)))&&(e=i)}}return e||n}return n}function r4(e,t,r,n){let i=e.state.doc.lineAt(t.head),s=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=function(e,t,r,n,i){var s;let o=n.head-e.from,a=t1.find(t,o,null!=(s=n.bidiLevel)?s:-1,n.assoc),l=t[a],h=l.side(i,r);if(o==h){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;o=(l=t[a=e]).side(!i,r),h=l.side(i,r)}let c=N(e.text,o,l.forward(i,r));(c<l.from||c>l.to)&&(c=h),t5=e.text.slice(Math.min(o,c),Math.max(o,c));let u=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return u&&c==h&&u.level+ +!i<l.level?q.cursor(u.side(!i,r)+e.from,u.forward(i,r)?1:-1,u.level):q.cursor(c+e.from,l.forward(i,r)?-1:1,l.level)}(i,s,o,a,r),h=t5;if(!t){if(i.number==(r?e.state.doc.lines:1))return a;h="\n",i=e.state.doc.line(i.number+(r?1:-1)),s=e.bidiSpans(i),t=e.visualLineSide(i,!r)}if(l){if(!l(h))return a}else{if(!n)return t;l=n(h)}a=t}}function r6(e,t,r){for(;;){let n=0;for(let i of e)i.between(t-1,t+1,(e,i,s)=>{if(t>e&&t<i){let s=n||r||(t-e<i-t?-1:1);t=s<0?e:i,n=s}});if(!n)return t}}function r8(e,t){let r=null;for(let n=0;n<t.ranges.length;n++){let i=t.ranges[n],s=null;if(i.empty){let t=r6(e,i.from,0);t!=i.from&&(s=q.cursor(t,-1))}else{let t=r6(e,i.from,-1),r=r6(e,i.to,1);(t!=i.from||r!=i.to)&&(s=i.undirectional?q.undirectionalRange(i.from,i.to):q.range(i.from==i.anchor?t:r,i.from==i.head?t:r))}s&&(r||(r=t.ranges.slice()),r[n]=s)}return r?q.create(r,t.mainIndex):t}function r9(e,t,r){let n=r6(e.state.facet(rx).map(t=>t(e)),r.from,t.head>r.from?-1:1);return n==r.from?r:q.cursor(n,n<r.from?1:-1)}class r7{constructor(e,t){this.pos=e,this.assoc=t}}function ne(e,t,r,n){let i=e.contentDOM.getBoundingClientRect(),s=i.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-s,h;for(;;){if(l<0)return new r7(0,1);if(l>e.viewState.docHeight)return new r7(e.state.doc.length,-1);if(h=e.elementAtHeight(l),null==n)break;if(h.type==tg.Text){if(n<0?h.to<e.viewport.from:h.from>e.viewport.to)break;let t=e.docView.coordsAt(n<0?h.from:h.to,n>0?-1:1);if(t&&(n<0?t.top<=l+s:t.bottom>=l+s))break}let t=e.viewState.heightOracle.textHeight/2;l=n>0?h.bottom+t:h.top-t}if(e.viewport.from>=h.to||e.viewport.to<=h.from){if(r)return null;if(h.type==tg.Text){let t=function(e,t,r,n,i){let s=Math.round((n-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&r.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;s+=Math.floor((i-r.top-(e.defaultLineHeight-t)*.5)/t)*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(r.from,r.to);return r.from+eJ(o,s,e.state.tabSize)}(e,i,h,o,a);return new r7(t,t==h.from?1:-1)}}if(h.type!=tg.Text)return l<(h.top+h.bottom)/2?new r7(h.from,1):new r7(h.to,-1);let c=e.docView.lineAt(h.from,2);return c&&c.length==h.length||(c=e.docView.lineAt(h.from,-2)),new nt(e,o,a,e.textDirectionAt(h.from)).scanTile(c,h.from)}class nt{constructor(e,t,r,n){this.view=e,this.x=t,this.y=r,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[t1.find(n,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[t1.find(n,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:n}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+n.from<t)}scan(e,t,r=!1){let n,i,s=0,o=e.length-1,a=new Set,l=this.bidiIn(e[0],e[o]),h=-1,c=1e9,u;for(;s<o;){let r=o-s,d=s+o>>1;t:if(a.has(d)){let e=s+Math.floor(Math.random()*r);for(let t=0;t<r;t++){if(!a.has(e)){d=e;break t}++e==o&&(e=s)}break}a.add(d);let f=t(d);if(f)for(let t=0;t<f.length;t++){let r=f[t],a=0;if(0!=r.width||!(f.length>1)){if(r.bottom<this.y)(!n||n.bottom<r.bottom)&&(n=r),a=1;
76else if(r.top>this.y)(!i||i.top>r.top)&&(i=r),a=-1;else{let e=r.left>this.x?this.x-r.left:r.right<this.x?this.x-r.right:0,t=Math.abs(e);t<c&&(h=d,c=t,u=r),e&&(a=e<0==(this.baseDir==tV.LTR)?-1:1)}-1==a&&(!l||this.baseDirAt(e[d],1))?o=d:1==a&&(!l||this.baseDirAt(e[d+1],-1))&&(s=d+1)}}}if(!u){if(!i&&!n)return{i:e[0],after:!1};let r=n&&(!i||this.y-n.bottom<i.top-this.y)?n:i;return this.y=(r.top+r.bottom)/2,this.scan(e,t,!0)}if(c&&!r){let{top:r,bottom:s}=u;if(n&&n.bottom>(r+r+s)/3)return this.y=n.bottom-1,this.scan(e,t,!0);if(i&&i.top<(r+s+s)/3)return this.y=i.top+1,this.scan(e,t,!0)}let d=(l?this.dirAt(e[h],1):this.baseDir)==tV.LTR;return{i:h,after:this.x>(u.left+u.right)/2==d}}scanText(e,t){let r=[];for(let n=0;n<e.length;n=N(e.text,n))r.push(t+n);r.push(t+e.length);let n=this.scan(r,n=>{let i=r[n]-t,s=r[n+1]-t;return t$(e.dom,i,s).getClientRects()});return n.after?new r7(r[n.i+1],-1):new r7(r[n.i],1)}scanTile(e,t){if(!e.length)return new r7(t,1);if(1==e.children.length){let r=e.children[0];if(r.isText())return this.scanText(r,t);if(r.isComposite())return this.scanTile(r,t)}let r=[t];for(let n=0,i=t;n<e.children.length;n++)r.push(i+=e.children[n].length);let n=this.scan(r,t=>{let r=e.children[t];return 48&r.flags?null:(1==r.dom.nodeType?r.dom:t$(r.dom,0,r.length)).getClientRects()}),i=e.children[n.i],s=r[n.i];return i.isText()?this.scanText(i,s):i.isComposite()?this.scanTile(i,s):n.after?new r7(r[n.i+1],-1):new r7(s,1)}}class nr{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(eO.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+="ï¿¿"}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let n=e;;){this.findPointBefore(r,n);let e=this.text.length;this.readNode(n);let i=rR.get(n),s=n.nextSibling;if(s==t){(null==i?void 0:i.breakAfter)&&!s&&r!=this.view.contentDOM&&this.lineBreak();break}let o=rR.get(s);(i&&o?i.breakAfter:(i?i.breakAfter:tR(n))||tR(s)&&("BR"!=n.nodeName||(null==i?void 0:i.isWidget()))&&this.text.length>e)&&!function(e,t){let r;for(;e!=t&&e;e=e.nextSibling){let t=rR.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(r||(r=[])).push(t)}if(r)for(let e of r){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}(s,t)&&this.lineBreak(),n=s}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,s=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,r),s=this.lineSeparator.length):(o=n.exec(t))&&(i=o.index,s=o[0].length),this.append(t.slice(r,i<0?t.length:i)),i<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);r=i+s}}readNode(e){let t=rR.get(e),r=t&&t.overrideDOMText;if(null!=r){this.findPointInside(e,r.length);for(let e=r.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(3==e.nodeType?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(!function(e,t,r){for(;;){if(!t||r<tP(t))return!1;if(t==e)return!0;r=tM(t)+1,t=t.parentNode}}(e,r.node,r.offset)?0:t))}}class nn{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class ni{constructor(e,t,r,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:s}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=function e(t,r,n,i){if(t.isComposite()){let s=-1,o=-1,a=-1,l=-1;for(let h=0,c=i,u=i;h<t.children.length;h++){let i=t.children[h],d=c+i.length;if(c<r&&d>n)return e(i,r,n,c);if(d>=r&&-1==s&&(s=h,o=c),c>n&&i.dom.parentNode==t.dom){a=h,l=u;break}u=d,c=d+i.breakAfter}return{from:o,to:l<0?i+t.length:l,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:a<t.children.length&&a>=0?t.children[a].dom:null}}return t.isText()?{from:i,to:i+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}(e.docView.tile,t,r,0))){let t=i||s?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:s}=e.observer.selectionRange;return r&&(t.push(new nn(r,n)),(i!=r||s!=n)&&t.push(new nn(i,s))),t}(e),r=new nr(t,e);r.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=r.text,this.newSel=function(e,t){if(0==e.length)return null;let r=e[0].pos,n=2==e.length?e[1].pos:r;return r>-1&&n>-1?q.single(r+t,n+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,r=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!tA(e.contentDOM,t.focu
76sNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),n=s&&s.node==t.anchorNode&&s.offset==t.anchorOffset||!tA(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),a=e.viewport;if((tc.ios||tc.chrome)&&r!=n&&Math.min(r,n)<=o.main.from&&Math.max(r,n)>=o.main.to&&(a.from>0||a.to<e.state.doc.length)){let t=Math.min(r,n),i=Math.max(r,n),s=a.from-t,o=a.to-i;(0==s||1==s||0==t)&&(0==o||-1==o||i==e.state.doc.length)&&(r=0,n=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(q.range(n,r));else if(e.lineWrapping&&n==r&&!(o.main.empty&&o.main.head==r)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(r,-1),n=0;t&&(n=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=q.create([q.cursor(r,n)])}else this.newSel=q.single(n,r)}}}function ns(e,t){let r,{newSel:n}=t,{state:i}=e,s=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:n}=t.bounds,a=s.from,l=null;(8===o||tc.android&&t.text.length<n-e)&&(a=s.to,l="end");let h=i.doc.sliceString(e,n,"ï¿¿"),c,u;!s.empty&&s.from>=e&&s.to<=n&&(t.typeOver||h!=t.text)&&h.slice(0,s.from-e)==t.text.slice(0,s.from-e)&&h.slice(s.to-e)==t.text.slice(c=t.text.length-(h.length-(s.to-e)))?r={from:s.from,to:s.to,insert:k.of(t.text.slice(s.from-e,c).split("ï¿¿"))}:(u=na(h,t.text,a-e,l))&&(tc.chrome&&13==o&&u.toB==u.from+2&&"ï¿¿ï¿¿"==t.text.slice(u.from,u.toB)&&u.toB--,r={from:e+u.from,to:e+u.toA,insert:k.of(t.text.slice(u.from,u.toB).split("ï¿¿"))})}else n&&(!e.hasFocus&&i.facet(ru)||nl(n,s))&&(n=null);if(!r&&!n)return!1;if((tc.mac||tc.android)&&r&&r.from==r.to&&r.from==s.head-1&&/^\. ?$/.test(r.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(n&&2==r.insert.length&&(n=q.single(n.main.anchor-1,n.main.head-1)),r={from:r.from,to:r.to,insert:k.of([r.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&e.docView.lineHasWidget(s.to)&&e.inputState.insertingTextAt>Date.now()-50?r={from:s.from,to:s.to,insert:i.toText(e.inputState.insertingText)}:tc.chrome&&r&&r.from==r.to&&r.from==s.head&&"\n "==r.insert.toString()&&e.lineWrapping&&(n&&(n=q.single(n.main.anchor-1,n.main.head-1)),r={from:s.from,to:s.to,insert:k.of([" "])}),r)return no(e,r,n,o);if(!n||nl(n,s))return!1;{let t=!1,r="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),"select.pointer"==(r=e.inputState.lastSelectionOrigin)&&(n=r8(i.facet(rx).map(t=>t(e)),n))),e.dispatch({selection:n,scrollIntoView:t,userEvent:r}),!0}}function no(e,t,r,n=-1){let i;if(tc.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(tc.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&" "==e.state.sliceDoc(t.from,s.from))&&1==t.insert.length&&2==t.insert.lines&&tz(e.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&0==t.insert.length||8==n&&t.insert.length<t.to-t.from&&t.to>s.head)&&tz(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&0==t.insert.length&&tz(e.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>i||(i=function(e,t,r){let n,i=e.state,s=i.selection.main,o=-1;if(t.from==t.to&&t.from<s.from||t.from>s.to){let r=t.from<s.from?-1:1,n=r<0?s.from:s.to,a=r6(i.facet(rx).map(t=>t(e)),n,r);t.from==a&&(o=a)}if(o>-1)n={changes:t,selection:q.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!r||r.main.empty&&r.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let r=s.from<t.from?i.sliceDoc(s.from,t.from):"",o=s.to>t.to?i.sliceDoc(t.to,s.to):"";n=i.replaceSelection(e.state.toText(r+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),a=r&&r.main.to<=o.newLength?r.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let l=e.state.sliceDoc(t.from,t.to),h,c=r&&r0(e,r.main.head);if(c){let e=t.insert.length-(t.to-t.from);h={from:c.from,to:c.to-e}}else h=e.state.doc.lineAt(s.head);let u=s.to-t.to;n=i.changeByRange(r=>{if(r.from==s.from&&r.to==s.to)return{changes:o,range:a||r.map(o)};let n=r.to-u,c=n-l.length;if(e.state.sliceDoc(c,n)!=l||n>=h.from&&c<=h.to)return{range:r};let d=i.changes({from:c,to:n,insert:t.insert}),f=r.to-s.to;return{changes:d,range:a?q.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):r.map(d)}})}else n={changes:o,selection:a&&i.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:a,scrollIntoView:!0})}(e,t,r));return e.state.facet(re).some(r=>r(e,t.from,t.to,o,a))||e.dispatch(a()),!0}function na(e,t,r,n){let i=Math.min(e.length,t.length),s=0;for(;s<i&&e.charCodeAt(s)==t.charCodeAt(s);)s++;if(s==i&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if("end"==n){let e=Math.max(0,s-Math.min(o,a));r-=o+e-s}if(o<s&&e.length<t.length){let e=r<=s&&r>=o?s-r:0;s-=e,a=s+(a-o),o=s}else if(a<s){let e=r<=s&&r>=a?s-r:0;s-=e,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function nl(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class nh{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,tc.safari&&e.contentDOM.addEventListener("input",()=>null),tc.gecko&&function(e){nP.has(e)||(nP.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){!function(e,t){if(!t.bubbles)return!0;
76if(t.defaultPrevented)return!1;for(let r=t.target,n;r!=e.contentDOM;r=r.parentNode)if(!r||11==r.nodeType||(n=rR.get(r))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0}(this.view,e)||this.ignoreDuringComposition(e)||"keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let e of r.observers)e(this.view,t);for(let e of r.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function r(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,n=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(n)for(let e in n){let i=n[e];i&&r(e).handlers.push(nc(t.value,i))}if(i)for(let e in i){let n=i[e];n&&r(e).observers.push(nc(t.value,n))}}for(let e in ng)r(e).handlers.push(ng[e]);for(let e in ny)r(e).observers.push(ny[e]);return t}(e),r=this.handlers,n=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,s=r[e];s&&!s.handlers.length!=i&&(n.removeEventListener(e,this.handleEvent),s=null),s||n.addEventListener(e,this.handleEvent,{passive:i})}for(let e in r)"scroll"==e||t[e]||n.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&0>nf.indexOf(e.keyCode)&&(this.tabFocusMode=-1),tc.android&&tc.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(tc.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(nu.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||nd.indexOf(e.key)>-1&&e.ctrlKey)){var t;let r={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return r.shiftKey&&tc.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&(t=this.view.win).visualViewport&&t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85&&(r.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:r},setTimeout(()=>this.flushIOSKey(),250),!0}return 229!=e.keyCode&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!(!t||"Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,tz(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&!e.synthetic&&(this.composing>0||!!(tc.safari&&!tc.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function nc(e,t){return(r,n)=>{try{return t.call(e,n,r)}catch(e){rc(r.state,e)}}}let nu=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nd="dthko",nf=[16,17,18,20,91,92,224,225];function np(e){return .7*Math.max(0,e)+8}class nm{constructor(e,t,r,n){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=tI(e.contentDOM),this.atoms=e.state.facet(rx).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(eO.allowMultipleSelections)&&function(e,t){let r=e.state.facet(t4);return r.length?r[0](t):tc.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!!function(e,t){let{main:r}=e.state.selection;if(r.empty)return!1;let n=tC(e.root);
76if(!n||0==n.rangeCount)return!0;let i=n.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let r=i[e];if(r.left<=t.clientX&&r.right>=t.clientX&&r.top<=t.clientY&&r.bottom>=t.clientY)return!0}return!1}(e,t)&&1==nE(t)&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&10>(t=this.startEvent,Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))))return;this.select(this.lastEvent=e);let r=0,n=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=rA(this.view);e.clientX-l.left<=i+6?r=-np(i-e.clientX):e.clientX+l.right>=o-6&&(r=np(e.clientX-o)),e.clientY-l.top<=s+6?n=-np(s-e.clientY):e.clientY+l.bottom>=a-6&&(n=np(e.clientY-a)),this.setScrollSpeed(r,n)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,r=r8(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,!1===this.dragging))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}let ng=Object.create(null),ny=Object.create(null),nv=tc.ie&&tc.ie_version<15||tc.ios&&tc.webkit_version<604;function nb(e,t,r){for(let n of e.facet(t))r=n(r,e);return r}function nw(e,t){t=nb(e.state,rr,t);let{state:r}=e,n,i=1,s=r.toText(t),o=s.lines==r.selection.ranges.length;if(null!=nO&&r.selection.ranges.every(e=>e.empty)&&nO==s.toString()){let e=-1;n=r.changeByRange(n=>{let a=r.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=r.toText((o?s.line(i++).text:t)+r.lineBreak);return{changes:{from:a.from,insert:l},range:q.cursor(n.from+l.length)}})}else n=o?r.changeByRange(e=>{let t=s.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:q.cursor(e.from+t.length)}}):r.replaceSelection(s);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function nx(e,t,r,n){if(1==n)return q.cursor(t,r);{if(2==n)return function(e,t,r=1){let n=e.charCategorizer(t),i=e.doc.lineAt(t),s=t-i.from;if(0==i.length)return q.cursor(t);0==s?r=1:s==i.length&&(r=-1);let o=s,a=s;r<0?o=N(i.text,s,!1):a=N(i.text,s);let l=n(i.text.slice(o,a));for(;o>0;){let e=N(i.text,o,!1);if(n(i.text.slice(e,o))!=l)break;o=e}for(;a<i.length;){let e=N(i.text,a);if(n(i.text.slice(a,e))!=l)break;a=e}return q.undirectionalRange(o+i.from,a+i.from)}(e.state,t,r);let i=e.docView.lineAt(t,r),s=e.state.doc.lineAt(i?i.posAtEnd:t),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<e.state.doc.length&&a==s.to&&a++,q.undirectionalRange(o,a)}}ny.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},ny.wheel=ny.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},ng.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ny.touchstart=(e,t)=>{let r=e.inputState,n=t.targetTouches[0];r.lastTouchTime=Date.now(),n&&(r.lastTouchX=n.clientX,r.lastTouchY=n.clientY),r.setSelectionOrigin("select.pointer")},ny.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},ng.mousedown=(e,t)=>{var r,n;let i,s,o;if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let a=null;for(let r of e.state.facet(t8))if(a=r(e,t))break;if(a||0!=t.button||(r=e,n=t,i=r.posAndSideAtCoords({x:n.clientX,y:n.clientY},!1),s=nE(n),o=r.state.selection,a={update(e){e.docChanged&&(i.pos=e.changes.mapPos(i.pos),o=o.map(e.changes))},get(e,t,n){let a=r.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),l,h=nx(r,a.pos,a.assoc,s);if(i.pos!=a.pos&&!t){let e=nx(r,i.pos,i.assoc,s),t=Math.min(e.from,h.from),n=Math.max(e.to,h.to);h=t<h.from?q.range(t,n,h.assoc):q.range(n,t,h.assoc)}return t?o.replaceRange(o.main.extend(h.from,h.to,h.assoc)):n&&1==s&&o.ranges.length>1&&(l=function(e,t){for(let r=0;r<e.ranges.length;r++){let{from:n,to:i}=e.ranges[r];if(n<=t&&i>=t)return q.create(e.ranges.slice(0,r).concat(e.ranges.slice(r+1)),e.mainIndex==r?0:e.mainIndex-(e.mainIndex>r))}return null}(o,a.pos))?l:n?o.addRange(h):q.create([h])}}),a){let r=!e.hasFocus;e.inputState.startMouseSelection(new nm(e,t,a,r)),r&&e.observer.ignore(()=>{tB(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let n=e.inputState.mouseSelection;if(n)return n.start(t),!1===n.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};let nk=tc.ie&&tc.ie_version<=11,nS=null,nC=0,nA=0;function nE(e){if(!nk)return e.detail;let t=nS,r=nA;return nS=e,nA=Date.now(),nC=!t||r>Date.now()-400&&2>Math.abs(t.clientX-e.clientX)&&2>Math.abs(t.clientY-e.clientY)?(nC+1)%3:1}function nT(e,t,r,n){let i;if(!(r=nb(e.state,rr,r)))return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,a=n&&o&&((i=e.state.facet(t6)).length?i[0](t):tc.mac?!t.altKey:!t.ctrlKey)?{from:o.from,to:o.to}:null,l={from:s,insert:r},h=e.state.changes(a?[a,l]:l);e.focus(),e.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}ng.dragstart=(e,t)=>{let{selection:{main:r}}=e.state;if(t.target.draggable){let n=e.docView.tile.nearest(t.target);if(n&&n.isWidget()){let e=n.posAtStart,t=e+n.length;(e>=r.to||t<=r.from)&&(r=q.undirectionalRange(e,t))}}let{inputState:n}=e;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=r,t.dataTransfer&&(t.dataTransfer.setData("Text",nb(e.state,rn,e.state.sliceDoc(r.from,r.to))),t.dataTransfer.effectAllowed="copyMove"),!1},ng.dragend=e=>(e.inputState.draggedContent=null,!1),ng.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let r=t.dataTransfer.files;if(r&&r.length){let n=Array(r.length),i=0,s=()=>{++i==r.length&&nT(e,t,n.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<r.length;e++){let t=new FileReader;t.onerror=s,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(n[e]=t.result),s()},t.readAsText(r[e])}return!0}{let r=t.dataTransfer.getData("Text");if(r)return nT(e,t,r,!0),!0}return!1},ng.paste=(e,t)=>
vendor: 7,246 bytes, line 76
76{if(e.state.readOnly)return!0;e.observer.flush();let r=nv?null:t.clipboardData;return r?(nw(e,r.getData("text/plain")||r.getData("text/uri-list")),!0):(!function(e){let t=e.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{e.focus(),r.remove(),nw(e,r.value)},50)}(e),!1)};let nO=null;ng.copy=ng.cut=(e,t)=>{if(!tE(e.contentDOM,e.observer.selectionRange))return!1;let{text:r,ranges:n,linewise:i}=function(e){let t=[],r=[],n=!1;for(let n of e.selection.ranges)n.empty||(t.push(e.sliceDoc(n.from,n.to)),r.push(n));if(!t.length){let i=-1;for(let{from:n}of e.selection.ranges){let s=e.doc.lineAt(n);s.number>i&&(t.push(s.text),r.push({from:s.from,to:Math.min(e.doc.length,s.to+1)})),i=s.number}n=!0}return{text:nb(e,rn,t.join(e.lineBreak)),ranges:r,linewise:n}}(e.state);if(!r&&!i)return!1;nO=i?r:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=nv?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",r),!0):(!function(e,t){let r=e.dom.parentNode;if(!r)return;let n=r.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=t,n.focus(),n.selectionEnd=t.length,n.selectionStart=0,setTimeout(()=>{n.remove(),e.focus()},50)}(e,r),!1)};let nM=ey.define();function nR(e,t){let r=[];for(let n of e.facet(rt)){let i=n(e,t);i&&r.push(i)}return r.length?e.update({effects:r,annotations:nM.of(!0)}):null}function nN(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let r=nR(e.state,t);r?e.dispatch(r):e.update([])}},10)}ny.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),nN(e)},ny.blur=e=>{e.observer.clearSelectionRange(),nN(e)},ny.compositionstart=ny.compositionupdate=e=>{!e.observer.editContext&&(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},ny.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,tc.chrome&&tc.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ny.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},ng.beforeinput=(e,t)=>{var r,n;let i;if(("insertText"==t.inputType||"insertCompositionText"==t.inputType)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let n=null==(r=t.dataTransfer)?void 0:r.getData("text/plain"),i=t.getTargetRanges();if(n&&i.length){let t=i[0],r=e.posAtDOM(t.startContainer,t.startOffset),s=e.posAtDOM(t.endContainer,t.endOffset);return no(e,{from:r,to:s,insert:e.state.toText(n)},null),!0}}if(tc.chrome&&tc.android&&(i=nu.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null==(n=window.visualViewport)?void 0:n.height)||0;setTimeout(()=>{var r;((null==(r=window.visualViewport)?void 0:r.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return tc.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),tc.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>ny.compositionend(e,t),20),!1};let nP=new Set,n_=["pre-wrap","normal","pre-line","break-spaces"],nD=!1;class nI{constructor(e){this.lineWrapping=e,this.doc=k.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return n_.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let n=e[r];n<0?r++:this.heightSamples[Math.floor(10*n)]||(t=!0,this.heightSamples[Math.floor(10*n)]=!0)}return t}refresh(e,t,r,n,i,s){let o=n_.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=r,this.textHeight=n,this.lineLength=i,a){this.heightSamples={};for(let e=0;e<s.length;e++){let t=s[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class nj{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class nL{constructor(e,t,r,n,i){this.from=e,this.length=t,this.top=r,this.height=n,this._content=i}get type(){return"number"==typeof this._content?tg.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof tw?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new nL(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var nB=((l=nB||(nB={}))[l.ByPos=0]="ByPos",l[l.ByHeight=1]="ByHeight",l[l.ByPosNoHeight=2]="ByPosNoHeight",l);class n${constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=2*!!e|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>.001&&(nD=!0),this.height=e)}replace(e,t,r){return n$.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,n){let i=this,s=r.doc;for(let o=n.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:h,toB:c}=n[o],u=i.lineAt(a,nB.ByPosNoHeight,r.setDoc(t),0,0),d=u.to>=l?u:i.lineAt(l,nB.ByPosNoHeight,r,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a<u.from&&(u=i.lineAt(a,nB.ByPosNoHeight,r,0,0));h+=u.from-a,a=u.from;let f=nK.build(r.setDoc(s),e,h,c);i=nz(i,i.replace(a,l,f))}return i.updateHeight(r,0)}static empty(){return new nW(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,r=e.length,n=0,i=0;for(;;)if(t==r)if(n>2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),r+=1+i.break,n-=i.size}else if(i>2*n){let t=e[r];t.break?e.splice(r,1,t.left,null,t.right):e.splice(r,1,t.left,t.right),r+=2+t.break,i-=t.size}else break;else if(n<i){let r=e[t++];r&&(n+=r.size)}else{let t=e[--r];t&&(i+=t.size)}let s=0;return null==e[t-1]?(s=1,t--):null==e[t]&&(s=1,r++),new nV(n$.of(e.slice(0,t)),s,n$.of(e.slice(r)))}}function nz(e,t){return e==t?e:(e.constructor!=t.constructor&&(nD=!0),t)}n$.prototype.size=1;let nF=ty.replace({});
vendor: 2,628 bytes, line 76
76class nH extends n${constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new nL(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,n){return this.spaceAbove&&e<r+this.spaceAbove?new nL(n,0,r,this.spaceAbove,nF):this.mainBlock(r,n)}lineAt(e,t,r,n,i){let s=this.mainBlock(n,i);return this.spaceAbove?this.blockAt(0,r,n,i).join(s):s}forEachLine(e,t,r,n,i,s){e<=i+this.length&&t>=i&&s(this.lineAt(0,nB.ByPos,r,n,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more&&this.setMeasuredHeight(n),this.outdated=!1,this}toString(){return`block(${this.length})`}}class nW extends nH{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new nL(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let n=r[0];return 1==r.length&&(n instanceof nW||n instanceof nU&&4&n.flags)&&10>Math.abs(this.length-n.length)?(n instanceof nU?n=new nW(n.length,this.height,this.spaceAbove):n.height=this.height,this.outdated||(n.outdated=!1),n):n$.of(r)}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more?this.setMeasuredHeight(n):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class nU extends n${constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,i=n-r+1,s,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);s=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else s=this.height/i;return{firstLine:r,lastLine:n,perLine:s,perChar:o}}blockAt(e,t,r,n){let{firstLine:i,lastLine:s,perLine:o,perChar:a}=this.heightMetrics(t,n);if(t.lineWrapping){let i=n+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),s=t.doc.lineAt(i),l=o+s.length*a,h=Math.max(r,e-l/2);return new nL(s.from,s.length,h,l,0)}{let n=Math.max(0,Math.min(s-i,Math.floor((e-r)/o))),{from:a,length:l}=t.doc.line(i+n);return new nL(a,l,r+o*n,o,0)}}lineAt(e,t,r,n,i){if(t==nB.ByHeight)return this.blockAt(e,r,n,i);if(t==nB.ByPosNoHeight){let{from:t,to:n}=r.doc.lineAt(e);return new nL(t,n-t,0,0,0)}let{firstLine:s,perLine:o,perChar:a}=this.heightMetrics(r,i),l=r.doc.lineAt(e),h=o+l.length*a,c=l.number-s,u=n+o*c+a
vendor: 6,619 bytes, line 76
76*(l.from-i-c);return new nL(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,0)}forEachLine(e,t,r,n,i,s){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i);for(let h=e,c=n;h<=t;){let t=r.doc.lineAt(h);if(h==e){let r=t.number-o;c+=a*r+l*(e-i-r)}let n=a+l*t.length;s(new nL(t.from,t.length,c,n,0)),c+=n,h=t.to+1}}replace(e,t,r){let n=this.length-t;if(n>0){let e=r[r.length-1];e instanceof nU?r[r.length-1]=new nU(e.length+n):r.push(null,new nU(n-1))}if(e>0){let t=r[0];t instanceof nU?r[0]=new nU(e+t.length):r.unshift(new nU(e-1),null)}return n$.of(r)}decomposeLeft(e,t){t.push(new nU(e-1),null)}decomposeRight(e,t){t.push(null,new nU(this.length-e-1))}updateHeight(e,t=0,r=!1,n){let i=t+this.length;if(n&&n.from<=t+this.length&&n.more){let r=[],s=Math.max(t,n.from),o=-1;for(n.from>t&&r.push(new nU(n.from-t-1).updateHeight(e,t));s<=i&&n.more;){let t=e.doc.lineAt(s).length;r.length&&r.push(null);let i=n.heights[n.index++],a=0;i<0&&(a=-i,i=n.heights[n.index++]),-1==o?o=i:Math.abs(i-o)>=.001&&(o=-2);let l=new nW(t,i,a);l.outdated=!1,r.push(l),s+=t+1}s<=i&&r.push(null,new nU(i-s).updateHeight(e,s));let a=n$.of(r);return(o<0||Math.abs(a.height-this.height)>=.001||Math.abs(o-this.heightMetrics(e,t).perLine)>=.001)&&(nD=!0),nz(this,a)}return(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class nV extends n${constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return 1&this.flags}blockAt(e,t,r,n){let i=r+this.left.height;return e<i?this.left.blockAt(e,t,r,n):this.right.blockAt(e,t,i,n+this.left.length+this.break)}lineAt(e,t,r,n,i){let s=n+this.left.height,o=i+this.left.length+this.break,a=t==nB.ByHeight?e<s:e<o,l=a?this.left.lineAt(e,t,r,n,i):this.right.lineAt(e,t,r,s,o);if(this.break||(a?l.to<o:l.from>o))return l;let h=t==nB.ByPosNoHeight?nB.ByPosNoHeight:nB.ByPos;return a?l.join(this.right.lineAt(o,h,r,s,o)):this.left.lineAt(o,h,r,n,i).join(l)}forEachLine(e,t,r,n,i,s){let o=n+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,r,n,i,s),t>=a&&this.right.forEachLine(e,t,r,o,a,s);else{let l=this.lineAt(a,nB.ByPos,r,n,i);e<l.from&&this.left.forEachLine(e,l.from-1,r,n,i,s),l.to>=e&&l.from<=t&&s(l),t>l.to&&this.right.forEachLine(l.to+1,t,r,o,a,s)}}replace(e,t,r){let n=this.left.length+this.break;if(t<n)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,r));let i=[];e>0&&this.decomposeLeft(e,i);let s=i.length;for(let e of r)i.push(e);if(e>0&&nq(i,s-1),t<this.length){let e=i.length;this.decomposeRight(t,i),nq(i,e)}return n$.of(i)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&e>=++r&&t.push(null),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,n=r+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<n&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?n$.of(this.break?[e,null,t]:[e,t]):(this.left=nz(this.left,e),this.right=nz(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,n){let{left:i,right:s}=this,o=t+i.length+this.break,a=null;return(n&&n.from<=t+i.length&&n.more?a=i=i.updateHeight(e,t,r,n):i.updateHeight(e,t,r),n&&n.from<=o+s.length&&n.more?a=s=s.updateHeight(e,o,r,n):s.updateHeight(e,o,r),a)?this.balanced(i,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function nq(e,t){let r,n;null==e[t]&&(r=e[t-1])instanceof nU&&(n=e[t+1])instanceof nU&&e.splice(t-1,3,new nU(r.length+1+n.length))}class nK{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof nW?r.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new nW(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let n=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let s=t-e;r.block?this.addBlock(new nH(s,n,r)):(s||i||n>=5)&&this.addLineDeco(n,i,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new nW(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new nU(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof nW)return e;let t=new nW(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof nW||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new nW(0,-1,0));let r=e;for(let e of this.nodes)e instanceof nW&&e.updateHeight(this.oracle,r),r+=e?e.length:1;return this.nodes}static build(e,t,r,n){let i=new nK(r,e);return eI.spans(t,r,n,i,0),i.finish(r)}}class nJ{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,n){(e<t||r&&r.heightRelevant||n&&n.heightRelevant)&&tk(e,t,this.changes,5)}}class nG{constructor(e,t,r,n){this.from=e,this.to=t,this.size=r,this.displaySize=n}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];
76if(n.from!=i.from||n.to!=i.to||n.size!=i.size)return!1}return!0}draw(e,t){return ty.replace({widget:new nY(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class nY extends tm{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class nX{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=n1,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=tV.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=t.facet(ry).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new nI(r),this.stateDeco=n2(t),this.heightMap=n$.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle.setDoc(t.doc),[new rT(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ty.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let n=r?t.head:t.anchor;if(!e.some(({from:e,to:t})=>n>=e&&n<=t)){let{from:t,to:r}=this.lineBlockAt(n);e.push(new nQ(t,r))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?n1:new n3(this.heightOracle,this.heightMap,this.viewports),2*!e.eq(this.scaler)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(n5(e,this.scaler))})}update(e,t=null){var r,n;let i;this.state=e.state;let s=this.stateDeco;this.stateDeco=n2(this.state);let o=e.changedRanges,a=rT.extendWithRanges(o,(r=this.stateDeco,n=e?e.changes:B.empty(this.state.doc.length),i=new nJ,eI.compare(s,r,n,i,0),i.changes)),l=this.heightMap.height,h=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);nD=!1,this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=l||nD)&&(e.flags|=2),h?(this.scrollAnchorPos=e.changes.mapPos(h.from,-1),this.scrollAnchorHeight=h.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let c=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(u||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(rs)&&(this.mustEnforceCursorAssoc=!0)}measure(){var e;let t,r,{view:n}=this,i=n.contentDOM,s=window.getComputedStyle(i),o=this.heightOracle,a=s.whiteSpace;this.defaultTextDirection="rtl"==s.direction?tV.RTL:tV.LTR;let l=this.heightOracle.mustRefreshForWrapping(a)||"refresh"===this.mustMeasureContent,h=i.getBoundingClientRect(),c=l||this.mustMeasureContent||this.contentDOMHeight!=h.height;this.contentDOMHeight=h.height,this.mustMeasureContent=!1;let u=0,d=0;if(h.width&&h.height){let{scaleX:e,scaleY:t}=tD(i,h);(e>.005&&Math.abs(this.scaleX-e)>.005||t>.005&&Math.abs(this.scaleY-t)>.005)&&(this.scaleX=e,this.scaleY=t,u|=16,l=c=!0)}let f=(parseInt(s.paddingTop)||0)*this.scaleY,p=(parseInt(s.paddingBottom)||
760)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=p)&&(this.paddingTop=f,this.paddingBottom=p,u|=18),this.editorWidth!=n.scrollDOM.clientWidth&&(o.lineWrapping&&(c=!0),this.editorWidth=n.scrollDOM.clientWidth,u|=16);let m=tI(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=tF(this.scrollParent||n.win);let y=(this.printing?function(e,t){let r=e.getBoundingClientRect();return{left:0,right:r.right-r.left,top:t,bottom:r.bottom-(r.top+t)}}:function(e,t){let r=e.getBoundingClientRect(),n=e.ownerDocument,i=n.defaultView||window,s=Math.max(0,r.left),o=Math.min(i.innerWidth,r.right),a=Math.max(0,r.top),l=Math.min(i.innerHeight,r.bottom);for(let t=e.parentNode;t&&t!=n.body;)if(1==t.nodeType){let r=t,n=window.getComputedStyle(r);if((r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)&&"visible"!=n.overflow){let n=r.getBoundingClientRect();s=Math.max(s,n.left),o=Math.min(o,n.right),a=Math.max(a,n.top),l=Math.min(t==e.parentNode?i.innerHeight:l,n.bottom)}t="absolute"==n.position||"fixed"==n.position?r.offsetParent:r.parentNode}else if(11==t.nodeType)t=t.host;else break;return{left:s-r.left,right:Math.max(s,o)-r.left,top:a-(r.top+t),bottom:Math.max(a,l)-(r.top+t)}})(i,this.paddingTop),v=y.top-this.pixelViewport.top,b=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;
76if(w!=this.inView&&(this.inView=w,w&&(c=!0)),!this.inView&&!this.scrollTarget&&(t=(e=n.dom).getBoundingClientRect(),r=e.ownerDocument.defaultView||window,!(t.left<r.innerWidth)||!(t.right>0)||!(t.top<r.innerHeight)||!(t.bottom>0)))return 0;let x=h.width;if((this.contentDOMWidth!=x||this.editorHeight!=n.scrollDOM.clientHeight)&&(this.contentDOMWidth=h.width,this.editorHeight=n.scrollDOM.clientHeight,u|=16),c){let e=n.docView.measureVisibleLineHeights(this.viewport);if(o.mustRefreshForHeights(e)&&(l=!0),l||o.lineWrapping&&Math.abs(x-this.contentDOMWidth)>o.charWidth){let{lineHeight:t,charWidth:r,textHeight:i}=n.docView.measureTextSize();(l=t>0&&o.refresh(a,t,r,i,Math.max(5,x/r),e))&&(n.docView.minWidth=0,u|=16)}for(let t of(v>0&&b>0?d=Math.max(v,b):v<0&&b<0&&(d=Math.min(v,b)),nD=!1,this.viewports)){let r=t.from==this.viewport.from?e:n.docView.measureVisibleLineHeights(t);this.heightMap=(l?n$.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle,[new rT(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(o,0,l,new nj(t.from,r))}nD&&(u|=2)}let S=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return S&&(2&u&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(2&u||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,n)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,i=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,a=new nQ(n.lineAt(s-1e3*r,nB.ByHeight,i,0,0).from,n.lineAt(o+(1-r)*1e3,nB.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=n.lineAt(e,nB.ByPos,i,0,0),o;o="center"==t.y?(s.top+s.bottom)/2-r/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-r,a=new nQ(n.lineAt(o-500,nB.ByHeight,i,0,0).from,n.lineAt(o+r+500,nB.ByHeight,i,0,0).to)}}return a}mapViewport(e,t){let r=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new nQ(this.heightMap.lineAt(r,nB.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,nB.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(e,nB.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,nB.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:o}=this;return(0==e||n<=s-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(r,250)))&&n>s-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let n of e)t.touchesRange(n.from,n.to)||r.push(new nG(t.mapPos(n.from),t.mapPos(n.to),n.size,n.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,n=r?1e4:2e3,i=n>>1,s=n<<1;if(this.defaultTextDirection!=tV.LTR&&!r)return[];let o=[],a=(n,s,l,h)=>{if(s-n<i)return;let c=this.state.selection.main,u=[c.from];for(let e of(c.empty||u.push(c.to),u))if(e>n&&e<s){a(n,e-10,l,h),a(e+10,s,l,h);return}let d=function(e,t){for(let r of e)if(t(r))return r}(e,e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-n)<i&&Math.abs(e.to-s)<i&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(s<l.to&&t&&r&&t.visibleRanges.some(e=>e.from<=s&&e.to>=s)){let e=t.moveToLineBoundary(q.cursor(s),!1,!0).head;e>n&&(s=e)}let e=this.gapSize(l,n,s,h),i=r||e<2e6?e:2e6;d=new nG(n,s,e,i)}o.push(d)},l=t=>{var i,o,l;let h,c,u,d,f;if(t.length<s||t.type!=tg.Text)return;let p=(i=t.from,o=t.to,l=this.stateDeco,u=[],d=i,f=0,eI.spans(l,i,o,{span(){},point(e,t){e>d&&(u.push({from:d,to:e}),f+=e-d),d=t}},20),d<o&&(u.push({from:d,to:o}),f+=o-d),{total:f,ranges:u});if(p.total<s)return;let m=this.scrollTarget?this.scrollTarget.range.head:null;if(r){let e,r,i=n/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=m){let n=n0(p,m),s=((this.visibleBottom-this.visibleTop)/2+i)/t.height;e=n-s,r=n+s}else e=(this.visibleTop-t.top-i)/t.height,r=(this.visibleBottom-t.top+i)/t.height;h=nZ(p,e),c=nZ(p,r)}else{let r,i,s=p.total*this.heightOracle.charWidth,o=n*this.heightOracle.charWidth,a=0;if(s>2e6)for(let r of e)r.from>=t.from&&r.from<t.to&&r.size!=r.displaySize&&r.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=r.size-r.displaySize);let l=this.pixelViewport.left+a,u=this.pixelViewport.right+a;if(null!=m){let e=n0(p,m),t=((u-l)/2+o)/s;
vendor: 5,015 bytes, line 76
76r=e-t,i=e+t}else r=(l-o)/s,i=(u+o)/s;h=nZ(p,r),c=nZ(p,i)}h>t.from&&a(t.from,h,t,p),c<t.to&&a(c,t.to,t,p)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return o}gapSize(e,t,r,n){let i=n0(n,r)-n0(n,t);return this.heightOracle.lineWrapping?e.height*i:n.total*this.heightOracle.charWidth*i}updateLineGaps(e){nG.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ty.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];eI.spans(t,this.viewport.from,this.viewport.to,{span(e,t){r.push({from:e,to:t})},point(){}},20);let n=0;if(r.length!=this.visibleRanges.length)n=12;else for(let t=0;t<r.length&&!(8&n);t++){let i=this.visibleRanges[t],s=r[t];(i.from!=s.from||i.to!=s.to)&&(n|=4,e&&e.mapPos(i.from,-1)==s.from&&e.mapPos(i.to,1)==s.to||(n|=8))}return this.visibleRanges=r,n}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||n5(this.heightMap.lineAt(e,nB.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||n5(this.heightMap.lineAt(this.scaler.fromDOM(e),nB.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return n5(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class nQ{constructor(e,t){this.from=e,this.to=t}}function nZ({total:e,ranges:t},r){if(r<=0)return t[0].from;if(r>=1)return t[t.length-1].to;let n=Math.floor(e*r);for(let e=0;;e++){let{from:r,to:i}=t[e],s=i-r;if(n<=s)return r+n;n-=s}}function n0(e,t){let r=0;for(let{from:n,to:i}of e.ranges){if(t<=i){r+=t-n;break}r+=i-n}return r/e.total}let n1={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function n2(e){let t=e.facet(rv).filter(e=>"function"!=typeof e),r=e.facet(rw).filter(e=>"function"!=typeof e);return r.length&&t.push(eI.join(r)),t}class n3{constructor(e,t,r){let n=0,i=0,s=0;for(let o of(this.viewports=r.map(({from:r,to:i})=>{let s=t.lineAt(r,nB.ByPos,e,0,0).top,o=t.lineAt(i,nB.ByPos,e,0,0).bottom;return n+=o-s,{from:r,to:i,top:s,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n),this.viewports))o.domTop=s+(o.top-i)*this.scale,s=o.domBottom=o.domTop+(o.bottom-o.top),i=o.bottom}toDOM(e){for(let t=0,r=0,n=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return n+(e-r)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);r=i.bottom,n=i.domBottom}}fromDOM(e){for(let t=0,r=0,n=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return r+(e-n)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);r=i.bottom,n=i.domBottom}}eq(e){return e instanceof n3&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to)}}function n5(e,t){if(1==t.scale)return e;let r=t.toDOM(e.top),n=t.toDOM(e.bottom);return new nL(e.from,e.length,r,n-r,Array.isArray(e._content)?e._content.map(e=>n5(e,t)):e._content)}let n4=G.define({combine:e=>e.join(" ")}),n6=G.define({combine:e=>e.indexOf(!0)>-1}),n8=eQ.newName(),n9=eQ.newName(),n7=eQ.newName(),ie={"&light":"."+n9,"&dark":"."+n7};function it(e,t,r){return new eQ(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!r||!r[t])throw RangeError(`Unsupported selector: ${t}`);return r[t]}):e+" "+t})}let ir=it("."+n8,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}}
vendor: 5,030 bytes, line 76
76,"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ie),ii={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},is=tc.ie&&tc.ie_version<=11;class io{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new tj,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(tc.ie&&tc.ie_version<=11||tc.ios&&e.composing)&&t.some(e=>
76"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&tc.android&&!1!==e.constructor.EDIT_CONTEXT&&!(tc.chrome&&tc.chrome_version<126)&&(this.editContext=new ih(e),e.state.facet(ru)&&(e.contentDOM.editContext=this.editContext.editContext)),is&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null==(e=this.view.docView)?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){for(let t of(this.gapIntersection.disconnect(),e))this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(ru)?r.root.activeElement!=this.dom:!tE(this.dom,n))return;let i=n.anchorNode&&r.docView.tile.nearest(n.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(tc.ie&&tc.ie_version<=11||tc.android&&tc.chrome)&&!r.state.selection.main.empty&&n.focusNode&&tO(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=tC(e.root);if(!t)return!1;let r=tc.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return il(e,r)}let r=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),r?il(e,r):null}(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let n=tE(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let r=t.focusNode,n=t.focusOffset;if(!r||t.anchorNode!=r||t.anchorOffset!=n)return!1;for(n=Math.min(n,tP(r));;)if(n){if(1!=r.nodeType)return!1;let e=r.childNodes[n-1];"false"==e.contentEditable?n--:n=tP(r=e)}else{if(r==e)return!0;n=tM(r),r=r.parentNode}}(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(1==r.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(11==r.nodeType)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,ii),is&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),is&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&tz(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null==(r=this.delayedAndroidKey)?void 0:r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,r=-1,n=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(n=!0),-1==t?{from:t,to:r}=e:(t=Math.min(e.from,t),r=Math.max(e.to,r)))}return{from:t,to:r,typeOver:n}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),n=this.selectionChanged&&tE(this.dom,this.selectionRange);
vendor: 4,759 bytes, line 76
76if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new ni(this.view,e,t,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,n=ns(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!nl(this.view.state.selection,t.newSel.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let r=ia(t,e.previousSibling||e.target.previousSibling,-1),n=ia(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(ru)!=e.state.facet(ru)&&(e.view.contentDOM.editContext=e.state.facet(ru)?this.editContext.editContext:null))}destroy(){var e,t,r;for(let n of(this.stop(),null==(e=this.intersection)||e.disconnect(),null==(t=this.gapIntersection)||t.disconnect(),null==(r=this.resizeScroll)||r.disconnect(),this.scrollTargets))n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ia(e,t,r){for(;t;){let n=rR.get(t);if(n&&n.parent==e)return n;let i=t.parentNode;t=i!=e.dom?i:r>0?t.nextSibling:t.previousSibling}return null}function il(e,t){let r=t.startContainer,n=t.startOffset,i=t.endContainer,s=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return tO(o.node,o.offset,i,s)&&([r,n,i,s]=[i,s,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:s}}class ih{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});for(let r in this.handlers.textupdate=r=>{let n=e.state.selection.main,{anchor:i,head:s}=n,o=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let l=a-o>r.text.length;o==this.from&&i<this.from?o=i:a==this.to&&i>this.to&&(a=i);let h=na(e.state.sliceDoc(o,a),r.text,(l?n.from:n.to)-o,l?"end":null);if(!h){let t=q.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));nl(t,n)||e.dispatch({selection:t,userEvent:"select"});return}let c={from:h.from+o,to:h.toA+o,insert:k.of(r.text.slice(h.from,h.toB).split("\n"))};if((tc.mac||tc.android)&&c.from==s-1&&/^\. ?$/.test(r.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(c={from:o,to:a,insert:k.of([r.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let t=this.to-this.from+(c.to-c.from+c.insert.length);no(e,c,q.single(this.toEditorPos(r.selectionStart,t),this.toEditorPos(r.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)}
vendor: 4,394 bytes, line 76
76,this.handlers.characterboundsupdate=r=>{let n=[],i=null;for(let t=this.toEditorPos(r.rangeStart),s=this.toEditorPos(r.rangeEnd);t<s;t++){let r=e.coordsForChar(t);i=r&&new DOMRect(r.left,r.top,r.right-r.left,r.bottom-r.top)||i||new DOMRect,n.push(i)}t.updateCharacterBounds(r.rangeStart,n)},this.handlers.textformatupdate=t=>{let r=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,n=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(n)){let i=this.toEditorPos(e.rangeStart),s=this.toEditorPos(e.rangeEnd);if(i<s){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(n)?1:2}px`;r.push(ty.mark({attributes:{style:e}}).range(i,s))}}}e.dispatch({effects:rh.of(ty.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}},this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:e=>{let t=tC(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,n=this.pendingContextChange;return e.changes.iterChanges((i,s,o,a,l)=>{if(r)return;let h=l.length-(s-i);if(n&&s>=n.to)if(n.from==i&&n.to==s&&n.insert.eq(l)){n=this.pendingContextChange=null,t+=h,this.to+=h;return}else n=null,this.revertPending(e.state);if(i+=t,(s+=t)<=this.from)this.from+=h,this.to+=h;else if(i<this.to){if(i<this.from||s>this.to||this.to-this.from+l.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(s),l.toString()),this.to+=h}t+=h}),n&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(r,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ic{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="
76cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;for(let t of(this.dispatchTransactions=e.dispatchTransactions||r&&(e=>e.forEach(e=>r(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new nX(this,e.state||eO.create(e)),e.scrollTo&&e.scrollTo.is(rl)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(rf).map(e=>new rm(e)),this.plugins))t.update(this);this.observer=new io(this),this.inputState=new nh(this),this.inputState.ensureHandlers(this.plugins),this.docView=new rQ(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null==(t=document.fonts)?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof ex?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,n,i=this.state;for(let t of e){if(t.startState!=i)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed){this.viewState.state=i;return}let s=this.hasFocus,o=0,a=null;e.some(e=>e.annotation(nM))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,(a=nR(i,s))||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(this.observer.clearDelayedAndroidKey(),((h=this.observer.readChange())&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(h=null)):this.observer.clear(),i.facet(eO.phrases)!=this.state.facet(eO.phrases))return this.setState(i);n=rO.create(this,i,e),n.flags|=o;let c=this.viewState.scrollTarget;try{for(let t of(this.updateState=2,e)){if(c&&(c=c.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection,{x:r,y:n}=this.state.facet(ic.cursorScrollMargin);c=new ra(e.empty?e:q.cursor(e.head,e.head>e.anchor?-1:1),"nearest","nearest",n,r)}for(let e of t.effects)e.is(rl)&&(c=e.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=ip.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(rE)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(n4)!=n.state.facet(n4)&&(this.viewState.mustMeasureContent=!0),(t||r||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!n.empty)for(let e of this.state.facet(t7))try{e(n)}catch(e){rc(this.state,e,"update listener")}(a||h)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!ns(this,h)&&l.force&&tz(this.contentDOM,l.key,l.keyCode)})}setState(e){if(0!=this.updateState)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);for(let t of(this.viewState=new nX(this,e),this.plugins=e.facet(rf).map(e=>new rm(e)),this.pluginMap.clear(),this.plugins))t.update(this);this.docView.destroy(),this.docView=new rQ(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(rf),r=e.state.facet(rf);if(t!=r){let n=[];for(let i of r){let r=t.indexOf(i);if(r<0)n.push(new rm(i));else{let t=this.plugins[r];t.mustUpdate=e,n.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){rc(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.viewState.scrollParent,n=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:s}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(s<0)if(tF(r||this.win))i=-1,s=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(n);i=e.from,s=e.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return rc(this.state,e),id}}),h=rO.create(this,this.state,[]),c=!1;h.flags|=o,t?t.flags|=o:t=h,this.updateState=2,!h.empty&&(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),(c=this.docView.update(h))&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=id)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){rc(this.state,e)}if(c&&this.docView.updateSelection(!0),!h.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let e=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-s)/this.scaleY;if((e>1||e<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n+=e,r?r.scrollTop+=e:this.win.scrollBy(0,e),s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(t7))e(t)}get themeClasses(){return n8+" "+(this.state.facet(n6)?n7:n9)+" "+this.state.facet(n4)}updateAttrs(){let e=im(this,rg,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ru)?"true":"false",class:"cm-content",style:`${tc.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),im(this,ry,t);let r=this.observer.ignore(()=>{let r=tp(this.contentDOM,this.contentAttrs,t),n=tp(this.dom,this.editorAttrs,e);return r||n});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let e of r.effects)e.is(ic.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(rE);let e=this.state.facet(ic.cspNonce);eQ.mount(this.root,this.styleModules.concat(ir).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if((this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e)&&!(this.measureRequests.indexOf(e)>
76-1)){if(null!=e.key){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,r){return r9(this,e,r4(this,e,t,r))}moveByGroup(e,t){return r9(this,e,r4(this,e,t,t=>{var r;let n,i;return r=e.head,i=(n=this.state.charCategorizer(r))(t),e=>{let t=n(e);return i==eE.Space&&(i=t),i==t}}))}visualLineSide(e,t){let r=this.bidiSpans(e),n=this.textDirectionAt(e.from),i=r[t?r.length-1:0];return q.cursor(i.side(t,n)+e.from,i.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,r=!0){return function(e,t,r,n){let i=r5(e,t.head,t.assoc||-1),s=n&&i.type==tg.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(s){let t=e.dom.getBoundingClientRect(),n=e.textDirectionAt(i.from),o=e.posAtCoords({x:r==(n==tV.LTR)?t.right-1:t.left+1,y:(s.top+s.bottom)/2});if(null!=o)return q.cursor(o,r?-1:1)}return q.cursor(r?i.to:i.from,r?-1:1)}(this,e,t,r)}moveVertically(e,t,r){return r9(this,e,function(e,t,r,n){let i=t.head,s=r?1:-1;if(i==(r?e.state.doc.length:0))return q.cursor(i,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),h=e.coordsAtPos(i,t.assoc||((t.empty?r:t.head==t.from)?1:-1)),c=e.documentTop;if(h)null==o&&(o=h.left-l.left),a=s<0?h.top:h.bottom;else{let t=e.viewState.lineBlockAt(i);null==o&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),a=(s<0?t.top:t.bottom)+c}let u=l.left+o,d=e.viewState.heightOracle.textHeight>>1,f=null!=n?n:d;for(let t=0;;t+=d){let n=a+(f+t)*s,i=ne(e,{x:u,y:n},!1,s);if(r?n>l.bottom:n<l.top)return q.cursor(i.pos,i.assoc);let h=e.coordsAtPos(i.pos,i.assoc),c=h?(h.top+h.bottom)/2:0;if(!h||(r?c>a:c<a))return q.cursor(i.pos,i.assoc,void 0,o)}}(this,e,t,r))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let r=ne(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),ne(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(e),i=this.bidiSpans(n);return t_(r,i[t1.find(i,e-n.from,-1,t)].dir==tV.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ri)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>iu)return t3(e.length);let t=this.textDirectionAt(e.from),r;for(let n of this.bidiCache)if(n.from==e.from&&n.dir==t&&(n.fresh||function e(t,r){if(t.length!=r.length)return!1;for(let n=0;n<t.length;n++){let i=t[n],s=r[n];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!e(i.inner,s.inner))return!1}return!0}(n.isolates,r=rS(this,e))))return n.order;r||(r=rS(this,e));let n=function(e,t,r){if(!e)return[new t1(0,0,+(t==tK))];if(t==tq&&!r.length&&!t0.test(e))return t3(e.length);if(r.length)for(;e.length>t2.length;)t2[t2.length]=256;let n=[],i=+(t!=tq);return function e(t,r,n,i,s,o,a){let l=r%2?2:1;!function(e,t,r,n,i){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:t,a=s<n.length?n[s].from:r,l=s?256:i;for(let t=o,r=l,n=l;t<a;t++){let i=tZ(e.charCodeAt(t));512==i?i=r:8==i&&4==n&&(i=16),t2[t]=4==i?2:i,7&i&&(n=i),r=i}for(let e=o,t=l,n=l;e<a;e++){let i=t2[e];if(128==i)e<a-1&&t==t2[e+1]&&24&t?i=t2[e]=t:t2[e]=256;else if(64==i){let i=e+1;for(;i<a&&64==t2[i];)i++;let s=e&&8==t||i<r&&8==t2[i]?1==n?1:8:256;for(let t=e;t<i;t++)t2[t]=s;e=i-1}else 8==i&&1==n&&(t2[e]=1);t=i,7&i&&(n=i)}}}(t,s,o,i,l),function(e,t,r,n,i){let s=1==i?2:1;for(let o=0,a=0,l=0;o<=n.length;o++){let h=o?n[o-1].to:t,c=o<n.length?n[o].from:r;for(let t=h,r,n,o;t<c;t++)if(n=tX[r=e.charCodeAt(t)])if(n<0){for(let e=a-3;e>=0;e-=3)if(tQ[e+1]==-n){let r=tQ[e+2],n=2&r?i:4&r?1&r?s:i:0;
76n&&(t2[t]=t2[tQ[e]]=n),a=e;break}}else if(189==tQ.length)break;else tQ[a++]=t,tQ[a++]=r,tQ[a++]=l;else if(2==(o=t2[t])||1==o){let e=o==i;l=+!e;for(let t=a-3;t>=0;t-=3){let r=tQ[t+2];if(2&r)break;if(e)tQ[t+2]|=2;else{if(4&r)break;tQ[t+2]|=4}}}}}(t,s,o,i,l),function(e,t,r,n){for(let i=0,s=n;i<=r.length;i++){let o=i?r[i-1].to:e,a=i<r.length?r[i].from:t;for(let l=o;l<a;){let o=t2[l];if(256==o){let o=l+1;for(;;)if(o==a){if(i==r.length)break;o=r[i++].to,a=i<r.length?r[i].from:t}else if(256==t2[o])o++;else break;let h=1==s,c=h==((o<t?t2[o]:n)==1)?h?1:2:n;for(let t=o,n=i,s=n?r[n-1].to:e;t>l;)t==s&&(t=r[--n].from,s=n?r[n-1].to:e),t2[--t]=c;l=o}else s=o,l++}}}(s,o,i,l),function t(r,n,i,s,o,a,l){let h=s%2?2:1;if(s%2==o%2)for(let c=n,u=0;c<i;){let n=!0,d=!1;if(u==a.length||c<a[u].from){let e=t2[c];e!=h&&(n=!1,d=16==e)}let f=n||1!=h?null:[],p=n?s:s+1,m=c;r:for(;;)if(u<a.length&&m==a[u].from){if(d)break;let t=a[u];if(!n)for(let e=t.to,r=u+1;;){if(e==i)break r;if(r<a.length&&a[r].from==e)e=a[r++].to;else if(t2[e]==h)break r;else break}u++,f?f.push(t):(t.from>c&&l.push(new t1(c,t.from,p)),e(r,t.direction==tq!=!(p%2)?s+1:s,o,t.inner,t.from,t.to,l),c=t.to),m=t.to}else if(m==i||(n?t2[m]!=h:t2[m]==h))break;else m++;f?t(r,c,m,s+1,o,f,l):c<m&&l.push(new t1(c,m,p)),c=m}else for(let c=i,u=a.length;c>n;){let i=!0,d=!1;if(!u||c>a[u-1].to){let e=t2[c-1];e!=h&&(i=!1,d=16==e)}let f=i||1!=h?null:[],p=i?s:s+1,m=c;r:for(;;)if(u&&m==a[u-1].to){if(d)break;let t=a[--u];if(!i)for(let e=t.from,r=u;;){if(e==n)break r;if(r&&a[r-1].to==e)e=a[--r].from;else if(t2[e-1]==h)break r;else break}f?f.push(t):(t.to<c&&l.push(new t1(t.to,c,p)),e(r,t.direction==tq!=!(p%2)?s+1:s,o,t.inner,t.from,t.to,l),c=t.from),m=t.from}else if(m==n||(i?t2[m-1]!=h:t2[m-1]==h))break;else m--;f?t(r,m,c,s+1,o,f,l):m<c&&l.push(new t1(m,c,p)),c=m}}(t,s,o,r,n,i,a)}(e,i,i,r,0,e.length,n),n}(e.text,t,r);return this.bidiCache.push(new ip(e.from,e.to,t,r,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||tc.safari&&(null==(e=this.inputState)?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{tB(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of(this.root.activeElement==this.contentDOM&&this.contentDOM.blur(),this.plugins))e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var r,n,i,s;return rl.of(new ra("number"==typeof e?q.cursor(e):e,null!=(r=t.y)?r:"nearest",null!=(n=t.x)?n:"nearest",null!=(i=t.yMargin)?i:5,null!=(s=t.xMargin)?s:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return rl.of(new ra(q.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return rp.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return rp.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=eQ.newName(),n=[n4.of(r),rE.of(it(`.${r}`,e))];return t&&t.dark&&n.push(n6.of(!0)),n}static baseTheme(e){return en.lowest(rE.of(it("."+n8,e,ie)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),n=r&&rR.get(r)||rR.get(e);return(null==(t=null==n?void 0:n.root)?void 0:t.view)||null}}ic.styleModule=rE,ic.inputHandler=re,ic.clipboardInputFilter=rr,ic.clipboardOutputFilter=rn,ic.scrollHandler=ro,ic.focusChangeEffect=rt,ic.perLineTextDirection=ri,ic.exceptionSink=t9,ic.updateListener=t7,ic.editable=ru,ic.mouseSelectionStyle=t8,ic.dragMovesSelection=t6,ic.clickAddsSelectionRange=t4,ic.decorations=rv,ic.blockWrappers=rb,ic.outerDecorations=rw,ic.atomicRanges=rx,ic.bidiIsolatedRanges=rk,ic.cursorScrollMargin=G.define({combine:e=>{let t=5,r=5;for(let n of e)"number"==typeof n?t=r=n:{x:t,y:r}=n;return{x:t,y:r}}}),ic.scrollMargins=rC,ic.darkTheme=n6,ic.cspNonce=G.define({combine:e=>e.length?e[0]:""}),ic.contentAttributes=ry,ic.editorAttributes=rg,ic.lineWrapping=ic.contentAttributes.of({class:"cm-lineWrapping"}),ic.announce=ew.define();let iu=4096,id={};class ip{constructor(e,t,r,n,i,s){this.from=e,this.to=t,this.dir=r,this.isolates=n,this.fresh=i,this.order=s}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let r=[],n=e.length?e[e.length-1].dir:tV.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let s=e[i];s.dir!=n||t.touchesRange(s.from,s.to)||r.push(new ip(t.mapPos(s.from,1),t.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return r}}function im(e,t,r){for(let n=e.state.facet(t),i=n.length-1;i>=0;i--){let t=n[i],s="function"==typeof t?t(e):t;s&&tu(s,r)}return r}let ig=tc.mac?"mac":tc.windows?"win":tc.linux?"linux":"key";
76function iy(e,t,r){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==r&&t.shiftKey&&(e="Shift-"+e),e}let iv=en.default(ic.domEventHandlers({keydown:(e,t)=>iA(ix(t.state),e,t,"editor")})),ib=G.define({enables:iv}),iw=new WeakMap;function ix(e){let t=e.facet(ib),r=iw.get(t);return r||iw.set(t,r=function(e,t=ig){let r=Object.create(null),n=Object.create(null),i=(e,t)=>{let r=n[e];if(null==r)n[e]=t;else if(r!=t)throw Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},s=(e,n,s,o,a)=>{var l,h;let c=r[e]||(r[e]=Object.create(null)),u=n.split(/ (?!$)/).map(e=>(function(e,t){let r,n,i,s,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"==a&&(a=" ");for(let e=0;e<o.length-1;++e){let a=o[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))"mac"==t?s=!0:n=!0;else throw Error("Unrecognized modifier name: "+a)}return r&&(a="Alt-"+a),n&&(a="Ctrl-"+a),s&&(a="Meta-"+a),i&&(a="Shift-"+a),a})(e,t));for(let t=1;t<u.length;t++){let r=u.slice(0,t).join(" ");i(r,!0),c[r]||(c[r]={preventDefault:!0,stopPropagation:!1,run:[t=>{let n=iS={view:t,prefix:r,scope:e};return setTimeout(()=>{iS==n&&(iS=null)},4e3),!0}]})}let d=u.join(" ");i(d,!1);let f=c[d]||(c[d]={preventDefault:!1,stopPropagation:!1,run:(null==(h=null==(l=c._any)?void 0:l.run)?void 0:h.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let n of e){let e=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let t of e){let e=r[t]||(r[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=n;for(let t in e)e[t].run.push(e=>i(e,iC))}let i=n[t]||n.key;if(i)for(let t of e)s(t,i,n.run,n.preventDefault,n.stopPropagation),n.shift&&s(t,"Shift-"+i,n.shift,n.preventDefault,n.stopPropagation)}return r}(t.reduce((e,t)=>e.concat(t),[]))),r}function ik(e,t,r){return iA(ix(e.state),t,e,r)}let iS=null,iC=null;function iA(e,t,r,n){iC=t;let i=e8(t),s=D(P(i,0))==i.length&&" "!=i,o="",a=!1,l=!1,h=!1;iS&&iS.view==r&&iS.scope==n&&(o=iS.prefix+" ",0>nf.indexOf(t.keyCode)&&(l=!0,iS=null));let c=new Set,u=e=>{if(e){for(let t of e.run)if(!c.has(t)&&(c.add(t),t(r)))return e.stopPropagation&&(h=!0),!0;e.preventDefault&&(e.stopPropagation&&(h=!0),l=!0)}return!1},d=e[n],f,p;return d&&(u(d[o+iy(i,t,!s)])?a=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(tc.windows&&t.ctrlKey&&t.altKey)&&!(tc.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(f=e1[t.keyCode])&&f!=i?u(d[o+iy(f,t,!0)])?a=!0:t.shiftKey&&(p=e2[t.keyCode])!=i&&p!=f&&u(d[o+iy(p,t,!1)])&&(a=!0):s&&t.shiftKey&&u(d[o+iy(i,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),l&&(a=!0),a&&h&&t.stopPropagation(),iC=null,a}class iE{constructor(e,t,r,n,i){this.className=e,this.left=t,this.top=r,this.width=n,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,r){if(!r.empty)return function(e,t,r){if(r.to<=e.viewport.from||r.from>=e.viewport.to)return[];let n=Math.max(r.from,e.viewport.from),i=Math.min(r.to,e.viewport.to),s=e.textDirection==tV.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=iT(e),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=r5(e,n,1),p=r5(e,i,-1),m=f.type==tg.Text?f:null,g=p.type==tg.Text?p:null;if(m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=iO(e,n,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=iO(e,i,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return v(b(r.from,r.to,m));{let t=m?b(r.from,null,m):w(f,!1),n=g?b(null,r.to,g):w(p,!0),i=[];return(m||f).to<(g||p).from-(m&&g?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<n.top?i.push(y(u,t.bottom,d,n.top)):t.bottom<n.top&&e.elementAtHeight((t.bottom+n.top)/2).type==tg.Text&&(t.bottom=n.top=(t.bottom+n.top)/2),v(t).concat(i).c
vendor: 4,458 bytes, line 76
76oncat(v(n))}function y(e,r,n,i){return new iE(t,e-l.left,r-l.top,Math.max(0,n-e),i-r)}function v({top:e,bottom:t,horizontal:r}){let n=[];for(let i=0;i<r.length;i+=2)n.push(y(r[i],e,r[i+1],t));return n}function b(t,r,n){let i=1e9,o=-1e9,a=[];function l(t,r,l,h,c){let f=e.coordsAtPos(t,t==n.to?-2:2),p=e.coordsAtPos(l,l==n.from?2:-2);f&&p&&(i=Math.min(f.top,p.top,i),o=Math.max(f.bottom,p.bottom,o),c==tV.LTR?a.push(s&&r?u:f.left,s&&h?d:p.right):a.push(!s&&h?u:p.left,!s&&r?d:f.right))}let h=null!=t?t:n.from,c=null!=r?r:n.to;for(let n of e.visibleRanges)if(n.to>h&&n.from<c)for(let i=Math.max(n.from,h),s=Math.min(n.to,c);;){let n=e.state.doc.lineAt(i);for(let o of e.bidiSpans(n)){let e=o.from+n.from,a=o.to+n.from;if(e>=s)break;a>i&&l(Math.max(e,i),null==t&&e<=h,Math.min(a,s),null==r&&a>=c,o.dir)}if((i=n.to+1)>=s)break}return 0==a.length&&l(h,null==t,c,null==r,e.textDirection),{top:i,bottom:o,horizontal:a}}function w(e,t){let r=a.top+(t?e.top:e.bottom);return{top:r,bottom:r,horizontal:[]}}}(e,t,r);{let n=e.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let i=iT(e);return[new iE(t,n.left-i.left,n.top-i.top,null,n.bottom-n.top)]}}}function iT(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==tV.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function iO(e,t,r,n){let i=e.coordsAtPos(t,2*r);if(!i)return n;let s=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=e.posAtCoords({x:s.left+1,y:o}),l=e.posAtCoords({x:s.right-1,y:o});return null==a||null==l?n:{from:Math.max(n.from,Math.min(a,l)),to:Math.min(n.to,Math.max(a,l))}}class iM{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(iR)!=e.state.facet(iR)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,r=e.facet(iR);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{var r;return r=this.drawn[t],!(e.constructor==r.constructor&&e.eq(r))})){let t=this.dom.firstChild,r=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[r].constructor&&n.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(n.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,tc.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}let iR=G.define();function iN(e){return[rp.define(t=>new iM(t,e)),iR.of(e)]}let iP=G.define({combine:e=>eM(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function i_(e={}){return[iP.of(e),iI,iL,iB,rs.of(!0)]}function iD(e){return e.startState.facet(iP)!=e.state.facet(iP)}let iI=iN({above:!0,markers(e){let{state:t}=e,r=t.facet(iP),n=[];for(let i of t.selection.ranges){let s=i==t.selection.main;if(i.empty||r.drawRangeCursor&&!(s&&tc.ios&&r.iosSelectionHandles)){let t=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",r=i.empty?i:q.cursor(i.head,i.assoc);for(let i of iE.forRange(e,t,r))n.push(i)}}return n},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let r=iD(e);return r&&ij(e.state,t),e.docChanged||e.selectionSet||r},mount(e,t){ij(t.state,e)},class:"cm-cursorLayer"});function ij(e,t){t.style.animationDuration=e.facet(iP).cursorBlinkRate+"ms"}let iL=iN({above:!1,markers(e){let t=[],{main:r,ranges:n}=e.state.selection;for(let r of n)if(!r.empty)for(let n of iE.forRange(e,"cm-selectionBackgroun
76d",r))t.push(n);if(tc.ios&&!r.empty&&e.state.facet(iP).iosSelectionHandles){for(let n of iE.forRange(e,"cm-selectionHandle cm-selectionHandle-start",q.cursor(r.from,1)))t.push(n);for(let n of iE.forRange(e,"cm-selectionHandle cm-selectionHandle-end",q.cursor(r.to,1)))t.push(n)}return t},update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||iD(e),class:"cm-selectionLayer"}),iB=en.highest(ic.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),i$=ew.define({map:(e,t)=>null==e?null:t.mapPos(e)}),iz=et.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(i$)?t.value:e,e))}),iF=rp.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let r=e.state.field(iz);null==r?null!=this.cursor&&(null==(t=this.cursor)||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(iz)!=r||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(iz),r=null!=t&&e.coordsAtPos(t);if(!r)return null;let n=e.scrollDOM.getBoundingClientRect();return{left:r.left-n.left+e.scrollDOM.scrollLeft*e.scaleX,top:r.top-n.top+e.scrollDOM.scrollTop*e.scaleY,height:r.bottom-r.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:r}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/r+"px",this.cursor.style.height=e.height/r+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(iz)!=e&&this.view.dispatch({effects:i$.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function iH(){return[iz,iF]}function iW(e,t,r,n,i){t.lastIndex=0;for(let s=e.iterRange(r,n),o=r,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=t.exec(s.value);)i(o+a.index,a)}class iU{constructor(e){const{regexp:t,decoration:r,decorate:n,boundary:i,maxLength:s=1e3}=e;if(!t.global)throw RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,n)this.addMatch=(e,t,r,i)=>n(i,r,r+e[0].length,e,t);else if("function"==typeof r)this.addMatch=(e,t,n,i)=>{let s=r(e,t,n);s&&i(n,n+e[0].length,s)};else if(r)this.addMatch=(e,t,n,i)=>i(n,n+e[0].length,r);else throw RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=s}createDeco(e){let t=new ej,r=t.add.bind(t);for(let{from:t,to:n}of function(e,t){let r=e.visibleRanges;if(1==r.length&&r[0].from==e.viewport.from&&r[0].to==e.viewport.to)return r;let n=[];for(let{from:i,to:s}of r)i=Math.max(e.state.doc.lineAt(i).from,i-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),n.length&&n[n.length-1].to>=i?n[n.length-1].to=s:n.push({from:i,to:s});return n}(e,this.maxLength))iW(e.state.doc,this.regexp,t,n,(t,n)=>this.addMatch(n,e,t,r));return t.finish()}updateDeco(e,t){let r=1e9,n=-1;return(e.docChanged&&e.changes.iterChanges((t,i,s,o)=>{o>=e.view.viewport.from&&s<=e.view.viewport.to&&(r=Math.min(s,r),n=Math.max(o,n))}),e.viewportMoved||n-r>1e3)?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),r,n):t}updateRange(e,t,r,n){for(let i of e.visibleRanges){let s=Math.max(i.from,r),o=Math.min(i.to,n);if(o>=s){let r=e.state.doc.lineAt(s),n=r.to<o?e.state.doc.lineAt(o):r,a=Math.max(i.from,r.from),l=Math.min(i.to,n.to);if(this.boundary){for(;s>r.from;s--)if(this.boundary.test(r.text[s-1-r.from])){a=s;break}for(;o<n.to;o++)if(this.boundary.test(n.text[o-n.from])){l=o;break}}let h=[],c,u=(e,t,r)=>h.push(r.range(e,t));if(r==n)for(this.regexp.lastIndex=a-r.from;(c=this.regexp.exec(r.text))&&c.index<l-r.from;)this.addMatch(c,e,c.index+r.from,u);else iW(e.state.doc,this.regexp,a,l,(t,r)=>this.addMatch(r,e,t,u));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:h})}}return t}}let iV=null!=/x/.unicode?"gu":"g",iq=RegExp("[\0-\b\n-\x1f�-Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]",iV),iK={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},iJ=null,iG=G.define({combine(e){let t=eM(e,{render:null,specialChars:iq,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==iJ&&"u">typeof document&&document.body){let t=document.body.style;iJ=(null!=(e=t.tabSize)?e:t.MozTabSize)!=null}return iJ||!1}())&&(t.specialChars=RegExp("	|"+t.specialChars.source,iV)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,iV)),t}});function iY(e={}){return[iG.of(e),iX||(iX=rp.fromClass(class{constructor(e){this.view=e,this.decorations=ty.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(iG)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new iU({regexp:e.specialChars,decoration:(t,r,n)=>{let{doc:i}=r.state,s=P(t[0],0);if(9==s){let e=i.lineAt(n),t=r.state.tabSize,s=eK(e.text,t,n-e.from);return ty.replace({widget:new iZ((t-s%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ty.replace({widget:new iQ(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(iG);e.startState.facet(iG)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let iX=null;class iQ extends tm{constructor(e,t){super(),this.options=e,this.co
76de=t}eq(e){return e.code==this.code}toDOM(e){var t;let r=(t=this.code)>=32?"•":10==t?"␤":String.fromCharCode(9216+t),n=e.state.phrase("Control character")+" "+(iK[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,r);if(i)return i;let s=document.createElement("span");return s.textContent=r,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class iZ extends tm{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="	",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function i0(){return i2}let i1=ty.line({class:"cm-activeLine"}),i2=rp.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,r=[];for(let n of e.state.selection.ranges){let i=e.lineBlockAt(n.head);i.from>t&&(r.push(i1.range(i.from)),t=i.from)}return ty.set(r)}},{decorations:e=>e.decorations});class i3 extends tm{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?tT(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),n=t_(t[0],"rtl"!=r.direction),i=parseInt(r.lineHeight);return n.bottom-n.top>1.5*i?{left:n.left,right:n.right,top:n.top,bottom:n.top+i}:n}ignoreEvent(){return!1}}function i5(e){let t=rp.fromClass(class{constructor(t){this.view=t,this.placeholder=e?ty.set([ty.widget({widget:new i3(e),side:1}).range(0)]):ty.none}get decorations(){return this.view.state.doc.length?ty.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,ic.contentAttributes.of({"aria-placeholder":e})]:t}function i4(e,t){var r;let n,i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),s=e.state.doc.lineAt(i),o=i-s.from,a=o>2e3?-1:o==s.length?(r=t.clientX,(n=e.coordsAtPos(e.viewport.from))?Math.round(Math.abs((n.left-r)/e.defaultCharacterWidth)):-1):eK(s.text,e.state.tabSize,i-s.from);return{line:s.number,col:a,off:o}}function i6(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return ic.mouseSelectionStyle.of((e,r)=>{let n,i;return t(r)?(n=i4(e,r),i=e.state.selection,{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),r=e.state.doc.lineAt(t);n={line:r.number,col:n.col,off:Math.min(n.off,r.length)},i=i.map(e.changes)}},get(t,r,s){let o=i4(e,t),a=function(e,t,r){let n=Math.min(t.line,r.line),i=Math.max(t.line,r.line),s=[];if(t.off>2e3||r.off>2e3||t.col<0||r.col<0){let o=Math.min(t.off,r.off),a=Math.max(t.off,r.off);for(let t=n;t<=i;t++){let r=e.doc.line(t);r.length<=a&&s.push(q.range(r.from+o,r.to+a))}}else{let o=Math.min(t.col,r.col),a=Math.max(t.col,r.col);for(let t=n;t<=i;t++){let r=e.doc.line(t),n=eJ(r.text,o,e.tabSize,!0);if(n<0)s.push(q.cursor(r.to));else{let t=eJ(r.text,a,e.tabSize);s.push(q.range(r.from+n,r.from+t))}}}return s}(e.state,n,o);return a.length?s?q.create(a.concat(i.ranges)):q.create(a):i}}):null})}let i8={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},i9={style:"cursor: crosshair"};function i7(e={}){let[t,r]=i8[e.key||"Alt"],n=rp.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||r(e))},keyup(e){e.keyCode!=t&&r(e)||this.set(!1)},mousemove(e){this.set(r(e))}}});return[n,ic.contentAttributes.of(e=>{var t;return(null==(t=e.plugin(n))?void 0:t.isDown)?i9:null})]}let se="-10000px";class st{constructor(e,t,r,n){this.facet=t,this.createTooltipView=r,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=r(e,i))}update(e,t){var r;let n=e.state.facet(this.facet),i=n.filter(e=>e);if(n===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let s=[],o=t?[]:null;for(let r=0;r<i.length;r++){let n=i[r],a=-1;if(n){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==n.create&&(a=e)}if(a<0)s[r]=this.createTooltipView(n,r?s[r-1]:null),o&&(o[r]=!!n.above);else{let n=s[r]=this.tooltipViews[a];o&&(o[r]=t[a]),n.update&&n.update(e)}}}for(let e of this.tooltipViews)0>s.indexOf(e)&&(this.removeTooltipView(e),null==(r=e.destroy)||r.call(e));
76return t&&(o.forEach((e,r)=>t[r]=e),t.length=o.length),this.input=n,this.tooltips=i,this.tooltipViews=s,!0}}function sr(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}let sn=G.define({combine:e=>{var t,r,n;return{position:tc.ios?"absolute":(null==(t=e.find(e=>e.position))?void 0:t.position)||"fixed",parent:(null==(r=e.find(e=>e.parent))?void 0:r.parent)||null,tooltipSpace:(null==(n=e.find(e=>e.tooltipSpace))?void 0:n.tooltipSpace)||sr}}}),si=new WeakMap,ss=rp.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(sn);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new st(e,sh,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver)for(let e of(this.intersectionObserver.disconnect(),this.manager.tooltipViews))this.intersectionObserver.observe(e.dom)}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let r=t||e.geometryChanged,n=e.state.facet(sn);if(n.position!=this.position&&!this.madeAbsolute){for(let e of(this.position=n.position,this.manager.tooltipViews))e.dom.style.position=this.position;r=!0}if(n.parent!=this.parent){for(let e of(this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer(),this.manager.tooltipViews))this.container.appendChild(e.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(e,t){let r=e.create(this.view),n=t?t.dom:null;if(r.dom.classList.add("cm-tooltip"),e.arrow&&!r.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",r.dom.appendChild(e)}return r.dom.style.position=this.position,r.dom.style.top=se,r.dom.style.left="0px",this.container.insertBefore(r.dom,n),r.mount&&r.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(r.dom),r}destroy(){var e,t,r;for(let t of(this.view.win.removeEventListener("resize",this.measureSoon),this.manager.tooltipViews))t.dom.remove(),null==(e=t.destroy)||e.call(t);this.parent&&this.container.remove(),null==(t=this.resizeObserver)||t.disconnect(),null==(r=this.intersectionObserver)||r.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,r=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(tc.safari){let t=e.getBoundingClientRect();r=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else r=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(r||"absolute"==this.position)if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(e=r.width/this.parent.offsetWidth,t=r.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),i=rA(this.view);return{visible:{left:n.left+i.left,top:n.top+i.top,right:n.right-i.right,bottom:n.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let r=this.manager.tooltipViews[t];return r.getCoords?r.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(sn).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:r}}writeMeasure(e){var t;if(e.makeAbsolute)for(let e of(this.madeAbsolute=!0,this.position="absolute",this.manager.tooltipViews))e.dom.style.position="absolute";
vendor: 6,314 bytes, line 76
76let{visible:r,space:n,scaleX:i,scaleY:s}=e,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],h=this.manager.tooltipViews[a],{dom:c}=h,u=e.pos[a],d=e.size[a];if(!u||!1!==l.clip&&(u.bottom<=Math.max(r.top,n.top)||u.top>=Math.min(r.bottom,n.bottom)||u.right<Math.max(r.left,n.left)-.1||u.left>Math.min(r.right,n.right)+.1)){c.style.top=se;continue}let f=l.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=7*!!f,m=d.right-d.left,g=null!=(t=si.get(h))?t:d.bottom-d.top,y=h.offset||sl,v=this.view.textDirection==tV.LTR,b=d.width>n.right-n.left?v?n.left:n.right-d.width:v?Math.max(n.left,Math.min(u.left-14*!!f+y.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+14*!!f-y.x),n.right-m),w=this.above[a];!l.strictSide&&(w?u.top-g-p-y.y<n.top:u.bottom+g+p+y.y>n.bottom)&&w==n.bottom-u.bottom>u.top-n.top&&(w=this.above[a]=!w);let x=(w?u.top-n.top:n.bottom-u.bottom)-p;if(x<g&&!1!==h.resize){if(x<this.view.defaultLineHeight){c.style.top=se;continue}si.set(h,g),c.style.height=(g=x)/s+"px"}else c.style.height&&(c.style.height="");let k=w?u.top-g-p-y.y:u.bottom+p+y.y,S=b+m;if(!0!==h.overlap)for(let e of o)e.left<S&&e.right>b&&e.top<k+g&&e.bottom>k&&(k=w?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(c.style.top=(k-e.parent.top)/s+"px",so(c,(b-e.parent.left)/i)):(c.style.top=k/s+"px",so(c,b/i)),f){let e=u.left+(v?y.x:-y.x)-(b+14-7);f.style.left=e/i+"px"}!0!==h.overlap&&o.push({left:b,top:k,right:S,bottom:k+g}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),h.positioned&&h.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView)&&(this.inView=this.view.inView,!this.inView))for(let e of this.manager.tooltipViews)e.dom.style.top=se}},{eventObservers:{scroll(){this.maybeMeasure()}}});function so(e,t){let r=parseInt(e.style.left,10);(isNaN(r)||Math.abs(t-r)>1)&&(e.style.left=t+"px")}let sa=ic.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),sl={x:0,y:0},sh=G.define({enables:[ss,sa]}),sc=G.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class su{static create(e){return new su(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new st(e,sc,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null==(e=t.destroy)||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let n=r[e];if(void 0!==n){if(void 0===t)t=n;else if(t!==n)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}let sd=sh.compute([sc],e=>{let t=e.facet(sc);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!=(t=e.end)?t:e.pos})),create:su.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),sf=G.define();class sp{constructor(e,t,r,n,i,s){this.view=e,this.source=t,this.field=r,this.locked=n,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,r=e.docView.tile.nearest(t.target);if(!r)return;let n,i=1;if(r.isWidget())n=r.posAtStart;else{if(null==(n=e.posAtCoords(t)))return;let r=e.coordsAtPos(n);if(!r||t.y<r.top||t.y>r.bottom||t.x<r.left-e.defaultCharacterWidth||t.x>r.right+e.defaultCharacterWidth)return;let s=e.bidiSpans(e.state.doc.lineAt(n)).find(e=>e.from<=n&&e.to>=n),o=s&&s.dir==tV.RTL?-1:1;i=t.x<r.left?-o:o}this.activateHover(e,n,i)}activateHover(e,t,r,n){let i=this.source(e,t,r),s=t=>{if(t&&!(Array.isArray(t)&&!t.length)){let r=Array.isArray(t)?t:[t];n&&this.locked.set(r,n),e.dispatch({effects:this.setHover.of(r)})}};if(i&&"then"in i){let r=this.pending={pos:t};i.then(e=>{this.pending==r&&(this.pending=null,s(e))},t=>rc(e.state,t,"hover tooltip"))}else s(i)}get tooltip(){let e=this.view.plugin(ss),t=e?e.manager.tooltips.findIndex(e=>e.create==su.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:i}=this;
76if(n.length&&!this.locked.has(n)&&i&&!function(e,t){let{left:r,right:n,top:i,bottom:s}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let e=o.getBoundingClientRect();i=Math.min(e.top,i),s=Math.max(e.bottom,s)}return t.clientX>=r-4&&t.clientX<=n+4&&t.clientY>=i-4&&t.clientY<=s+4}(i.dom,e)||this.pending){let{pos:i}=n[0]||this.pending,s=null!=(r=null==(t=n[0])?void 0:t.end)?r:i;(i==s?this.view.posAtCoords(this.lastMove)!=i:!function(e,t,r,n,i){let s=e.scrollDOM.getBoundingClientRect(),o=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>n||s.right<n||s.top>i||Math.min(s.bottom,o)<i)return!1;let a=e.posAtCoords({x:n,y:i},!1);return a>=t&&a<=r}(this.view,i,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t);let{active:n}=this;!n.length||this.locked.has(n)||this.view.dom.contains(r.relatedTarget)||this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function sm(e,t={}){let r=ew.define(),n=new WeakMap,i=et.define({create:()=>[],update(e,s){let o=n.get(e);if(e.length&&(t.hideOnChange&&(s.docChanged||s.selection)||o&&o(s)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(s,e)))),s.docChanged&&e.length){let t=[];for(let r of e){let e=s.changes.mapPos(r.pos,-1,j.TrackDel);if(null!=e){let n=Object.assign(Object.create(null),r);n.pos=e,null!=n.end&&(n.end=s.changes.mapPos(n.end)),t.push(n)}}e=t}for(let t of s.effects)t.is(r)&&(e=t.value,o=void 0),(t.is(sv)&&!t.value||t.value==i)&&(e=[]);return e.length&&o&&n.set(e,o),e},provide:e=>sc.from(e)}),s=rp.define(s=>new sp(s,e,i,n,r,t.hoverTime||300));return{active:i,extension:[i,s,sf.of(s),sd]}}function sg(e,t,r,n={}){var i;let s=e.state.facet(sf).map(t=>e.plugin(t)).filter(e=>!!e);if(n.tooltip&&n.tooltip.active){let e=s.find(e=>e.field==n.tooltip.active);e&&(s=[e])}for(let o of s)o.activateHover(e,t,r,null!=(i=n.until)?i:()=>!1)}function sy(e,t){let r=e.plugin(ss);if(!r)return null;let n=r.manager.tooltips.indexOf(t);return n<0?null:r.manager.tooltipViews[n]}let sv=ew.define(),sb=G.define({combine(e){let t,r;for(let n of e)t=t||n.topContainer,r=r||n.bottomContainer;return{topContainer:t,bottomContainer:r}}});function sw(e,t){let r=e.plugin(sx),n=r?r.specs.indexOf(t):-1;return n>-1?r.panels[n]:null}let sx=rp.fromClass(class{constructor(e){this.input=e.state.facet(sC),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(sb);for(let r of(this.top=new sk(e,!0,t.topContainer),this.bottom=new sk(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top)),this.panels))r.dom.classList.add("cm-panel"),r.mount&&r.mount()}update(e){let t=e.state.facet(sb);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new sk(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new sk(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let r=e.state.facet(sC);if(r!=this.input){let t=r.filter(e=>e),n=[],i=[],s=[],o=[];for(let r of t){let t=this.specs.indexOf(r),a;t<0?(a=r(e.view),o.push(a)):(a=this.panels[t]).update&&a.update(e),n.push(a),(a.top?i:s).push(a)}for(let e of(this.specs=t,this.panels=n,this.top.sync(i),this.bottom.sync(s),o))e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>ic.scrollMargins.of(t=>{let r=t.plugin(e);return r&&{top:r.top.scrollMargin(),bottom:r.bottom.scrollMargin()}})});class sk{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&0>e.indexOf(t)&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"to
76p":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=sS(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=sS(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function sS(e){let t=e.nextSibling;return e.remove(),t}let sC=G.define({enables:sx});function sA(e,t){let r,n=new Promise(e=>r=e),i=e=>(function(e,t,r){let n=t.content?t.content(e,()=>o(null)):null;if(!n){if(n=e9("form"),t.input){let e=e9("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||(e.name="input"),n.appendChild(e9("label",(t.label||"")+": ",e))}else n.appendChild(document.createTextNode(t.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(e9("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let i="FORM"==n.nodeName?[n]:n.querySelectorAll("form");for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener("keydown",e=>{27==e.keyCode?(e.preventDefault(),o(null)):13==e.keyCode&&(e.preventDefault(),o(t))}),t.addEventListener("submit",e=>{e.preventDefault(),o(t)})}let s=e9("div",n,e9("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));function o(t){s.contains(s.ownerDocument.activeElement)&&e.focus(),r(t)}return t.class&&(s.className=t.class),s.classList.add("cm-dialog"),{dom:s,top:t.top,mount:()=>{if(t.focus){let e;(e="string"==typeof t.focus?n.querySelector(t.focus):n.querySelector("input")||n.querySelector("button"))&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}})(e,t,r);e.state.field(sE,!1)?e.dispatch({effects:sT.of(i)}):e.dispatch({effects:ew.appendConfig.of(sE.init(()=>[i]))});let s=sO.of(i);return{close:s,result:n.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(sE).indexOf(i)>-1&&e.dispatch({effects:s})}),t))}}let sE=et.define({create:()=>[],update(e,t){for(let r of t.effects)r.is(sT)?e=[r.value].concat(e):r.is(sO)&&(e=e.filter(e=>e!=r.value));return e},provide:e=>sC.computeN([e],t=>t.field(e))}),sT=ew.define(),sO=ew.define();class sM extends eR{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}sM.prototype.elementClass="",sM.prototype.toDOM=void 0,sM.prototype.mapMode=j.TrackBefore,sM.prototype.startSide=sM.prototype.endSide=-1,sM.prototype.point=!0;let sR=G.define(),sN=G.define(),sP={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>eI.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},s_=G.define();function sD(e){return[sj(),s_.of({...sP,...e})]}let sI=G.define({combine:e=>e.some(e=>e)});function sj(e){let t=[sL];return e&&!1===e.fixed&&t.push(sI.of(!0)),t}let sL=rp.fromClass(class{constructor(e){for(let t of(this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(s_).map(t=>new sF(e,t)),this.fixed=!e.state.facet(sI),this.gutters))"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,r=e.view.viewport,n=Math.min(t.to,r.to)-Math.max(t.from,r.from);this.syncGutters(n<(r.to-r.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(sI)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let r=eI.iter(this.view.state.facet(sR),this.view.viewport.from),n=[],i=this.gutters.map(e=>new sz(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(e.type)){let t=!0;for(let s of e.type)if(s.type==tg.Text&&t){for(let e of(s$(r,n,s.from),i))e.line(this.view,s,n);t=!1}else if(s.widget)for(let e of i)e.widget(this.view,s)}else if(e.type==tg.Text)for(let t of(s$(r,n,e.from),i))t.line(this.view,e,n);else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(s_),r=e.state.facet(s_),n=e.docChanged||e.heightChanged||e.viewportChanged||!eI.eq(e.startState.facet(sR),e.state.facet(sR),e.view.viewport.from,e.view.viewport.to);if(t==r)for(let t of this.gutters)t.update(e)&&(n=!0);else{n=!0;let i=[];for(let n of r){let r=t.indexOf(n);r<0?i.push(new sF(this.view,n)):(this.gutters[r].update(e),i.push(this.gutters[r]))}for(let e of this.gutters)e.dom.remove(),0>i.indexOf(e)&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return n}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>ic.scrollMargins.of(t=>{let r=t.plugin(e);if(!r||0==r.gutters.length||!r.fixed)return null;let n=r.dom.offsetWidth*t.scaleX,i=r.domAfter?r.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==tV.LTR?{left:n,right:i}:{right:n,left:i}})});function sB(e){return Array.isArray(e)?e:[e]}function s$(e,t,r){for(;e.value&&e.from<=r;)e.from==r&&t.push(e.value),e.next()}class sz{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=eI.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:n}=this,i=(t.top-this.height)/e.scaleY,s=t.height/e.scaleY;if(this.i==n.elements.length){let t=new sH(e,s,i,r);n.elements.push(t),n.dom.appendChild(t.dom)}else n.elements[this.i].update(e,s,i,r);this.height=t.bottom,this.i++}line(e,t,r){let n=[];s$(this.cursor,n,t.from),r.length&&(n=n.concat(r));let i=this.gutter.config.lineMarker(e,t,n);i&&n.unshift(i);let s=this.gutter;(0!=n.length||s.config.renderEmptyElements)&&this.addElement(e,t,n)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),n=r?[r]:null;for(let r of e.state.facet(sN)){let i=r(e,t.widget,t);i&&(n||(n=[])).push(i)}n&&this.addElement(e,t,n)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class sF{constructor(e,t){for(let r in this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="
76cm-gutter"+(this.config.class?" "+this.config.class:""),t.domEventHandlers)this.dom.addEventListener(r,n=>{let i=n.target,s;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();s=(e.top+e.bottom)/2}else s=n.clientY;let o=e.lineBlockAtHeight(s-e.documentTop);t.domEventHandlers[r](e,o,n)&&n.preventDefault()});this.markers=sB(t.markers(e)),t.initialSpacer&&(this.spacer=new sH(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=sB(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let r=e.view.viewport;return!eI.eq(this.markers,t,r.from,r.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class sH{constructor(e,t,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,n)}update(e,t,r,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),!function(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].compare(t[r]))return!1;return!0}(this.markers,n)&&this.setMarkers(e,n)}setMarkers(e,t){let r="cm-gutterElement",n=this.dom.firstChild;for(let i=0,s=0;;){let o=s,a=i<t.length?t[i++]:null,l=!1;if(a){let e=a.elementClass;e&&(r+=" "+e);for(let e=s;e<this.markers.length;e++)if(this.markers[e].compare(a)){o=e,l=!0;break}}else o=this.markers.length;for(;s<o;){let e=this.markers[s++];if(e.toDOM){e.destroy(n);let t=n.nextSibling;n.remove(),n=t}}if(!a)break;a.toDOM&&(l?n=n.nextSibling:this.dom.insertBefore(a.toDOM(e),n)),l&&s++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}let sW=G.define(),sU=G.define(),sV=G.define({combine:e=>eM(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let e in t){let n=r[e],i=t[e];r[e]=n?(e,t,r)=>n(e,t,r)||i(e,t,r):i}return r}})});class sq extends sM{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function sK(e,t){return e.state.facet(sV).formatNumber(t,e.state)}let sJ=s_.compute([sV],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(sW),lineMarker:(e,t,r)=>r.some(e=>e.toDOM)?null:new sq(sK(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,r)=>{for(let n of e.state.facet(sU)){let i=n(e,t,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(sV)!=e.state.facet(sV),initialSpacer:e=>new sq(sK(e,sY(e.state.doc.lines))),updateSpacer(e,t){let r=sK(t.view,sY(t.view.state.doc.lines));return r==e.number?e:new sq(r)},domEventHandlers:e.facet(sV).domEventHandlers,side:"before"}));function sG(e={}){return[sV.of(e),sj(),sJ]}function sY(e){let t=9;for(;t<e;)t=10*t+9;return t}let sX=new class extends sM{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},sQ=sR.compute(["selection"],e=>{let t=[],r=-1;for(let n of e.selection.ranges){let i=e.doc.lineAt(n.head).from;i>r&&(r=i,t.push(sX.range(i)))}return eI.of(t)});function sZ(){return sQ}e.s(["Decoration",0,ty,"Direction",0,tV,"EditorView",0,ic,"GutterMarker",0,sM,"ViewPlugin",0,rp,"WidgetType",0,tm,"activateHover",0,sg,"crosshairCursor",0,i7,"drawSelection",0,i_,"dropCursor",0,iH,"getPanel",0,sw,"getTooltip",0,sy,"gutter",0,sD,"highlightActiveLine",0,i0,"highlightActiveLineGutter",0,sZ,"highlightSpecialChars",0,iY,"hoverTooltip",0,sm,"keymap",0,ib,"lineNumbers",0,sG,"logException",0,rc,"placeholder",0,i5,"rectangularSelection",0,i6,"runScopeHandlers",0,ik,"showDialog",0,sA,"showPanel",0,sC,"showTooltip",0,sh],15080);let s0=0;class s1{constructor(e,t){this.from=e,this.to=t}}class s2{constructor(e={}){this.id=s0++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=s4.match(e)),t=>{let r=e(t);return void 0===r?null:[this,r]}}}s2.closedBy=new s2({deserialize:e=>e.split(" ")}),s2.openedBy=new s2({deserialize:e=>e.split(" ")}),s2.group=new s2({deserialize:e=>e.split(" ")}),s2.isolate=new s2({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),s2.contextHash=new s2({perNode:!0}),s2.lookAhead=new s2({perNode:!0}),s2.mounted=new s2({perNode:!0});class s3{constructor(e,t,r,n=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=n}static get(e){return e&&e.props&&e.props[s2.mounted.id]}}let s5=Object.create(null);class s4{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):s5,r=!!e.top|2*!!e.ski
76pped|4*!!e.error|8*(null==e.name),n=new s4(e.name||"",t,e.id,r);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(s2.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return e=>{for(let r=e.prop(s2.group),n=-1;n<(r?r.length:0);n++){let i=t[n<0?e.name:r[n]];if(i)return i}}}}s4.none=new s4("",Object.create(null),0,8);class s6{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let t of e){let e=t(r);if(e){n||(n=Object.assign({},r.props));let t=e[1],i=e[0];i.combine&&i.id in n&&(t=i.combine(n[i.id],t)),n[i.id]=t}}t.push(n?new s4(r.name,n,r.id,r.flags):r)}return new s6(t)}}let s8=new WeakMap,s9=new WeakMap;(h=c||(c={}))[h.ExcludeBuffers=1]="ExcludeBuffers",h[h.IncludeAnonymous=2]="IncludeAnonymous",h[h.IgnoreMounts=4]="IgnoreMounts",h[h.IgnoreOverlays=8]="IgnoreOverlays",h[h.EnterBracketed=16]="EnterBracketed";class s7{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length)for(let[e,t]of(this.props=Object.create(null),i))this.props["number"==typeof e?e:e.id]=t}toString(){let e=s3.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let r=e.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new of(this.topNode,e)}cursorAt(e,t=0,r=0){let n=new of(s8.get(this)||this.topNode);return n.moveTo(e,t),s8.set(this,n._tree),n}get topNode(){return new oo(this,0,0,null)}resolve(e,t=0){let r=on(s8.get(this)||this.topNode,e,t,!1);return s8.set(this,r),r}resolveInner(e,t=0){let r=on(s9.get(this)||this.topNode,e,t,!0);return s9.set(this,r),r}resolveStack(e,t=0){return function(e,t,r){let n=e.resolveInner(t,r),i=null;for(let e=n instanceof oo?n:n.context.parent;e;e=e.parent)if(e.index<0){let s=e.parent;(i||(i=[n])).push(s.resolve(t,r)),e=s}else{let s=s3.get(e.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){let o=new oo(s.tree,s.overlay[0].from+e.from,-1,e);(i||(i=[n])).push(on(o,t,r,!1))}}return i?ou(i):n}(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e,s=e.mode||0,o=(s&c.IncludeAnonymous)>0;for(let e=this.cursor(s|c.IncludeAnonymous);;){let s=!1;if(e.from<=i&&e.to>=n&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&r&&(o||!e.type.isAnonymous)&&r(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];
76if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:oy(s4.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,r)=>new s7(this.type,e,t,r,this.propValues),e.makeTree||((e,t,r)=>new s7(s4.none,e,t,r)))}static build(e){return function(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:s=[],minRepeatType:o=n.types.length}=e,a=Array.isArray(r)?new oe(r,r.length):r,l=n.types,h=0,c=0;function u(e,t,r,i,s,o,a,l,h){let c=[],u=[];for(;e.length>i;)c.push(e.pop()),u.push(t.pop()+r-s);e.push(d(n.types[a],c,u,o-s,l-o,h)),t.push(s-r)}function d(e,t,r,n,i,s,o){if(s){let e=[s2.contextHash,s];o=o?[e].concat(o):[e]}if(i>25){let e=[s2.lookAhead,i];o=o?[e].concat(o):[e]}return new s7(e,t,r,n,o)}let f=[],p=[];for(;a.pos>0;)!function e(t,r,f,p,m,g){let{id:y,start:v,end:b,size:w}=a,x=c,k=h;if(w<0){if(a.next(),-1==w){let e=s[y];f.push(e),p.push(v-t);return}if(-3==w){h=y;return}if(-4==w){c=y;return}else throw RangeError(`Unrecognized record size: ${w}`)}let S=l[y],C,A,E=v-t;if(b-v<=i&&(A=function(e,t){let r=a.fork(),n=0,s=0,l=0,h=r.end-i,c={size:0,start:0,skip:0};n:for(let i=r.pos-e;r.pos>i;){let e=r.size;if(r.id==t&&e>=0){c.size=n,c.start=s,c.skip=l,l+=4,n+=4,r.next();continue}let a=r.pos-e;if(e<0||a<i||r.start<h)break;let u=4*(r.id>=o),d=r.start;for(r.next();r.pos>a;){if(r.size<0)if(-3==r.size||-4==r.size)u+=4;else break n;else r.id>=o&&(u+=4);r.next()}s=d,n+=e,l+=u}return(t<0||n==e)&&(c.size=n,c.start=s,c.skip=l),c.size>4?c:void 0}(a.pos-r,m))){let e=new Uint16Array(A.size-A.skip),r=a.pos-A.size,i=e.length;for(;a.pos>r;)i=function e(t,r,n){let{id:i,start:s,end:l,size:u}=a;if(a.next(),u>=0&&i<o){let o=n;if(u>4){let i=a.pos-(u-4);for(;a.pos>i;)n=e(t,r,n)}r[--n]=o,r[--n]=l-t,r[--n]=s-t,r[--n]=i}else -3==u?h=i:-4==u&&(c=i);return n}(A.start,e,i);C=new ot(e,b-A.start,n),E=A.start-t}else{let t=a.pos-w;a.next();let r=[],s=[],l=y>=o?y:-1,h=0,c=b;for(;a.pos>t;)l>=0&&a.id==l&&a.size>=0?(a.end<=c-i&&(u(r,s,v,h,a.end,c,l,x,k),h=r.length,c=a.end),a.next()):g>2500?function(e,t,r,s){let o=[],l=0,h=-1;for(;a.pos>t;){let{id:e,start:t,end:r,size:n}=a;if(n>4)a.next();else if(h>-1&&t<h)break;else h<0&&(h=r-i),o.push(e,t,r),l++,a.next()}if(l){let t=new Uint16Array(4*l),i=o[o.length-2];for(let e=o.length-3,r=0;e>=0;e-=3)t[r++]=o[e],t[r++]=o[e+1]-i,t[r++]=o[e+2]-i,t[r++]=r;r.push(new ot(t,o[2]-i,n)),s.push(i-e)}}(v,t,r,s):e(v,t,r,s,l,g+1);if(l>=0&&h>0&&h<r.length&&u(r,s,v,h,v,c,l,x,k),r.reverse(),s.reverse(),l>-1&&h>0){let e=function(e,t){return(r,n,i)=>{let s=0,o=r.length-1,a,l;if(o>=0&&(a=r[o])instanceof s7){if(!o&&a.type==e&&a.length==i)return a;(l=a.prop(s2.lookAhead))&&(s=n[o]+a.length+l)}return d(e,r,n,i,s,t)}}(S,k);C=oy(S,r,s,0,r.length,0,b-v,e,e)}else C=d(S,r,s,b-v,x-b,k)}f.push(C),p.push(E)}(e.start||0,e.bufferStart||0,f,p,-1,0);let m=null!=(t=e.length)?t:f.length?p[0]+f[0].length:0;return new s7(l[e.topID],f.reverse(),p.reverse(),m)}(e)}}s7.empty=new s7(s4.none,[],[],0);class oe{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new oe(this.buffer,this.index)}}class ot{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return s4.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),r==(e+=4))return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,t,r,n,i){let{buffer:s}=this,o=-1;for(let a=e;a!=t&&(!or(i,n,s[a+1],s[a+2])||(o=a,!(r>0)));a=s[a+3]);return o}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),s=0;for(let o=e,a=0;o<t;){i[a++]=n[o++],i[a++]=n[o++]-r;let t=i[a++]=n[o++]-r;i[a++]=n[o++]-e,s=Math.max(s,t)}return new ot(i,s,this.set)}}function or(e,t,r,n){switch(e){case -2:return r<t;case -1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function on(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof oo&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=n?0:c.IgnoreOverlays;if(n)for(let n=e,o=n.parent;o;o=(n=o).parent)n instanceof oo&&n.index<0&&(null==(i=o.enter(t,r,s))?void 0:i.from)!=n.from&&(e=o);for(;;){let n=e.enter(t,r,s);if(!n)return e;e=n}}
vendor: 4,122 bytes, line 76
76class oi{cursor(e=0){return new of(this,e)}getChild(e,t=null,r=null){let n=oa(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return oa(this,e,t,r)}resolve(e,t=0){return on(this,e,t,!1)}resolveInner(e,t=0){return on(this,e,t,!0)}matchContext(e){return ol(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(r=t,t=e.prevSibling):t=e}return r}get node(){return this}get next(){return this.parent}}class oo extends oi{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,i=0){for(let s=this;;){for(let{children:o,positions:a}=s._tree,l=t>0?o.length:-1;e!=l;e+=t){let l=o[e],h=a[e]+s.from,u;if(i&c.EnterBracketed&&l instanceof s7&&(u=s3.get(l))&&!u.overlay&&u.bracketed&&r>=h&&r<=h+l.length||or(n,r,h,h+l.length)){if(l instanceof ot){if(i&c.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,t,r-h,n);if(o>-1)return new oc(new oh(s,l,e,h),null,o)}else if(i&c.IncludeAnonymous||!l.type.isAnonymous||op(l)){let o;if(!(i&c.IgnoreMounts)&&(o=s3.get(l))&&!o.overlay)return new oo(o.tree,h,e,s);let a=new oo(l,h,e,s);return i&c.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,r,n,i)}}}if(i&c.IncludeAnonymous||!s.type.isAnonymous||(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,!(s=s._parent)))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let n;if(!(r&c.IgnoreOverlays)&&(n=s3.get(this._tree))&&n.overlay){let i=e-this.from,s=r&c.EnterBracketed&&n.bracketed;for(let{from:e,to:r}of n.overlay)if((t>0||s?e<=i:e<i)&&(t<0||s?r>=i:r>i))return new oo(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function oa(e,t,r,n){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=r){for(let e=!1;!e;)if(e=i.type.is(r),!i.nextSibling())return s}for(;;){if(null!=n&&i.type.is(n))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==n?s:[]}}function ol(e,t,r=t.length-1){for(let n=e;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class oh{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class oc extends oi{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new oc(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&c.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new oc(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.
vendor: 1,268 bytes, line 76
76index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new oc(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new oc(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let s=r.buffer[this.index+1];e.push(r.slice(n,i,s)),t.push(0)}return new s7(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ou(e){if(!e.length)return null;let t=0,r=e[0];for(let n=1;n<e.length;n++){let i=e[n];(i.from>r.from||i.to<r.to)&&(r=i,t=n)}let n=r instanceof oo&&r.index<0?null:r.parent,i=e.slice();return n?i[t]=n:i.splice(t,1),new od(i,r)}class od{constructor(e,t){this.heads=e,this.node=t}get next(){return ou(this.heads)}}class of{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~c.EnterBracketed,e instanceof oo)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;
vendor: 2,104 bytes, line 76
76for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return!!e&&(e instanceof oo?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?!(r&c.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&c.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&c.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let e=r<0?0:this.stack[r]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(e)}return r<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}
vendor: 4,247 bytes, line 76
76=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let n=t+e,i=e<0?-1:r._tree.children.length;n!=i;n+=e){let e=r._tree.children[n];if(this.mode&c.IncludeAnonymous||e instanceof ot||!e.type.isAnonymous||op(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)n:for(let n=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=i+1;break n}n=this.stack[--i]}for(let e=r;e<this.stack.length;e++)t=new oc(this.buffer,t,this.stack[e]);return this.bufferNode=new oc(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return ol(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return ol(this._tree,e,n);let s=r[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function op(e){return e.children.some(e=>e instanceof ot||!e.type.isAnonymous||op(e))}let om=new WeakMap;function og(e,t){if(!e.isAnonymous||t instanceof ot||t.type!=e)return 1;let r=om.get(t);if(null==r){for(let n of(r=1,t.children)){if(n.type!=e||!(n instanceof s7)){r=1;break}r+=og(e,n)}om.set(t,r)}return r}function oy(e,t,r,n,i,s,o,a,l){let h=0;for(let r=n;r<i;r++)h+=og(e,t[r]);let c=Math.ceil(1.5*h/8),u=[],d=[];return!function t(r,n,i,o,a){for(let h=i;h<o;){let i=h,f=n[h],p=og(e,r[h]);for(h++;h<o;h++){let t=og(e,r[h]);if(p+t>=c)break;p+=t}if(h==i+1){if(p>c){let e=r[i];t(e.children,e.positions,0,e.children.length,n[i]+a);continue}u.push(r[i])}else{let t=n[h-1]+r[h-1].length-f;u.push(oy(e,r,n,i,h,f,t,null,l))}d.push(f+a-s)}}(t,r,n,i,0),(a||l)(u,d,o)}class ov{constructor(e,t,r,n,i=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=!!i|2*!!s}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],r=!1){let n=[new ov(0,e.length,e,0,!1,r)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],i=1,s=e.length?e[0]:null;for(let o=0,a=0,l=0;;o++){let h=o<t.length?t[o]:null,c=h?h.fromA:1e9;if(c-a>=r)for(;s&&s.from<c;){let t=s;if(a>=t.from||c<=t.to||l){let e=Math.max(t.from,a)-l,r=Math.min(t.to,c)-l;t=e>=r?null:new ov(e,r,t.tree,t.offset+l,o>0,!!h)}if(t&&n.push(t),s.to>c)break;s=i<e.length?e[i++]:null}if(!h)break;a=h.toA,l=h.toA-h.toB}return n}}class ob{startParse(e,t,r){return"string"==typeof e&&(e=new ow(e)),r=r?r.length?r.map(e=>new s1(e.from,e.to)):[new s1(0,0)]:[new s1(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let e=n.advance();if(e)return e}}}class ow{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new s2({perNode:!0});let ox=0;class ok{constructor(e,t,r,n){this.name=e,this.set=t,this.base=r,this.modified=n,this.id=ox++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){if(e instanceof ok&&(t=e),null==t?void 0:t.base)throw Error("Can not derive from a modified tag");let r=new ok("string"==typeof e?e:"?",[],null,[]);if(r.set.push(r),t)for(let e of t.set)r.set.push(e);return r}static defineModifier(e){let t=new oC(e);return e=>e.modified.indexOf(t)>-1?e:oC.get(e.base||e,e.modified.concat(t).sort((e,t)=>
76e.id-t.id))}}let oS=0;class oC{constructor(e){this.name=e,this.instances=[],this.id=oS++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(r=>{var n,i;return r.base==e&&(n=t,i=r.modified,n.length==i.length&&n.every((e,t)=>e==i[t]))});if(r)return r;let n=[],i=new ok(e.name,n,e,t);for(let e of t)e.instances.push(i);let s=function(e){let t=[[]];for(let r=0;r<e.length;r++)for(let n=0,i=t.length;n<i;n++)t.push(t[n].concat(e[r]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)n.push(oC.get(t,e));return i}}function oA(e){let t=Object.create(null);for(let r in e){let n=e[r];for(let e of(Array.isArray(n)||(n=[n]),r.split(" ")))if(e){let r=[],i=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){i=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!n)throw RangeError("Invalid path: "+e);if(r.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),(t+=n[0].length)==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){i=0;break}if("/"!=o)throw RangeError("Invalid path: "+e);s=e.slice(t)}let o=r.length-1,a=r[o];if(!a)throw RangeError("Invalid path: "+e);let l=new oT(n,i,o>0?r.slice(0,o):null);t[a]=l.sort(t[a])}}return oE.add(t)}let oE=new s2({combine(e,t){let r,n,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),r&&r.mode==i.mode&&!i.context&&!r.context)continue;let s=new oT(i.tags,i.mode,i.context);r?r.next=s:n=s,r=s}return n}});class oT{constructor(e,t,r,n){this.tags=e,this.mode=t,this.context=r,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function oO(e,t){let r=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)r[e.id]=t.class;else r[t.tag.id]=t.class;let{scope:n,all:i=null}=t||{};return{style:e=>{let t=i;for(let n of e)for(let e of n.set){let n=r[e.id];if(n){t=t?t+" "+n:n;break}}return t},scope:n}}oT.empty=new oT([],2,null);class oM{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,n,i){let{type:s,from:o,to:a}=e;if(o>=r||a<=t)return;s.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(s)));let l=n,h=function(e){let t=e.type.prop(oE);for(;t&&t.context&&!e.matchContext(t.context);
vendor: 8,496 bytes, line 76
76)t=t.next;return t||null}(e)||oT.empty,c=function(e,t){let r=null;for(let n of e){let e=n.style(t);e&&(r=r?r+" "+e:e)}return r}(i,h.tags);if(c&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(t,o),l),h.opaque)return;let u=e.tree&&e.tree.prop(s2.mounted);if(u&&u.overlay){let s=e.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),c=e.firstChild();for(let d=0,f=o;;d++){let p=d<u.overlay.length?u.overlay[d]:null,m=p?p.from+o:a,g=Math.max(t,f),y=Math.min(r,m);if(g<y&&c)for(;e.from<y&&(this.highlightRange(e,g,y,n,i),this.startSpan(Math.min(y,e.to),l),!(e.to>=m)&&e.nextSibling()););if(!p||m>r)break;(f=p.to+o)>t&&(this.highlightRange(s.cursor(),Math.max(t,p.from+o),Math.min(r,f),"",h),this.startSpan(Math.min(r,f),l))}c&&e.parent()}else if(e.firstChild()){u&&(n="");do{if(e.to<=t)continue;if(e.from>=r)break;this.highlightRange(e,t,r,n,i),this.startSpan(Math.min(r,e.to),l)}while(e.nextSibling())e.parent()}}}let oR=ok.define,oN=oR(),oP=oR(),o_=oR(oP),oD=oR(oP),oI=oR(),oj=oR(oI),oL=oR(oI),oB=oR(),o$=oR(oB),oz=oR(),oF=oR(),oH=oR(),oW=oR(oH),oU=oR(),oV={comment:oN,lineComment:oR(oN),blockComment:oR(oN),docComment:oR(oN),name:oP,variableName:oR(oP),typeName:o_,tagName:oR(o_),propertyName:oD,attributeName:oR(oD),className:oR(oP),labelName:oR(oP),namespace:oR(oP),macroName:oR(oP),literal:oI,string:oj,docString:oR(oj),character:oR(oj),attributeValue:oR(oj),number:oL,integer:oR(oL),float:oR(oL),bool:oR(oI),regexp:oR(oI),escape:oR(oI),color:oR(oI),url:oR(oI),keyword:oz,self:oR(oz),null:oR(oz),atom:oR(oz),unit:oR(oz),modifier:oR(oz),operatorKeyword:oR(oz),controlKeyword:oR(oz),definitionKeyword:oR(oz),moduleKeyword:oR(oz),operator:oF,derefOperator:oR(oF),arithmeticOperator:oR(oF),logicOperator:oR(oF),bitwiseOperator:oR(oF),compareOperator:oR(oF),updateOperator:oR(oF),definitionOperator:oR(oF),typeOperator:oR(oF),controlOperator:oR(oF),punctuation:oH,separator:oR(oH),bracket:oW,angleBracket:oR(oW),squareBracket:oR(oW),paren:oR(oW),brace:oR(oW),content:oB,heading:o$,heading1:oR(o$),heading2:oR(o$),heading3:oR(o$),heading4:oR(o$),heading5:oR(o$),heading6:oR(o$),contentSeparator:oR(oB),list:oR(oB),quote:oR(oB),emphasis:oR(oB),strong:oR(oB),link:oR(oB),monospace:oR(oB),strikethrough:oR(oB),inserted:oR(),deleted:oR(),changed:oR(),invalid:oR(),meta:oU,documentMeta:oR(oU),annotation:oR(oU),processingInstruction:oR(oU),definition:ok.defineModifier("definition"),constant:ok.defineModifier("constant"),function:ok.defineModifier("function"),standard:ok.defineModifier("standard"),local:ok.defineModifier("local"),special:ok.defineModifier("special")};for(let e in oV){let t=oV[e];t instanceof ok&&(t.name=e)}oO([{tag:oV.link,class:"tok-link"},{tag:oV.heading,class:"tok-heading"},{tag:oV.emphasis,class:"tok-emphasis"},{tag:oV.strong,class:"tok-strong"},{tag:oV.keyword,class:"tok-keyword"},{tag:oV.atom,class:"tok-atom"},{tag:oV.bool,class:"tok-bool"},{tag:oV.url,class:"tok-url"},{tag:oV.labelName,class:"tok-labelName"},{tag:oV.inserted,class:"tok-inserted"},{tag:oV.deleted,class:"tok-deleted"},{tag:oV.literal,class:"tok-literal"},{tag:oV.string,class:"tok-string"},{tag:oV.number,class:"tok-number"},{tag:[oV.regexp,oV.escape,oV.special(oV.string)],class:"tok-string2"},{tag:oV.variableName,class:"tok-variableName"},{tag:oV.local(oV.variableName),class:"tok-variableName tok-local"},{tag:oV.definition(oV.variableName),class:"tok-variableName tok-definition"},{tag:oV.special(oV.variableName),class:"tok-variableName2"},{tag:oV.definition(oV.propertyName),class:"tok-propertyName tok-definition"},{tag:oV.typeName,class:"tok-typeName"},{tag:oV.namespace,class:"tok-namespace"},{tag:oV.className,class:"tok-className"},{tag:oV.macroName,class:"tok-macroName"},{tag:oV.propertyName,class:"tok-propertyName"},{tag:oV.operator,class:"tok-operator"},{tag:oV.comment,class:"tok-comment"},{tag:oV.meta,class:"tok-meta"},{tag:oV.invalid,class:"tok-invalid"},{tag:oV.punctuation,class:"tok-punctuation"}]);let oq=new s2,oK=new s2;class oJ{constructor(e,t,r=[],n=""){this.data=e,this.name=n,eO.prototype.hasOwnProperty("tree")||Object.defineProperty(eO.prototype,"tree",{get(){return oX(this)}}),this.parser=t,this.extension=[o6.of(this),eO.languageData.of((e,t,r)=>{let n=oG(e,t,r),i=n.type.prop(oq);if(!i)return[];let s=e.facet(i),o=n.type.prop(oK);if(o){let i=n.resolve(t-n.from,r);for(let t of o)if(t.test(i,e)){let r=e.facet(t.facet);return"replace"==t.type?r:r.concat(s)}}return s})].concat(r)}isActiveAt(e,t,r=-1){return oG(e,t,r).type.prop(oq)==this.data}findRegions(e){let t=e.facet(o6);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],n=(e,t)=>{if(e.prop(oq)==this.data)return void r.push({from:t,to:t+e.length});let i=e.prop(s2.mounted);if(i){if(i.tree.prop(oq)==this.data){if(i.overlay)for(let e of i.overlay)r.push({from:e.from+t,to:e.to+t});else r.push({from:t,to:t+e.length});return}else if(i.overlay){let e=r.length;if(n(i.tree,i.overlay[0].from+t),r.length>e)return}}for(let r=0;r<e.children.length;r++){let i=e.children[r];i instanceof s7&&n(i,e.positions[r]+t)}};return n(oX(e),0),r}get allowsNesting(){return!0}}function oG(e,t,r){let n=e.facet(o6),i=oX(e).topNode;if(!n||n.allowsNesting)for(let e=i;e;e=e.enter(t,r,c.ExcludeBuffers|c.EnterBracketed))e.type.isTop&&(i=e);return i}oJ.setState=ew.define();class oY extends oJ{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){var t;let r=(t=e.languageData,G.define({combine:t?e=>e.concat(t):void 0}));return new oY(r,e.parser.configure({props:[oq.add(e=>e.isTop?r:void 0)]}),e.name)}configure(e,t){return new oY(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function oX(e){let t=e.field(oJ.state,!1);return t?t.tree:s7.empty}class oQ{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let oZ=null;class o0{constructor(e,t,r=[],n,i,s,o,a){this.parser=e,this.state=t,this.fragments=r,this.tree=n,this.treeLen=i,this.viewport=s,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new o0(e,t,[],s7.empty,0,r,[],null)}startParse(){return this.parser.startParse(new oQ(this.state.doc),this.fragments)}work(e,t){return(null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=s7.empty&&this.isDone(null!=t?t:this.state.doc.length))?(this.takeTree(),!0):this.withContext(()=>{var r;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(ov.addTree(n,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!=(r=this.parse.stoppedAt)?r:this.state.doc.length,this.tree=n,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ov.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=oZ;oZ=this;try{return e()}finally{oZ=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=o1(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:n,treeLen:i,viewport:s,skipped:o}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,r,n,i)=>t.push({fromA:e,toA:r,fromB:n,toB:i})),r=ov.applyChanges(r,t),n=s7.empty,i=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length)for(let t of(o=[],this.skipped)){let r=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);r<n&&o.push({from:r,to:n})}}return new o0(this.parser,t,r,n,i,s,o,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:r,to:n}=this.skipped[t];r<e.to&&n>
vendor: 4,853 bytes, line 76
76e.from&&(this.fragments=o1(this.fragments,r,n),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ob{createParse(t,r,n){let i=n[0].from,s=n[n.length-1].to;return{parsedPos:i,advance(){let t=oZ;if(t){for(let e of n)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new s7(s4.none,[],[],s-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return oZ}}function o1(e,t,r){return ov.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}class o2{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new o2(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=o0.create(e.facet(o6).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new o2(r)}}oJ.state=et.define({create:o2.init,update(e,t){for(let e of t.effects)if(e.is(oJ.setState))return e.value;return t.startState.facet(o6)!=t.state.facet(o6)?o2.init(t.state):e.apply(t)}});let o3=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"u">typeof requestIdleCallback&&(o3=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});let o5="u">typeof navigator&&(null==(u=navigator.scheduling)?void 0:u.isInputPending)?()=>navigator.scheduling.isInputPending():null,o4=rp.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(oJ.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(oJ.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=o3(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:n}}=this.view,i=r.field(oJ.state);if(i.tree==i.context.tree&&i.context.isDone(n+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!o5?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<n&&r.doc.length>n+1e3,a=i.context.work(()=>o5&&o5()||Date.now()>s,n+1e5*!o);this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:oJ.setState.of(new o2(i.context))})),this.chunkBudget>0&&!(a&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>rc(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),o6=G.define({combine:e=>e.length?e[0]:null,enables:e=>[oJ.state,o4,ic.contentAttributes.compute([e],t=>{let r=t.facet(e);return r&&r.name?{"data-language":r.name}:{}})]});class o8{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}let o9=G.define(),o7=G.define({combine:e=>{if(!e.length)return"  ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function ae(e){let t=e.facet(o7);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function at(e,t){let r="",n=e.tabSize,i=e.facet(o7)[0];if("	"==i){for(;t>=n;)r+="	",t-=n;i=" "}for(let e=0;e<t;e++)r+=i;return r}function ar(e,t){for(let r of(e instanceof eO&&(e=new an(e)),e.state.facet(o9))){let n=r(e,t);if(void 0!==n)return n}let r=oX(e.state);return r.length>=t?function(e,t,r){let n=t.resolveStack(r),i=t.resolveInner(r,-1).resolve(r,0).enterUnfinishedNodesBefore(r);if(i!=n.node){let e=[];for(let t=i;t&&!(t.from<n.node.from||t.to>n.node.to||t.from==n.node.from&&t.type==n.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)n={node:e[t],next:n}}return as(n,e,r)}(e,r,t):null}class an{constructor(e,t={}){this.state=e,this.options=t,this.unit=ae(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:i}=this.options;if(null!=n&&n>=r.from&&n<=r.to)if(i&&n==e)return{text:"",from:e};
76else if(t<0?n<e:n<=e)return{text:r.text.slice(n-r.from),from:n};else return{text:r.text.slice(0,n-r.from),from:r.from};return r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:n}=this.lineAt(e,t);return r.slice(e-n,Math.min(r.length,e+100-n))}column(e,t=1){let{text:r,from:n}=this.lineAt(e,t),i=this.countColumn(r,e-n),s=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return s>-1&&(i+=s-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,t=e.length){return eK(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:n}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(n);if(e>-1)return e}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}let ai=new s2;function as(e,t,r){for(let n=e;n;n=n.next){let e=function(e){let t=e.type.prop(ai);if(t)return t;let r=e.firstChild,n;if(r&&(n=r.type.prop(s2.closedBy))){let t=e.lastChild,r=t&&n.indexOf(t.name)>-1;return e=>(function(e,t,r,n){let i=e.textAfter,s=i.match(/^\s*/)[0].length,o=r&&i.slice(s,s+r.length)==r||n==e.pos+s,a=t?function(e){let t=e.node,r=t.childAfter(t.from),n=t.lastChild;if(!r)return null;let i=e.options.simulateBreak,s=e.state.doc.lineAt(r.from),o=null==i||i<=s.from?s.to:Math.min(s.to,i);for(let e=r.to;;){let i=t.childAfter(e);if(!i||i==n)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(s.text.slice(r.to-s.from))[0].length;return{from:r.from,to:r.to+e}}e=i.to}}(e):null;return a?o?e.column(a.from):e.column(a.to):e.baseIndent+(o?0:+e.unit)})(e,!0,void 0,r&&!(e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak)?t.from:void 0)}return null==e.parent?ao:null}(n.node);if(e)return e(aa.create(t,r,n))}return 0}function ao(){return 0}class aa extends an{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new aa(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(function(e,t){for(let r=t;r;r=r.parent)if(e==r)return!0;return!1}(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return as(this.context.next,this.base,this.pos)}}function al({except:e,units:t=1}={}){return r=>{let n=e&&e.test(r.textAfter);return r.baseIndent+(n?0:t*r.unit)}}let ah=G.define(),ac=new s2;function au(e,t,r){for(let n of e.facet(ah)){let i=n(e,t,r);if(i)return i}return function(e,t,r){let n=oX(e);if(n.length<r)return null;let i=n.resolveStack(r,1),s=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=r||i.from>r)continue;if(s&&i.from<t)break;let a=i.type.prop(ac);if(a&&(i.to<n.length-50||n.length==e.doc.length||!function(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}(i))){let n=a(i,e);n&&n.from<=r&&n.from>=t&&n.to>r&&(s=n)}}return s}(e,t,r)}function ad(e,t){let r=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);return r>=n?void 0:{from:r,to:n}}let af=ew.define({map:ad}),ap=ew.define({map:ad});function am(e){let t=[];for(let{head:r}of e.state.selection.ranges)t.some(e=>e.from<=r&&e.to>=r)||t.push(e.lineBlockAt(r));return t}let ag=et.define({create:()=>ty.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,r)=>e=ay(e,t,r)),e=e.map(t.changes);let r=[];for(let n of t.effects)n.is(af)&&!function(e,t,r){let n=!1;return e.between(t,t,(e,i)=>{e==t&&i==r&&(n=!0)}),n}(e,n.value.from,n.value.to)?r.push(n.value):n.is(ap)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(r.length){let{preparePlaceholder:n}=t.state.facet(aS),i=r.map(e=>(n?ty.replace({widget:new aT(n(t.state,e))}):aE).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=ay(e,t.selection.main.head)),e},provide:e=>ic.decorations.from(e),toJSON(e,t){let r=[];return e.between(0,t.doc.length,(e,t)=>{r.push(e,t)}),r},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError("Invalid JSON for fold state");let t=[];for(let r=0;r<e.length;){let n=e[r++],i=e[r++];if("number"!=typeof n||"number"!=typeof i)throw RangeError("Invalid JSON for fold state");t.push(aE.range(n,i))}return ty.set(t,!0)}});function ay(e,t,r=t){let n=!1;return e.between(t,r,(e,i)=>{e<r&&i>t&&(n=!0)}),n?e.update({filterFrom:t,filterTo:r,filter:(e,n)=>e>=r||n<=t}):e}function av(e,t,r){var n;let i=null;return null==(n=e.field(ag,!1))||n.between(t,r,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function ab(e,t){return e.field(ag,!1)?t:t.concat(ew.appendConfig.of(aC()))}function aw(e,t,r=!0){let n=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return ic.announce.of(`${e.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${e.state.phrase("to")} ${i}.`)}let ax=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of am(e)){let r=au(e.state,t.from,t.to);if(r)return e.dispatch({effects:ab(e.state,[af.of(r),aw(e,r)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(ag,!1))return!1;let t=[];for(let r of am(e)){let n=av(e.state,r.from,r.to);
vendor: 4,862 bytes, line 76
76n&&t.push(ap.of(n),aw(e,n,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,r=[];for(let n=0;n<t.doc.length;){let i=e.lineBlockAt(n),s=au(t,i.from,i.to);s&&r.push(af.of(s)),n=(s?e.lineBlockAt(s.to):i).to+1}return r.length&&e.dispatch({effects:ab(e.state,r)}),!!r.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(ag,!1);if(!t||!t.size)return!1;let r=[];return t.between(0,e.state.doc.length,(e,t)=>{r.push(ap.of({from:e,to:t}))}),e.dispatch({effects:r}),!0}}],ak={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},aS=G.define({combine:e=>eM(e,ak)});function aC(e){let t=[ag,aR];return e&&t.push(aS.of(e)),t}function aA(e,t){let{state:r}=e,n=r.facet(aS),i=t=>{let r=e.lineBlockAt(e.posAtDOM(t.target)),n=av(e.state,r.from,r.to);n&&e.dispatch({effects:ap.of(n)}),t.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(e,i,t);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",r.phrase("folded code")),s.title=r.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}let aE=ty.replace({widget:new class extends tm{toDOM(e){return aA(e,null)}}});class aT extends tm{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return aA(e,this.value)}}let aO={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class aM extends sM{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}let aR=ic.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class aN{constructor(e,t){let r;function n(e){let t=eQ.newName();return(r||(r=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?n(t.all):void 0,s=t.scope;this.scope=s instanceof oJ?e=>e.prop(oq)==s.data:s?e=>e==s:void 0,this.style=oO(e.map(e=>({tag:e.tag,class:e.class||n(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=r?new eQ(r):null,this.themeType=t.themeType}static define(e,t){return new aN(e,t||{})}}let aP=G.define(),a_=G.define({combine:e=>e.length?[e[0]]:null});function aD(e){let t=e.facet(aP);return t.length?t:e.facet(a_)}function aI(e,t){let r=[aj],n;return e instanceof aN&&(e.module&&r.push(ic.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?r.push(a_.of(e)):n?r.push(aP.computeN([ic.darkTheme],t=>t.facet(ic.darkTheme)==("dark"==n)?[e]:[])):r.push(aP.of(e)),r}let aj=en.high(rp.fromClass(class{constructor(e){this.markCache=Object.create(null),this.tree=oX(e.state),this.decorations=this.buildDeco(e,aD(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=oX(e.state),r=aD(e.state),n=r!=aD(e.startState),{viewport:i}=e.view,s=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!n&&t.type==this.tree.type&&s>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return ty.none;let r=new ej;for(let{from:n,to:i}of e.visibleRanges)!function(e,t,r,n=0,i=e.length){let s=new oM(n,Array.isArray(t)?t:[t],r);s.highlightRange(e.cursor(),n,i,"",s.highlighters),s.flush(i)}(this.tree,t,(e,t,n)=>{r.add(e,t,this.markCache[n]||(this.markCache[n]=ty.mark({class:n})))},n,i);return r.finish()}},{decorations:e=>e.decorations})),aL=aN.define([{tag:oV.meta,color:"#404740"},{tag:oV.link,textDecoration:"underline"},{tag:oV.heading,textDecoration:"underline",fontWeight:"bold"},{tag:oV.emphasis,fontStyle:"italic"},{tag:oV.strong,fontWeight:"bold"},{tag:oV.strikethrough,textDecoration:"line-through"},{tag:oV.keyword,color:"#708"},{tag:[oV.atom,oV.bool,oV.url,oV.contentSeparator,oV.labelName],color:"#219"},{tag:[oV.literal,oV.inserted],color:"#164"},{tag:[oV.string,oV.deleted],color:"#a11"},{tag:[oV.regexp,oV.escape,oV.special(oV.string)],color:"#e40"},{tag:oV.definition(oV.variableName),color:"#00f"},{tag:oV.local(oV.variableName),color:"#30a"},{tag:[oV.typeName,oV.namespace],color:"#085"},{tag:oV.className,color:"#167"},{tag:[oV.special(oV.variableName),oV.macroName],color:"#256"},{tag:oV.definition(oV.propertyName),color:"#00c"},{tag:oV.comment,color:"#940"},{tag:oV.invalid,color:"#f00"}]),aB=ic.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),a$="()[]{}",az=G.define({combine:e=>
76eM(e,{afterCursor:!0,brackets:a$,maxScanDistance:1e4,renderMatch:aW})}),aF=ty.mark({class:"cm-matchingBracket"}),aH=ty.mark({class:"cm-nonmatchingBracket"});function aW(e){let t=[],r=e.matched?aF:aH;return t.push(r.range(e.start.from,e.start.to)),e.end&&t.push(r.range(e.end.from,e.end.to)),t}function aU(e){let t=[],r=e.facet(az);for(let n of e.selection.ranges){if(!n.empty)continue;let i=aG(e,n.head,-1,r)||n.head>0&&aG(e,n.head-1,1,r)||r.afterCursor&&(aG(e,n.head,1,r)||n.head<e.doc.length&&aG(e,n.head+1,-1,r));i&&(t=t.concat(r.renderMatch(i,e)))}return ty.set(t,!0)}let aV=[rp.fromClass(class{constructor(e){this.paused=!1,this.decorations=aU(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=aU(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),aB],aq=new s2;function aK(e,t,r){let n=e.prop(t<0?s2.openedBy:s2.closedBy);if(n)return n;if(1==e.name.length){let n=r.indexOf(e.name);if(n>-1&&n%2==+(t<0))return[r[n+t]]}return null}function aJ(e){let t=e.type.prop(aq);return t?t(e.node):e}function aG(e,t,r,n={}){let i=n.maxScanDistance||1e4,s=n.brackets||a$,o=oX(e),a=o.resolveInner(t,r);for(let e=a;e;e=e.parent){let n=aK(e.type,r,s);if(n&&e.from<e.to){let i=aJ(e);if(i&&(r>0?t>=i.from&&t<i.to:t>i.from&&t<=i.to))return function(e,t,r,n,i){let s=t.parent,o={from:r.from,to:r.to},a=0,l=null==s?void 0:s.cursor();if(l&&(e<0?l.childBefore(t.from):l.childAfter(t.to)))do if(e<0?l.to<=t.from:l.from>=t.to){if(0==a&&n.indexOf(l.type.name)>-1&&l.from<l.to){let e=aJ(l);return{start:o,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}else if(aK(l.type,e,i))a++;else if(aK(l.type,-e,i)){if(0==a){let e=aJ(l);return{start:o,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}a--}}while(e<0?l.prevSibling():l.nextSibling())return{start:o,matched:!1}}(r,e,i,n,s)}}return function(e,t,r,n,i,s,o){if(r<0?!t:t==e.doc.length)return null;let a=r<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=r>0)return null;let h={from:r<0?t-1:t,to:r>0?t+1:t},c=e.doc.iterRange(t,r>0?e.doc.length:0),u=0;for(let e=0;!c.next().done&&e<=s;){let s=c.value;r<0&&(e+=s.length);let a=t+e*r;for(let e=r>0?0:s.length-1,t=r>0?s.length:-1;e!=t;e+=r){let t=o.indexOf(s[e]);if(!(t<0)&&n.resolveInner(a+e,1).type==i)if(t%2==0==r>0)u++;else{if(1==u)return{start:h,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}r>0&&(e+=s.length)}return c.done?{start:h,matched:!1}:null}(e,t,r,o,a.type,i,s)}let aY=Object.create(null),aX=[s4.none],aQ=[],aZ=Object.create(null),a0=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])a0[e]=function(e,t){let r=[];for(let n of t.split(" ")){let t=[];for(let r of n.split(".")){let n=e[r]||oV[r];n?"function"==typeof n?t.length?t=t.map(n):a1(r,`Modifier ${r} used at start of tag`):t.length?a1(r,`Tag ${r} used as modifier`):t=Array.isArray(n)?n:[n]:a1(r,`Unknown highlighting tag ${r}`)}for(let e of t)r.push(e)}if(!r.length)return 0;let n=t.replace(/ /g,"_"),i=n+" "+r.map(e=>e.id),s=aZ[i];if(s)return s.id;let o=aZ[i]=s4.define({id:aX.length,name:n,props:[oA({[n]:r})]});return aX.push(o),o.id}(aY,t);function a1(e,t){aQ.indexOf(e)>-1||(aQ.push(e),console.warn(t))}function a2(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let i=e(t,r);return!!i&&(n(r.update(i)),!0)}}tV.RTL,tV.LTR;let a3=a2(function(e,t,r=t.selection.ranges){let n=[],i=-1;i:for(let{from:e,to:s}of r){let r=n.length,o=1e9,a;for(let r=e;r<=s;){let l=t.doc.lineAt(r);if(void 0==a&&!(a=a6(t,l.from).line))continue i;if(l.from>i&&(e==s||s>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,r=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<o&&(o=e),n.push({line:l,comment:r,token:a,indent:e,empty:t,single:!1})}r=l.to+1}if(o<1e9)for(let e=r;e<n.length;e++)n[e].indent<n[e].line.text.length&&(n[e].indent=o);n.length==r+1&&(n[r].single=!0)}if(2!=e&&n.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:r,indent:i,empty:s,single:o}of n)(o||!s)&&e.push({from:t.from+i,insert:r+" "});let r=t.changes(e);return{changes:r,selection:t.selection.map(r,1)}}if(1!=e&&n.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:r,token:i}of n)if(r>=0){let n=t.from+r,s=n+i.length;" "==t.text[s-t.from]&&s++,e.push({from:n,to:s})}return{changes:e}}return null},0),a5=a2(a8,0),a4=a2((e,t)=>a8(e,t,function(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),i=r.to<=n.to?n:e.doc.lineAt(r.to);i.from>n.from&&i.from==r.to&&(i=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let s=t.length-1;s>=0&&t[s].to>n.from?t[s].to=i.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return t}(t)),0);function a6(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}function a8(e,t,r=t.selection.ranges){let n=r.map(e=>a6(t,e.from).block);if(!n.every(e=>e))return null;let i=r.map((e,r)=>(function(e,{open:t,close:r},n,i){let s,o,a=e.sliceDoc(n-50,n),l=e.sliceDoc(i,i+50),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-t.length,u)==t&&l.slice(c,c+r.length)==r)return{open:{pos:n-h,margin:h&&1},close:{pos:i+c,margin:c&&1}};i-n<=100?s=o=e.sliceDoc(n,i):(s=e.sliceDoc(n,n+50),o=e.sliceDoc(i-50,i));let d=/^\s*/.exec(s)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-r.length;return s.slice(d,d+t.length)==t&&o.slice(p,p+r.length)==r?{open:{pos:n+d+t.length,margin:+!!/\s/.test(s.charAt(d+t.length))},close:{pos:i-f-r.length,margin:+!!/\s/.test(o.charAt(p-1))}}:null})(t,n[r],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(r.map((e,t)=>i[t]?[]:[{from:e.from,insert:n[t].open+" "},{from:e.to,insert:" "+n[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t=0,r;t<i.length;t++)if(r=i[t]){let i=n[t],{open:s,close:o}=r;e.push({from:s.pos-i.open.length,to:s.pos+s.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}let a9=ey.define(),a7=ey.define(),le=G.define(),lt=G.define({combine:e=>eM(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>
76t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,n)=>e(r,n)||t(r,n)})}),lr=et.define({create:()=>lm.empty,update(e,t){let r=t.state.facet(lt),n=t.annotation(a9);if(n){let i=ll.fromTransaction(t,n.selection),s=n.side,o=0==s?e.undone:e.done;return o=i?lh(o,o.length,r.minDepth,i):ld(o,t.startState.selection),new lm(0==s?n.rest:o,0==s?o:n.rest)}let i=t.annotation(a7);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(ex.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=ll.fromTransaction(t),o=t.annotation(ex.time),a=t.annotation(ex.userEvent);return s?e=e.addChanges(s,o,a,r,t):t.selection&&(e=e.addSelection(t.startState.selection,o,a,r.newGroupDelay)),("full"==i||"after"==i)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new lm(e.done.map(ll.fromJSON),e.undone.map(ll.fromJSON))});function ln(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let i=r.field(lr,!1);if(!i)return!1;let s=i.pop(e,r,t);return!!s&&(n(s),!0)}}let li=ln(0,!1),ls=ln(1,!1),lo=ln(0,!0),la=ln(1,!0);class ll{constructor(e,t,r,n,i){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=n,this.selectionsAfter=i}setSelAfter(e){return new ll(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:null==(e=this.changes)?void 0:e.toJSON(),mapped:null==(t=this.mapped)?void 0:t.toJSON(),startSelection:null==(r=this.startSelection)?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new ll(e.changes&&B.fromJSON(e.changes),[],e.mapped&&L.fromJSON(e.mapped),e.startSelection&&q.fromJSON(e.startSelection),e.selectionsAfter.map(q.fromJSON))}static fromTransaction(e,t){let r=lu;for(let t of e.startState.facet(le)){let n=t(e);n.length&&(r=r.concat(n))}return!r.length&&e.changes.empty?null:new ll(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,lu)}static selection(e){return new ll(void 0,lu,void 0,void 0,e)}}function lh(e,t,r,n){let i=e.slice(t+1>r+20?t-r-1:0,t);return i.push(n),i}function lc(e,t){return e.length?t.length?e.concat(t):e:t}let lu=[];function ld(e,t){if(!e.length)return[ll.selection([t])];{let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-200));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),lh(e,e.length-1,1e9,r.setSelAfter(n)))}}function lf(e,t){if(!e.length)return e;let r=e.length,n=lu;for(;r;){let i=function(e,t,r){let n=lc(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):lu,r);if(!e.changes)return ll.selection(n);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new ll(i,ew.mapEffects(e.effects,t),o,e.startSelection.map(s),n)}(e[r-1],t,n);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,r);return t[r-1]=i,t}t=i.mapped,r--,n=i.selectionsAfter}return n.length?[ll.selection(n)]:lu}let lp=/^(input\.type|delete)($|\.)/;class lm{constructor(e,t,r=0,n){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new lm(this.done,this.undone):this}addChanges(e,t,r,n,i){var s,o;let a,l,h=this.done,c=h[h.length-1];return new lm(h=c&&c.changes&&!c.changes.empty&&e.changes&&(!r||lp.test(r))&&(!c.selectionsAfter.length&&t-this.prevTime<n.newGroupDelay&&n.joinToEvent(i,(s=c.changes,o=e.changes,a=[],l=!1,s.iterChangedRanges((e,t)=>a.push(e,t)),o.iterChangedRanges((e,t,r,n)=>{for(let e=0;e<a.length;){let t=a[e++],i=a[e++];n>=t&&r<=i&&(l=!0)}}),l))||"input.type.compose"==r)?lh(h,h.length-1,n.minDepth,new ll(e.changes.compose(c.changes),lc(ew.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,lu)):lh(h,h.length,n.minDepth,e),lu,t,r)}addSelection(e,t,r,n){var i;let s=this.done.length?this.done[this.done.length-1].selectionsAfter:lu;return s.length>0&&t-this.prevTime<n&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&(i=s[s.length-1],i.ranges.length==e.ranges.length&&0===i.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length)?this:new lm(ld(this.done,e),this.undone,t,r)}addMapping(e){return new lm(lf(this.done,e),lf(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let n=0==e?this.done:this.undone;if(0==n.length)return null;let i=n[n.length-1],s=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(r&&i.selectionsAfter.length){let r,o;return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:a9.of({side:e,rest:(r=n[n.length-1],(o=n.slice())[n.length-1]=r.setSelAfter(r.selectionsAfter.slice(0,r.selectionsAfter.length-1)),o),selection:s}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}{if(!i.changes)return null;let r=1==n.length?lu:n.slice(0,n.length-1);
vendor: 8,595 bytes, line 76
76return i.mapped&&(r=lf(r,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:a9.of({side:e,rest:r,selection:s}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}lm.empty=new lm(lu,lu);let lg=[{key:"Mod-z",run:li,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ls,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ls,preventDefault:!0},{key:"Mod-u",run:lo,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:la,preventDefault:!0}];function ly(e,t){return q.create(e.ranges.map(t),e.mainIndex)}function lv(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function lb({state:e,dispatch:t},r){let n=ly(e.selection,r);return!n.eq(e.selection,!0)&&(t(lv(e,n)),!0)}function lw(e,t){return q.cursor(t?e.to:e.from)}function lx(e,t){return lb(e,r=>r.empty?e.moveByChar(r,t):lw(r,t))}function lk(e){return e.textDirectionAt(e.state.selection.main.head)==tV.LTR}let lS=e=>lx(e,!lk(e)),lC=e=>lx(e,lk(e));function lA(e,t){return lb(e,r=>r.empty?e.moveByGroup(r,t):lw(r,t))}function lE(e,t,r){let n,i,s=oX(e).resolveInner(t.head),o=r?s2.closedBy:s2.openedBy;for(let n=t.head;;){let t=r?s.childAfter(n):s.childBefore(n);if(!t)break;!function(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,o)?n=r?t.to:t.from:s=t}return i=s.type.prop(o)&&(n=r?aG(e,s.from,1):aG(e,s.to,-1))&&n.matched?r?n.end.to:n.end.from:r?s.to:s.from,q.cursor(i,r?-1:1)}function lT(e,t){return lb(e,r=>{if(!r.empty)return lw(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}"u">typeof Intl&&Intl.Segmenter;let lO=e=>lT(e,!1),lM=e=>lT(e,!0);function lR(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,i;if(t){for(let t of e.state.facet(ic.scrollMargins)){let i=t(e);(null==i?void 0:i.top)&&(r=Math.max(null==i?void 0:i.top,r)),(null==i?void 0:i.bottom)&&(n=Math.max(null==i?void 0:i.bottom,n))}i=e.scrollDOM.clientHeight-r-n}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function lN(e,t){let r,n=lR(e),{state:i}=e,s=ly(i.selection,r=>r.empty?e.moveVertically(r,t,n.height):lw(r,t));if(s.eq(i.selection))return!1;if(n.selfScroll){let t=e.coordsAtPos(i.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;t&&t.top>a&&t.bottom<l&&(r=ic.scrollIntoView(s.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(lv(i,s),{effects:r}),!0}let lP=e=>lN(e,!1),l_=e=>lN(e,!0);function lD(e,t,r){let n=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,r);if(i.head==t.head&&i.head!=(r?n.to:n.from)&&(i=e.moveToLineBoundary(t,r,!1)),!r&&i.head==n.from&&n.length){let r=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;r&&t.head!=n.from+r&&(i=q.cursor(n.from+r))}return i}function lI(e,t,r){let n=ly(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=q.range(e.head,e.anchor));let n=r(e);return q.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return!n.eq(e.state.selection)&&(e.dispatch(lv(e.state,n)),!0)}function lj(e,t){return lI(e,t,r=>e.moveByChar(r,t))}let lL=e=>lj(e,!lk(e)),lB=e=>lj(e,lk(e));function l$(e,t){return lI(e,t,r=>e.moveByGroup(r,t))}function lz(e,t){return lI(e,t,r=>e.moveVertically(r,t))}let lF=e=>lz(e,!1),lH=e=>lz(e,!0);function lW(e,t){return lI(e,t,r=>e.moveVertically(r,t,lR(e).height))}let lU=e=>lW(e,!1),lV=e=>lW(e,!0),lq=({state:e,dispatch:t})=>(t(lv(e,{anchor:0})),!0),lK=({state:e,dispatch:t})=>(t(lv(e,{anchor:e.doc.length})),!0),lJ=({state:e,dispatch:t})=>(t(lv(e,{anchor:e.selection.main.anchor,head:0})),!0),lG=({state:e,dispatch:t})=>(t(lv(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function lY(e,t){let{state:r}=e,n=r.selection,i=r.selection.ranges.slice();for(let n of r.selection.ranges){let s=r.doc.lineAt(n.head);if(t?s.to<e.state.doc.length:s.from>0)for(let r=n;;){let n=e.moveVertically(r,t);if(n.head<s.from||n.head>s.to){i.some(e=>e.head==n.head)||i.push(n);break}if(n.head==r.head)break;r=n}}return i.length!=n.ranges.length&&(e.dispatch(lv(r,q.create(i,i.length-1))),!0)}function lX(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,i=n.changeByRange(n=>{let{from:i,to:s}=n;if(i==s){let o=t(n);o<i?(r="delete.backward",o=lQ(e,o,!1)):o>i&&(r="delete.forward",o=lQ(e,o,!0)),i=Math.min(i,o),s=Math.max(s,o)}else i=lQ(e,i,!1),s=lQ(e,s,!0);return i==s?{range:n}:{changes:{from:i,to:s},range:q.cursor(i,i<n.head?-1:1)}});return!i.changes.empty&&(e.dispatch(n.update(i,{scrollIntoView:!0,userEvent:r,effects:"delete.selection"==r?ic.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function lQ(e,t,r){if(e instanceof ic)for(let n of e.state.facet(ic.atomicRanges).map(t=>t(e)))n.between(t,t,(e,n)=>{e<t&&n>t&&(t=r?n:e)});return t}let lZ=(e,t,r)=>lX(e,n=>{let i=n.from,{state:s}=e,o=s.doc.lineAt(i),a,l;if(r&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if("	"==a[a.length-1])return i-1;let e=eK(a,s.tabSize)%ae(s)||ae(s);for(let t=0;t<e&&" "==a[a.length-1-t];t++)i--;l=i}else(l=N(o.text,i-o.from,t,t)+o.from)==i&&o.number!=(t?s.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=N(o.text,l-o.from,!1,!1)+o.from);return l}),l0=e=>lZ(e,!1,!0),l1=e=>lZ(e,!0,!1),l2=(e,t)=>lX(e,r=>{let n=r.head,{state:i}=e,s=i.doc.lineAt(n),o=i.charCategorizer(n);for(let e=null;;){if(n==(t?s.to:s.from)){n==r.head&&s.number!=(t?i.doc.lines:1)&&(n+=t?1:-1);break}let a=N(s.text,n-s.from,t)+s.from,l=s.text.slice(Math.min(n,a)-s.from,Math.max(n,a)-s.from),h=o(l);if(null!=e&&h!=e)break;(" "!=l||n!=r.head)&&(e=h),n=a}return n}),l3=e=>l2(e,!1);function l5(e){let t=[],r=-1;for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),s=e.doc.lineAt(n.to);if(n.empty||n.to!=s.from||(s=e.doc.lineAt(n.to-1)),r>=i.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(n)}else t.push({from:i.from,to:s.to,ranges:[n]});r=s.number+1}return t}function l4(e,t,r){if(e.readOnly)return!1;let n=[],i=[];for(let t of l5(e)){if(r?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(r?t.to+1:t.from-1),o=s.length+1;if(r)for(let r of(n.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak}),t.ranges))i.push(q.range(Math.min(e.doc.length,r.anchor+o),Math.min(e.doc.length,r.head+o)));else for(let r of(n.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text}),t.ranges))i.push(q.range(r.anchor-o,r.head-o))}return!!n.length&&(t(e.update({changes:n,scrollIntoView:!0,selection:q.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function l6(e,t,r){if(e.readOnly)return!1;let n=[];for(let t of l5(e))r?n.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):n.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(n);return t(e.update({changes:i,selection:e.selection.map(i,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}let l8=l7(!1),l9=l7(!0);function l7(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{let{from:n,to:i}=r,s=t.doc.lineAt(n),o=!e&&n==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=oX(e).resolveInner(t),n=r.childBefore(t),i=r.childAfter(t),s;return n&&i&&n.to<=t&&i.from>=t&&(s=n.type.prop(s2.closedBy))&&s.indexOf(i.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}(t,n);e&&(n=i=(i<=s.to?s:t.doc.lineAt(i)).to);let a=new an(t,{simulateBreak:n,simulateDoubleBreak:!!o}),l=ar(a,n);for(null==l&&(l=eK(/^\s*/.exec(t.doc.lineAt(n).text)[0],t.tabSize));i<s.to&&/\s/.test(s.text[i-s.from]);)i++;o?{from:n,to:i}=o:n>s.from&&n<s.from+100&&!/\S/.test(s.text.slice(0,n))&&(n=s.from);let h=["",at(t,l)];return o&&h.push(at(t,a.lineIndent(s.from,-1))),{changes:{from:n,to:i,insert:k.of(h)},range:q.cursor(n+1+h[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function he(e,t){let r=-1;return e.changeByRange(n=>{let i=[];for(let s=n.from;s<=n.to;){let o=e.doc.lineAt(s);o.number>r&&(n.empty||n.to>o.from)&&(t(o,i,n),r=o.number),s=o.to+1}let s=e.changes(i);return{changes:i,range:q.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}let ht=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(he(e,(t,r)=>{r.push({from:t.from,insert:e.facet(o7)})}),{userEvent:"input.indent"})),!0),hr=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(he(e,(t,r)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let i=eK(n,e.tabSize),s=0,o=at(e,Math.max(0,i-ae(e)));for(;
vendor: 5,974 bytes, line 76
76s<n.length&&s<o.length&&n.charCodeAt(s)==o.charCodeAt(s);)s++;r.push({from:t.from+s,to:t.from+n.length,insert:o.slice(s)})}),{userEvent:"delete.dedent"})),!0),hn=[{key:"Ctrl-b",run:lS,shift:lL,preventDefault:!0},{key:"Ctrl-f",run:lC,shift:lB},{key:"Ctrl-p",run:lO,shift:lF},{key:"Ctrl-n",run:lM,shift:lH},{key:"Ctrl-a",run:e=>lb(e,t=>q.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>lI(e,!1,t=>q.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>lb(e,t=>q.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>lI(e,!0,t=>q.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:l1},{key:"Ctrl-h",run:l0},{key:"Ctrl-k",run:e=>lX(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:l3},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:k.of(["",""])},range:q.cursor(e.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let r=t.from,n=e.doc.lineAt(r),i=r==n.from?r-1:N(n.text,r-n.from,!1)+n.from,s=r==n.to?r+1:N(n.text,r-n.from,!0)+n.from;return{changes:{from:i,to:s,insert:e.doc.slice(r,s).append(e.doc.slice(i,r))},range:q.cursor(s)}});return!r.changes.empty&&(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:l_}],hi=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>lb(e,t=>lE(e.state,t,!lk(e))),shift:e=>{let t=!lk(e);return lI(e,t,r=>lE(e.state,r,t))}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>lb(e,t=>lE(e.state,t,lk(e))),shift:e=>{let t=lk(e);return lI(e,t,r=>lE(e.state,r,t))}},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>l4(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>l6(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>l4(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>l6(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>lY(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>lY(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=q.create([r.main]):r.main.empty||(n=q.create([q.cursor(r.main.head)])),!!n&&(t(lv(e,n)),!0)}},{key:"Mod-Enter",run:l9},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let r=l5(e).map(({from:t,to:r})=>q.range(t,Math.min(r+1,e.doc.length)));return t(e.update({selection:q.create(r),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let r=ly(e.selection,t=>{let r=oX(e),n=r.resolveStack(t.from,1);if(t.empty){let e=r.resolveStack(t.from,-1);e.node.from>=n.node.from&&e.node.to<=n.node.to&&(n=e)}for(let e=n;e;e=e.next){let{node:r}=e;if((r.from<t.from&&r.to>=t.to||r.to>t.to&&r.from<=t.from)&&e.next)return q.range(r.to,r.from)}return t});return!r.eq(e.selection)&&(t(lv(e,r)),!0)},preventDefault:!0},{key:"Mod-[",run:hr},{key:"Mod-]",run:ht},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new an(e,{overrideIndentation:e=>{let t=r[e];return null==t?-1:t}}),i=he(e,(t,i,s)=>{let o=ar(n,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let a=/^\s*/.exec(t.text)[0],l=at(e,o);(a!=l||s.from<t.from+a.length)&&(r[t.from]=o,i.push({from:t.from,to:t.from+a.length,insert:l}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(l5(t).map(({from:e,to:r})=>(e>0?e--:r<t.doc.length&&r++,{from:e,to:r}))),n=ly(t.selection,t=>{let r;if(e.lineWrapping){let n=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(r=n.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,r)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let r,n;return r=!1,n=ly(e.selection,t=>{let n=aG(e,t.head,-1)||aG(e,t.head,1)||t.head>0&&aG(e,t.head-1,1)||t.head<e.doc.length&&aG(e,t.head+1,-1);if(!n||!n.end)return t;r=!0;let i=n.start.from==t.head?n.end.to:n.end.from;return q.cursor(i)}),!!r&&(t(lv(e,n)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=a6(e.state,r.from);return n.line?a3(e):!!n.block&&a4(e)}},{key:"Alt-A",run:a5},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:lS,shift:lL,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>lA(e,!lk(e)),shift:e=>l$(e,!lk(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>lb(e,t=>lD(e,t,!lk(e))),shift:e=>{let t=!lk(e);return lI(e,t,r=>lD(e,r,t))},preventDefault:!0},{key:"ArrowRight",run:lC,shift:lB,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>lA(e,lk(e)),shift:e=>l$(e,lk(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>lb(e,t=>lD(e,t,lk(e))),shift:e=>{let t=lk(e);return lI(e,t,r=>lD(e,r,t))},preventDefault:!0},{key:"ArrowUp",run:lO,shift:lF,preventDefault:!0},{mac:"Cmd-ArrowUp",run:lq,shift:lJ},{mac:"Ctrl-ArrowUp",run:lP,shift:lU},{key:"ArrowDown",run:lM,shift:lH,preventDefault:!0},{mac:"Cmd-ArrowDown",run:lK,shift:lG},{mac:"Ctrl-ArrowDown",run:l_,shift:lV},{key:"PageUp",run:lP,shift:lU},{key:"PageDown",run:l_,shift:lV},{key:"Home",run:e=>lb(e,t=>lD(e,t,!1)),shift:e=>lI(e,!1,t=>lD(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:lq,shift:lJ},{key:"End",run:e=>lb(e,t=>lD(e,t,!0)),shift:e=>lI(e,!0,t=>lD(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:lK,shift:lG},{key:"Enter",run:l8,shift:l8},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:l0,shift:l0,preventDefault:!0},{key:"Delete",run:l1,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:l3,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>l2(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>lX(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>
76r?r:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>lX(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(hn.map(e=>({mac:e.key,run:e.run,shift:e.shift})))),hs={key:"Tab",run:ht,shift:hr},ho="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class ha{constructor(e,t,r=0,n=e.length,i,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,n),this.bufferStart=r,this.normalize=i?e=>i(ho(e)):ho,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return P(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=_(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=D(e);let n=this.normalize(t);if(n.length)for(let e=0,i=r,s=!0;;e++){let r=n.charCodeAt(e),o=this.match(r,i,s,this.bufferPos+this.bufferStart,e==n.length-1);if(o)return this.value=o,this;if(e==n.length-1)break;s&&e<t.length&&t.charCodeAt(e)==r?i++:s=!1}}}match(e,t,r,n,i){let s=null;for(let t=0;t<this.matches.length;){let r=this.matches[t],o=!1;this.query.charCodeAt(r.index)==e&&(r.index==this.query.length-1?s={from:r.from,to:n,precise:i&&r.precise}:(r.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?s={from:t,to:n,precise:r&&i}:this.matches.push({from:t,index:1,precise:r})),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}"u">typeof Symbol&&(ha.prototype[Symbol.iterator]=function(){return this});let hl={from:-1,to:-1,match:/.*/.exec(""),precise:!0},hh="gm"+(null==/x/.unicode?"":"u");class hc{constructor(e,t,r,n=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=hl,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new hf(e,t,r,n,i);this.re=new RegExp(t,hh+((null==r?void 0:r.ignoreCase)?"i":"")),this.test=null==r?void 0:r.test,this.iter=e.iter();let s=e.lineAt(n);this.curLineStart=s.from,this.matchPos=hp(e,n),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,n=r+t[0].length;if(this.matchPos=hp(this.text,n+ +(r==n)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<n||r>this.value.to)&&(!this.test||this.test(r,n,t)))return this.value={from:r,to:n,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let hu=new WeakMap;class hd{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let n=hu.get(e);if(!n||n.from>=r||n.to<=t){let n=new hd(t,e.sliceString(t,r));return hu.set(e,n),n}if(n.from==t&&n.to==r)return n;let{text:i,from:s}=n;return s>t&&(i=e.sliceString(t,s)+i,s=t),n.to<r&&(i+=e.sliceString(n.to,r)),hu.set(e,new hd(s,i)),new hd(t,i.slice(t-s,r-s))}}class hf{constructor(e,t,r,n,i){this.text=e,this.to=i,this.done=!1,this.value=hl,this.matchPos=hp(e,n),this.re=new RegExp(t,hh+((null==r?void 0:r.ignoreCase)?"i":"")),this.test=null==r?void 0:r.test,this.flat=hd.get(e,n,this.chunkEnd(n+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,r=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,t)))return this.value={from:e,to:r,precise:!0,match:t},this.matchPos=hp(this.text,r+ +(e==r)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=hd.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function hp(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}"u">typeof Symbol&&(hc.prototype[Symbol.iterator]=hf.prototype[Symbol.iterator]=function(){return this});let hm={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hg=G.define({combine:e=>eM(e,hm,{highlightWordAroundCursor:(e,t)=>
76e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),hy=ty.mark({class:"cm-selectionMatch"}),hv=ty.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function hb(e,t,r,n){return(0==r||e(t.sliceDoc(r-1,r))!=eE.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=eE.Word)}let hw=rp.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(hg),{state:r}=e,n=r.selection;if(n.ranges.length>1)return ty.none;let i=n.main,s,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return ty.none;let e=r.wordAt(i.head);if(!e)return ty.none;o=r.charCategorizer(i.head),s=r.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return ty.none;if(t.wholeWords){var a,l,h;if(s=r.sliceDoc(i.from,i.to),!(hb(o=r.charCategorizer(i.head),r,i.from,i.to)&&(a=o,l=i.from,h=i.to,a(r.sliceDoc(l,l+1))==eE.Word&&a(r.sliceDoc(h-1,h))==eE.Word)))return ty.none}else if(!(s=r.sliceDoc(i.from,i.to)))return ty.none}let c=[];for(let n of e.visibleRanges){let e=new ha(r.doc,s,n.from,n.to);for(;!e.next().done;){let{from:n,to:s}=e.value;if((!o||hb(o,r,n,s))&&(i.empty&&n<=i.from&&s>=i.to?c.push(hv.range(n,s)):(n>=i.to||s<=i.from)&&c.push(hy.range(n,s)),c.length>t.maxMatches))return ty.none}}return ty.set(c)}},{decorations:e=>e.decorations}),hx=ic.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),hk=G.define({combine:e=>eM(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new hX(e),scrollToMatch:e=>ic.scrollIntoView(e)})});class hS{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,hh),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new hR(this):new hE(this)}getCursor(e,t=0,r){let n=e.doc?e:eO.create({doc:e});return null==r&&(r=n.doc.length),this.regexp?hT(this,n,t,r):hA(this,n,t,r)}}class hC{constructor(e){this.spec=e}}function hA(e,t,r,n){var i,s,o,a;let l;return e.wholeWord&&(o=t.doc,a=t.charCategorizer(t.selection.main.head),l=(e,t,r,n)=>((n>e||n+r.length<t)&&(n=Math.max(0,e-2),r=o.sliceString(n,Math.min(o.length,t+2))),(a(hO(r,e-n))!=eE.Word||a(hM(r,e-n))!=eE.Word)&&(a(hM(r,t-n))!=eE.Word||a(hO(r,t-n))!=eE.Word))),e.test&&(i=e.test,s=l,l=(e,r,n,o)=>(!s||!!s(e,r,n,o))&&i(e>=o&&r<=o+n.length?n.slice(e-o,r-o):t.doc.sliceString(e,r),t,e,r)),new ha(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:e=>e.toLowerCase(),l)}class hE extends hC{constructor(e){super(e)}nextMatch(e,t,r){let n=hA(this.spec,e,r,e.doc.length).nextOverlapping();if(n.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);n=hA(this.spec,e,0,r).nextOverlapping()}return n.done||n.value.from==t&&n.value.to==r?null:n.value}prevMatchInRange(e,t,r){for(let n=r;;){let r=Math.max(t,n-1e4-this.spec.unquoted.length),i=hA(this.spec,e,r,n),s=null;for(;!i.nextOverlapping().done;)s=i.value;if(s)return s;if(r==t)return null;n-=1e4}}prevMatch(e,t,r){let n=this.prevMatchInRange(e,0,t);return n||(n=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),n&&(n.from!=t||n.to!=r)?n:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=hA(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let i=hA(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)n(i.value.from,i.value.to)}}function hT(e,t,r,n){var i,s,o;let a;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),a=(e,t,r)=>!r[0].length||(o(hO(r.input,r.index))!=eE.Word||o(hM(r.input,r.index))!=eE.Word)&&(o(hM(r.input,r.index+r[0].length))!=eE.Word||o(hO(r.input,r.index+r[0].length))!=eE.Word)),e.test&&(i=e.test,s=a,a=(e,r,n)=>(!s||s(e,r,n))&&i(n[0],t,e,r)),new hc(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:a},r,n)}function hO(e,t){return e.slice(N(e,t,!1),t)}function hM(e,t){return e.slice(t,N(e,t))}class hR extends hC{nextMatch(e,t,r){let n=hT(this.spec,e,r,e.doc.length).next();return n.done&&(n=hT(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=1;;n++){let i=Math.max(t,r-1e4*n),s=hT(this.spec,e,i,r),o=null;for(;!s.next().done;)o=s.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if("&"==r)return e.match[0];if("$"==r)return"$";for(let t=r.length;t>0;t--){let n=+r.slice(0,t);if(n>
760&&n<e.match.length)return e.match[n]+r.slice(t)}return t})}matchAll(e,t){let r=hT(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let i=hT(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)n(i.value.from,i.value.to)}}let hN=ew.define(),hP=ew.define(),h_=et.define({create:e=>new hD(hV(e).create(),null),update(e,t){for(let r of t.effects)r.is(hN)?e=new hD(r.value.create(),e.panel):r.is(hP)&&(e=new hD(e.query,r.value?hU:null));return e},provide:e=>sC.from(e,e=>e.panel)});class hD{constructor(e,t){this.query=e,this.panel=t}}let hI=ty.mark({class:"cm-searchMatch"}),hj=ty.mark({class:"cm-searchMatch cm-searchMatch-selected"}),hL=rp.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(h_))}update(e){let t=e.state.field(h_);(t!=e.startState.field(h_)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return ty.none;let{view:r}=this,n=new ej;for(let t=0,i=r.visibleRanges,s=i.length;t<s;t++){let{from:o,to:a}=i[t];for(;t<s-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(r.state,o,a,(e,t)=>{let i=r.state.selection.ranges.some(r=>r.from==e&&r.to==t);n.add(e,t,i?hj:hI)})}return n.finish()}},{decorations:e=>e.decorations});function hB(e){return t=>{let r=t.state.field(h_,!1);return r&&r.query.spec.valid?e(t,r):hJ(t)}}let h$=hB((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let i=q.single(n.from,n.to),s=e.state.facet(hk);return e.dispatch({selection:i,effects:[h0(e,n),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),hK(e),!0}),hz=hB((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,i=t.prevMatch(r,n,n);if(!i)return!1;let s=q.single(i.from,i.to),o=e.state.facet(hk);return e.dispatch({selection:s,effects:[h0(e,i),o.scrollToMatch(s.main,e)],userEvent:"select.search"}),hK(e),!0}),hF=hB((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!!r&&!!r.length&&(e.dispatch({selection:q.create(r.map(e=>q.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),hH=hB((e,{query:t})=>{let{state:r}=e,{from:n,to:i}=r.selection.main;if(r.readOnly)return!1;let s=t.nextMatch(r,n,n);if(!s)return!1;let o=s,a=[],l,h,c=[];o.precise?o.from==n&&o.to==i&&(h=r.toText(t.getReplacement(o)),a.push({from:o.from,to:o.to,insert:h}),o=t.nextMatch(r,o.from,o.to),c.push(ic.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))):o=t.nextMatch(r,o.from,o.to);let u=e.state.changes(a);return o&&(l=q.single(o.from,o.to).map(u),c.push(h0(e,o)),c.push(r.facet(hk).scrollToMatch(l.main,e))),e.dispatch({changes:u,selection:l,effects:c,userEvent:"input.replace"}),!0}),hW=hB((e,{query:t})=>{if(e.state.readOnly)return!1;let r=[];for(let n of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:s}=n;s&&r.push({from:e,to:i,insert:t.getReplacement(n)})}if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:ic.announce.of(n),userEvent:"input.replace.all"}),!0});function hU(e){return e.state.facet(hk).createPanel(e)}function hV(e,t){var r,n,i,s,o;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let h=e.facet(hk);return new hS({search:(null!=(r=null==t?void 0:t.literal)?r:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!=(n=null==t?void 0:t.caseSensitive)?n:h.caseSensitive,literal:null!=(i=null==t?void 0:t.literal)?i:h.literal,regexp:null!=(s=null==t?void 0:t.regexp)?s:h.regexp,wholeWord:null!=(o=null==t?void 0:t.wholeWord)?o:h.wholeWord})}function hq(e){let t=sw(e,hU);return t&&t.dom.querySelector("[main-field]")}function hK(e){let t=hq(e);t&&t==e.root.activeElement&&t.select()}let hJ=e=>{let t=e.state.field(h_,!1);if(t&&t.panel){let r=hq(e);if(r&&r!=e.root.activeElement){let n=hV(e.state,t.query.spec);n.valid&&e.dispatch({effects:hN.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[hP.of(!0),t?hN.of(hV(e.state,t.query.spec)):ew.appendConfig.of(h2)]});return!0},hG=e=>{let t=e.state.field(h_,!1);if(!t||!t.panel)return!1;let r=sw(e,hU);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:hP.of(!1)}),!0},hY=[{key:"Mod-f",run:hJ,scope:"editor search-panel"},{key:"F3",run:h$,shift:hz,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:h$,shift:hz,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:hG,scope:"editor search-panel"}
76,{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:i}=r.main,s=[],o=0;for(let t=new ha(e.doc,e.sliceDoc(n,i));!t.next().done;){if(s.length>1e3)return!1;t.value.from==n&&(o=s.length),s.push(q.range(t.value.from,t.value.to))}return t(e.update({selection:q.create(s,o),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,r=String(t.doc.lineAt(e.state.selection.main.head).number),{close:n,result:i}=sA(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:t.phrase("go")});return i.then(r=>{let i=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!i)return void e.dispatch({effects:n});let s=t.doc.lineAt(t.selection.main.head),[,o,a,l,h]=i,c=l?+l.slice(1):0,u=a?+a:s.number;if(a&&h){let e=u/100;o&&(e=e*("-"==o?-1:1)+s.number/t.doc.lines),u=Math.round(t.doc.lines*e)}else a&&o&&(u=u*("-"==o?-1:1)+s.number);let d=t.doc.line(Math.max(1,Math.min(t.doc.lines,u))),f=q.cursor(d.from+Math.max(0,Math.min(c,d.length)));e.dispatch({effects:[n,ic.scrollIntoView(f.from,{y:"center"})],selection:f})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:r}=e,n=q.create(r.ranges.map(t=>e.wordAt(t.head)||q.cursor(t.head)),r.mainIndex);return!n.eq(r)&&(t(e.update({selection:n})),!0)})({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=n))return!1;let i=function(e,t){let{main:r,ranges:n}=e.selection,i=e.wordAt(r.head),s=i&&i.from==r.from&&i.to==r.to;for(let r=!1,i=new ha(e.doc,t,n[n.length-1].to);;)if(i.next(),i.done){if(r)return null;i=new ha(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),r=!0}else{if(r&&n.some(e=>e.from==i.value.from))continue;if(s){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}(e,n);return!!i&&(t(e.update({selection:e.selection.addRange(q.range(i.from,i.to),!1),effects:ic.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class hX{constructor(e){this.view=e;let t=this.query=e.state.field(h_).query.spec;function r(e,t,r){return e9("button",{class:"cm-button",name:e,onclick:t,type:"button"},r)}this.commit=this.commit.bind(this),this.searchField=e9("input",{value:t.search,placeholder:hQ(e,"Find"),"aria-label":hQ(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=e9("input",{value:t.replace,placeholder:hQ(e,"Replace"),"aria-label":hQ(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=e9("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=e9("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=e9("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=e9("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,r("next",()=>h$(e),[hQ(e,"next")]),r("prev",()=>hz(e),[hQ(e,"previous")]),r("select",()=>hF(e),[hQ(e,"all")]),e9("label",null,[this.caseField,hQ(e,"match case")]),e9("label",null,[this.reField,hQ(e,"regexp")]),e9("label",null,[this.wordField,hQ(e,"by word")]),...e.state.readOnly?[]:[e9("br"),this.replaceField,r("replace",()=>hH(e),[hQ(e,"replace")]),r("replaceAll",()=>hW(e),[hQ(e,"replace all")])],e9("button",{name:"close",onclick:()=>hG(e),"aria-label":hQ(e,"close"),type:"button"},["×"])])}commit(){let e=new hS({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:hN.of(e)}))}keydown(e){ik(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?hz:h$)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),hH(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(hN)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(hk).top}}function hQ(e,t){return e.state.phrase(t)}let hZ=/[\s\.,:;?!]/;function h0(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),i=e.state.doc.lineAt(r).to,s=Math.max(n.from,t-30),o=Math.min(i,r+30),a=e.state.sliceDoc(s,o);if(s!=n.from){for(let e=0;e<30;e++)if(!hZ.test(a[e+1])&&hZ.test(a[e])){a=a.slice(e);break}}if(o!=i){for(let e=a.length-1;e>a.length-30;e--)if(!hZ.test(a[e-1])&&hZ.test(a[e])){a=a.slice(0,e);break}}return ic.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${n.number}.`)}let h1=ic.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),h2=[h_,en.low(hL),h1];class h3{constructor(e,t,r,n){this.state=e,this.pos=t,this.explicit=r,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=oX(this.state).resolveInner(this.pos,-1);for(;t&&0>e.indexOf(t.name);)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}
76matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),n=t.text.slice(r-t.from,this.pos-t.from),i=n.search(h8(e,!1));return i<0?null:{from:r+i,to:this.pos,text:n.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,r){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function h5(e){let t=Object.keys(e).join(""),r=/\w/.test(t);return r&&(t=t.replace(/\w/g,"")),`[${r?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class h4{constructor(e,t,r,n){this.completion=e,this.source=t,this.match=r,this.score=n}}function h6(e){return e.selection.main.from}function h8(e,t){var r;let{source:n}=e,i=t&&"^"!=n[0],s="$"!=n[n.length-1];return i||s?RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,null!=(r=e.flags)?r:e.ignoreCase?"i":""):e}let h9=ey.define(),h7=new WeakMap;function ce(e){if(!Array.isArray(e))return e;let t=h7.get(e);return t||h7.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[r,n]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),r=Object.create(null);for(let{label:n}of e){t[n[0]]=!0;for(let e=1;e<n.length;e++)r[n[e]]=!0}let n=h5(t)+h5(r)+"*$";return[RegExp("^"+n),new RegExp(n)]}(t);return e=>{let i=e.matchBefore(n);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:r}:null}}(e)),t}let ct=ew.define(),cr=ew.define();class cn{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=P(e,t),n=D(r);this.chars.push(r);let i=e.slice(t,t+n),s=i.toUpperCase();this.folded.push(P(s==i?i.toLowerCase():s,0)),t+=n}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:n,precise:i,byWord:s}=this;if(1==t.length){let n=P(e,0),i=D(n),s=i==e.length?0:-100;if(n==t[0]);else{if(n!=r[0])return null;s+=-200}return this.ret(s,[0,i])}let o=e.indexOf(this.pattern);if(0==o)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(o<0){for(let i=0,s=Math.min(e.length,200);i<s&&l<a;){let s=P(e,i);(s==t[l]||s==r[l])&&(n[l++]=i),i+=D(s)}if(l<a)return null}let h=0,c=0,u=!1,d=0,f=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let n=0,l=Math.min(e.length,200),y=0;n<l&&c<a;){let l=P(e,n);o<0&&(h<a&&l==t[h]&&(i[h++]=n),d<a&&(l==t[d]||l==r[d]?(0==d&&(f=n),p=n+1,d++):d=0));let v,b=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(v=_(l))!=v.toLowerCase()?1:2*(v!=v.toUpperCase());(!n||1==b&&m||0==y&&0!=b)&&(t[c]==l||r[c]==l&&(u=!0)?s[c++]=n:s.length&&(g=!1)),y=b,n+=D(l)}return c==a&&0==s[0]&&g?this.result(-100+(u?-200:0),s,e):d==a&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):d==a?this.ret(-900-e.length,[f,p]):c==a?this.result(-100+(u?-200:0)+-700+(g?0:-1100),s,e):2==t.length?null:this.result((n[0]?-700:0)+-200+-1100,n,e)}result(e,t,r){let n=[],i=0;for(let e of t){let t=e+(this.astral?D(P(r,e)):1);i&&n[i-1]==e?n[i-1]=t:(n[i++]=e,n[i++]=t)}return this.ret(e-r.length,n)}}class ci{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==r?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}let cs=G.define({combine:e=>eM(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:ca,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>co(e(r),t(r)),optionClass:(e,t)=>r=>co(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>
vendor: 4,542 bytes, line 76
76e||t})});function co(e,t){return e?t?e+" "+t:e:t}function ca(e,t,r,n,i,s){let o=e.textDirection==tV.RTL,a=o,l=!1,h="top",c,u,d=t.left-i.left,f=i.right-t.right,p=n.right-n.left,m=n.bottom-n.top;if(a&&d<Math.min(p,f)?a=!1:!a&&f<Math.min(p,d)&&(a=!0),p<=(a?d:f))c=Math.max(i.top,Math.min(r.top,i.bottom-m))-t.top,u=Math.min(400,a?d:f);else{l=!0,u=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?c=r.bottom-t.top:(h="bottom",c=t.bottom-r.top)}let g=(t.bottom-t.top)/s.offsetHeight,y=(t.right-t.left)/s.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${u/y}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}let cl=ew.define();function ch(e,t,r){if(e<=r)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/r);return{from:e*r,to:(e+1)*r}}let n=Math.ceil((e-t)/r);return{from:e-n*r,to:e-(n-1)*r}}class cc{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:i,selected:s}=n.open,o=e.state.facet(cs);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,r,n){let i=document.createElement("span");i.className="cm-completionLabel";let s=e.displayLabel||e.label,o=0;for(let e=0;e<n.length;){let t=n[e++],r=n[e++];t>o&&i.appendChild(document.createTextNode(s.slice(o,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(t,r))),a.className="cm-completionMatchedText",o=r}return o<s.length&&i.appendChild(document.createTextNode(s.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=ch(i.length,s,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",r=>{let{options:n}=e.state.field(t).open;for(let t=r.target,i;t&&t!=this.dom;t=t.parentNode)if("LI"==t.nodeName&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<n.length){this.applyCompletion(e,n[+i[1]]),r.preventDefault();return}if(r.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&r.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&r.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:cl.of(t)}),r.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let r=e.state.field(this.stateField,!1);r&&r.tooltip&&e.state.facet(cs).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:cr.of(null)})}),this.showOptions(i,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=n){let{options:i,selected:s,disabled:o}=r.open;n.open&&n.open.options==i||(this.range=ch(i.length,s,e.state.facet(cs).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),o!=(null==(t=n.open)?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=ch(t.options.length,t.selected,this.view.state.facet(cs).maxRenderedOptions),this.showOptions(t.options,e.id));let r=this.updateSelectedOption(t.selected);if(r){this.destroyInfo();
76let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let s="string"==typeof i?document.createTextNode(i):i(n);if(!s)return;"then"in s?s.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)}).catch(e=>rc(this.view.state,e,"completion info")):(this.addInfoPane(s,n),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)r.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:n}=e;r.appendChild(t),this.infoDestroy=n||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){var t,r;let n,i,s,o=null;for(let t=this.list.firstChild,r=this.range.from;t;t=t.nextSibling,r++)"LI"==t.nodeName&&t.id?r==e?t.hasAttribute("aria-selected")||(t.setAttribute("aria-selected","true"),o=t):t.hasAttribute("aria-selected")&&(t.removeAttribute("aria-selected"),t.removeAttribute("aria-describedby")):r--;return o&&(t=this.list,r=o,n=t.getBoundingClientRect(),i=r.getBoundingClientRect(),s=n.height/t.offsetHeight,i.top<n.top?t.scrollTop-=(n.top-i.top)/s:i.bottom>n.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/s)),o}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return n.top>Math.min(i.bottom,t.bottom)-10||n.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(cs).positionInfo(this.view,t,n,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){let n=document.createElement("ul");n.id=t,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label",this.view.state.phrase("Completions")),n.addEventListener("mousedown",e=>{e.target==n&&e.preventDefault()});let i=null;for(let s=r.from;s<r.to;s++){let{completion:o,match:a}=e[s],{section:l}=o;if(l){let e="string"==typeof l?l:l.name;e!=i&&(s>r.from||0==r.from)&&(i=e,"string"!=typeof l&&l.header?n.appendChild(l.header(l)):n.appendChild(document.createElement("completion-section")).textContent=e)}let h=n.appendChild(document.createElement("li"));h.id=t+"-"+s,h.setAttribute("role","option");let c=this.optionClass(o);for(let e of(c&&(h.className=c),this.optionContent)){let t=e(o,this.view.state,this.view,a);t&&h.appendChild(t)}}return r.from&&n.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&n.classList.add("cm-completionListIncompleteBottom"),n}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function cu(e){return 100*(e.boost||0)+10*!!e.apply+5*!!e.info+ +!!e.type}class cd{constructor(e,t,r,n,i,s){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=n,this.selected=i,this.disabled=s}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new cd(this.options,cg(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,n,i,s){if(n&&!s&&e.some(e=>e.isPending))return n.setDisabled();let o=function(e,t){let r=[],n=null,i=null,s=e=>{r.push(e);let{section:t}=e.completion;if(t){n||(n=[]);let e="string"==typeof t?t:t.name;n.some(t=>t.name==e)||n.push("string"==typeof t?{name:e}:t)}},o=t.facet(cs);for(let n of e)if(n.hasResult()){let e=n.result.getMatch;if(!1===n.result.filter)for(let t of n.result.options)s(new h4(t,n.source,e?e(t):[],1e9-r.length));else{let r=t.sliceDoc(n.from,n.to),a,l=o.filterStrict?new ci(r):new cn(r);for(let t of n.result.options)if(a=l.match(t.label)){let r=t.displayLabel?e?e(t,a.matched):[]:a.matched,o=a.score+(t.boost||0);if(s(new h4(t,n.source,r,o)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;i||(i=Object.create(null)),i[e]=Math.max(o,i[e]||-1e9)}}}}if(n){let e=Object.create(null),t=0;for(let r of n.sort((e,t)=>
76("dynamic"===e.rank&&"dynamic"===t.rank?i[t.name]-i[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1)))t-=1e5,e[r.name]=t;for(let t of r){let{section:r}=t.completion;r&&(t.score+=e["string"==typeof r?r:r.name])}}let a=[],l=null,h=o.compareCompletions;for(let e of r.sort((e,t)=>t.score-e.score||h(e.completion,t.completion))){let t=e.completion;l&&l.label==t.label&&l.detail==t.detail&&(null==l.type||null==t.type||l.type==t.type)&&l.apply==t.apply&&l.boost==t.boost?cu(e.completion)>cu(l)&&(a[a.length-1]=e):a.push(e),l=e.completion}return a}(e,t);if(!o.length)return n&&e.some(e=>e.isPending)?n.setDisabled():null;let a=t.facet(cs).selectOnOpen?0:-1;if(n&&n.selected!=a&&-1!=n.selected){let e=n.options[n.selected].completion;for(let t=0;t<o.length;t++)if(o[t].completion==e){a=t;break}}return new cd(o,cg(r,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:cC,above:i.aboveCursor},n?n.timestamp:Date.now(),a,!1)}map(e){return new cd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new cd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class cf{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new cf(cy,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,r=t.facet(cs),n=(r.override||t.languageDataAt("autocomplete",h6(t)).map(ce)).map(t=>(this.active.find(e=>e.source==t)||new cb(t,+!!this.active.some(e=>0!=e.state))).update(e,r));n.length==this.active.length&&n.every((e,t)=>e==this.active[t])&&(n=this.active);let i=this.open,s=e.effects.some(e=>e.is(cx));for(let o of(i&&e.docChanged&&(i=i.map(e.changes)),e.selection||n.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let r=0,n=0;;){for(;r<e.length&&!e[r].hasResult();)r++;for(;n<t.length&&!t[n].hasResult();)n++;let i=r==e.length,s=n==t.length;if(i||s)return i==s;if(e[r++].result!=t[n++].result)return!1}}(n,this.active)||s?i=cd.build(n,t,this.id,i,r,s):i&&i.disabled&&!n.some(e=>e.isPending)&&(i=null),!i&&n.every(e=>!e.isPending)&&n.some(e=>e.hasResult())&&(n=n.map(e=>e.hasResult()?new cb(e.source,0):e)),e.effects))o.is(cl)&&(i=i&&i.setSelected(o.value,this.id));return n==this.active&&i==this.open?this:new cf(n,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?cp:cm}}let cp={"aria-autocomplete":"list"},cm={};function cg(e,t){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(r["aria-activedescendant"]=e+"-"+t),r}let cy=[];function cv(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(h9);if(r&&t.activateOnCompletion(r))return 12}let r=e.isUserEvent("input.type");return r&&t.activateOnTyping?5:r?1:e.isUserEvent("delete.backward")?2:e.selection?8:16*!!e.docChanged}class cb{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let r=cv(e,t),n=this;for(let t of((8&r||16&r&&this.touches(e))&&(n=new cb(n.source,0)),4&r&&0==n.state&&(n=new cb(this.source,1)),n=n.updateFor(e,r),e.effects))if(t.is(ct))n=new cb(n.source,1,t.value);else if(t.is(cr))n=new cb(n.source,0);else if(t.is(cx))for(let e of t.value)e.source==n.source&&(n=e);return n}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(h6(e.state))}}class cw extends cb{constructor(e,t,r,n,i,s){super(e,3,t),this.limit=r,this.result=n,this.from=i,this.to=s}hasResult(){return!0}updateFor(e,t){var r;if(!(3&t))return this.map(e.changes);let n=this.result;n.map&&!e.changes.empty&&(n=n.map(n,e.changes));let i=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),o=h6(e.state);if(o>s||!n||2&t&&(h6(e.startState)==this.from||o<this.limit))return new cb(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return!function(e,t,r,n){if(!e)return!1;let i=t.sliceDoc(r,n);return"function"==typeof e?e(i,r,n,t):h8(e,!0).test(i)}(n.validFor,e.state,i,s)?n.update&&(n=n.update(n,i,s,new h3(e.state,o,!1)))?new cw(this.source,this.explicit,a,n,n.from,null!=(r=n.to)?r:h6(e.state)):new cb(this.source,1,this.explicit):new cw(this.source,this.explicit,a,n,i,s)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new cw(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new cb(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}let cx=ew.define({map:(e,t)=>e.map(e=>e.map(t))}),ck=et.define({create:()=>cf.start(),update:(e,t)=>
vendor: 4,781 bytes, line 76
76e.update(t),provide:e=>[sh.from(e,e=>e.tooltip),ic.contentAttributes.from(e,e=>e.attrs)]});function cS(e,t){let r=t.completion.apply||t.completion.label,n=e.state.field(ck).active.find(e=>e.source==t.source);return n instanceof cw&&("string"==typeof r?e.dispatch({...function(e,t,r,n){let{main:i}=e.selection,s=r-i.from,o=n-i.from;return{...e.changeByRange(a=>{if(a!=i&&r!=n&&e.sliceDoc(a.from+s,a.from+o)!=e.sliceDoc(r,n))return{range:a};let l=e.toText(t);return{changes:{from:a.from+s,to:n==i.from?a.to:a.from+o,insert:l},range:q.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}(e.state,r,n.from,n.to),annotations:h9.of(t.completion)}):r(e,t.completion,n.from,n.to),!0)}let cC=e=>new cc(e,ck,cS);function cA(e,t="option"){return r=>{let n=r.state.field(ck,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<r.state.facet(cs).interactionDelay)return!1;let i=1,s;"page"==t&&(s=sy(r,n.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+i*(e?1:-1):e?0:o-1;return a<0?a="page"==t?0:o-1:a>=o&&(a="page"==t?o-1:0),r.dispatch({effects:cl.of(a)}),!0}}let cE=e=>!!e.state.field(ck,!1)&&(e.dispatch({effects:ct.of(!0)}),!0);class cT{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}let cO=rp.fromClass(class{constructor(e){for(let t of(this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0,e.state.field(ck).active))t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(ck),r=e.state.facet(cs);if(!e.selectionSet&&!e.docChanged&&e.startState.field(ck)==t)return;let n=e.transactions.some(e=>{let t=cv(e,r);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let r=this.running[t];if(n||r.context.abortOnDocChange&&e.docChanged||r.updates.length+e.transactions.length>50&&Date.now()-r.time>1e3){for(let e of r.context.abortListeners)try{e()}catch(e){rc(this.view.state,e)}r.context.abortListeners=null,this.running.splice(t--,1)}else r.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(ct)))&&(this.pendingStart=!0);let i=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(ck);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(cs).updateSyncTime))}startQuery(e){let{state:t}=this.view,r=h6(t),n=new h3(t,r,e.explicit,this.view),i=new cT(e,n);this.running.push(i),Promise.resolve(e.source(n)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:cr.of(null)}),rc(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(cs).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],r=this.view.state.facet(cs),n=this.view.state.field(ck);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(void 0===s.done)continue;if(this.running.splice(i--,1),s.done){let n=h6(s.updates.length?s.updates[0].startState:this.view.state),i=Math.min(n,s.done.from+ +!s.active.explicit),o=new cw(s.active.source,s.active.explicit,i,s.done,s.done.from,null!=(e=s.done.to)?e:n);for(let e of s.updates)o=o.update(e,r);if(o.hasResult()){t.push(o);continue}}let o=n.active.find(e=>e.source==s.active.source);if(o&&o.isPending)if(null==s.done){let e=new cb(s.active.source,0);for(let t of s.updates)e=e.update(t,r);e.isPending||t.push(e)}else this.startQuery(o)}(t.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:cx.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(ck,!1);if(t&&t.tooltip&&this.view.state.facet(cs).closeOnBlur){let r=t.open&&sy(this.view,t.open.tooltip);r&&r.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:cr.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:ct.of(!1)}),20),this.composing=0}}}),cM="object"==typeof navigator&&/Win/.test(navigator.platform),cR=en.highe
vendor: 4,221 bytes, line 76
76st(ic.domEventHandlers({keydown(e,t){let r=t.state.field(ck,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||e.key.length>1||e.ctrlKey&&!(cM&&e.altKey)||e.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find(e=>e.source==n.source),s=n.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&cS(t,n),!1}})),cN=ic.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),cP=ty.widget({widget:new class extends tm{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),c_=ty.mark({class:"cm-snippetField"});class cD{constructor(e,t){this.ranges=e,this.active=t,this.deco=ty.set(e.map(e=>(e.from==e.to?cP:c_).range(e.from,e.to)),!0)}map(e){let t=[];for(let r of this.ranges){let n=r.map(e);if(!n)return null;t.push(n)}return new cD(t,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}}let cI=ew.define({map:(e,t)=>e&&e.map(t)}),cj=ew.define(),cL=et.define({create:()=>null,update(e,t){for(let r of t.effects){if(r.is(cI))return r.value;if(r.is(cj)&&e)return new cD(e.ranges,r.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>ic.decorations.from(e,e=>e?e.deco:ty.none)});function cB(e){return({state:t,dispatch:r})=>{var n;let i=t.field(cL,!1);if(!i||e<0&&0==i.active)return!1;let s=i.active+e,o=e>0&&!i.ranges.some(t=>t.field==s+e);return r(t.update({selection:(n=i.ranges,q.create(n.filter(e=>e.field==s).map(e=>
76q.range(e.from,e.to)))),effects:cI.of(o?null:new cD(i.ranges,s)),scrollIntoView:!0})),!0}}let c$=[{key:"Tab",run:cB(1),shift:cB(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(cL,!1)&&(t(e.update({effects:cI.of(null)})),!0)}],cz={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},cF=ew.define({map(e,t){let r=t.mapPos(e,-1,j.TrackAfter);return null==r?void 0:r}}),cH=new class extends eR{};cH.startSide=1,cH.endSide=-1;let cW=et.define({create:()=>eI.empty,update(e,t){if(e=e.map(t.changes),t.selection){let r=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=r.from&&e<=r.to})}for(let r of t.effects)r.is(cF)&&(e=e.update({add:[cH.range(r.value,r.value+1)]}));return e}}),cU="()[]{}<>«»»«[]{}";function cV(e){for(let t=0;t<cU.length;t+=2)if(cU.charCodeAt(t)==e)return cU.charAt(t+1);return _(e<128?e:e+1)}function cq(e,t){return e.languageDataAt("closeBrackets",t)[0]||cz}let cK="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),cJ=ic.inputHandler.of((e,t,r,n)=>{if((cK?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(n.length>2||2==n.length&&1==D(P(n,0))||t!=i.from||r!=i.to)return!1;let s=function(e,t){let r=cq(e,e.selection.main.head),n=r.brackets||cz.brackets;for(let i of n){let s=cV(P(i,0));if(t==i)return s==i?function(e,t,r,n){let i=n.stringPrefixes||cz.stringPrefixes,s=null,o=e.changeByRange(n=>{if(!n.empty)return{changes:[{insert:t,from:n.from},{insert:t,from:n.to}],effects:cF.of(n.to+t.length),range:q.range(n.anchor+t.length,n.head+t.length)};let o=n.head,a=cX(e.doc,o),l;if(a==t){if(cQ(e,o))return{changes:{insert:t+t,from:o},effects:cF.of(o+t.length),range:q.cursor(o+t.length)};else if(cY(e,o)){let n=r&&e.sliceDoc(o,o+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+n.length,insert:n},range:q.cursor(o+n.length)}}}else if(r&&e.sliceDoc(o-2*t.length,o)==t+t&&(l=cZ(e,o-2*t.length,i))>-1&&cQ(e,l))return{changes:{insert:t+t+t+t,from:o},effects:cF.of(o+t.length),range:q.cursor(o+t.length)};else if(e.charCategorizer(o)(a)!=eE.Word&&cZ(e,o,i)>-1&&!function(e,t,r,n){let i=oX(e).resolveInner(t,-1),s=n.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+r.length+s)),a=o.indexOf(r);if(!a||a>-1&&n.indexOf(o.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>r.length+a;){if(e.sliceDoc(t.to-r.length,t.to)==r)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,o,t,i))return{changes:{insert:t+t,from:o},effects:cF.of(o+t.length),range:q.cursor(o+t.length)};return{range:s=n}});return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,n.indexOf(i+i+i)>-1,r):function(e,t,r,n){let i=null,s=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:r,from:s.to}],effects:cF.of(s.to+t.length),range:q.range(s.anchor+t.length,s.head+t.length)};let o=cX(e.doc,s.head);return!o||/\s/.test(o)||n.indexOf(o)>-1?{changes:{insert:t+r,from:s.head},effects:cF.of(s.head+t.length),range:q.cursor(s.head+t.length)}:{range:i=s}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,s,r.before||cz.before);if(t==s&&cY(e,e.selection.main.from))return function(e,t){let r=null,n=e.changeByRange(n=>n.empty&&cX(e.doc,n.head)==t?{changes:{from:n.head,to:n.head+t.length,insert:t},range:q.cursor(n.head+t.length)}:r={range:n});return r?null:e.update(n,{scrollIntoView:!0,userEvent:"input.type"})}(e,s)}return null}(e.state,n);return!!s&&(e.dispatch(s),!0)}),cG=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=cq(e,e.selection.main.head).brackets||cz.brackets,n=null,i=e.changeByRange(t=>{if(t.empty){var i,s;let n,o=(i=e.doc,s=t.head,D(P(n=i.sliceString(s-2,s),0))==n.length?n:n.slice(1));for(let n of r)if(n==o&&cX(e.doc,t.head)==cV(P(n,0)))return{changes:{from:t.head-n.length,to:t.head+n.length},range:q.cursor(t.head-n.length)}}return{range:n=t}});return n||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!n}}];function cY(e,t){let r=!1;return e.field(cW).between(0,e.doc.length,e=>{e==t&&(r=!0)}),r}function cX(e,t){let r=e.sliceString(t,t+2);return r.slice(0,D(P(r,0)))}function cQ(e,t){let r=oX(e).resolveInner(t+1);return r.parent&&r.from==t}function cZ(e,t,r){let n=e.charCategorizer(t);if(n(e.sliceDoc(t-1,t))!=eE.Word)return t;for(let i of r){let r=t-i.length;if(e.sliceDoc(r,t)==i&&n(e.sliceDoc(r-1,r))!=eE.Word)return r}return -1}let c0=[{key:"Ctrl-Space",run:cE},{mac:"Alt-`",run:cE},{mac:"Alt-i",run:cE},{key:"Escape",run:e=>{let t=e.state.field(ck,!1);return!!t&&!!t.active.some(e=>0!=e.state)&&(e.dispatch({effects:cr.of(null)}),!0)}},{key:"ArrowDown",run:cA(!0)},{key:"ArrowUp",run:cA(!1)},{key:"PageDown",run:cA(!0,"page")},{key:"PageUp",run:cA(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(ck,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(cs).interactionDelay)&&cS(e,t.open.options[t.open.selected])}}
76],c1=en.highest(ib.computeN([cs],e=>e.facet(cs).defaultKeymap?[c0]:[]));class c2{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class c3{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let n=r.facet(ui).markerFilter;n&&(e=n(e,r));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new ej,o=[],a=0,l=r.doc.iter(),h=0,c=r.doc.length;for(let e=0;;){let t,r,n=e==i.length?null:i[e];if(!n&&!o.length)break;if(o.length)t=a,r=o.reduce((e,t)=>Math.min(e,t.to),n&&n.from>t?n.from:1e8);else{if((t=n.from)>c)break;r=n.to,o.push(n),e++}for(;e<i.length;){let n=i[e];if(n.from==t&&(n.to>n.from||n.to==t))o.push(n),e++,r=Math.min(n.to,r);else{r=Math.min(n.from,r);break}}r=Math.min(r,c);let u=!1;if(o.some(e=>e.from==t&&(e.to==r||r==c))&&!(u=t==r)&&r-t<10){let e=t-(h+l.value.length);e>0&&(l.next(e),h=t);for(let e=t;;){if(e>=r){u=!0;break}if(!l.lineBreak&&h+l.value.length>e)break;e=h+l.value.length,h+=l.value.length,l.next()}}let d=uf(o);if(u)s.add(t,t,ty.widget({widget:new ul(d),diagnostics:o.slice()}));else{let e=o.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");s.add(t,r,ty.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:o.slice(),inclusiveEnd:o.some(e=>e.to>r)}))}if((a=r)==c)break;for(let e=0;e<o.length;e++)o[e].to<=a&&o.splice(e--,1)}let u=s.finish();return new c3(u,t,c5(u))}}function c5(e,t=null,r=0){let n=null;return e.between(r,1e9,(e,r,{spec:i})=>{if(!(t&&0>i.diagnostics.indexOf(t)))if(n){if(0>i.diagnostics.indexOf(n.diagnostic))return!1;n=new c2(n.from,r,n.diagnostic)}else n=new c2(e,r,t||i.diagnostics[0])}),n}function c4(e,t){let r=t.pos,n=t.end||r,i=e.state.facet(ui).hideOn(e,r,n);if(null!=i)return i;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(c6))||e.changes.touchesRange(s.from,Math.max(s.to,n)))}let c6=ew.define(),c8=ew.define(),c9=ew.define(),c7=et.define({create:()=>new c3(ty.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let r=e.diagnostics.map(t.changes),n=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);n=c5(r,e.selected.diagnostic,i)||c5(r,null,i)}!r.size&&i&&t.state.facet(ui).autoPanel&&(i=null),e=new c3(r,i,n)}for(let r of t.effects)if(r.is(c6)){let n=t.state.facet(ui).autoPanel?r.value.length?uc.open:null:e.panel;e=c3.init(r.value,n,t.state)}else r.is(c8)?e=new c3(e.diagnostics,r.value?uc.open:null,e.selected):r.is(c9)&&(e=new c3(e.diagnostics,e.panel,r.value));return e},provide:e=>[sC.from(e,e=>e.panel),ic.decorations.from(e,e=>e.diagnostics)]}),ue=ty.mark({class:"cm-lintRange cm-lintRange-active"});function ut(e,t){return e9("ul",{class:"cm-tooltip-lint"},t.map(t=>ua(e,t,!1)))}let ur=e=>{let t=e.state.field(c7,!1);return!!t&&!!t.panel&&(e.dispatch({effects:c8.of(!1)}),!0)},un=[{key:"Mod-Shift-m",run:e=>{var t,r;let n=e.state.field(c7,!1);n&&n.panel||e.dispatch({effects:(t=e.state,r=[c8.of(!0)],t.field(c7,!1)?r:r.concat(ew.appendConfig.of(uy)))});let i=sw(e,uc.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(c7,!1);if(!t)return!1;let r=e.state.selection.main,n=c5(t.diagnostics,null,r.to+1);return(!!n||!!(n=c5(t.diagnostics,null,0))&&(n.from!=r.from||n.to!=r.to))&&(e.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),sg(e,n.from,1,{tooltip:ug,until:e=>e.docChanged||e.newSelection.main.head<n.from||e.newSelection.main.head>n.to}),!0)}}],ui=G.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...eM(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:us,tooltipFilter:us,needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t,hideOn:(e,t)=>e?t?(r,n,i)=>e(r,n,i)||t(r,n,i):e:t,autoPanel:(e,t)=>e||t})})});function us(e,t){return e?t?(r,n)=>t(e(r,n),n):e:t}function uo(e){let t=[];if(e)s:for(let{name:r}of e){for(let e=0;e<r.length;e++){let n=r[e];if(/[a-zA-Z]/.test(n)&&!t.some(e=>e.toLowerCase()==n.toLowerCase())){t.push(n);continue s}}t.push("")}return t}function ua(e,t,r){var n;let i=r?uo(t.actions):[];return e9("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},e9("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null==(n=t.actions)?void 0:n.map((r,n)=>{let s=!1,o=n=>{if(n.preventDefault(),s)return;s=!0;let i=c5(e.state.field(c7).diagnostics,t);i&&r.apply(e,i.from,i.to)},{name:a}=r,l=i[n]?a.indexOf(i[n]):-1,h=l<0?a:[a.slice(0,l),e9("u",a.slice(l,l+1)),a.slice(l+1)];return e9("button",{type:"button",class:"cm-diagnosticAction"+(r.markClass?" "+r.markClass:""),onclick:o,onmousedown:o,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[n]})"`}.`},h)}),t.source&&e9("div",{class:"cm-diagnosticSource"},t.source))}class ul extends tm{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return e9("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class uh{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=ua(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class uc{constructor(e){this.view=e,this.items=[];let t=t=>{if(!t.ctrlKey&&!t.altKey&&!t.metaKey){if(27==t.keyCode)ur(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:r}=this.items[this.selectedIndex],n=uo(r.actions);for(let i=0;i<n.length;
76i++)if(n[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=c5(this.view.state.field(c7).diagnostics,r);t&&r.actions[i].apply(e,t.from,t.to)}}t.preventDefault()}},r=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=e9("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=e9("div",{class:"cm-panel-lint"},this.list,e9("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>ur(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(c7).selected;if(!e)return -1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return -1}update(){let{diagnostics:e,selected:t}=this.view.state.field(c7),r=0,n=!1,i=null,s=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:a})=>{for(let e of a.diagnostics){if(s.has(e))continue;s.add(e);let o=-1,a;for(let t=r;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(a=new uh(this.view,e),this.items.splice(r,0,a),n=!0):(a=this.items[o],o>r&&(this.items.splice(r,o-r),n=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),i=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();0==this.items.length&&(this.items.push(new uh(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let r=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/r:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/r)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=c5(this.view.state.field(c7).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:c9.of(t)})}static open(e){return new uc(e)}}function uu(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let ud=ic.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:uu("#f11")},".cm-lintRange-warning":{backgroundImage:uu("orange")},".cm-lintRange-info":{backgroundImage:uu("#999")},".cm-lintRange-hint":{backgroundImage:uu("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function uf(e){let t="hint",r=1;for(let i of e){var n;let e="error"==(n=i.severity)?4:"warning"==n?3:"info"==n?2:1;e>r&&(r=e,t=i.severity)}return t}let up=ew.define(),um=et.define({create:()=>null,update:(e,t)=>
76(e&&t.docChanged&&(e=c4(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(up)?t.value:e,e)),provide:e=>sh.from(e)}),ug=sm(function(e,t,r){let{diagnostics:n}=e.state.field(c7),i,s=-1,o=-1;n.between(t-(r<0),t+ +(r>0),(e,n,{spec:a})=>{if(t>=e&&t<=n&&(e==n||(t>e||r>0)&&(t<n||r<0)))return i=a.diagnostics,s=e,o=n,!1});let a=e.state.facet(ui).tooltipFilter;return(i&&a&&(i=a(i,e.state)),i)?{pos:s,end:o,above:!0,create:()=>({dom:ut(e,i)})}:null},{hideOn:c4}),uy=[c7,ic.decorations.compute([c7],e=>{let{selected:t,panel:r}=e.field(c7);return t&&r&&t.from!=t.to?ty.set([ue.range(t.from,t.to)]):ty.none}),ug,ud],uv=G.define({combine:e=>eM(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});var ub=function(e){void 0===e&&(e={});var t=e.crosshairCursor,r=[];!1!==e.closeBracketsKeymap&&(r=r.concat(cG)),!1!==e.defaultKeymap&&(r=r.concat(hi)),!1!==e.searchKeymap&&(r=r.concat(hY)),!1!==e.historyKeymap&&(r=r.concat(lg)),!1!==e.foldKeymap&&(r=r.concat(ax)),!1!==e.completionKeymap&&(r=r.concat(c0)),!1!==e.lintKeymap&&(r=r.concat(un));var n=[];return!1!==e.lineNumbers&&n.push(sG()),!1!==e.highlightActiveLineGutter&&n.push(sZ()),!1!==e.highlightSpecialChars&&n.push(iY()),!1!==e.history&&n.push(function(e={}){return[lr,lt.of(e),ic.domEventHandlers({beforeinput(e,t){let r="historyUndo"==e.inputType?li:"historyRedo"==e.inputType?ls:null;return!!r&&(e.preventDefault(),r(t))}})]}()),!1!==e.foldGutter&&n.push(function(e={}){let t={...aO,...e},r=new aM(t,!0),n=new aM(t,!1),i=rp.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(o6)!=e.state.facet(o6)||e.startState.field(ag,!1)!=e.state.field(ag,!1)||oX(e.startState)!=oX(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new ej;for(let i of e.viewportLineBlocks){let s=av(e.state,i.from,i.to)?n:au(e.state,i.from,i.to)?r:null;s&&t.add(i.from,i.from,s)}return t.finish()}}),{domEventHandlers:s}=t;return[i,sD({class:"cm-foldGutter",markers(e){var t;return(null==(t=e.plugin(i))?void 0:t.markers)||eI.empty},initialSpacer:()=>new aM(t,!1),domEventHandlers:{...s,click:(e,t,r)=>{if(s.click&&s.click(e,t,r))return!0;let n=av(e.state,t.from,t.to);if(n)return e.dispatch({effects:ap.of(n)}),!0;let i=au(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:af.of(i)}),!0)}}}),aC()]}()),!1!==e.drawSelection&&n.push(i_()),!1!==e.dropCursor&&n.push(iH()),!1!==e.allowMultipleSelections&&n.push(eO.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&n.push(eO.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let r=e.newDoc,{head:n}=e.newSelection.main,i=r.lineAt(n);if(n>i.from+200)return e;let s=r.sliceString(i.from,n);if(!t.some(e=>e.test(s)))return e;let{state:o}=e,a=-1,l=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==a)continue;a=t.from;let r=ar(o,t.from);if(null==r)continue;let n=/^\s*/.exec(t.text)[0],i=at(o,r);n!=i&&l.push({from:t.from,to:t.from+n.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e})),!1!==e.syntaxHighlighting&&n.push(aI(aL,{fallback:!0})),!1!==e.bracketMatching&&n.push(function(e={}){return[az.of(e),aV]}()),!1!==e.closeBrackets&&n.push([cJ,cW]),!1!==e.autocompletion&&n.push(function(e={}){return[cR,ck,cs.of(e),cO,c1,cN]}()),!1!==e.rectangularSelection&&n.push(i6()),!1!==(void 0!==t&&t)&&n.push(i7()),!1!==e.highlightActiveLine&&n.push(i0()),!1!==e.highlightSelectionMatches&&n.push([hx,hw]),e.tabSize&&"number"==typeof e.tabSize&&n.push(o7.of(" ".repeat(e.tabSize))),n.concat([ib.of(r.flat())]).filter(Boolean)};let uw="#e06c75",ux="#abb2bf",uk="#7d8799",uS="#d19a66",uC="#2c313a",uA="#282c34",uE="#353a42",uT="#528bff",uO=[ic.theme({"&":{color:ux,backgroundColor:uA},".cm-content":{caretColor:uT},".cm-cursor, .cm-dropCursor":{borderLeftColor:uT},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackgroun
76d, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:ux},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:uA,color:uk,border:"none"},".cm-activeLineGutter":{backgroundColor:uC},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:uE},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:uE,borderBottomColor:uE},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:uC,color:ux}}},{dark:!0}),aI(aN.define([{tag:oV.keyword,color:"#c678dd"},{tag:[oV.name,oV.deleted,oV.character,oV.propertyName,oV.macroName],color:uw},{tag:[oV.function(oV.variableName),oV.labelName],color:"#61afef"},{tag:[oV.color,oV.constant(oV.name),oV.standard(oV.name)],color:uS},{tag:[oV.definition(oV.name),oV.separator],color:ux},{tag:[oV.typeName,oV.className,oV.number,oV.changed,oV.annotation,oV.modifier,oV.self,oV.namespace],color:"#e5c07b"},{tag:[oV.operator,oV.operatorKeyword,oV.url,oV.escape,oV.regexp,oV.link,oV.special(oV.string)],color:"#56b6c2"},{tag:[oV.meta,oV.comment],color:uk},{tag:oV.strong,fontWeight:"bold"},{tag:oV.emphasis,fontStyle:"italic"},{tag:oV.strikethrough,textDecoration:"line-through"},{tag:oV.link,color:uk,textDecoration:"underline"},{tag:oV.heading,fontWeight:"bold",color:uw},{tag:[oV.atom,oV.bool,oV.special(oV.variableName)],color:uS},{tag:[oV.processingInstruction,oV.string,oV.inserted],color:"#98c379"},{tag:oV.invalid,color:"#ffffff"}]))];e.s(["oneDark",0,uO],29359);var uM=ic.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),uR=function(e){void 0===e&&(e={});var t=e,r=t.indentWithTab,n=t.editable,i=t.readOnly,s=t.theme,o=void 0===s?"light":s,a=t.placeholder,l=void 0===a?"":a,h=t.basicSetup,c=void 0===h||h,u=[];switch((void 0===r||r)&&u.unshift(ib.of([hs])),c&&("boolean"==typeof c?u.unshift(ub()):u.unshift(ub(c))),l&&u.unshift(i5(l)),o){case"light":u.push(uM);break;case"dark":u.push(uO);break;case"none":break;default:u.push(o)}return!1===(void 0===n||n)&&u.push(ic.editable.of(!1)),void 0!==i&&i&&u.push(eO.readOnly.of(!0)),[...u]};class uN{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error("TimeoutLatch callback error:",e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class uP{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var u_=null,uD=ey.define(),uI=[],uj=e.i(43476),uL=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],uB=(0,d.forwardRef)((e,t)=>{var r,i,s,o,a,l,h,c,u,f,p,m,g,y,v,b,w,x,k,S,C,A,E,T,O,M,R,N,P,_,D,I,j,L,B,$,z,F,H,W,U,V,q,K,J,G,Y,X,Q,Z=e.className,ee=e.value,et=void 0===ee?"":ee,er=e.selection,en=e.extensions,ei=e.onCh
76ange,es=e.onStatistics,eo=e.onCreateEditor,ea=e.onUpdate,el=e.autoFocus,eh=e.theme,ec=void 0===eh?"light":eh,eu=e.height,ed=e.minHeight,ef=e.maxHeight,ep=e.width,em=e.minWidth,eg=e.maxWidth,ey=e.basicSetup,ev=e.placeholder,eb=e.indentWithTab,ex=e.editable,ek=e.readOnly,eS=e.root,eC=e.initialState,eA=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,uL),eE=(0,d.useRef)(null),eT=(i=(r={root:eS,value:et,autoFocus:el,theme:ec,height:eu,minHeight:ed,maxHeight:ef,width:ep,minWidth:em,maxWidth:eg,basicSetup:ey,placeholder:ev,indentWithTab:eb,editable:ex,readOnly:ek,selection:er,onChange:ei,onStatistics:es,onCreateEditor:eo,onUpdate:ea,extensions:void 0===en?[]:en,initialState:eC}).value,s=r.selection,o=r.onChange,a=r.onStatistics,l=r.onCreateEditor,h=r.onUpdate,u=void 0===(c=r.extensions)?uI:c,f=r.autoFocus,m=void 0===(p=r.theme)?"light":p,y=void 0===(g=r.height)?null:g,b=void 0===(v=r.minHeight)?null:v,x=void 0===(w=r.maxHeight)?null:w,S=void 0===(k=r.width)?null:k,A=void 0===(C=r.minWidth)?null:C,T=void 0===(E=r.maxWidth)?null:E,M=void 0===(O=r.placeholder)?"":O,N=void 0===(R=r.editable)||R,_=void 0!==(P=r.readOnly)&&P,I=void 0===(D=r.indentWithTab)||D,L=void 0===(j=r.basicSetup)||j,B=r.root,$=r.initialState,F=(z=(0,d.useState)())[0],H=z[1],U=(W=(0,d.useState)())[0],V=W[1],K=(q=(0,d.useState)())[0],J=q[1],G=(0,d.useState)(()=>({current:null}))[0],Y=(0,d.useState)(()=>({current:null}))[0],X=ic.theme({"&":{height:y,minHeight:b,maxHeight:x,width:S,minWidth:A,maxWidth:T},"& .cm-scroller":{height:"100% !important"}}),Q=[ic.updateListener.of(e=>{e.docChanged&&"function"==typeof o&&!e.transactions.some(e=>e.annotation(uD))&&(G.current?G.current.reset():(G.current=new uN(()=>{if(Y.current){var e=Y.current;Y.current=null,e()}G.current=null},200),("u"<typeof window?new uP:(!u_&&(u_=new uP),u_)).add(G.current)),o(e.state.doc.toString(),e)),a&&a({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)})}),X,...uR({theme:m,editable:N,readOnly:_,placeholder:M,indentWithTab:I,basicSetup:L})],h&&"function"==typeof h&&Q.push(ic.updateListener.of(h)),Q=Q.concat(u),(0,d.useLayoutEffect)(()=>{if(F&&!K){var e={doc:i,selection:s,extensions:Q},t=$?eO.fromJSON($.json,e,$.fields):eO.create(e);if(J(t),!U){var r=new ic({state:t,parent:F,root:B});V(r),l&&l(r,t)}}return()=>{U&&(J(void 0),V(void 0))}},[F,K]),(0,d.useEffect)(()=>{r.container&&H(r.container)},[r.container]),(0,d.useEffect)(()=>()=>{U&&(U.destroy(),V(void 0)),G.current&&(G.current.cancel(),G.current=null)},[U]),(0,d.useEffect)(()=>{f&&U&&U.focus()},[f,U]),(0,d.useEffect)(()=>{U&&U.dispatch({effects:ew.reconfigure.of(Q)})},[m,u,y,b,x,S,A,T,M,N,_,I,L,o,h]),(0,d.useEffect)(()=>{if(void 0!==i){var e=U?U.state.doc.toString():"";if(U&&i!==e){var t=G.current&&!G.current.isDone,r=()=>{U&&i!==U.state.doc.toString()&&U.dispatch({changes:{from:0,to:U.state.doc.toString().length,insert:i||""},annotations:[uD.of(!0)]})};t?Y.current=r:r()}}},[i,U]),{state:K,setState:J,view:U,setView:V,container:F,setContainer:H}),eM=eT.state,eR=eT.view,eN=eT.container,eP=eT.setContainer;(0,d.useImperativeHandle)(t,()=>({editor:eE.current,state:eM,view:eR}),[eE,eN,eM,eR]);var e_=(0,d.useCallback)(e=>{eE.current=e,eP(e)},[eP]);if("string"!=typeof et)throw Error("value must be typeof string but got "+typeof et);return(0,uj.jsx)("div",n({ref:e_,className:("string"==typeof ec?"cm-theme-"+ec:"cm-theme")+(Z?" "+Z:"")},eA))});uB.displayName="CodeMirror",e.s(["default",0,uB],12140);var u$=e.i(47167);class uz{constructor(e,t,r,n,i,s,o,a,l,h=0,c){this.p=e,this.stack=t,this.state=r,this.reducePos=n,this.pos=i,this.score=s,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter((e,t)=>
76t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let n=e.parser.context;return new uz(e,[],t,r,r,0,[],0,n?new uF(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,n=65535&e,{parser:i}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),o=i.dynamicPrecedence(n);if(o&&(this.score+=o),0==r){n<i.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(i.getGoto(this.state,n,!0),this.reducePos),n<i.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(r-1)*3-(262144&e?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from;n<i.minRepeatTerm&&l==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let h=this.reducePos-l;h>=2e3&&!(null==(t=this.p.parser.nodeSet.types[n])?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=h));let c=a?this.stack[a-1]:0,u=this.bufferBase+this.buffer.length-c;if(n<i.minRepeatTerm||131072&e){let e=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,l,e,u+4,!0)}if(262144&e)this.state=this.stack[a];else{let e=this.stack[a-3];this.state=i.getGoto(e,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,t,r,n=4,i=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&0==this.buffer[e-4]&&this.buffer[e-1]>-1){if(t==r)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=r;return}}}if(i&&this.pos!=r){let i=this.buffer.length;if(i>0&&(0!=this.buffer[i-4]||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>r;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>r;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,n>4&&(n-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=r,this.buffer[i+3]=n}else this.buffer.push(e,t,r,n)}shift(e,t,r,n){if(131072&e)this.pushState(65535&e,this.pos);else if((262144&e)==0){let{parser:i}=this.p;this.pos=n;let s=i.stateFlag(e,1);!s&&(n>r||t<=i.maxNode)&&(this.reducePos=n),this.pushState(e,s?r:Math.min(r,this.reducePos)),this.shiftContext(t,r),t<=i.maxNode&&this.buffer.push(t,r,n,4)}else this.pos=n,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,n,4)}apply(e,t,r,n){65536&e?this.reduce(e):this.shift(e,t,r,n)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&0==e.buffer[t-4]&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new uz(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new uH(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==r)return!1;if((65536&r)==0)return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let n=0,i;n<t.length;n+=2)(i=t[n+1])!=this.state&&this.p.parser.hasAction(i,e)&&r.push(t[n],i);if(this.stack.length<120)for(let e=0;r.length<8&&e<t.length;e+=2){let n=t[e+1];r.some((e,t)=>1&t&&e==n)||r.push(t[e],n)}t=r}let r=[];for(let e=0;e<t.length&&r.length<4;e+=2){let n=t[e+1];if(n==this.state)continue;let i=this.split();i.pushState(n,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,r.push(i)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((65536&t)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,n=65535&t,i=this.stack.length-3*r;if(i<0||0>e.getGoto(this.stack[i],n,!1)){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(n,i)=>{if(!t.includes(n))return t.push(n),e.allActions(n,t=>{if(393216&t);else if(65536&t){let r=(t>>19)-i;if(r>1){let n=65535&t,i=this.stack.length-3*r;if(i>=0&&e.getGoto(this.stack[i],n,!1)>=0)return r<<19|65536|n}}else{let e=r(t,i+1);if(null!=e)return e}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new uF(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class uF{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class uH{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e>>19;0==t?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0
76),this.base+=3):this.base-=(t-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],65535&e,!0);this.state=r}}class uW{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new uW(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new uW(this.stack,this.pos,this.index)}}function uU(e,t=Uint16Array){if("string"!=typeof e)return e;let r=null;for(let n=0,i=0;n<e.length;){let s=0;for(;;){let t=e.charCodeAt(n++),r=!1;if(126==t){s=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,r=!0),s+=i,r)break;s*=46}r?r[i++]=s:r=new t(s)}return r}class uV{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}let uq=new uV;class uK{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=uq,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,n=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!n)return null;let e=this.ranges[--n];i-=r.from-e.to,r=e}for(;t<0?i>r.to:i>=r.to;){if(n==this.ranges.length-1)return null;let e=this.ranges[++n];i+=e.from-r.to,r=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,n;if(t>=0&&t<this.chunk.length)r=this.pos+e,n=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(null==t)return -1;if((r=t)>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=r;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(null==r||r<this.token.start)throw RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=uq,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(r+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return r}}class uJ{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;uG(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}function uG(e,t,r,n,i,s){let o=0,a=1<<n,{dialect:l}=r.p.parser;n:for(;(a&e[o])!=0;){let r=e[o+1];for(let n=o+3;n<r;n+=2)if((e[n+1]&a)>0){let r=e[n];if(l.allows(r)&&(-1==t.token.value||t.token.value==r||function(e,t,r,n){let i=uY(r,n,t);return i<0||uY(r,n,e)<i}(r,t.token.value,i,s))){t.acceptToken(r);break}}let n=t.next,h=0,c=e[o+2];if(t.next<0&&c>h&&65535==e[r+3*c-3]){o=e[r+3*c-1];continue}for(;h<c;){let i=h+c>>1,s=r+i+(i<<1),a=e[s],l=e[s+1]||65536;if(n<a)c=i;else if(n>=l)h=i+1;else{o=e[s+2],t.advance();continue n}}break}}function uY(e,t,r){for(let n=t,i;65535!=(i=e[n]);n++)if(i==r)return n-t;return -1}uJ.prototype.contextual=uJ.prototype.fallback=uJ.prototype.extend=!1,(class{constructor(e,t,r){this.precTable=t,this.elseToken=r,this.data="string"==typeof e?uU(e):e}token(e,t){let r=e.pos,n=0;for(;;){let r=e.next<0,i=e.resolveOffset(1,1);if(uG(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(!r&&n++,null==i)break;e.reset(i,e.token)}n&&(e.reset(r,e.token),e.acceptToken(this.elseToken,n))}}).prototype.contextual=uJ.prototype.fallback=uJ.prototype.extend=!1;let uX=void 0!==u$.default&&u$.default.env&&/\bparse\b/.test(u$.default.env.LOG),uQ=null;function uZ(e,t,r){let n=e.cursor(c.IncludeAnonymous);for(n.moveTo(t);;
vendor: 4,457 bytes, line 76
76)if(!(r<0?n.childBefore(t):n.childAfter(t)))for(;;){if((r<0?n.to<t:n.from>t)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(e.length,Math.max(n.from+1,t+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:e.length}}class u0{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?uZ(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?uZ(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],n=this.index[t];if(n==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[n],s=this.start[t]+r.positions[n];if(s>e)return this.nextStart=s,null;if(i instanceof s7){if(s==e){if(s<this.safeFrom)return null;let e=s+i.length;if(e<=this.safeTo){let t=i.prop(s2.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,s+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+i.length}}}class u1{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new uV)}getActions(e){let t=0,r=null,{parser:n}=e.p,{tokenizers:i}=n,s=n.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,a=0;for(let n=0;n<i.length;n++){if((1<<n&s)==0)continue;let l=i[n],h=this.tokens[n];if((!r||l.fallback)&&((l.contextual||h.start!=e.pos||h.mask!=s||h.context!=o)&&(this.updateCachedToken(h,l,e),h.mask=s,h.context=o),h.lookAhead>h.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!l.extend&&(r=h,t>n))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),r||e.pos!=this.stream.end||((r=new uV).value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new uV,{pos:r,p:n}=e;return t.start=r,t.end=Math.min(r+1,n.stream.end),t.value=r==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,r){let n=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(n,e),r),e.value>-1){let{parser:t}=r.p;for(let n=0;n<t.specialized.length;n++)if(t.specialized[n]==e.value){let i=t.specializers[n](this.stream.read(e.start,e.end),r);if(i>=0&&r.p.parser.dialect.allows(i>>1)){(1&i)==0?e.value=i>>1:e.extended=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,r,n){for(let t=0;t<n;t+=3)if(this.actions[t]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=r,n}addActions(e,t,r,n){let{state:i}=e,{parser:s}=e.p,{data:o}=s;for(let e=0;e<2;e++)for(let a=s.stateSlot(i,e?2:1);;a+=3){if(65535==o[a])if(1==o[a+1])a=u6(o,a+2);else{0==n&&2==o[a+1]&&(n=this.putAction(u6(o,a+2),t,r,n));break}o[a]==t&&(n=this.putAction(u6(o,a+1),t,r,n))}return n}}class u2{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new uK(t,n),this.tokens=new u1(e,this.stream),this.topTerm=e.top[1];let{from:i}=n[0];this.stacks=[uz.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>4*e.bufferLength?new u0(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,r=this.stacks,n=this.minStackPos,i=this.stacks=[];if(this.bigReductionCount>300&&1==r.length){let[e]=r;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<r.length;s++){let o=r[s];for(;;){if(this.tokens.mainToken=null,o.pos>n)i.push(o);else{if(this.advanceStack(o,i,r))continue;e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);
vendor: 6,127 bytes, line 76
76t.push(n.value,n.end)}break}}if(!i.length){let t=e&&function(e){let t=null;for(let r of e){let e=r.p.stoppedAt;(r.pos==r.p.stream.end||null!=e&&r.pos>e)&&r.p.parser.stateFlag(r.state,2)&&(!t||t.score<r.score)&&(t=r)}return t}(e);if(t)return uX&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw uX&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&e){let r=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,i);if(r)return uX&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(i.length>e)for(i.sort((e,t)=>t.score-e.score);i.length>e;)i.pop();i.some(e=>e.reducePos>n)&&this.recovering--}else if(i.length>1){o:for(let e=0;e<i.length-1;e++){let t=i[e];for(let r=e+1;r<i.length;r++){let n=i[r];if(t.sameState(n)||t.buffer.length>500&&n.buffer.length>500)if((t.score-n.score||t.buffer.length-n.buffer.length)>0)i.splice(r--,1);else{i.splice(e--,1);continue o}}}i.length>12&&(i.sort((e,t)=>t.score-e.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let e=1;e<i.length;e++)i[e].pos<this.minStackPos&&(this.minStackPos=i[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let n=e.pos,{parser:i}=this,s=uX?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,r=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(n>-1&&o.length&&(!t||(o.prop(s2.contextHash)||0)==r))return e.useNode(o,n),uX&&console.log(s+this.stackID(e)+` (via reuse of ${i.getName(o.type.id)})`),!0;if(!(o instanceof s7)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(a instanceof s7&&0==o.positions[0])o=a;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),uX&&console.log(s+this.stackID(e)+` (via always-reduce ${i.getName(65535&o)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let o=0;o<a.length;){let l=a[o++],h=a[o++],c=a[o++],u=o==a.length||!r,d=u?e:e.split(),f=this.tokens.mainToken;if(d.apply(l,h,f?f.start:d.pos,c),uX&&console.log(s+this.stackID(d)+` (via ${(65536&l)==0?"shift":`reduce of ${i.getName(65535&l)}`} for ${i.getName(h)} @ ${n}${d==e?"":", split"})`),u)return!0;d.pos>n?t.push(d):r.push(d)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return u3(e,t),!0}}runRecovery(e,t,r){let n=null,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=t[s<<1],l=t[(s<<1)+1],h=uX?this.stackID(o)+" -> ":"";if(o.deadEnd&&(i||(i=!0,o.restart(),uX&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,r))))continue;let c=o.split(),u=h;for(let e=0;e<10&&c.forceReduce()&&(uX&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,r));e++)uX&&(u=this.stackID(c)+" -> ");for(let e of o.recoverByInsert(a))uX&&console.log(h+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,r);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),uX&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),u3(o,r)):(!n||n.score<c.score)&&(n=c)}return n}stackToTree(e){return e.close(),s7.build({buffer:uW.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(uQ||(uQ=new WeakMap)).get(e);return t||uQ.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function u3(e,t){for(let r=0;r<t.length;r++){let n=t[r];if(n.pos==e.pos&&n.sameState(e)){t[r].score<e.score&&(t[r]=e);return}}t.push(e)}class u5{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||0==this.disabled[e]}}class u4 extends ob{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let r=Object.keys(e.topRules).map(t=>e.topRules[t][1]),n=[];for(let e=0;e<t.length;e++)n.push([]);function i(e,t,r){n[e].push([t,t.deserialize(String(r))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=s2[e]);for(let r=1;r<t.length;){let n=t[r++];if(n>=0)i(n,e,t[r++]);else{let s=t[r+-n];for(let o=-n;o>0;o--)i(t[r++],e,s);r++}}}this.nodeSet=new s6(t.map((t,i)=>s4.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:n[i],top:r.indexOf(i)>-1,error:0==i,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let s=uU(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(u8),this.states=uU(e.states,Uint32Array),this.data=uU(e.stateData),this.goto=uU(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new uJ(s,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let n=new u2(this,e,t,r);for(let i of this.wrappers)n=i(n,e,t,r);return n}getGoto(e,t,r=!1){let n=this.goto;if(t>=n[0])return -1;for(let i=n[t+1];;){let t=n[i++],s=1&t,o=n[i++];if(s&&r)return o;for(let r=i+(t>>
761);i<r;i++)if(n[i]==e)return o;if(s)return -1}}hasAction(e,t){let r=this.data;for(let n=0;n<2;n++)for(let i=this.stateSlot(e,n?2:1),s;;i+=3){if(65535==(s=r[i]))if(1==r[i+1])s=r[i=u6(r,i+2)];else if(2==r[i+1])return u6(r,i+2);else break;if(s==t||0==s)return u6(r,i+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let r=this.stateSlot(e,4),n=r?t(r):void 0;for(let r=this.stateSlot(e,1);null==n;r+=3){if(65535==this.data[r])if(1==this.data[r+1])r=u6(this.data,r+2);else break;n=t(u6(this.data,r+1))}return n}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(65535==this.data[r])if(1==this.data[r+1])r=u6(this.data,r+2);else break;if((1&this.data[r+2])==0){let e=this.data[r+1];t.some((t,r)=>1&r&&t==e)||t.push(this.data[r],e)}}return t}configure(e){let t=Object.assign(Object.create(u4.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let r=e.tokenizers.find(e=>e.from==t);return r?r.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,n)=>{let i=e.specializers.find(e=>e.from==r.external);if(!i)return r;let s=Object.assign(Object.assign({},r),{external:i.to});return t.specializers[n]=u8(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let n of e.split(" ")){let e=t.indexOf(n);e>=0&&(r[e]=!0)}let n=null;for(let e=0;e<t.length;e++)if(!r[e])for(let r=this.dialects[t[e]],i;65535!=(i=this.data[r++]);)(n||(n=new Uint8Array(this.maxTerm+1)))[i]=1;return new u5(e,r,n)}static deserialize(e){return new u4(e)}}function u6(e,t){return e[t]|e[t+1]<<16}function u8(e){if(e.external){let t=+!!e.extend;return(r,n)=>e.external(r,n)<<1|t}return e.get}let u9=oA({String:oV.string,Number:oV.number,"True False":oV.bool,PropertyName:oV.propertyName,Null:oV.null,", :":oV.separator,"[ ]":oV.squareBracket,"{ }":oV.brace}),u7=u4.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[u9],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),de=oY.define({name:"json",parser:u7.configure({props:[ai.add({Object:al({except:/^\s*\}/}),Array:al({except:/^\s*\]/})}),ac.add({"Object Array":function(e){let t=e.firstChild,r=e.lastChild;return t&&t.to<r.from?{from:t.to,to:r.type.isError?e.to:r.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});e.s(["json",0,function(){return new o8(de)}],49989)},29402,e=>{"use strict";let t,r,n;var i=e.i(71645),s=e.i(74080),o=e.i(70152),a=e.i(81140),l=e.i(75830),h=e.i(20783),c=e.i(30030),u=e.i(86318),d=e.i(26330),f=e.i(3536),p=e.i(65491),m=e.i(10772);let g=["top","right","bottom","left"],y=Math.min,v=Math.max,b=Math.round,w=Math.floor,x=e=>({x:e,y:e}
76),k={left:"right",right:"left",bottom:"top",top:"bottom"},S={start:"end",end:"start"};function C(e,t){return"function"==typeof e?e(t):e}function A(e){return e.split("-")[0]}function E(e){return e.split("-")[1]}function T(e){return"x"===e?"y":"x"}function O(e){return"y"===e?"height":"width"}let M=new Set(["top","bottom"]);function R(e){return M.has(A(e))?"y":"x"}function N(e){return e.replace(/start|end/g,e=>S[e])}let P=["left","right"],_=["right","left"],D=["top","bottom"],I=["bottom","top"];function j(e){return e.replace(/left|right|bottom|top/g,e=>k[e])}function L(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function B(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function $(e,t,r){let n,{reference:i,floating:s}=e,o=R(t),a=T(R(t)),l=O(a),h=A(t),c="y"===o,u=i.x+i.width/2-s.width/2,d=i.y+i.height/2-s.height/2,f=i[l]/2-s[l]/2;switch(h){case"top":n={x:u,y:i.y-s.height};break;case"bottom":n={x:u,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:d};break;case"left":n={x:i.x-s.width,y:d};break;default:n={x:i.x,y:i.y}}switch(E(t)){case"start":n[a]-=f*(r&&c?-1:1);break;case"end":n[a]+=f*(r&&c?-1:1)}return n}async function z(e,t){var r;void 0===t&&(t={});let{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:h="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:d=!1,padding:f=0}=C(t,e),p=L(f),m=a[d?"floating"===u?"reference":"floating":u],g=B(await s.getClippingRect({element:null==(r=await (null==s.isElement?void 0:s.isElement(m)))||r?m:m.contextElement||await (null==s.getDocumentElement?void 0:s.getDocumentElement(a.floating)),boundary:h,rootBoundary:c,strategy:l})),y="floating"===u?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=await (null==s.getOffsetParent?void 0:s.getOffsetParent(a.floating)),b=await (null==s.isElement?void 0:s.isElement(v))&&await (null==s.getScale?void 0:s.getScale(v))||{x:1,y:1},w=B(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-w.top+p.top)/b.y,bottom:(w.bottom-g.bottom+p.bottom)/b.y,left:(g.left-w.left+p.left)/b.x,right:(w.right-g.right+p.right)/b.x}}let F=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(t)),h=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:u}=$(h,n,l),d=n,f={},p=0;for(let r=0;r<a.length;r++){var m;let{name:s,fn:g}=a[r],{x:y,y:v,data:b,reset:w}=await g({x:c,y:u,initialPlacement:n,placement:d,strategy:i,middlewareData:f,re
76cts:h,platform:{...o,detectOverflow:null!=(m=o.detectOverflow)?m:z},elements:{reference:e,floating:t}});c=null!=y?y:c,u=null!=v?v:u,f={...f,[s]:{...f[s],...b}},w&&p<=50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(h=!0===w.rects?await o.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:c,y:u}=$(h,d,l)),r=-1)}return{x:c,y:u,placement:d,strategy:i,middlewareData:f}};function H(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function W(e){return g.some(t=>e[t]>=0)}let U=new Set(["left","top"]);async function V(e,t){let{placement:r,platform:n,elements:i}=e,s=await (null==n.isRTL?void 0:n.isRTL(i.floating)),o=A(r),a=E(r),l="y"===R(r),h=U.has(o)?-1:1,c=s&&l?-1:1,u=C(t,e),{mainAxis:d,crossAxis:f,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof p&&(f="end"===a?-1*p:p),l?{x:f*c,y:d*h}:{x:d*h,y:f*c}}function q(){return"u">typeof window}function K(e){return Y(e)?(e.nodeName||"").toLowerCase():"#document"}function J(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function G(e){var t;return null==(t=(Y(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Y(e){return!!q()&&(e instanceof Node||e instanceof J(e).Node)}function X(e){return!!q()&&(e instanceof Element||e instanceof J(e).Element)}function Q(e){return!!q()&&(e instanceof HTMLElement||e instanceof J(e).HTMLElement)}function Z(e){return!(!q()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof J(e).ShadowRoot)}let ee=new Set(["inline","contents"]);function et(e){let{overflow:t,overflowX:r,overflowY:n,display:i}=ed(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!ee.has(i)}let er=new Set(["table","td","th"]),en=[":popover-open",":modal"];function ei(e){return en.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let es=["transform","translate","scale","rotate","perspective"],eo=["transform","translate","scale","rotate","perspective","filter"],ea=["paint","layout","strict","content"];function el(e){let t=eh(),r=X(e)?ed(e):e;return es.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||eo.some(e=>(r.willChange||"").includes(e))||ea.some(e=>(r.contain||"").includes(e))}function eh(){return!("u"<typeof CSS)&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let ec=new Set(["html","body","#document"]);function eu(e){return ec.has(K(e))}function ed(e){return J(e).getComputedStyle(e)}function ef(e){return X(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ep(e){if("html"===K(e))return e;let t=e.assignedSlot||e.parentNode||Z(e)&&e.host||G(e);return Z(t)?t.host:t}function em(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=ep(t);return eu(r)?t.ownerDocument?t.ownerDocument.body:t.body:Q(r)&&et(r)?r:e(r)}(e),s=i===(null==(n=e.ownerDocument)?void 0:n.body),o=J(i);if(s){let e=eg(o);return t.concat(o,o.visualViewport||[],et(i)?i:[],e&&r?em(e):[])}return t.concat(i,em(i,[],r))}function eg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ey(e){let t=ed(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=Q(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=b(r)!==s||b(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function ev(e){return X(e)?e:e.contextElement}function eb(e){let t=ev(e);if(!Q(t))return x(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:s}=ey(t),o=(s?b(r.width):r.width)/n,a=(s?b(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),a&&Number.isFinite(a)||(a=1),{x:o,y:a}}let ew=x(0);function ex(e){let t=J(e);return eh()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ew}function ek(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let s=e.getBoundingClientRect(),o=ev(e),a=x(1);t&&(n?X(n)&&(a=eb(n)):a=eb(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===J(o))&&i)?ex(o):x(0),h=(s.left+l.x)/a.x,c=(s.top+l.y)/a.y,u=s.width/a.x,d=s.height/a.y;if(o){let e=J(o),t=n&&X(n)?J(n):n,r=e,i=eg(r);for(;i&&n&&t!==r;){let e=eb(i),t=i.getBoundingClientRect(),n=ed(i),s=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.to
76p+(i.clientTop+parseFloat(n.paddingTop))*e.y;h*=e.x,c*=e.y,u*=e.x,d*=e.y,h+=s,c+=o,i=eg(r=J(i))}}return B({width:u,height:d,x:h,y:c})}function eS(e,t){let r=ef(e).scrollLeft;return t?t.left+r:ek(G(e)).left+r}function eC(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-eS(e,r),y:r.top+t.scrollTop}}let eA=new Set(["absolute","fixed"]);function eE(e,t,r){var n;let i;if("viewport"===t)i=function(e,t){let r=J(e),n=G(e),i=r.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let e=eh();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}let h=eS(n);if(h<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-i);o<=25&&(s-=o)}else h<=25&&(s+=h);return{width:s,height:o,x:a,y:l}}(e,r);else if("document"===t){let t,r,s,o,a,l,h;n=G(e),t=G(n),r=ef(n),s=n.ownerDocument.body,o=v(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=v(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),l=-r.scrollLeft+eS(n),h=-r.scrollTop,"rtl"===ed(s).direction&&(l+=v(t.clientWidth,s.clientWidth)-o),i={width:o,height:a,x:l,y:h}}else if(X(t)){let e,n,s,o,a,l;n=(e=ek(t,!0,"fixed"===r)).top+t.clientTop,s=e.left+t.clientLeft,o=Q(t)?eb(t):x(1),a=t.clientWidth*o.x,l=t.clientHeight*o.y,i={width:a,height:l,x:s*o.x,y:n*o.y}}else{let r=ex(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return B(i)}function eT(e){return"static"===ed(e).position}function eO(e,t){if(!Q(e)||"fixed"===ed(e).position)return null;if(t)return t(e);let r=e.offsetParent;return G(e)===r&&(r=r.ownerDocument.body),r}function eM(e,t){var r;let n=J(e);if(ei(e))return n;if(!Q(e)){let t=ep(e);for(;t&&!eu(t);){if(X(t)&&!eT(t))return t;t=ep(t)}return n}let i=eO(e,t);for(;i&&(r=i,er.has(K(r)))&&eT(i);)i=eO(i,t);return i&&eu(i)&&eT(i)&&!el(i)?n:i||function(e){let t=ep(e);for(;Q(t)&&!eu(t);){if(el(t))return t;if(ei(t))break;t=ep(t)}return null}(e)||n}let eR=async function(e){let t=this.getOffsetParent||eM,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=Q(t),i=G(t),s="fixed"===r,o=ek(e,!0,s,t),a={scrollLeft:0,scrollTop:0},l=x(0);if(n||!n&&!s)if(("body"!==K(t)||et(i))&&(a=ef(t)),n){let e=ek(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=eS(i));s&&!n&&i&&(l.x=eS(i));let h=!i||n||s?x(0):eC(i,a);return{x:o.left+a.scrollLeft-l.x-h.x,y:o.top+a.scrollTop-l.y-h.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},eN={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,s="fixed"===i,o=G(n),a=!!t&&ei(t.floating);if(n===o||a&&s)return r;let l={scrollLeft:0,scrollTop:0},h=x(1),c=x(0),u=Q(n);if((u||!u&&!s)&&(("body"!==K(n)||et(o))&&(l=ef(n)),Q(n))){let e=ek(n);h=eb(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let d=!o||u||s?x(0):eC(o,l);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-l.scrollLeft*h.x+c.x+d.x,y:r.y*h.y-l.scrollTop*h.y+c.y+d.y}},getDocumentElement:G,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,s=[..."clippingAncestors"===r?ei(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=em(e,[],!1).filter(e=>X(e)&&"body"!==K(e)),i=null,s="fixed"===ed(e).position,o=s?ep(e):e;for(;X(o)&&!eu(o);){let t=ed(o),r=el(o);r||"fixed"!==t.position||(i=null),(s?!r&&!i:!r&&"static"===t.position&&!!i&&eA.has(i.position)||et(o)&&!r&&function e(t,r){let n=ep(t);return!(n===r||!X(n)||eu(n))&&("fixed"===ed(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=ep(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=s[0],a=s.reduce((e,r)=>{let n=eE(t,r,i);return e.top=v(n.top,e.top),e.right=y(n.right,e.right),e.bottom=y(n.bottom,e.bottom),e.left=v(n.left,e.left),e},eE(t,o,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:eM,getElementRects:eR,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=ey(e);return{width:t,height:r}},getScale:eb,isElement:X,isRTL:function(e){return"rtl"===ed(e).direction}};function eP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let e_=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:h,padding:c=0}=C(e,t)||{};if(null==h)return{};let u=L(c),d={x:r,y:n},f=T(R(i)),p=O(f),m=await o.getDimensions(h),g="y"===f,b=g?"clientHeight":"clientWidth",w=s.reference[p]+s.reference[f]-d[f]-s.floating[p],x=d[f]-s.reference[f],k=await (null==o.getOffsetParent?void 0:o.getOffsetParent(h)),S=k?k[b]:0;S&&await (null==o.isElement?void 0:o.isElement(k))||(S=a.floating[b]||s.floating[p]);let A=S/2-m[p]/2-1,M=y(u[g?"top":"left"],A),N=y(u[g?"bottom":"right"],A),P=S-m[p]-N,_=S/2-m[p]/2+(w/2-x/2),D=v(M,y(_,P)),I=!l.arrow&&null!=E(i)&&_!==D&&s.reference[p]/2-(_<M?M:N)-m[p]/2<0,j=I?_<M?_-M:_-P:0;return{[f]:d[f]+j,data:{[f]:D,centerOffset:_-D-j,...I&&{alignmentOffset:j}},reset:I}}});var eD="u">typeof document?i.useLayoutEffect:function(){};function eI(e,t){let r,n,i;if(e===t)return!0;
76if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!eI(e[n],t[n]))return!1;return!0}if((r=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!=n--;){let r=i[n];if(("_owner"!==r||!e.$$typeof)&&!eI(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function ej(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function eL(e,t){let r=ej(e);return Math.round(t*r)/r}function eB(e){let t=i.useRef(e);return eD(()=>{t.current=e}),t}var e$=e.i(48425),ez=e.i(43476),eF=i.forwardRef((e,t)=>{let{children:r,width:n=10,height:i=5,...s}=e;return(0,ez.jsx)(e$.Primitive.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,ez.jsx)("polygon",{points:"0,0 30,0 15,10"})})});eF.displayName="Arrow";var eH=e.i(30207),eW=e.i(34620),eU="Popper",[eV,eq]=(0,c.createContextScope)(eU),[eK,eJ]=eV(eU),eG=e=>{let{__scopePopper:t,children:r}=e,[n,s]=i.useState(null);return(0,ez.jsx)(eK,{scope:t,anchor:n,onAnchorChange:s,children:r})};eG.displayName=eU;var eY="PopperAnchor",eX=i.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...s}=e,o=eJ(eY,r),a=i.useRef(null),l=(0,h.useComposedRefs)(t,a),c=i.useRef(null);return i.useEffect(()=>{let e=c.current;c.current=n?.current||a.current,e!==c.current&&o.onAnchorChange(c.current)}),n?null:(0,ez.jsx)(e$.Primitive.div,{...s,ref:l})});eX.displayName=eY;var eQ="PopperContent",[eZ,e0]=eV(eQ),e1=i.forwardRef((e,t)=>{var r,n,o,a,l,c,u,d,f,p,m,g,b,x,k,S,M,L,B,$,z;let{__scopePopper:q,side:K="bottom",sideOffset:J=0,align:Y="center",alignOffset:X=0,arrowPadding:Q=0,avoidCollisions:Z=!0,collisionBoundary:ee=[],collisionPadding:et=0,sticky:er="partial",hideWhenDetached:en=!1,updatePositionStrategy:ei="optimized",onPlaced:es,...eo}=e,ea=eJ(eQ,q),[el,eh]=i.useState(null),ec=(0,h.useComposedRefs)(t,e=>eh(e)),[eu,ed]=i.useState(null),ef=function(e){let[t,r]=i.useState(void 0);return(0,eW.useLayoutEffect)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,i;if(!Array.isArray(t)||!t.length)return;let s=t[0];if("borderBoxSize"in s){let e=s.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,i=t.blockSize}else n=e.offsetWidth,i=e.offsetHeight;r({width:n,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}(eu),ep=ef?.width??0,eg=ef?.height??0,ey="number"==typeof et?et:{top:0,right:0,bottom:0,left:0,...et},eb=Array.isArray(ee)?ee:[ee],ew=eb.length>0,ex={padding:ey,boundary:eb.filter(e4),altBoundary:ew},{refs:eS,floatingStyles:eC,placement:eA,isPositioned:eE,middlewareData:eT}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:a,floating:l}={},transform:h=!0,whileElementsMounted:c,open:u}=e,[d,f]=i.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=i.useState(n);eI(p,n)||m(n);let[g,y]=i.useState(null),[v,b]=i.useState(null),w=i.useCallback(e=>{e!==C.current&&(C.current=e,y(e))},[]),x=i.useCallback(e=>{e!==A.current&&(A.current=e,b(e))},[]),k=a||g,S=l||v,C=i.useRef(null),A=i.useRef(null),E=i.useRef(d),T=null!=c,O=eB(c),M=eB(o),R=eB(u),N=i.useCallback(()=>{var e,n;let i,o,a;if(!C.current||!A.current)return;let l={placement:t,strategy:r,middleware:p};M.current&&(l.platform=M.current),(e=C.current,n=A.current,i=new Map,a={...(o={platform:eN,...l}).platform,_c:i},F(e,n,{...o,platform:a})).then(e=>{let t={...e,isPositioned:!1!==R.current};P.current&&!eI(E.current,t)&&(E.current=t,s.flushSync(()=>{f(t)}))})},[p,t,r,M,R]);eD(()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let P=i.useRef(!1);eD(()=>(P.current=!0,()=>{P.current=!1}),[]),eD(()=>{if(k&&(C.current=k),S&&(A.current=S),k&&S){if(O.current)return O.current(k,S,N);N()}},[k,S,N,O,T]);let _=i.useMemo(()=>({reference:C,floating:A,setReference:w,setFloating:x}),[w,x]),D=i.useMemo(()=>({reference:k,floating:S}),[k,S]),I=i.useMemo(()=>{let e={position:r,left:0,top:0};if(!D.floating)return e;let t=eL(D.floating,d.x),n=eL(D.floating,d.y);return h?{...e,transform:"translate("+t+"px, "+n+"px)",...ej(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,h,D.floating,d.x,d.y]);return i.useMemo(()=>({...d,update:N,refs:_,elements:D,floatingStyles:I}),[d,N,_,D,I])}({strategy:"fixed",placement:K+("center"!==Y?"-"+Y:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let i;void 0===n&&(n={});let{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:h=!1}=n,c=ev(e),u=s||o?[...c?em(c):[],...em(t)]:[];
76u.forEach(e=>{s&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let d=c&&l?function(e,t){let r,n=null,i=G(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),s();let h=e.getBoundingClientRect(),{left:c,top:u,width:d,height:f}=h;if(a||t(),!d||!f)return;let p={rootMargin:-w(u)+"px "+-w(i.clientWidth-(c+d))+"px "+-w(i.clientHeight-(u+f))+"px "+-w(c)+"px",threshold:v(0,y(1,l))||1},m=!0;function g(t){let n=t[0].intersectionRatio;if(n!==l){if(!m)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||eP(h,e.getBoundingClientRect())||o(),m=!1}try{n=new IntersectionObserver(g,{...p,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(g,p)}n.observe(e)}(!0),s}(c,r):null,f=-1,p=null;a&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),c&&!h&&p.observe(c),p.observe(t));let m=h?ek(e):null;return h&&function t(){let n=ek(e);m&&!eP(m,n)&&r(),m=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{s&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==d||d(),null==(e=p)||e.disconnect(),p=null,h&&cancelAnimationFrame(i)}})(...e,{animationFrame:"always"===ei}),elements:{reference:ea.anchor},middleware:[{...{name:"offset",options:o=r={mainAxis:J+eg,alignmentAxis:X},async fn(e){var t,r;let{x:n,y:i,placement:s,middlewareData:a}=e,l=await V(e,o);return s===(null==(t=a.offset)?void 0:t.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:n+l.x,y:i+l.y,data:{...l,placement:s}}}},options:[r,n]},Z&&{...{name:"shift",options:f=u={mainAxis:!0,crossAxis:!1,limiter:"partial"===er?{...(void 0===(c=a)&&(c={}),{options:c,fn(e){let{x:t,y:r,placement:n,rects:i,middlewareData:s}=e,{offset:o=0,mainAxis:a=!0,crossAxis:l=!0}=C(c,e),h={x:t,y:r},u=R(n),d=T(u),f=h[d],p=h[u],m=C(o,e),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){let e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+g.mainAxis,r=i.reference[d]+i.reference[e]-g.mainAxis;f<t?f=t:f>r&&(f=r)}if(l){var y,v;let e="y"===d?"width":"height",t=U.has(A(n)),r=i.reference[u]-i.floating[e]+(t&&(null==(y=s.offset)?void 0:y[u])||0)+(t?0:g.crossAxis),o=i.reference[u]+i.reference[e]+(t?0:(null==(v=s.offset)?void 0:v[u])||0)-(t?g.crossAxis:0);p<r?p=r:p>o&&(p=o)}return{[d]:f,[u]:p}}}),options:[a,l]}:void 0,...ex},async fn(e){let{x:t,y:r,placement:n,platform:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=C(f,e),h={x:t,y:r},c=await i.detectOverflow(e,l),u=R(A(n)),d=T(u),p=h[d],m=h[u];if(s){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=p+c[e],n=p-c[t];p=v(r,y(p,n))}if(o){let e="y"===u?"top":"left",t="y"===u?"bottom":"right",r=m+c[e],n=m-c[t];m=v(r,y(m,n))}let g=a.fn({...e,[d]:p,[u]:m});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[d]:s,[u]:o}}}}},options:[u,d]},Z&&{...{name:"flip",options:g=p={...ex},async fn(e){var t,r,n,i,s,o,a,l;
76let h,c,u,{placement:d,middlewareData:f,rects:p,initialPlacement:m,platform:y,elements:v}=e,{mainAxis:b=!0,crossAxis:w=!0,fallbackPlacements:x,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:M=!0,...L}=C(g,e);if(null!=(t=f.arrow)&&t.alignmentOffset)return{};let B=A(d),$=R(m),z=A(m)===m,F=await (null==y.isRTL?void 0:y.isRTL(v.floating)),H=x||(z||!M?[j(m)]:(h=j(m),[N(m),h,N(h)])),W="none"!==S;!x&&W&&H.push(...(c=E(m),u=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?_:P;return t?P:_;case"left":case"right":return t?D:I;default:return[]}}(A(m),"start"===S,F),c&&(u=u.map(e=>e+"-"+c),M&&(u=u.concat(u.map(N)))),u));let U=[m,...H],V=await y.detectOverflow(e,L),q=[],K=(null==(r=f.flip)?void 0:r.overflows)||[];if(b&&q.push(V[B]),w){let e,t,r,n,i=(o=d,a=p,void 0===(l=F)&&(l=!1),e=E(o),r=O(t=T(R(o))),n="x"===t?e===(l?"end":"start")?"right":"left":"start"===e?"bottom":"top",a.reference[r]>a.floating[r]&&(n=j(n)),[n,j(n)]);q.push(V[i[0]],V[i[1]])}if(K=[...K,{placement:d,overflows:q}],!q.every(e=>e<=0)){let e=((null==(n=f.flip)?void 0:n.index)||0)+1,t=U[e];if(t&&("alignment"!==w||$===R(t)||K.every(e=>R(e.placement)!==$||e.overflows[0]>0)))return{data:{index:e,overflows:K},reset:{placement:t}};let r=null==(i=K.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!r)switch(k){case"bestFit":{let e=null==(s=K.filter(e=>{if(W){let t=R(e.placement);return t===$||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(r=e);break}case"initialPlacement":r=m}if(d!==r)return{reset:{placement:r}}}return{}}},options:[p,m]},{...{name:"size",options:k=b={...ex,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:i,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${i}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}},async fn(e){var t,r;let n,i,{placement:s,rects:o,platform:a,elements:l}=e,{apply:h=()=>{},...c}=C(k,e),u=await a.detectOverflow(e,c),d=A(s),f=E(s),p="y"===R(s),{width:m,height:g}=o.floating;"top"===d||"bottom"===d?(n=d,i=f===(await (null==a.isRTL?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(i=d,n="end"===f?"top":"bottom");let b=g-u.top-u.bottom,w=m-u.left-u.right,x=y(g-u[n],b),S=y(m-u[i],w),T=!e.middlewareData.shift,O=x,M=S;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(M=w),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(O=b),T&&!f){let e=v(u.left,0),t=v(u.right,0),r=v(u.top,0),n=v(u.bottom,0);p?M=m-2*(0!==e||0!==t?e+t:v(u.left,u.right)):O=g-2*(0!==r||0!==n?r+n:v(u.top,u.bottom))}await h({...e,availableWidth:M,availableHeight:O});let N=await a.getDimensions(l.floating);return m!==N.width||g!==N.height?{reset:{rects:!0}}:{}}},options:[b,x]},eu&&{...{name:"arrow",options:L=S={element:eu,padding:Q},fn(e){let{element:t,padding:r}="function"==typeof L?L(e):L;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?e_({element:t.current,padding:r}).fn(e):{}:t?e_({element:t,padding:r}).fn(e):{}}},options:[S,M]},e6({arrowWidth:ep,arrowHeight:eg}),en&&{...{name:"hide",options:z=B={strategy:"referenceHidden",...ex},async fn(e){let{rects:t,platform:r}=e,{strategy:n="referenceHidden",...i}=C(z,e);switch(n){case"referenceHidden":{let n=H(await r.detectOverflow(e,{...i,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:W(n)}}}case"escaped":{let n=H(await r.detectOverflow(e,{...i,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:W(n)}}}default:return{}}}},options:[B,$]}]}),[eO,eM]=e8(eA),eR=(0,eH.useCallbackRef)(es);(0,eW.useLayoutEffect)(()=>{eE&&eR?.()},[eE,eR]);let eF=eT.arrow?.x,eU=eT.arrow?.y,eV=eT.arrow?.centerOffset!==0,[eq,eK]=i.useState();return(0,eW.useLayoutEffect)(()=>{el&&eK(window.getComputedStyle(el).zIndex)},[el]),(0,ez.jsx)("div",{ref:eS.setFloating,"data-radix-popper-content-wrapper":"",style:{...eC,transform:eE?eC.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eq,"--radix-popper-transform-origin":[eT.transformOrigin?.x,eT.transformOrigin?.y].join(" "),...eT.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,ez.jsx)(eZ,{scope:q,placedSide:eO,onArrowChange:ed,arrowX:eF,arrowY:eU,shouldHideArrow:eV,children:(0,ez.jsx)(e$.Primitive.div,{"data-side":eO,"data-align":eM,...eo,ref:ec,style:{...eo.style,animation:eE?void 0:"none"}})})})});e1.displayName=eQ;var e2="PopperArrow",e3={top:"bottom",right:"left",bottom:"top",left:"r
76ight"},e5=i.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,i=e0(e2,r),s=e3[i.placedSide];return(0,ez.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,ez.jsx)(eF,{...n,ref:t,style:{...n.style,display:"block"}})})});function e4(e){return null!==e}e5.displayName=e2;var e6=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,o=s?0:e.arrowWidth,a=s?0:e.arrowHeight,[l,h]=e8(r),c={start:"0%",center:"50%",end:"100%"}[h],u=(i.arrow?.x??0)+o/2,d=(i.arrow?.y??0)+a/2,f="",p="";return"bottom"===l?(f=s?c:`${u}px`,p=`${-a}px`):"top"===l?(f=s?c:`${u}px`,p=`${n.floating.height+a}px`):"right"===l?(f=`${-a}px`,p=s?c:`${d}px`):"left"===l&&(f=`${n.floating.width+a}px`,p=s?c:`${d}px`),{data:{x:f,y:p}}}});function e8(e){let[t,r="center"]=e.split("-");return[t,r]}var e9=e.i(74606),e7=Symbol("radix.slottable");function te(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===e7}var tt=e.i(69340),tr=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});i.forwardRef((e,t)=>(0,ez.jsx)(e$.Primitive.span,{...e,ref:t,style:{...tr,...e.style}})).displayName="VisuallyHidden";var tn=e.i(86312),ti=e.i(85369),ts=[" ","Enter","ArrowUp","ArrowDown"],to=[" ","Enter"],ta="Select",[tl,th,tc]=(0,l.createCollection)(ta),[tu,td]=(0,c.createContextScope)(ta,[tc,eq]),tf=eq(),[tp,tm]=tu(ta),[tg,ty]=tu(ta),tv=e=>{let{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:a,defaultValue:l,onValueChange:h,dir:c,name:d,autoComplete:f,disabled:p,required:g,form:y}=e,v=tf(t),[b,w]=i.useState(null),[x,k]=i.useState(null),[S,C]=i.useState(!1),A=(0,u.useDirection)(c),[E,T]=(0,tt.useControllableState)({prop:n,defaultProp:s??!1,onChange:o,caller:ta}),[O,M]=(0,tt.useControllableState)({prop:a,defaultProp:l,onChange:h,caller:ta}),R=i.useRef(null),N=!b||y||!!b.closest("form"),[P,_]=i.useState(new Set),D=Array.from(P).map(e=>e.props.value).join(";");return(0,ez.jsx)(eG,{...v,children:(0,ez.jsxs)(tp,{required:g,scope:t,trigger:b,onTriggerChange:w,valueNode:x,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:(0,m.useId)(),value:O,onValueChange:M,open:E,onOpenChange:T,dir:A,triggerPointerDownPosRef:R,disabled:p,children:[(0,ez.jsx)(tl.Provider,{scope:t,children:(0,ez.jsx)(tg,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(e=>{_(t=>new Set(t).add(e))},[]),onNativeOptionRemove:i.useCallback(e=>{_(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:r})}),N?(0,ez.jsxs)(t5,{"aria-hidden":!0,required:g,tabIndex:-1,name:d,autoComplete:f,value:O,onChange:e=>M(e.target.value),disabled:p,form:y,children:[void 0===O?(0,ez.jsx)("option",{value:""}):null,Array.from(P)]},D):null]})})};tv.displayName=ta;var tb="SelectTrigger",tw=i.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:n=!1,...s}=e,o=tf(r),l=tm(tb,r),c=l.disabled||n,u=(0,h.useComposedRefs)(t,l.onTriggerChange),d=th(r),f=i.useRef("touch"),[p,m,g]=t6(e=>{let t=d().filter(e=>!e.disabled),r=t.find(e=>e.value===l.value),n=t8(t,e,r);void 0!==n&&l.onValueChange(n.value)}),y=e=>{c||(l.onOpenChange(!0),g()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,ez.jsx)(eX,{asChild:!0,...o,children:(0,ez.jsx)(e$.Primitive.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":t4(l.value)?"":void 0,...s,ref:u,onClick:(0,a.composeEventHandlers)(s.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&y(e)}),onPointerDown:(0,a.composeEventHandlers)(s.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(y(e),e.preventDefault())}),onKeyDown:(0,a.composeEventHandlers)(s.onKeyDown,e=>{let t=""!==p.current;
76e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),(!t||" "!==e.key)&&ts.includes(e.key)&&(y(),e.preventDefault())})})})});tw.displayName=tb;var tx="SelectValue",tk=i.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:i,children:s,placeholder:o="",...a}=e,l=tm(tx,r),{onValueNodeHasChildrenChange:c}=l,u=void 0!==s,d=(0,h.useComposedRefs)(t,l.onValueNodeChange);return(0,eW.useLayoutEffect)(()=>{c(u)},[c,u]),(0,ez.jsx)(e$.Primitive.span,{...a,ref:d,style:{pointerEvents:"none"},children:t4(l.value)?(0,ez.jsx)(ez.Fragment,{children:o}):s})});tk.displayName=tx;var tS=i.forwardRef((e,t)=>{let{__scopeSelect:r,children:n,...i}=e;return(0,ez.jsx)(e$.Primitive.span,{"aria-hidden":!0,...i,ref:t,children:n||"▼"})});tS.displayName="SelectIcon";var tC=e=>(0,ez.jsx)(e9.Portal,{asChild:!0,...e});tC.displayName="SelectPortal";var tA="SelectContent",tE=i.forwardRef((e,t)=>{let r=tm(tA,e.__scopeSelect),[n,o]=i.useState();return((0,eW.useLayoutEffect)(()=>{o(new DocumentFragment)},[]),r.open)?(0,ez.jsx)(tR,{...e,ref:t}):n?s.createPortal((0,ez.jsx)(tT,{scope:e.__scopeSelect,children:(0,ez.jsx)(tl.Slot,{scope:e.__scopeSelect,children:(0,ez.jsx)("div",{children:e.children})})}),n):null});tE.displayName=tA;var[tT,tO]=tu(tA),tM=((n=i.forwardRef((e,t)=>{let{children:r,...n}=e;if(i.isValidElement(r)){var s;let e,o,a=(s=r,(o=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(o=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),l=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==i.Fragment&&(l.ref=t?(0,h.composeRefs)(t,a):a),i.cloneElement(r,l)}return i.Children.count(r)>1?i.Children.only(null):null})).displayName="SelectContent.RemoveScroll.SlotClone",t=n,(r=i.forwardRef((e,r)=>{let{children:n,...s}=e,o=i.Children.toArray(n),a=o.find(te);if(a){let e=a.props.children,n=o.map(t=>t!==a?t:i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null);return(0,ez.jsx)(t,{...s,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,n):null})}return(0,ez.jsx)(t,{...s,ref:r,children:n})})).displayName="SelectContent.RemoveScroll.Slot",r),tR=i.forwardRef((e,t)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:l,side:c,sideOffset:u,align:m,alignOffset:g,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:w,hideWhenDetached:x,avoidCollisions:k,...S}=e,C=tm(tA,r),[A,E]=i.useState(null),[T,O]=i.useState(null),M=(0,h.useComposedRefs)(t,e=>E(e)),[R,N]=i.useState(null),[P,_]=i.useState(null),D=th(r),[I,j]=i.useState(!1),L=i.useRef(!1);i.useEffect(()=>{if(A)return(0,tn.hideOthers)(A)},[A]),(0,f.useFocusGuards)();let B=i.useCallback(e=>{let[t,...r]=D().map(e=>e.ref.current),[n]=r.slice(-1),i=document.activeElement;for(let r of e)if(r===i||(r?.scrollIntoView({block:"nearest"}),r===t&&T&&(T.scrollTop=0),r===n&&T&&(T.scrollTop=T.scrollHeight),r?.focus(),document.activeElement!==i))return},[D,T]),$=i.useCallback(()=>B([R,A]),[B,R,A]);i.useEffect(()=>{I&&$()},[I,$]);let{onOpenChange:z,triggerPointerDownPosRef:F}=C;i.useEffect(()=>{if(A){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():A.contains(r.target)||z(!1),document.removeEventListener("pointermove",t),F.current=null};return null!==F.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[A,z,F]),i.useEffect(()=>{let e=()=>z(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[z]);let[H,W]=t6(e=>{let t=D().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=t8(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),U=i.useCallback((e,t,r)=>{let n=!L.current&&!r;(void 0!==C.value&&C.value===t||n)&&(N(e),n&&(L.current=!0))},[C.value]),V=i.useCallback(()=>A?.focus(),[A]),q=i.useCallback((e,t,r)=>{let n=!L.current&&!r;(void 0!==C.value&&C.value===t||n)&&_(e)},[C.value]),K="popper"===n?tP:tN,J=K===tP?{side:c,sideOffset:u,align:m,alignOffset:g,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:w,hideWhenDetached:x,avoidCollisions:k}:{};return(0,ez.jsx)(tT,{scope:r,content:A,viewport:T,onViewportChange:O,itemRefCallback:U,selectedItem:R,onItemLeave:V,itemTextRefCallback:q,focusSelectedItem:$,selectedItemText:P,position:n,isPositioned:I,searchRef:H,children:(0,ez.jsx)(ti.RemoveScroll,{as:tM,allowPinchZoom:!0,children:(0,ez.jsx)(p.FocusScope,{asChild:!0,trapped:C.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:(0,a.composeEventHandlers)(s,e=>{C.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,ez.jsx)(d.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:(0,ez.jsx)(K,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:e=>e.preventDefault(),...S,...J,onPlaced:()=>j(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:(0,a.composeEventHandlers)(S.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;
76if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||W(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=D().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>B(t)),e.preventDefault()}})})})})})})});tR.displayName="SelectContentImpl";var tN=i.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:n,...s}=e,a=tm(tA,r),l=tO(tA,r),[c,u]=i.useState(null),[d,f]=i.useState(null),p=(0,h.useComposedRefs)(t,e=>f(e)),m=th(r),g=i.useRef(!1),y=i.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:w,focusSelectedItem:x}=l,k=i.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&d&&v&&b&&w){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),r=a.valueNode.getBoundingClientRect(),i=w.getBoundingClientRect();if("rtl"!==a.dir){let n=i.left-t.left,s=r.left-n,a=e.left-s,l=e.width+a,h=Math.max(l,t.width),u=window.innerWidth-10,d=(0,o.clamp)(s,[10,Math.max(10,u-h)]);c.style.minWidth=l+"px",c.style.left=d+"px"}else{let n=t.right-i.right,s=window.innerWidth-r.right-n,a=window.innerWidth-e.right-s,l=e.width+a,h=Math.max(l,t.width),u=window.innerWidth-10,d=(0,o.clamp)(s,[10,Math.max(10,u-h)]);c.style.minWidth=l+"px",c.style.right=d+"px"}let s=m(),l=window.innerHeight-20,h=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),y=parseInt(u.borderBottomWidth,10),x=f+p+h+parseInt(u.paddingBottom,10)+y,k=Math.min(5*b.offsetHeight,x),S=window.getComputedStyle(v),C=parseInt(S.paddingTop,10),A=parseInt(S.paddingBottom,10),E=e.top+e.height/2-10,T=b.offsetHeight/2,O=f+p+(b.offsetTop+T);if(O<=E){let e=s.length>0&&b===s[s.length-1].ref.current;c.style.bottom="0px";let t=Math.max(l-E,T+(e?A:0)+(d.clientHeight-v.offsetTop-v.offsetHeight)+y);c.style.height=O+t+"px"}else{let e=s.length>0&&b===s[0].ref.current;c.style.top="0px";let t=Math.max(E,f+v.offsetTop+(e?C:0)+T);c.style.height=t+(x-O)+"px",v.scrollTop=O-E+v.offsetTop}c.style.margin="10px 0",c.style.minHeight=k+"px",c.style.maxHeight=l+"px",n?.(),requestAnimationFrame(()=>g.current=!0)}},[m,a.trigger,a.valueNode,c,d,v,b,w,a.dir,n]);(0,eW.useLayoutEffect)(()=>k(),[k]);let[S,C]=i.useState();(0,eW.useLayoutEffect)(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);let A=i.useCallback(e=>{e&&!0===y.current&&(k(),x?.(),y.current=!1)},[k,x]);return(0,ez.jsx)(t_,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:A,children:(0,ez.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,ez.jsx)(e$.Primitive.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});tN.displayName="SelectItemAlignedPosition";var tP=i.forwardRef((e,t)=>{let{__scopeSelect:r,align:n="start",collisionPadding:i=10,...s}=e,o=tf(r);return(0,ez.jsx)(e1,{...o,...s,ref:t,align:n,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});tP.displayName="SelectPopperPosition";var[t_,tD]=tu(tA,{}),tI="SelectViewport",tj=i.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:n,...s}=e,o=tO(tI,r),l=tD(tI,r),c=(0,h.useComposedRefs)(t,o.onViewportChange),u=i.useRef(0);return(0,ez.jsxs)(ez.Fragment,{children:[(0,ez.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,ez.jsx)(tl.Slot,{scope:r,children:(0,ez.jsx)(e$.Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:(0,a.composeEventHandlers)(s.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=l;if(n?.current&&r){let e=Math.abs(u.current-t.scrollTop);if(e>0){let n=window.innerHeight-20,i=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(i<n){let s=i+e,o=Math.min(n,s),a=s-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=a>0?a:0,r.style.justifyContent="flex-end")}}}u.current=t.scrollTop})})})]})});tj.displayName=tI;var tL="SelectGroup",[tB,t$]=tu(tL),tz=i.forwardRef((e,t)=>
76{let{__scopeSelect:r,...n}=e,i=(0,m.useId)();return(0,ez.jsx)(tB,{scope:r,id:i,children:(0,ez.jsx)(e$.Primitive.div,{role:"group","aria-labelledby":i,...n,ref:t})})});tz.displayName=tL;var tF="SelectLabel",tH=i.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,i=t$(tF,r);return(0,ez.jsx)(e$.Primitive.div,{id:i.id,...n,ref:t})});tH.displayName=tF;var tW="SelectItem",[tU,tV]=tu(tW),tq=i.forwardRef((e,t)=>{let{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...l}=e,c=tm(tW,r),u=tO(tW,r),d=c.value===n,[f,p]=i.useState(o??""),[g,y]=i.useState(!1),v=(0,h.useComposedRefs)(t,e=>u.itemRefCallback?.(e,n,s)),b=(0,m.useId)(),w=i.useRef("touch"),x=()=>{s||(c.onValueChange(n),c.onOpenChange(!1))};if(""===n)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,ez.jsx)(tU,{scope:r,value:n,disabled:s,textId:b,isSelected:d,onItemTextChange:i.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:(0,ez.jsx)(tl.ItemSlot,{scope:r,value:n,disabled:s,textValue:f,children:(0,ez.jsx)(e$.Primitive.div,{role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:v,onFocus:(0,a.composeEventHandlers)(l.onFocus,()=>y(!0)),onBlur:(0,a.composeEventHandlers)(l.onBlur,()=>y(!1)),onClick:(0,a.composeEventHandlers)(l.onClick,()=>{"mouse"!==w.current&&x()}),onPointerUp:(0,a.composeEventHandlers)(l.onPointerUp,()=>{"mouse"===w.current&&x()}),onPointerDown:(0,a.composeEventHandlers)(l.onPointerDown,e=>{w.current=e.pointerType}),onPointerMove:(0,a.composeEventHandlers)(l.onPointerMove,e=>{w.current=e.pointerType,s?u.onItemLeave?.():"mouse"===w.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:(0,a.composeEventHandlers)(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:(0,a.composeEventHandlers)(l.onKeyDown,e=>{(u.searchRef?.current===""||" "!==e.key)&&(to.includes(e.key)&&x()," "===e.key&&e.preventDefault())})})})})});tq.displayName=tW;var tK="SelectItemText",tJ=i.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:o,...a}=e,l=tm(tK,r),c=tO(tK,r),u=tV(tK,r),d=ty(tK,r),[f,p]=i.useState(null),m=(0,h.useComposedRefs)(t,e=>p(e),u.onItemTextChange,e=>c.itemTextRefCallback?.(e,u.value,u.disabled)),g=f?.textContent,y=i.useMemo(()=>(0,ez.jsx)("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=d;return(0,eW.useLayoutEffect)(()=>(v(y),()=>b(y)),[v,b,y]),(0,ez.jsxs)(ez.Fragment,{children:[(0,ez.jsx)(e$.Primitive.span,{id:u.textId,...a,ref:m}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?s.createPortal(a.children,l.valueNode):null]})});tJ.displayName=tK;var tG="SelectItemIndicator",tY=i.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return tV(tG,r).isSelected?(0,ez.jsx)(e$.Primitive.span,{"aria-hidden":!0,...n,ref:t}):null});tY.displayName=tG;var tX="SelectScrollUpButton",tQ=i.forwardRef((e,t)=>{let r=tO(tX,e.__scopeSelect),n=tD(tX,e.__scopeSelect),[s,o]=i.useState(!1),a=(0,h.useComposedRefs)(t,n.onScrollButtonChange);return(0,eW.useLayoutEffect)(()=>{if(r.viewport&&r.isPositioned){let e=function(){o(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),s?(0,ez.jsx)(t1,{...e,ref:a,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});tQ.displayName=tX;var tZ="SelectScrollDownButton",t0=i.forwardRef((e,t)=>{let r=tO(tZ,e.__scopeSelect),n=tD(tZ,e.__scopeSelect),[s,o]=i.useState(!1),a=(0,h.useComposedRefs)(t,n.onScrollButtonChange);return(0,eW.useLayoutEffect)(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),s?(0,ez.jsx)(t1,{...e,ref:a,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});t0.displayName=tZ;var t1=i.forwardRef((e,t)=>
76{let{__scopeSelect:r,onAutoScroll:n,...s}=e,o=tO("SelectScrollButton",r),l=i.useRef(null),h=th(r),c=i.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>c(),[c]),(0,eW.useLayoutEffect)(()=>{let e=h().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[h]),(0,ez.jsx)(e$.Primitive.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:(0,a.composeEventHandlers)(s.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(n,50))}),onPointerMove:(0,a.composeEventHandlers)(s.onPointerMove,()=>{o.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(n,50))}),onPointerLeave:(0,a.composeEventHandlers)(s.onPointerLeave,()=>{c()})})}),t2=i.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return(0,ez.jsx)(e$.Primitive.div,{"aria-hidden":!0,...n,ref:t})});t2.displayName="SelectSeparator";var t3="SelectArrow";i.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,i=tf(r),s=tm(t3,r),o=tO(t3,r);return s.open&&"popper"===o.position?(0,ez.jsx)(e5,{...i,...n,ref:t}):null}).displayName=t3;var t5=i.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{let s,o=i.useRef(null),a=(0,h.useComposedRefs)(n,o),l=(s=i.useRef({value:t,previous:t}),i.useMemo(()=>(s.current.value!==t&&(s.current.previous=s.current.value,s.current.value=t),s.current.previous),[t]));return i.useEffect(()=>{let e=o.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(l!==t&&r){let n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[l,t]),(0,ez.jsx)(e$.Primitive.select,{...r,style:{...tr,...r.style},ref:a,defaultValue:t})});function t4(e){return""===e||void 0===e}function t6(e){let t=(0,eH.useCallbackRef)(e),r=i.useRef(""),n=i.useRef(0),s=i.useCallback(e=>{let i=r.current+e;t(i),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(i)},[t]),o=i.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function t8(e,t,r){var n,i;let s=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=r?e.indexOf(r):-1,a=(n=e,i=Math.max(o,0),n.map((e,t)=>n[(i+t)%n.length]));1===s.length&&(a=a.filter(e=>e!==r));let l=a.find(e=>e.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==r?l:void 0}t5.displayName="SelectBubbleInput",e.s(["Content",0,tE,"Group",0,tz,"Icon",0,tS,"Item",0,tq,"ItemIndicator",0,tY,"ItemText",0,tJ,"Label",0,tH,"Portal",0,tC,"Root",0,tv,"ScrollDownButton",0,t0,"ScrollUpButton",0,tQ,"Separator",0,t2,"Trigger",0,tw,"Value",0,tk,"Viewport",0,tj],29402)},43531,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,t],43531)},55838,(e,t,r)=>{"use strict";var n=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=n.useState,o=n.useEffect,a=n.useLayoutEffect,l=n.useDebugValue;function h(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=s({inst:{value:r,getSnapshot:t}}),i=n[0].inst,c=n[1];return a(function(){i.value=r,i.getSnapshot=t,h(i)&&c({inst:i})},[e,r,t]),o(function(){return h(i)&&c({inst:i}),e(function(){h(i)&&c({inst:i})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},2239,(e,t,r)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,r)=>{"use strict";var n=e.r(71645),i=e.r(2239),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=i.useSyncExternalStore,a=n.useRef,l=n.useEffect,h=n.useMemo,c=n.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var u=a(null);if(null===u.current){var d={hasValue:!1,value:null};u.current=d}else d=u.current;var f=o(e,(u=h(function(){function e(e){if(!l){if(l=!0,o=e,e=n(e),void 0!==i&&d.hasValue){var t=d.value;if(i(t,e))return a=t}return a=e}if(t=a,s(o,e))return t;var r=n(e);return void 0!==i&&i(t,r)?(o=e,t):(o=e,a=r)}var o,a,l=!1,h=void 0===r?null:r;return[function(){return e(t())},null===h?void 0:function(){return e(h())}]},[t,r,n,i]))[0],u[1]);return l(function(){d.hasValue=!0,d.value=f},[f]),c(f),f}},30224,(e,t,r)=>{"use strict";
76t.exports=e.r(52822)},19566,94499,63612,76399,56378,55841,3869,97643,30152,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(29402),i=e.i(43531),s=e.i(64659),o=e.i(55900),a=e.i(8311);let l=n.Root;n.Group;let h=n.Value,c=r.forwardRef(({className:e,children:r,...i},o)=>(0,t.jsxs)(n.Trigger,{ref:o,className:(0,a.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...i,children:[r,(0,t.jsx)(n.Icon,{asChild:!0,children:(0,t.jsx)(s.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));c.displayName=n.Trigger.displayName;let u=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.ScrollUpButton,{ref:i,className:(0,a.cn)("flex cursor-default items-center justify-center py-1",e),...r,children:(0,t.jsx)(o.ChevronUp,{className:"h-4 w-4"})}));u.displayName=n.ScrollUpButton.displayName;let d=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.ScrollDownButton,{ref:i,className:(0,a.cn)("flex cursor-default items-center justify-center py-1",e),...r,children:(0,t.jsx)(s.ChevronDown,{className:"h-4 w-4"})}));d.displayName=n.ScrollDownButton.displayName;let f=r.forwardRef(({className:e,children:r,position:i="popper",...s},o)=>(0,t.jsx)(n.Portal,{children:(0,t.jsxs)(n.Content,{ref:o,className:(0,a.cn)("zero relative z-[9999] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-background text-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:i,...s,children:[(0,t.jsx)(u,{}),(0,t.jsx)(n.Viewport,{className:(0,a.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,t.jsx)(d,{})]})}));f.displayName=n.Content.displayName,r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Label,{ref:i,className:(0,a.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...r})).displayName=n.Label.displayName;let p=r.forwardRef(({className:e,children:r,...s},o)=>(0,t.jsxs)(n.Item,{ref:o,className:(0,a.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(n.ItemIndicator,{children:(0,t.jsx)(i.Check,{className:"h-4 w-4"})})}),(0,t.jsx)(n.ItemText,{children:r})]}));p.displayName=n.Item.displayName,r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Separator,{ref:i,className:(0,a.cn)("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=n.Separator.displayName,e.s(["Select",0,l,"SelectContent",0,f,"SelectItem",0,p,"SelectTrigger",0,c,"SelectValue",0,h],19566),e.i(47167);var m=r,g=e.i(74080),y=e.i(2239);function v(e){this.content=e}function b(e){return e>=56320&&e<57344}function w(e){return e>=55296&&e<56320}v.prototype={constructor:v,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 -1==t?void 0:this.content[t+1]},update:function(e,t,r){var n=r&&r!=e?this.remove(r):this,i=n.find(e),s=n.content.slice();return -1==i?s.push(r||e,t):(s[i+1]=t,r&&(s[i]=r)),new v(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var r=this.content.slice();return r.splice(t,2),new v(r)},addToStart:function(e,t){return new v([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new v(r)},addBefore:function(e,t,r){var n=this.remove(t),i=n.content.slice(),s=n.find(e);return i.splice(-1==s?i.length:s,0,t,r),new v(i)}
vendor: 3,483 bytes, line 76
76,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=v.from(e)).size?new v(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=v.from(e)).size?new v(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=v.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},toObject:function(){var e={};return this.forEach(function(t,r){e[t]=r}),e},get size(){return this.content.length>>1}},v.from=function(e){if(e instanceof v)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new v(t)};class x{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,r,n=0,i){for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;if(l>e&&!1!==r(a,n+o,i||null,s)&&a.content.size){let i=o+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),r,n+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,n){let i="",s=!0;return this.nodesBetween(e,t,(o,a)=>{let l=o.isText?o.text.slice(Math.max(e,a)-a,t-a):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&r&&(s?s=!1:i+=r),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,n=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(n[n.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)n.push(e.content[i]);return new x(n,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let r=[],n=0;if(t>e)for(let i=0,s=0;s<t;i++){let o=this.content[i],a=s+o.nodeSize;a>e&&((s<e||a>t)&&(o=o.isText?o.cut(Math.max(0,e-s),Math.min(o.text.length,t-s)):o.cut(Math.max(0,e-s-1),Math.min(o.content.size,t-s-1))),r.push(o),n+=o.nodeSize),s=a}return new x(r,n)}cutByIndex(e,t){return e==t?x.empty:0==e&&t==this.content.length?this:new x(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let n=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return n[e]=t,new x(n,i)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let n=this.content[t];e(n,r,t),r+=n.nodeSize}}findDiffStart(e,t=0){return function e(t,r,n){for(let i=0;;i++){if(i==t.childCount||i==r.childCount)return t.childCount==r.childCount?null:n;let s=t.child(i),o=r.child(i);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){let e=s.text,t=o.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&w(e.charCodeAt(r-1))&&b(e.charCodeAt(r))&&n--,n}if(s.content.size||o.content.size){let t=e(s.content,o.content,n+1);if(null!=t)return t}n+=s.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return function e(t,r,n,i){for(let s=t.childCount,o=r.childCount;;
76){if(0==s||0==o)return s==o?null:{a:n,b:i};let a=t.child(--s),l=r.child(--o),h=a.nodeSize;if(a==l){n-=h,i-=h;continue}if(!a.sameMarkup(l))return{a:n,b:i};if(a.isText&&a.text!=l.text){let e=a.text,t=l.text,r=e.length,s=t.length;for(;r>0&&s>0&&e[r-1]==t[s-1];)r--,s--,n--,i--;return r&&s&&r<e.length&&w(e.charCodeAt(r-1))&&b(e.charCodeAt(r))&&(n++,i++),{a:n,b:i}}if(a.content.size||l.content.size){let t=e(a.content,l.content,n-1,i-1);if(t)return t}n-=h,i-=h}}(this,e,t,r)}findIndex(e){if(0==e)return S(0,e);if(e==this.size)return S(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let n=r+this.child(t).nodeSize;if(n>=e){if(n==e)return S(t+1,n);return S(t,r)}r=n}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return x.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return x.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let t,r=0;for(let n=0;n<e.length;n++){let i=e[n];r+=i.nodeSize,n&&i.isText&&e[n-1].sameMarkup(i)?(t||(t=e.slice(0,n)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new x(t||e,r)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);let k={index:0,offset:0};function S(e,t){return k.index=e,k.offset=t,k}function C(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!C(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!C(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class A{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,n));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,n)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&C(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw RangeError(`There is no mark type ${t.type} in this schema`);let n=r.create(t.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return A.none;if(e instanceof A)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}A.none=[];class E extends Error{}class T{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=function e(t,r,n,i,s,o){let{index:a,offset:l}=t.findIndex(r),h=t.maybeChild(a);if(l==r||h.isText)return o&&i<=0&&s<=0&&!o.canReplace(a,a,n)?null:t.cut(0,r).append(n).append(t.cut(r));let c=e(h.content,r-l-1,n,0==a?i-1:0,a==t.childCount-1?s-1:0,h);return c&&t.replaceChild(a,h.copy(c))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new T(r,this.openStart,this.openEnd)}removeBetween(e,t){return new T(function e(t,r,n){let{index:i,offset:s}=t.findIndex(r),o=t.maybeChild(i),{index:a,offset:l}=t.findIndex(n);if(s==r||o.isText){if(l!=n&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,r).append(t.cut(n))}if(i!=a)throw RangeError("Removing non-flat range");return t.replaceChild(i,o.copy(e(o.content,r-s-1,n-s-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return T.empty;let r=t.openStart||0,n=t.openEnd||0;if("number"!=typeof r||"number"!=typeof n)throw RangeError("Invalid input for Slice.fromJSON");return new T(x.fromJSON(e,t.content),r,n)}static maxOpen(e,t=!0){let r=0,n=0;for(let n=e.firstChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)n++;return new T(e,r,n)}}function O(e,t){if(!t.type.compatibleContent(e.type))throw new E("Cannot join "+t.type.name+" onto "+e.type.n
vendor: 4,756 bytes, line 76
76ame)}function M(e,t,r){let n=e.node(r);return O(n,t.node(r)),n}function R(e,t){let r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function N(e,t,r,n){let i=(t||e).node(r),s=0,o=t?t.index(r):i.childCount;e&&(s=e.index(r),e.depth>r?s++:e.textOffset&&(R(e.nodeAfter,n),s++));for(let e=s;e<o;e++)R(i.child(e),n);t&&t.depth==r&&t.textOffset&&R(t.nodeBefore,n)}function P(e,t){if(!e.type.validContent(t))throw new E("Invalid content for node "+e.type.name);return e.copy(t)}function _(e,t,r){let n=[];return N(null,e,r,n),e.depth>r&&R(P(M(e,t,r+1),_(e,t,r+1)),n),N(t,null,r,n),new x(n)}T.empty=new T(x.empty,0,0);class D{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(t);return r?e.child(t).cut(r):n}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[3*t],n=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)n+=r.child(t).nodeSize;return n}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return A.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),n=e.maybeChild(t);if(!r){let e=r;r=n,n=e}let i=r.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||n&&i[s].isInSet(n.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,n=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||n&&r[i].isInSet(n.marks)||(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new B(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let r=[],n=0,i=t;for(let t=e;;){let{index:e,offset:s}=t.content.findIndex(i),o=i-s;if(r.push(t,e,n+s),!o||(t=t.child(e)).isText)break;i=o-1,n+=s+1}return new D(t,r,i)}static resolveCached(e,t){let r=L.get(e);if(r)for(let e=0;e<r.elts.length;e++){let n=r.elts[e];if(n.pos==t)return n}else L.set(e,r=new I);let n=r.elts[r.i]=D.resolve(e,t);return r.i=(r.i+1)%j,n}}class I{constructor(){this.elts=[],this.i=0}}let j=12,L=new WeakMap;class B{constructor(e,t,r){this.$from=e,this.$to=t,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)}}let $=Object.create(null);class z{constructor(e,t,r,n=A.none){this.type=e,this.attrs=t,this.marks=n,this.content=r||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,n=0){this.content.nodesBetween(e,t,r,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}
76textBetween(e,t,r,n){return this.content.textBetween(e,t,r,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&C(this.attrs,t||e.defaultAttrs||$)&&A.sameSet(this.marks,r||A.none)}copy(e=null){return e==this.content?this:new z(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new z(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return T.empty;let n=this.resolve(e),i=this.resolve(t),s=r?0:n.sharedDepth(t),o=n.start(s);return new T(n.node(s).content.cut(n.pos-o,i.pos-o),n.depth-s,i.depth-s)}replace(e,t,r){var n=this.resolve(e),i=this.resolve(t);if(r.openStart>n.depth)throw new E("Inserted content deeper than insertion position");if(n.depth-r.openStart!=i.depth-r.openEnd)throw new E("Inconsistent open depths");return function e(t,r,n,i){let s=t.index(i),o=t.node(i);if(s==r.index(i)&&i<t.depth-n.openStart){let a=e(t,r,n,i+1);return o.copy(o.content.replaceChild(s,a))}if(!n.content.size)return P(o,_(t,r,i));if(n.openStart||n.openEnd||t.depth!=i||r.depth!=i){let{start:e,end:s}=function(e,t){let r=t.depth-e.openStart,n=t.node(r).copy(e.content);for(let e=r-1;e>=0;e--)n=t.node(e).copy(x.from(n));return{start:n.resolveNoCache(e.openStart+r),end:n.resolveNoCache(n.content.size-e.openEnd-r)}}(n,t);return P(o,function e(t,r,n,i,s){let o=t.depth>s&&M(t,r,s+1),a=i.depth>s&&M(n,i,s+1),l=[];return N(null,t,s,l),o&&a&&r.index(s)==n.index(s)?(O(o,a),R(P(o,e(t,r,n,i,s+1)),l)):(o&&R(P(o,_(t,r,s+1)),l),N(r,n,s,l),a&&R(P(a,_(n,i,s+1)),l)),N(i,null,s,l),new x(l)}(t,e,s,r,i))}{let e=t.parent,i=e.content;return P(e,i.cut(0,t.parentOffset).append(n.content).append(i.cut(r.parentOffset)))}}(n,i,r,0)}nodeAt(e){for(let t=this;;){let{index:r,offset:n}=t.content.findIndex(e);if(!(t=t.maybeChild(r)))return null;if(n==e||t.isText)return t;e-=n+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let n=this.content.child(t-1);return{node:n,index:t-1,offset:r-n.nodeSize}}resolve(e){return D.resolveCached(this,e)}resolveNoCache(e){return D.resolve(this,e)}rangeHasMark(e,t,r){let n=!1;return t>e&&this.nodesBetween(e,t,e=>(r.isInSet(e.marks)&&(n=!0),!n)),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),H(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=x.empty,n=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,n,i),o=s&&s.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,t,r,n){if(n&&!this.type.allowsMarks(n))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return!!s&&s.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=A.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!A.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>
76e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let r;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,r)}let n=x.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,n,r);return i.type.checkAttrs(i.attrs),i}}z.prototype.text=void 0;class F extends z{constructor(e,t,r,n){if(super(e,t,null,n),!r)throw RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):H(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new F(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new F(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function H(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}class W{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var r;let n,i=new U(e,t);if(null==i.next)return W.empty;let s=function e(t){let r=[];do r.push(function(t){let r=[];do r.push(function(t){let r=function(t){if(t.eat("(")){let r=e(t);return t.eat(")")||t.err("Missing closing paren"),r}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let r=e.nodeTypes,n=r[t];if(n)return[n];let i=[];for(let e in r){let n=r[e];n.isInGroup(t)&&i.push(n)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))r={type:"plus",expr:r};else if(t.eat("*"))r={type:"star",expr:r};else if(t.eat("?"))r={type:"opt",expr:r};else if(t.eat("{"))r=function(e,t){let r=V(e),n=r;return e.eat(",")&&(n="}"!=e.next?V(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}(t,r);else break;return r}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==r.length?r[0]:{type:"seq",exprs:r}}(t));while(t.eat("|"))return 1==r.length?r[0]:{type:"choice",exprs:r}}(i);i.next&&i.err("Unexpected trailing text");let o=(r=function(e){let t=[[]];return i(function e(t,s){if("choice"==t.type)return t.exprs.reduce((t,r)=>t.concat(e(r,s)),[]);if("seq"==t.type)for(let n=0;;n++){let o=e(t.exprs[n],s);if(n==t.exprs.length-1)return o;i(o,s=r())}else if("star"==t.type){let o=r();return n(s,o),i(e(t.expr,o),o),[n(o)]}else if("plus"==t.type){let o=r();return i(e(t.expr,s),o),i(e(t.expr,o),o),[n(o)]}else if("opt"==t.type)return[n(s)].concat(e(t.expr,s));else if("range"==t.type){let o=s;for(let n=0;n<t.min;n++){let n=r();i(e(t.expr,o),n),o=n}if(-1==t.max)i(e(t.expr,o),o);else for(let s=t.min;s<t.max;s++){let s=r();n(o,s),i(e(t.expr,o),s),o=s}return[n(o)]}else if("name"==t.type)return[n(s,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),r()),t;function r(){return t.push([])-1}function n(e,r,n){let i={term:n,to:r};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(s),n=Object.create(null),function e(t){let i=[];t.forEach(e=>{r[e].forEach(({term:e,to:t})=>{let n;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(n=i[t][1]);K(r,t).forEach(t=>{n||i.push([e,n=[]]),-1==n.indexOf(t)&&n.push(t)})}})});let s=n[t.join(",")]=new W(t.indexOf(r.length-1)>-1);for(let t=0;t<i.length;t++){let r=i[t][1].sort(q);s.next.push({type:i[t][0],next:n[r.join(",")]||e(r)})}return s}(K(r,0)));return function(e,t){for(let r=0,n=[e];r<n.length;r++){let e=n[r],i=!e.validEnd,s=[];for(let t=0;t<e.next.length;t++){let{type:r,next:o}=e.next[t];s.push(r.name),i&&!(r.isText||r.hasRequiredAttrs())&&(i=!1),-1==n.indexOf(o)&&n.push(o)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,i),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}
vendor: 4,607 bytes, line 76
76matchFragment(e,t=0,r=e.childCount){let n=this;for(let i=t;n&&i<r;i++)n=n.matchType(e.child(i).type);return n}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let n=[this];return function i(s,o){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return x.from(o.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:r}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==n.indexOf(r)){n.push(r);let e=i(r,o.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),i=n.match;if(i.matchType(e)){let e=[];for(let t=n;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:s,next:o}=i.next[e];s.isLeaf||s.hasRequiredAttrs()||s.name in t||n.type&&!o.validEnd||(r.push({match:s.contentMatch,type:s,via:n}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&t(r.next[n].next)}(this),e.map((t,r)=>{let n=r+(t.validEnd?"*":" ")+" ";for(let r=0;r<t.next.length;r++)n+=(r?", ":"")+t.next[r].type.name+"->"+e.indexOf(t.next[r].next);return n}).join("\n")}}W.empty=new W(!0);class U{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function V(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function q(e,t){return t-e}function K(e,t){let r=[];return function t(n){let i=e[n];if(1==i.length&&!i[0].term)return t(i[0].to);r.push(n);for(let e=0;e<i.length;e++){let{term:n,to:s}=i[e];n||-1!=r.indexOf(s)||t(s)}}(t),r.sort(q)}function J(e){let t=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;t[r]=n.default}return t}function G(e,t){let r=Object.create(null);for(let n in e){let i=t&&t[n];if(void 0===i){let t=e[n];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+n)}r[n]=i}return r}function Y(e,t,r,n){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${r} of type ${n}`);for(let r in e)e[r].validate&&e[r].validate(t[r])}function X(e,t){let r=Object.create(null);if(t)for(let n in t)r[n]=new Z(e,n,t[n]);return r}class Q{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=X(e,r.attrs),this.defaultAttrs=J(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==W.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:G(this.attrs,e)}create(e=null,t,r){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new z(this,this.computeAttrs(e),x.from(t),A.setFrom(r))}createChecked(e=null,t,r){return t=x.from(t),this.checkContent(t),new z(this,this.computeAttrs(e),t,A.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),(t=x.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let n=this.contentMatch.matchFragment(t),i=n&&n.fillBefore(x.empty,!0);return i?new z(this,e,t.append(i),A.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);
76if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Y(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:A.none:e}static compile(e,t){let r=Object.create(null);e.forEach((e,n)=>r[e]=new Q(e,t,n));let n=t.spec.topNode||"doc";if(!r[n])throw RangeError("Schema is missing its top node type ('"+n+"')");if(!r.text)throw RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw RangeError("The text node type should not have attributes");return r}}class Z{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,r){let n=r.split("|");return r=>{let i=null===r?"null":typeof r;if(0>n.indexOf(i))throw RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ee{constructor(e,t,r,n){this.name=e,this.rank=t,this.schema=r,this.spec=n,this.attrs=X(e,n.attrs),this.excluded=null;let i=J(this.attrs);this.instance=i?new A(this,i):null}create(e=null){return!e&&this.instance?this.instance:new A(this,G(this.attrs,e))}static compile(e,t){let r=Object.create(null),n=0;return e.forEach((e,i)=>r[e]=new ee(e,n++,t,i)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Y(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class et{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=v.from(e.nodes),t.marks=v.from(e.marks||{}),this.nodes=Q.compile(this.spec.nodes,this),this.marks=ee.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],n=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=W.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?er(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],r=t.spec.excludes;t.excluded=null==r?[t]:""==r?[]:er(this,r.split(" "))}this.nodeFromJSON=e=>z.fromJSON(this,e),this.markFromJSON=e=>A.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,n){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof Q){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,r,n)}text(e,t){let r=this.nodes.text;return new F(r,r.defaultAttrs,e,A.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function er(e,t){let r=[];for(let n=0;n<t.length;n++){let i=t[n],s=e.marks[i],o=s;if(s)r.push(s);else for(let t in e.marks){let n=e.marks[t];("_"==i||n.spec.group&&n.spec.group.split(" ").indexOf(i)>-1)&&r.push(o=n)}if(!o)throw SyntaxError("Unknown mark type: '"+t[n]+"'")}return r}class en{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];
76t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>r.indexOf(t)&&r.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let r=e.nodes[t.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let r=new eh(this,t,!1);return r.addAll(e,A.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new eh(this,t,!0);return r.addAll(e,A.none,t.from,t.to),T.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){var n,i;let r=this.tags[s];if(n=e,i=r.tag,(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,i)&&(void 0===r.namespace||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}matchStyle(e,t,r,n){for(let i=n?this.styles.indexOf(n)+1:0;i<this.styles.length;i++){let n=this.styles[i],s=n.style;if(0==s.indexOf(e)&&(!n.context||r.matchesContext(n.context))&&(!(s.length>e.length)||61==s.charCodeAt(e.length)&&s.slice(e.length+1)==t)){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}static schemaRules(e){let t=[];function r(e){let r=null==e.priority?50:e.priority,n=0;for(;n<t.length;n++){let e=t[n];if((null==e.priority?50:e.priority)<r)break}t.splice(n,0,e)}for(let t in e.marks){let n=e.marks[t].spec.parseDOM;n&&n.forEach(e=>{r(e=ec(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let n=e.nodes[t].spec.parseDOM;n&&n.forEach(e=>{r(e=ec(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new en(e,en.schemaRules(e)))}}let ei={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},es={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},eo={ol:!0,ul:!0};function ea(e,t,r){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&r}class el{constructor(e,t,r,n,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=n,this.options=s,this.content=[],this.activeMarks=A.none,this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(x.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,r;return(r=t.findWrapping(e.type))?(this.match=t,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=x.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ei.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class eh{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let n=t.topNode,i,s=ea(null,t.preserveWhitespace,0)|4*!!r;i=n?new el(n.type,n.attrs,A.none,!0,t.topMatch||n.type.contentMatch,s):r?new el(null,null,A.none,!0,null,s):new el(e.schema.topNodeType,null,A.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,n=this.top,i=2&n.options?"full":this.localPreserveWS||(1&n.options)>0,{schema:s}=this.parser;if("full"===i||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if("full"===i)r=r.replace(/\r\n?/g,"\n");else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let e=r.split(/\r?\n|\r/);for(let r=0;r<e.length;r++)r&&this.insertNode(s.linebreakReplacement.create(),t,!0),e[r]&&this.insertNode(s.text(e[r]),t,!/\S/.test(e[r]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let t=n.content[n.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let n=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;eo.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,r=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;
vendor: 5,101 bytes, line 76
76e&&eo.hasOwnProperty(e)&&r?(r.appendChild(t),t=r):"li"==e?r=t:e&&(r=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));a:if(a?a.ignore:es.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let r,n=this.needsBlock;if(ei.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),r=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break a}let o=a&&a.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),r&&this.sync(i),this.needsBlock=n}else{let r=this.readStyles(e,t);r&&this.addElementByRule(e,a,r,!1===a.consuming?o:void 0)}this.localPreserveWS=n}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let n=this.parser.matchedStyles[e],i=r.getPropertyValue(n);if(i)for(let e;;){let r=this.parser.matchStyle(n,i,this,e);if(!r)break;if(r.ignore)return null;if(t=r.clearMark?t.filter(e=>!r.clearMark(e)):t.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1===r.consuming)e=r;else break}}return t}addElementByRule(e,t,r,n){let i,s;if(t.node)if((s=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(s.create(t.attrs),r,"BR"==e.nodeName)||this.leafFallback(e,r);else{let e=this.enter(s,t.attrs||null,r,t.preserveWhitespace);e&&(i=!0,r=e)}else{let e=this.parser.schema.marks[t.mark];r=r.concat(e.create(t.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(n)this.addElement(e,r,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,r,!1));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n,r),this.findAround(e,n,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,r,n){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=null==n?null:e.childNodes[n];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,r){let n,i;for(let t=this.open,s=0;t>=0;t--){let o=this.nodes[t],a=o.findWrapping(e);if(a&&(!n||n.length>a.length+s)&&(n=a,i=o,!a.length))break;if(o.solid){if(r)break;s+=2}}if(!n)return null;this.sync(i);for(let e=0;e<n.length;e++)t=this.enterInner(n[e],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let n=this.findPlace(e,t,r);if(n){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let r=A.none;for(let i of n.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):eu(i.type,e.type))&&(r=i.addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r,n){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,n)),i}enterInner(e,t,r,n=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=ea(e,i,s.options);4&s.options&&0==s.content.length&&(o|=4);let a=A.none;return r=r.filter(t=>(s.type?!s.type.allowsMarkType(t.type):!eu(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new el(e,t,a,n,null,o)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let t=r.length-1;t>=0;t--)e+=r[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let n=0;n<this.find.length;n++)null==this.find[n].pos&&1==e.nodeType&&e.contains(this.find[n].node)&&t.compareDocumentPosition(this.find[n].node)&(r?2:4)&&(this.find[n].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,n=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+ +!n,s=(e,o)=>{for(;e>=0;e--){let a=t[e];
76if(""==a){if(e==t.length-1||0==e)continue;for(;o>=i;o--)if(s(e-1,o))return!0;return!1}{let e=o>0||0==o&&n?this.nodes[o].type:r&&o>=i?r.node(o-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;o--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function ec(e){let t={};for(let r in e)t[r]=e[r];return t}function eu(e,t){let r=t.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let s=[],o=e=>{s.push(e);for(let r=0;r<e.edgeCount;r++){let{type:n,next:i}=e.edge(r);if(n==t||0>s.indexOf(i)&&o(i))return!0}};if(o(i.contentMatch))return!0}}class ed{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ep(t).createDocumentFragment());let n=r,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let r=0,s=0;for(;r<i.length&&s<e.marks.length;){let t=e.marks[s];if(!this.marks[t.type.name]){s++;continue}if(!t.eq(i[r][0])||!1===t.type.spec.spanning)break;r++,s++}for(;r<i.length;)n=i.pop()[1];for(;s<e.marks.length;){let r=e.marks[s++],o=this.serializeMark(r,e.isInline,t);o&&(i.push([r,n]),n.appendChild(o.dom),n=o.contentDOM||o.dom)}}n.appendChild(this.serializeNodeInner(e,t))}),r}serializeNodeInner(e,t){if(e.isText)return ep(t).createTextNode(e.text);let{dom:r,contentDOM:n}=eg(ep(t),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,n)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let n=e.marks.length-1;n>=0;n--){let i=this.serializeMark(e.marks[n],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let n=this.marks[e.type.name];return n&&eg(ep(r),n(e,t),null,e.attrs)}static renderSpec(e,t,r=null,n){return"string"==typeof t?{dom:e.createTextNode(t)}:eg(e,t,r,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ed(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ef(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return ef(e.marks)}}function ef(e){let t={};for(let r in e){let n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function ep(e){return e.document||window.document}let em=new WeakMap;function eg(e,t,r,n){let i,s,o;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let a=t[0],l;if("string"!=typeof a)throw RangeError("Invalid array passed to renderSpec");if(n&&(void 0===(s=em.get(n))&&em.set(n,(o=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])o||(o=[]),o.push(t);else for(let r=0;r<t.length;r++)e(t[r]);else for(let r in t)e(t[r])}(n),s=o)),l=s)&&l.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let h=a.indexOf(" ");h>0&&(r=a.slice(0,h),a=a.slice(h+1));let c=r?e.createElementNS(r,a):e.createElement(a),u=t[1],d=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in d=2,u)if(null!=u[e]){let t=e.indexOf(" ");t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),u[e]):"style"==e&&c.style?c.style.cssText=u[e]:c.setAttribute(e,u[e])}}for(let s=d;s<t.length;s++){let o=t[s];if(0===o){if(s<t.length-1||s>d)throw RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}if("string"==typeof o)c.appendChild(e.createTextNode(o));else{let{dom:t,contentDOM:s}=eg(e,o,r,n);if(c.appendChild(t),s){if(i)throw RangeError("Multiple content holes");i=s}}}return{dom:c,contentDOM:i}}class ey{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class ev{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ev.empty)return ev.empty}recover(e){let t=0,r=65535&e;if(!this.inverted)for(let e=0;e<r;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*r]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let n=0,i=this.inverted?2:1,s=this.inverted?1:2;
vendor: 25,970 bytes, line 76
76for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?n:0);if(a>e)break;let l=this.ranges[o+i],h=this.ranges[o+s],c=a+l;if(e<=c){let i=l?e==a?-1:e==c?1:t:t,s=a+n+(i<0?0:h);if(r)return s;let u=e==(t<0?a:c)?null:o/3+(e-a)*65536,d=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(d|=8),new ey(s,d,u)}n+=h-l}return r?e+n:new ey(e+n,0,null)}touches(e,t){let r=0,n=65535&t,i=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?r:0);if(o>e)break;let a=this.ranges[t+i];if(e<=o+a&&t==3*n)return!0;r+=this.ranges[t+s]-a}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let s=this.ranges[n],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),l=this.ranges[n+t],h=this.ranges[n+r];e(o,o+l,a,a+h),i+=h-l}}invert(){return new ev(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?ev.empty:new ev(e<0?[0,-e,0]:[0,0,e])}}ev.empty=new ev([]);class eb{constructor(e,t,r=0,n=e?e.length:0){this.mirror=t,this.from=r,this.to=n,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new eb(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let n=e.getMirror(t);this.appendMap(e._maps[t],null!=n&&n<t?r+n:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let n=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=n&&n>t?r-n-1:void 0)}}invert(){let e=new eb;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this._maps[r].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(r);if(null!=t&&t>r&&t<this.to){r=t,e=this._maps[t].recover(i.recover);continue}}n|=i.delInfo,e=i.pos}return r?e:new ey(e,n,null)}}let ew=Object.create(null);class ex{getMap(){return ev.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let r=ew[t.stepType];if(!r)throw RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ew)throw RangeError("Duplicate use of step JSON ID "+e);return ew[e]=t,t.prototype.jsonID=e,t}}class ek{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ek(e,null)}static fail(e){return new ek(null,e)}static fromReplace(e,t,r,n){try{return ek.ok(e.replace(t,r,n))}catch(e){if(e instanceof E)return ek.fail(e.message);throw e}}}function eS(e,t,r){let n=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(eS(s.content,t,s))),s.isInline&&(s=t(s,r,i)),n.push(s)}return x.fromArray(n)}class eC extends ex{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),n=r.node(r.sharedDepth(this.to)),i=new T(eS(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,n),t.openStart,t.openEnd);return ek.fromReplace(e,this.from,this.to,i)}invert(){return new eA(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new eC(t.pos,r.pos,this.mark)}merge(e){return e instanceof eC&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eC(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new eC(t.from,t.to,e.markFromJSON(t.mark))}}ex.jsonID("addMark",eC);class eA extends ex{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new T(eS(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return ek.fromReplace(e,this.from,this.to,r)}invert(){return new eC(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new eA(t.pos,r.pos,this.mark)}merge(e){return e instanceof eA&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eA(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new eA(t.from,t.to,e.markFromJSON(t.mark))}}ex.jsonID("removeMark",eA);class eE extends ex{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ek.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ek.fromReplace(e,this.pos,this.pos+1,new T(x.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(e))return new eE(this.pos,t.marks[r]);return new eE(this.pos,this.mark)}}return new eT(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eE(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new eE(t.pos,e.markFromJSON(t.mark))}}ex.jsonID("addNodeMark",eE);class eT extends ex{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ek.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ek.fromReplace(e,this.pos,this.pos+1,new T(x.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new eE(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eT(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new eT(t.pos,e.markFromJSON(t.mark))}}ex.jsonID("removeNodeMark",eT);class eO extends ex{constructor(e,t,r,n=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=n}apply(e){return this.structure&&eR(e,this.from,this.to)?ek.fail("Structure replace would overwrite content"):ek.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ev([this.from,this.to-this.from,this.slice.size])}invert(e){return new eO(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&eO.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new eO(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof eO)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new eO(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new eO(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new eO(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}eO.MAP_BIAS=1,ex.jsonID("replace",eO);class eM extends ex{constructor(e,t,r,n,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(eR(e,this.from,this.gapFrom)||eR(e,this.gapTo,this.to)))return ek.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ek.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ek.fromReplace(e,this.from,this.to,r):ek.fail("Content does not fit in gap")}getMap(){return new ev([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new eM(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),n=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||n<t.pos||i>r.pos?null:new eM(t.pos,r.pos,n,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new eM(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}function eR(e,t,r){let n=e.resolve(t),i=r-t,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let e=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function eN(e,t,r,n=r.contentMatch,i=!0){let s=e.doc.nodeAt(t),o=[],a=t+1;for(let t=0;t<s.childCount;t++){let l=s.child(t),h=a+l.nodeSize,c=n.matchType(l.type);if(c){n=c;for(let t=0;t<l.marks.length;t++)r.allowsMarkType(l.marks[t].type)||e.step(new eA(a,h,l.marks[t]));if(i&&l.isText&&"pre"!=r.whitespace){let e,t=/\r?\n|\r/g,n;for(;e=t.exec(l.text);)n||(n=new T(x.from(r.schema.text(" ",r.allowedMarks(l.marks))),0,0)),o.push(new eO(a+e.index,a+e.index+e[0].length,n))}}else o.push(new eO(a,h,T.empty));a=h}if(!n.validEnd){let t=n.fillBefore(x.empty,!0);e.replace(a,a,new T(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function eP(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,n=0,i=0;;--r){let s=e.$from.node(r),o=e.$from.index(r)+n,a=e.$to.indexAfter(r)-i;if(r<e.depth&&s.canReplace(o,a,t))return r;if(0==r||s.type.spec.isolating||!((0==o||s.canReplace(o,s.childCount))&&(a==s.childCount||s.canReplace(0,a))))break;o&&(n=1),a<s.childCount&&(i=1)}return null}function e_(e,t,r=null,n=e){let i=function(e,t){let{parent:r,startIndex:n,endIndex:i}=e,s=r.contentMatchAt(n).findWrapping(t);if(!s)return null;let o=s.length?s[0]:t;return r.canReplaceWith(n,i,o)?s:null}(e,t),s=i&&function(e,t){let{parent:r,startIndex:n,endIndex:i}=e,s=r.child(n),o=t.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:t).contentMatch;for(let e=n;a&&e<i;e++)a=a.matchType(r.child(e).type);return a&&a.validEnd?o:null}(n,t);return s?i.map(eD).concat({type:t,attrs:r}).concat(s.map(eD)):null}function eD(e){return{type:e,attrs:null}}function eI(e,t,r,n){t.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let i=e.mapping.slice(n).map(r+1+s+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function ej(e,t,r,n){t.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(n).map(r+1+s);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function eL(e,t,r=1,n){let i=e.resolve(t),s=i.depth-r,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=r-2;e>s;e--,t--){let r=i.node(e),s=i.index(e);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(s,r.childCount),a=n&&n[t+1];a&&(o=o.replaceChild(0,a.type.create(a.attrs)));let l=n&&n[t]||r;if(!r.canReplace(s+1,r.childCount)||!l.type.validContent(o))return!1}let a=i.indexAfter(s),l=n&&n[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function eB(e,t){let r=e.resolve(t),n=r.index();return e$(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function e$(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),o=s.type==n?e.type.schema.nodes.text:s.type;if(!(r=r.matchType(o))||!e.type.allowsMarks(s.marks))return!1}return r.validEnd}(e,t))}function ez(e,t,r=-1){let n=e.resolve(t);for(let e=n.depth;;e--){let i,s,o=n.index(e);if(e==n.depth?(i=n.nodeBefore,s=n.nodeAfter):r>0?(i=n.node(e+1),o++,s=n.node(e).maybeChild(o)):(i=n.node(e).maybeChild(o-1),s=n.node(e+1)),i&&!i.isTextblock&&e$(i,s)&&n.node(e).canReplace(o,o+1))return t;if(0==e)break;t=r<0?n.before(e):n.after(e)}}function eF(e,t,r){let n=e.resolve(t);if(!r.content.size)return t;let i=r.content;for(let e=0;e<r.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==r.openStart&&r.size?2:1);e++)for(let t=n.depth;t>=0;t--){let r=t==n.depth?0:n.pos<=(n.start(t+1)+n.end(t+1))/2?-1:1,s=n.index(t)+ +(r>0),o=n.node(t),a=!1;if(1==e)a=o.canReplace(s,s,i);else{let e=o.contentMatchAt(s).findWrapping(i.firstChild.type);a=e&&o.canReplaceWith(s,s,e[0])}if(a)return 0==r?n.pos:r<0?n.before(t+1):n.after(t+1)}return null}function eH(e,t,r=t,n=T.empty){if(t==r&&!n.size)return null;let i=e.resolve(t),s=e.resolve(r);return eW(i,s,n)?new eO(t,r,n):new eU(i,s,n).fit()}function eW(e,t,r){return!r.openStart&&!r.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),r.content)}ex.jsonID("replaceAround",eM);class eU{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let t=0;t<=e.depth;t++){let r=e.node(t);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=x.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,n=this.close(e<0?this.$to:r.doc.resolve(e));if(!n)return null;let i=this.placed,s=r.depth,o=n.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let a=new T(i,s,o);return e>-1?new eM(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new eO(r.pos,n.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,n=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(n=0),i.type.spec.isolating&&n<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=1==t?e:this.unplaced.openStart;r>=0;r--){let e=null,n=(r?(e=eK(this.unplaced.content,r-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:s,match:o}=this.frontier[i],a,l=null;if(1==t&&(n?o.matchType(n.type)||(l=o.fillBefore(x.from(n),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:r,frontierDepth:i,parent:e,inject:l};if(2==t&&n&&(a=o.findWrapping(n.type)))return{sliceDepth:r,frontierDepth:i,parent:e,wrap:a};if(e&&o.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,n=eK(e,t);return!!n.childCount&&!n.firstChild.isLeaf&&(this.unplaced=new T(e,t+1,Math.max(r,n.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,n=eK(e,t);if(n.childCount<=1&&t>0){let i=e.size-t<=t+n.size;this.unplaced=new T(eV(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new T(eV(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:n,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let s=this.unplaced,o=r?r.content:s.content,a=s.openStart-e,l=0,h=[],{match:c,type:u}=this.frontier[t];if(n){for(let e=0;e<n.childCount;e++)h.push(n.child(e));c=c.matchFragment(n)}let d=o.size+e-(s.content.size-s.openEnd);for(;l<o.childCount;){let e=o.child(l),t=c.matchType(e.type);if(!t)break;(++l>1||0==a||e.content.size)&&(c=t,h.push(function e(t,r,n){if(r<=0)return t;let i=t.content;return r>1&&(i=i.replaceChild(0,e(i.firstChild,r-1,1==i.childCount?n-1:0))),r>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(x.empty,!0)))),t.copy(i)}(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==o.childCount?d:-1)))}let f=l==o.childCount;f||(d=-1),this.placed=eq(this.placed,t,x.from(h)),this.frontier[t].match=c,f&&d<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<d;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=f?0==e?T.empty:new T(eV(s.content,e-1,1),e-1,d<0?s.openEnd:e-1):new T(eV(s.content,e,l),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eJ(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:r}=this.$to,n=this.$to.after(r);for(;r>1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(e){n:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:n}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=eJ(e,t,n,r,i);if(s){for(let r=t-1;r>=0;r--){let{match:t,type:n}=this.frontier[r],i=eJ(e,r,n,t,!0);if(!i||i.childCount)continue n}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=eq(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let t=e.node(r),n=t.type.contentMatch.fillBefore(t.content,!0,e.index(r));this.openFrontierNode(t.type,t.attrs,n)}return e}openFrontierNode(e,t=null,r){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=eq(this.placed,this.depth,x.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(x.empty,!0);e.childCount&&(this.placed=eq(this.placed,this.frontier.length,e))}}function eV(e,t,r){return 0==t?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(eV(e.firstChild.content,t-1,r)))}function eq(e,t,r){return 0==t?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(eq(e.lastChild.content,t-1,r)))}function eK(e,t){for(let r=0;r<t;r++)e=e.firstChild.content;return e}function eJ(e,t,r,n,i){let s=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==s.childCount&&!r.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!function(e,t,r){for(let n=r;n<t.childCount;n++)if(!e.allowsMarks(t.child(n).marks))return!0;return!1}(r,s.content,o)?a:null}function eG(e,t){let r=[],n=Math.min(e.depth,t.depth);for(let i=n;i>=0;i--){let n=e.start(i);if(n<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;(n==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==n-1)&&r.push(i)}return r}class eY extends ex{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ek.fail("No node at attribute step's position");let r=Object.create(null);for(let e in t.attrs)r[e]=t.attrs[e];r[this.attr]=this.value;let n=t.type.create(r,null,t.marks);return ek.fromReplace(e,this.pos,this.pos+1,new T(x.from(n),0,+!t.isLeaf))}getMap(){return ev.empty}invert(e){return new eY(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eY(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new eY(t.pos,t.attr,t.value)}}ex.jsonID("attr",eY);class eX extends ex{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ek.ok(r)}getMap(){return ev.empty}invert(e){return new eX(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eX(t.attr,t.value)}}ex.jsonID("docAttr",eX);let eQ=class extends Error{};(eQ=function e(t){let r=Error.call(this,t);return r.__proto__=e.prototype,r}).prototype=Object.create(Error.prototype),eQ.prototype.constructor=eQ,eQ.prototype.name="TransformError";class eZ{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new eb}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eQ(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let n=this.mapping.maps[r];r&&(e=n.map(e,1),t=n.map(t,-1)),n.forEach((r,n,i,s)=>{e=Math.min(e,i),t=Math.max(t,s)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=T.empty){let n=eH(this.doc,e,t,r);return n&&this.step(n),this}replaceWith(e,t,r){return this.replace(e,t,new T(x.from(r),0,0))}delete(e,t){return this.replace(e,t,T.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return!function(e,t,r,n){if(!n.size)return e.deleteRange(t,r);let i=e.doc.resolve(t),s=e.doc.resolve(r);if(eW(i,s,n))return e.step(new eO(t,r,n));let o=eG(i,s);0==o[o.length-1]&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let r=i.node(e).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;o.indexOf(e)>-1?a=e:i.before(e)==t&&o.splice(1,0,-e)}let l=o.indexOf(a),h=[],c=n.openStart;for(let e=n.content,t=0;;t++){let r=e.firstChild;if(h.push(r),t==n.openStart)break;e=r.content}for(let e=c-1;e>=0;e--){var u;let t=h[e],r=(u=t.type).spec.defining||u.spec.definingForContent;if(r&&!t.sameMarkup(i.node(Math.abs(a)-1)))c=e;else if(r||!t.type.isTextblock)break}for(let t=n.openStart;t>=0;t--){let a=(t+c+1)%(n.openStart+1),u=h[a];if(u)for(let t=0;t<o.length;t++){let h=o[(t+l)%o.length],c=!0;h<0&&(c=!1,h=-h);let d=i.node(h-1),f=i.index(h-1);if(d.canReplaceWith(f,f,u.type,u.marks))return e.replace(i.before(h),c?s.after(h):r,new T(function e(t,r,n,i,s){if(r<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(e(s.content,r+1,n,i,s)))}if(r>i){let e=s.contentMatchAt(0),r=e.fillBefore(t).append(t);t=r.append(e.matchFragment(r).fillBefore(x.empty,!0))}return t}(n.content,0,n.openStart,a),a,n.openEnd))}}let d=e.steps.length;for(let a=o.length-1;a>=0&&(e.replace(t,r,n),!(e.steps.length>d));a--){let e=o[a];e<0||(t=i.before(e),r=s.after(e))}}(this,e,t,r),this}replaceRangeWith(e,t,r){var n=e,i=t;if(!r.isInline&&n==i&&this.doc.resolve(n).parent.content.size){let e=function(e,t,r){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),r))return t;if(0==n.parentOffset)for(let e=n.depth-1;e>=0;e--){let t=n.index(e);if(n.node(e).canReplaceWith(t,t,r))return n.before(e+1);if(t>0)return null}if(n.parentOffset==n.parent.content.size)for(let e=n.depth-1;e>=0;e--){let t=n.indexAfter(e);if(n.node(e).canReplaceWith(t,t,r))return n.after(e+1);if(t<n.node(e).childCount)break}return null}(this.doc,n,r.type);null!=e&&(n=i=e)}return this.replaceRange(n,i,new T(x.from(r),0,0)),this}deleteRange(e,t){return!function(e,t,r){let n=e.doc.resolve(t),i=e.doc.resolve(r);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&0==n.parentOffset&&0==i.parentOffset){let s=n.sharedDepth(r),o=!1;for(let e=n.depth;e>s;e--)n.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>s;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=n.depth;e>0&&t==n.start(e);e--)t=n.before(e);for(let e=i.depth;e>0&&r==i.start(e);e--)r=i.before(e);n=e.doc.resolve(t),i=e.doc.resolve(r)}}let s=eG(n,i);for(let t=0;t<s.length;t++){let r=s[t],o=t==s.length-1;if(o&&0==r||n.node(r).type.contentMatch.validEnd)return e.delete(n.start(r),i.end(r));if(r>0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return e.delete(n.before(r),i.after(r))}for(let s=1;s<=n.depth&&s<=i.depth;s++)if(t-n.start(s)==n.depth-s&&r>n.end(s)&&i.end(s)-r!=i.depth-s&&n.start(s-1)==i.start(s-1)&&n.node(s-1).canReplace(n.index(s-1),i.index(s-1)))return e.delete(n.before(s),r);e.delete(t,r)}(this,e,t),this}lift(e,t){return!function(e,t,r){let{$from:n,$to:i,depth:s}=t,o=n.before(s+1),a=i.after(s+1),l=o,h=a,c=x.empty,u=0;for(let e=s,t=!1;e>r;e--)t||n.index(e)>
760?(t=!0,c=x.from(n.node(e).copy(c)),u++):l--;let d=x.empty,f=0;for(let e=s,t=!1;e>r;e--)t||i.after(e+1)<i.end(e)?(t=!0,d=x.from(i.node(e).copy(d)),f++):h++;e.step(new eM(l,h,o,a,new T(c.append(d),u,f),c.size-u,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,s=e.doc.resolve(t-r),o=s.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,t=!!o.contentMatch.matchType(i);e&&!t?n=!1:!e&&t&&(n=!0)}let a=e.steps.length;if(!1===n){let n=e.doc.resolve(t+r);ej(e,n.node(),n.before(),a)}o.inlineContent&&eN(e,t+r-1,o,s.node().contentMatchAt(s.index()),null==n);let l=e.mapping.slice(a),h=l.map(t-r);if(e.step(new eO(h,l.map(t+r,-1),T.empty,!0)),!0===n){let t=e.doc.resolve(h);eI(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,r){let n=x.empty;for(let e=r.length-1;e>=0;e--){if(n.size){let t=r[e].type.contentMatch.matchFragment(n);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=x.from(r[e].type.create(r[e].attrs,n))}let i=t.start,s=t.end;e.step(new eM(i,s,i,s,new T(n,0,0),r.length,!0))}(this,e,t),this}setBlockType(e,t=e,r,n=null){var i=this;if(!r.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var o,a,l;let h,c,u="function"==typeof n?n(e):n;if(e.isTextblock&&!e.hasMarkup(r,u)&&(o=i.doc,a=i.mapping.slice(s).map(t),l=r,c=(h=o.resolve(a)).index(),h.parent.canReplaceWith(c,c+1,l))){let n=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?n=!1:!e&&t&&(n=!0)}!1===n&&ej(i,e,t,s),eN(i,i.mapping.slice(s).map(t,1),r,void 0,null===n);let o=i.mapping.slice(s),a=o.map(t,1),l=o.map(t+e.nodeSize,1);return i.step(new eM(a,l,a+1,l-1,new T(x.from(r.create(u,null,e.marks)),0,0),1,!0)),!0===n&&eI(i,e,t,s),!1}}),this}setNodeMarkup(e,t,r=null,n){return!function(e,t,r,n,i){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");r||(r=s.type);let o=r.create(n,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,o);if(!r.validContent(s.content))throw RangeError("Invalid content for node type "+r.name);e.step(new eM(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new T(x.from(o),0,0),1,!0))}(this,e,t,r,n),this}setNodeAttribute(e,t,r){return this.step(new eY(e,t,r)),this}setDocAttribute(e,t){return this.step(new eX(e,t)),this}addNodeMark(e,t){return this.step(new eE(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw RangeError("No node at position "+e);if(t instanceof A)t.isInSet(r.marks)&&this.step(new eT(e,t));else{let n=r.marks,i,s=[];for(;i=t.isInSet(n);)s.push(new eT(e,i)),n=i.removeFromSet(n);for(let e=s.length-1;e>=0;e--)this.step(s[e])}return this}split(e,t=1,r){return!function(e,t,r=1,n){let i=e.doc.resolve(t),s=x.empty,o=x.empty;for(let e=i.depth,t=i.depth-r,a=r-1;e>t;e--,a--){s=x.from(i.node(e).copy(s));let t=n&&n[a];o=x.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new eO(t,t,new T(s.append(o),r,r),!0))}(this,e,t,r),this}addMark(e,t,r){var n;let i,s,o,a;return n=this,o=[],a=[],n.doc.nodesBetween(e,t,(n,l,h)=>{if(!n.isInline)return;let c=n.marks;if(!r.isInSet(c)&&h.type.allowsMarkType(r.type)){let h=Math.max(l,e),u=Math.min(l+n.nodeSize,t),d=r.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(d)||(i&&i.to==h&&i.mark.eq(c[e])?i.to=u:o.push(i=new eA(h,u,c[e])));s&&s.to==h?s.to=u:a.push(s=new eC(h,u,r))}}),o.forEach(e=>n.step(e)),a.forEach(e=>n.step(e)),this}removeMark(e,t,r){var n;let i,s;return n=this,i=[],s=0,n.doc.nodesBetween(e,t,(n,o)=>{if(!n.isInline)return;s++;let a=null;if(r instanceof ee){let e=n.marks,t;for(;t=r.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else r?r.isInSet(n.marks)&&(a=[r]):a=n.marks;if(a&&a.length){let r=Math.min(o+n.nodeSize,t);for(let t=0;t<a.length;t++){let n=a[t],l;for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&n.eq(i[e].style)&&(l=t)}l?(l.to=r,l.step=s):i.push({style:n,from:Math.max(o,e),to:r,step:s})}}}
vendor: 12,211 bytes, line 76
76),i.forEach(e=>n.step(new eA(e.from,e.to,e.style))),this}clearIncompatible(e,t,r){return eN(this,e,t,r),this}}let e0=Object.create(null);class e1{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new e2(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=T.empty){let r=t.content.lastChild,n=null;for(let e=0;e<t.openEnd;e++)n=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],h=e.mapping.slice(i);e.replaceRange(h.map(a.pos),h.map(l.pos),o?T.empty:t),0==o&&tr(e,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:s,$to:o}=n[i],a=e.mapping.slice(r),l=a.map(s.pos),h=a.map(o.pos);i?e.deleteRange(l,h):(e.replaceRangeWith(l,h,t),tr(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let n=e.parent.inlineContent?new e4(e):tt(e.node(0),e.parent,e.pos,e.index(),t,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let i=t<0?tt(e.node(0),e.node(n),e.before(n+1),e.index(n),t,r):tt(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,t,r);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new e7(e.node(0))}static atStart(e){return tt(e,e,0,0,1)||new e7(e)}static atEnd(e){return tt(e,e,e.content.size,e.childCount,-1)||new e7(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let r=e0[t.type];if(!r)throw RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in e0)throw RangeError("Duplicate use of selection JSON ID "+e);return e0[e]=t,t.prototype.jsonID=e,t}getBookmark(){return e4.between(this.$anchor,this.$head).getBookmark()}}e1.prototype.visible=!0;class e2{constructor(e,t){this.$from=e,this.$to=t}}let e3=!1;function e5(e){e3||e.parent.inlineContent||(e3=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class e4 extends e1{constructor(e,t=e){e5(e),e5(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return e1.near(r);let n=e.resolve(t.map(this.anchor));return new e4(n.parent.inlineContent?n:r,r)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof e4&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new e6(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new e4(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let n=e.resolve(t);return new this(n,r==t?n:e.resolve(r))}static between(e,t,r){let n=e.pos-t.pos;if((!r||n)&&(r=n>=0?1:-1),!t.parent.inlineContent){let e=e1.findFrom(t,r,!0)||e1.findFrom(t,-r,!0);if(!e)return e1.near(t,r);t=e.$head}return e.parent.inlineContent||(0==n?e=t:(e=(e1.findFrom(e,-r,!0)||e1.findFrom(e,r,!0)).$anchor).pos<t.pos!=n<0&&(e=t)),new e4(e,t)}}e1.jsonID("text",e4);class e6{constructor(e,t){this.anchor=e,this.head=t}map(e){return new e6(e.map(this.anchor),e.map(this.head))}resolve(e){return e4.between(e.resolve(this.anchor),e.resolve(this.head))}}class e8 extends e1{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:n}=t.mapResult(this.anchor),i=e.resolve(n);return r?e1.near(i):new e8(i)}content(){return new T(x.from(this.node),0,0)}eq(e){return e instanceof e8&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new e9(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new e8(e.resolve(t.anchor))}static create(e,t){return new e8(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}e8.prototype.visible=!1,e1.jsonID("node",e8);class e9{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new e6(r,r):new e9(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&e8.isSelectable(r)?new e8(t):e1.near(t)}}class e7 extends e1{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let t=e1.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new e7(e)}map(e){return new e7(e)}eq(e){return e instanceof e7}getBookmark(){return te}}e1.jsonID("all",e7);let te={map(){return this},resolve:e=>new e7(e)};function tt(e,t,r,n,i,s=!1){if(t.inlineContent)return e4.create(e,r);for(let o=n-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let n=t.child(o);if(n.isAtom){if(!s&&e8.isSelectable(n))return e8.create(e,r-(i<0?n.nodeSize:0))}else{let t=tt(e,n,r+i,i<0?n.childCount:0,i,s);if(t)return t}r+=n.nodeSize*i}return null}function tr(e,t,r){let n,i=e.steps.length-1;if(i<t)return;let s=e.steps[i];(s instanceof eO||s instanceof eM)&&(e.mapping.maps[i].forEach((e,t,r,i)=>{null==n&&(n=i)}),e.setSelection(e1.near(e.doc.resolve(n),r)))}class tn extends eZ{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return A.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||A.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let n=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(null==r&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=r==t?e.marks():e.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,n.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(e1.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function ti(e,t){return t&&e?e.bind(t):e}class ts{constructor(e,t,r){this.name=e,this.init=ti(t.init,r),this.apply=ti(t.apply,r)}}let to=[new ts("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new ts("selection",{init:(e,t)=>e.selection||e1.atStart(t.doc),apply:e=>e.selection}),new ts("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,r,n)=>n.selection.$cursor?e.storedMarks:null}),new ts("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class ta{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=to.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new ts(e.key,e.spec.state,e))})}}class tl{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let t=this.config.plugins[r];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),n=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let a=n?n[s].n:0,l=n?n[s].state:this,h=a<t.length&&o.spec.appendTransaction.call(o,a?t.slice(a):t,l,r);if(h&&r.filterTransaction(h,s)){if(h.setMeta("appendedTransaction",e),!n){n=[];for(let e=0;e<this.config.plugins.length;e++)n.push(e<s?{state:r,n:t.length}:{state:this,n:0})}t.push(h),r=r.applyInner(h),i=!0}n&&(n[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new tl(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let i=r[n];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new tn(this)}static create(e){let t=new ta(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new tl(t);for(let n=0;n<t.fields.length;n++)r[t.fields[n].name]=t.fields[n].init(e,r);return r}reconfigure(e){let t=new ta(this.schema,e.plugins),r=t.fields,n=new tl(t);for(let t=0;t<r.length;t++){let i=r[t].name;n[i]=this.hasOwnProperty(i)?this[i]:r[t].init(e,n)}return n}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let r in e){if("doc"==r||"selection"==r)throw RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[r],i=n.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(n,this[n.key]))}return t}static fromJSON(e,t,r){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let n=new ta(e.schema,e.plugins),i=new tl(n);return n.fields.forEach(n=>{if("doc"==n.name)i.doc=z.fromJSON(e.schema,t.doc);else if("selection"==n.name)i.selection=e1.fromJSON(i.doc,t.selection);else if("storedMarks"==n.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let s in r){let o=r[s],a=o.spec.state;if(o.key==n.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,s)){i[n.name]=a.fromJSON.call(o,e,t[s],i);return}}i[n.name]=n.init(e,i)}}),i}}class th{constructor(e){this.spec=e,this.props={},e.props&&function e(t,r,n){for(let i in t){let s=t[i];s instanceof Function?s=s.bind(r):"handleDOMEvents"==i&&(s=e(s,r,{})),n[i]=s}return n}(e.props,this,this.props),this.key=e.key?e.key.key:tu("plugin")}getState(e){return e[this.key]}}let tc=Object.create(null);function tu(e){return e in tc?e+"$"+ ++tc[e]:(tc[e]=0,e+"$")}class td{constructor(e="key"){this.key=tu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let tf=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function tp(e,t){let{$cursor:r}=e.selection;return r&&(t?t.endOfTextblock("backward",e):!(r.parentOffset>0))?r:null}let tm=(e,t,r)=>{let n=tp(e,r);if(!n)return!1;let i=tb(n);if(!i){let r=n.blockRange(),i=r&&eP(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)}let s=i.nodeBefore;if(tM(e,i,t,-1))return!0;
76if(0==n.parent.content.size&&(ty(s,"end")||e8.isSelectable(s)))for(let r=n.depth;;r--){let o=eH(e.doc,n.before(r),n.after(r),T.empty);if(o&&o.slice.size<o.to-o.from){if(t){let r=e.tr.step(o);r.setSelection(ty(s,"end")?e1.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):e8.create(r.doc,i.pos-s.nodeSize)),t(r.scrollIntoView())}return!0}if(1==r||n.node(r-1).childCount>1)break}return!!s.isAtom&&i.depth==n.depth-1&&(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0)};function tg(e,t,r){let n=t.nodeBefore,i=t.pos-1;for(;!n.isTextblock;i--){if(n.type.spec.isolating)return!1;let e=n.lastChild;if(!e)return!1;n=e}let s=t.nodeAfter,o=t.pos+1;for(;!s.isTextblock;o++){if(s.type.spec.isolating)return!1;let e=s.firstChild;if(!e)return!1;s=e}let a=eH(e.doc,i,o,T.empty);if(!a||a.from!=i||a instanceof eO&&a.slice.size>=o-i)return!1;if(r){let t=e.tr.step(a);t.setSelection(e4.create(t.doc,i)),r(t.scrollIntoView())}return!0}function ty(e,t,r=!1){for(let n=e;n;n="start"==t?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&1!=n.childCount)break}return!1}let tv=(e,t,r)=>{let{$head:n,empty:i}=e.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;s=tb(n)}let o=s&&s.nodeBefore;return!!o&&!!e8.isSelectable(o)&&(t&&t(e.tr.setSelection(e8.create(e.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function tb(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 tw(e,t){let{$cursor:r}=e.selection;return r&&(t?t.endOfTextblock("forward",e):!(r.parentOffset<r.parent.content.size))?r:null}let tx=(e,t,r)=>{let n=tw(e,r);if(!n)return!1;let i=tS(n);if(!i)return!1;let s=i.nodeAfter;if(tM(e,i,t,1))return!0;if(0==n.parent.content.size&&(ty(s,"start")||e8.isSelectable(s))){let r=eH(e.doc,n.before(),n.after(),T.empty);if(r&&r.slice.size<r.to-r.from){if(t){let n=e.tr.step(r);n.setSelection(ty(s,"start")?e1.findFrom(n.doc.resolve(n.mapping.map(i.pos)),1):e8.create(n.doc,n.mapping.map(i.pos))),t(n.scrollIntoView())}return!0}}return!!s.isAtom&&i.depth==n.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0)},tk=(e,t,r)=>{let{$head:n,empty:i}=e.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;s=tS(n)}let o=s&&s.nodeAfter;return!!o&&!!e8.isSelectable(o)&&(t&&t(e.tr.setSelection(e8.create(e.doc,s.pos)).scrollIntoView()),!0)};function tS(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let r=e.node(t);if(e.index(t)+1<r.childCount)return e.doc.resolve(e.after(t+1));if(r.type.spec.isolating)break}return null}let tC=(e,t)=>{let{$head:r,$anchor:n}=e.selection;return!!r.parent.type.spec.code&&!!r.sameParent(n)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function tA(e){for(let t=0;t<e.edgeCount;t++){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}let tE=(e,t)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),s=r.indexAfter(-1),o=tA(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(t){let n=r.after(),i=e.tr.replaceWith(n,n,o.createAndFill());i.setSelection(e1.near(i.doc.resolve(n),1)),t(i.scrollIntoView())}return!0},tT=(e,t)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof e7||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=tA(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let r=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,o=e.tr.insert(r,s.createAndFill());o.setSelection(e4.create(o.doc,r+1)),t(o.scrollIntoView())}return!0},tO=(e,t)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let n=r.before();if(eL(e.doc,n))return t&&t(e.tr.split(n).scrollIntoView()),!0}let n=r.blockRange(),i=n&&eP(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)};function tM(e,t,r,n){let i,s,o,a=t.nodeBefore,l=t.nodeAfter,h,c,u=a.type.spec.isolating||l.type.spec.isolating;if(!u&&(i=t.nodeBefore,s=t.nodeAfter,o=t.index(),i&&s&&i.type.compatibleContent(s.type)&&(!i.content.size&&t.parent.canReplace(o-1,o)?(r&&r(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(o,o+1)&&
76!!(s.isTextblock||eB(e.doc,t.pos))&&(r&&r(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let d=!u&&t.parent.canReplace(t.index(),t.index()+1);if(d&&(h=(c=a.contentMatchAt(a.childCount)).findWrapping(l.type))&&c.matchType(h[0]||l.type).validEnd){if(r){let n=t.pos+l.nodeSize,i=x.empty;for(let e=h.length-1;e>=0;e--)i=x.from(h[e].create(null,i));i=x.from(a.copy(i));let s=e.tr.step(new eM(t.pos-1,n,t.pos,n,new T(i,1,0),h.length,!0)),o=s.doc.resolve(n+2*h.length);o.nodeAfter&&o.nodeAfter.type==a.type&&eB(s.doc,o.pos)&&s.join(o.pos),r(s.scrollIntoView())}return!0}let f=l.type.spec.isolating||n>0&&u?null:e1.findFrom(t,1),p=f&&f.$from.blockRange(f.$to),m=p&&eP(p);if(null!=m&&m>=t.depth)return r&&r(e.tr.lift(p,m).scrollIntoView()),!0;if(d&&ty(l,"start",!0)&&ty(a,"end")){let n=a,i=[];for(;i.push(n),!n.isTextblock;)n=n.lastChild;let s=l,o=1;for(;!s.isTextblock;s=s.firstChild)o++;if(n.canReplace(n.childCount,n.childCount,s.content)){if(r){let n=x.empty;for(let e=i.length-1;e>=0;e--)n=x.from(i[e].copy(n));r(e.tr.step(new eM(t.pos-i.length,t.pos+l.nodeSize,t.pos+o,t.pos+l.nodeSize-o,new T(n,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function tR(e){return function(t,r){let n=t.selection,i=e<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(r&&r(t.tr.setSelection(e4.create(t.doc,e<0?i.start(s):i.end(s)))),!0)}}let tN=tR(-1),tP=tR(1);function t_(e,t=null){return function(r,n){let i=!1;for(let n=0;n<r.selection.ranges.length&&!i;n++){let{$from:{pos:s},$to:{pos:o}}=r.selection.ranges[n];r.doc.nodesBetween(s,o,(n,s)=>{if(i)return!1;if(!(!n.isTextblock||n.hasMarkup(e,t)))if(n.type==e)i=!0;else{let t=r.doc.resolve(s),n=t.index();i=t.parent.canReplaceWith(n,n+1,e)}})}if(!i)return!1;if(n){let i=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:s},$to:{pos:o}}=r.selection.ranges[n];i.setBlockType(s,o,e,t)}n(i.scrollIntoView())}return!0}}function tD(...e){return function(t,r,n){for(let i=0;i<e.length;i++)if(e[i](t,r,n))return!0;return!1}}let tI=tD(tf,tm,tv),tj=tD(tf,tx,tk),tL={Enter:tD(tC,tT,tO,(e,t)=>{let{$from:r,$to:n}=e.selection;if(e.selection instanceof e8&&e.selection.node.isBlock)return!!r.parentOffset&&!!eL(e.doc,r.pos)&&(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,o,a=!1,l=!1;for(let e=r.depth;;e--){if(r.node(e).isBlock){let t;a=r.end(e)==r.pos+(r.depth-e),l=r.start(e)==r.pos-(r.depth-e),o=tA(r.node(e-1).contentMatchAt(r.indexAfter(e-1)));i.unshift(t||(a&&o?{type:o}:null)),s=e;break}if(1==e)return!1;i.unshift(null)}let h=e.tr;(e.selection instanceof e4||e.selection instanceof e7)&&h.deleteSelection();let c=h.mapping.map(r.pos),u=eL(h.doc,c,i.length,i);if(u||(i[0]=o?{type:o}:null,u=eL(h.doc,c,i.length,i)),!u)return!1;if(h.split(c,i.length,i),!a&&l&&r.node(s).type!=o){let e=h.mapping.map(r.before(s)),t=h.doc.resolve(e);o&&r.node(s-1).canReplaceWith(t.index(),t.index()+1,o)&&h.setNodeMarkup(h.mapping.map(r.before(s)),o)}return t&&t(h.scrollIntoView()),!0}),"Mod-Enter":tE,Backspace:tI,"Mod-Backspace":tI,"Shift-Backspace":tI,Delete:tj,"Mod-Delete":tj,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new e7(e.doc))),!0)},tB={"Ctrl-h":tL.Backspace,"Alt-Backspace":tL["Mod-Backspace"],"Ctrl-d":tL.Delete,"Ctrl-Alt-Backspace":tL["Mod-Delete"],"Alt-Delete":tL["Mod-Delete"],"Alt-d":tL["Mod-Delete"],"Ctrl-a":tN,"Ctrl-e":tP};for(let e in tL)tB[e]=tL[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();let t$=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},tz=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},tF=null,tH=function(e,t,r){let n=tF||(tF=document.createRange());return n.setEnd(e,null==r?e.nodeValue.length:r),n.setStart(e,t||0),n},tW=function(){tF=null},tU=function(e,t,r,n){return r&&(tq(e,t,r,n,-1)||tq(e,t,r,n,1))},tV=/^(img|br|input|textarea|hr)$/i;function tq(e,t,r,n,i){for(var s;;){if(e==r&&t==n)return!0;if(t==(i<0?0:tK(e))){let r=e.parentNode;if(!r||1!=r.nodeType||tJ(e)||tV.test(e.nodeName)||"false"==e.contentEditable)return!1;t=t$(e)+(i<0?0:1),e=r}
76else{if(1!=e.nodeType)return!1;let r=e.childNodes[t+(i<0?-1:0)];if(1==r.nodeType&&"false"==r.contentEditable)if(null==(s=r.pmViewDesc)||!s.ignoreForSelection)return!1;else t+=i;else e=r,t=i<0?tK(e):0}}}function tK(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tJ(e){let t;for(let r=e;r&&!(t=r.pmViewDesc);r=r.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let tG=function(e){return e.focusNode&&tU(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function tY(e,t){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=t,r}let tX="u">typeof navigator?navigator:null,tQ="u">typeof document?document:null,tZ=tX&&tX.userAgent||"",t0=/Edge\/(\d+)/.exec(tZ),t1=/MSIE \d/.exec(tZ),t2=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(tZ),t3=!!(t1||t2||t0),t5=t1?document.documentMode:t2?+t2[1]:t0?+t0[1]:0,t4=!t3&&/gecko\/(\d+)/i.test(tZ);t4&&(/Firefox\/(\d+)/.exec(tZ)||[0,0])[1];let t6=!t3&&/Chrome\/(\d+)/.exec(tZ),t8=!!t6,t9=t6?+t6[1]:0,t7=!t3&&!!tX&&/Apple Computer/.test(tX.vendor),re=t7&&(/Mobile\/\w+/.test(tZ)||!!tX&&tX.maxTouchPoints>2),rt=re||!!tX&&/Mac/.test(tX.platform),rr=!!tX&&/Win/.test(tX.platform),rn=/Android \d/.test(tZ),ri=!!tQ&&"webkitFontSmoothing"in tQ.documentElement.style,rs=ri?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ro(e,t){return"number"==typeof e?e:e[t]}function ra(e,t,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let o=r||e.dom;o;){if(1!=o.nodeType){o=tz(o);continue}let e=o,r=e==s.body,a=r?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(s):function(e){let t=e.getBoundingClientRect(),r=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*r,top:t.top,bottom:t.top+e.clientHeight*n}}(e),l=0,h=0;if(t.top<a.top+ro(n,"top")?h=-(a.top-t.top+ro(i,"top")):t.bottom>a.bottom-ro(n,"bottom")&&(h=t.bottom-t.top>a.bottom-a.top?t.top+ro(i,"top")-a.top:t.bottom-a.bottom+ro(i,"bottom")),t.left<a.left+ro(n,"left")?l=-(a.left-t.left+ro(i,"left")):t.right>a.right-ro(n,"right")&&(l=t.right-a.right+ro(i,"right")),l||h)if(r)s.defaultView.scrollBy(l,h);else{let r=e.scrollLeft,n=e.scrollTop;h&&(e.scrollTop+=h),l&&(e.scrollLeft+=l);let i=e.scrollLeft-r,s=e.scrollTop-n;t={left:t.left-i,top:t.top-s,right:t.right-i,bottom:t.bottom-s}}let c=r?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(c))break;o="absolute"==c?o.offsetParent:tz(o)}}function rl(e){let t=[],r=e.ownerDocument;for(let n=e;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=tz(n));return t}function rh(e,t){for(let r=0;r<e.length;r++){let{dom:n,top:i,left:s}=e[r];n.scrollTop!=i+t&&(n.scrollTop=i+t),n.scrollLeft!=s&&(n.scrollLeft=s)}}let rc=null;function ru(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function rd(e){return e.top<e.bottom||e.left<e.right}function rf(e,t){let r=e.getClientRects();if(r.length){let e=r[t<0?0:r.length-1];if(rd(e))return e}return Array.prototype.find.call(r,rd)||e.getBoundingClientRect()}let rp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function rm(e,t,r){let{node:n,offset:i,atom:s}=e.docView.domFromPos(t,r<0?-1:1),o=ri||t4;if(3==n.nodeType)if(o&&(rp.test(n.nodeValue)||(r<0?!i:i==n.nodeValue.length))){let e=rf(tH(n,i,i),r);if(t4&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let t=rf(tH(n,i-1,i-1),-1);if(t.top==e.top){let r=rf(tH(n,i,i+1),-1);if(r.top!=e.top)return rg(r,r.left<t.left)}}return e}else{let e=i,t=i,s=r<0?1:-1;return r<0&&!i?(t++,s=-1):r>=0&&i==n.nodeValue.length?(e--,s=1):r<0?e--:t++,rg(rf(tH(n,e,t),s),s<0)}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(r<0||i==tK(n))){let e=n.childNodes[i-1];if(1==e.nodeType)return ry(e.getBoundingClientRect(),!1)}if(null==s&&i<tK(n)){let e=n.childNodes[i];if(1==e.nodeType)return ry(e.getBoundingClientRect(),!0)}return ry(n.getBoundingClientRect(),r>=0)}if(null==s&&i&&(r<0||i==tK(n))){let e=n.childNodes[i-1],t=3==e.nodeType?tH(e,tK(e)-!o):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return rg(rf(t,1),!1)}if(null==s&&i<tK(n)){let e=n.childNodes[i];for(;
76e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?tH(e,0,+!o):1==e.nodeType?e:null:null;if(t)return rg(rf(t,-1),!0)}return rg(rf(3==n.nodeType?tH(n):n,-r),r>=0)}function rg(e,t){if(0==e.width)return e;let r=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function ry(e,t){if(0==e.height)return e;let r=t?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function rv(e,t,r){let n=e.state,i=e.root.activeElement;n!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return r()}finally{n!=t&&e.updateState(n),i!=e.dom&&i&&i.focus()}}let rb=/[\u0590-\u08ac]/,rw=null,rx=null,rk=!1;class rS{constructor(e,t,r,n){this.parent=e,this.children=t,this.dom=r,this.contentDOM=n,this.dirty=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let n=this.children[t];if(n==e)return r;r+=n.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){let n;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(r<0){let r,n;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((n=r.pmViewDesc)&&n.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(n)+n.size:this.posAtStart}else{let r,n;if(e==this.contentDOM)r=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&!((n=r.pmViewDesc)&&n.parent==this);)r=r.nextSibling;return r?this.posBeforeChild(n):this.posAtEnd}if(e==this.dom&&this.contentDOM)n=t>t$(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){n=!1;break}if(t.previousSibling)break}if(null==n&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){n=!0;break}if(t.nextSibling)break}}return(null==n?r>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,n=e;n;n=n.parentNode){let i=this.getDesc(n),s;if(i&&(!t||i.node))if(!r||!(s=i.nodeDOM)||(1==s.nodeType?s.contains(1==e.nodeType?e:e.parentNode):s==e))return i;else r=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,r){for(let n=e;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(e,t,r)}return -1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let n=this.children[t],i=r+n.size;if(r==e&&i!=r){for(;!n.border&&n.children.length;)for(let e=0;e<n.children.length;e++){let t=n.children[e];if(t.size){n=t;break}}return n}if(e<i)return n.descAt(e-r-n.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,n=0;for(let t=0;r<this.children.length;
76r++){let i=this.children[r],s=t+i.size;if(s>e||i instanceof rR){n=e-t;break}t=s}if(n)return this.children[r].domFromPos(n-this.children[r].border,t);for(let e;r&&!(e=this.children[r-1]).size&&e instanceof rC&&e.side>=0;r--);if(t<=0){let e,n=!0;for(;(e=r?this.children[r-1]:null)&&e.dom.parentNode!=this.contentDOM;r--,n=!1);return e&&t&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?t$(e.dom)+1:0}}{let e,n=!0;for(;(e=r<this.children.length?this.children[r]:null)&&e.dom.parentNode!=this.contentDOM;r++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?t$(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let s=r,o=0;;o++){let r=this.children[o],a=s+r.size;if(-1==n&&e<=a){let i=s+r.border;if(e>=i&&t<=a-r.border&&r.node&&r.contentDOM&&this.contentDOM.contains(r.contentDOM))return r.parseRange(e,t,i);e=s;for(let t=o;t>0;t--){let r=this.children[t-1];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(1)){n=t$(r.dom)+1;break}e-=r.size}-1==n&&(n=0)}if(n>-1&&(a>t||o==this.children.length-1)){t=a;for(let e=o+1;e<this.children.length;e++){let r=this.children[e];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(-1)){i=t$(r.dom);break}t+=r.size}-1==i&&(i=this.contentDOM.childNodes.length);break}s=a}return{node:this.contentDOM,from:e,to:t,fromOffset:n,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(1!=t.nodeType||r==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,n=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let o=0,a=0;o<this.children.length;o++){let l=this.children[o],h=a+l.size;if(i>a&&s<h)return l.setSelection(e-a-l.border,t-a-l.border,r,n);a=h}let o=this.domFromPos(e,e?-1:1),a=t==e?o:this.domFromPos(t,t?-1:1),l=r.root.getSelection(),h=r.domSelectionRange(),c=!1;if((t4||t7)&&e==t){let{node:e,offset:t}=o;if(3==e.nodeType){if((c=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,r;t;t=t.parentNode){if(r=t.nextSibling){"BR"==r.nodeName&&(o=a={node:r.parentNode,offset:t$(r)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let r=e.childNodes[t-1];c=r&&("BR"==r.nodeName||"false"==r.contentEditable)}}if(t4&&h.focusNode&&h.focusNode!=a.node&&1==h.focusNode.nodeType){let e=h.focusNode.childNodes[h.focusOffset];e&&"false"==e.contentEditable&&(n=!0)}if(!(n||c&&t7)&&tU(o.node,o.offset,h.anchorNode,h.anchorOffset)&&tU(a.node,a.offset,h.focusNode,h.focusOffset))return;let u=!1;if((l.extend||e==t)&&!(c&&t4)){l.collapse(o.node,o.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=o;o=a,a=e}let r=document.createRange();r.setEnd(a.node,a.offset),r.setStart(o.node,o.offset),l.removeAllRanges(),l.addRange(r)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,n=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let n=r+i.border,o=s-i.border;if(e>=n&&t<=o){this.dirty=e==r||t==s?2:1,e==n&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-n,t-n);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}r=s}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=1==e?2:1;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class rC extends rS{constructor(e,t,r,n){let i,s=t.type.toDOM;if("function"==typeof s&&(s=s(r,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:n)),!t.type.spec.raw){if(1!=s.nodeType){let e=document.createElement("span");e.appendChild(s),s=e}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class rA extends rS{constructor(e,t,r,n){super(e,[],t,null),this.textDOM=r,this.text=n}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class rE extends rS{constructor(e,t,r,n,i){super(e,[],r,n),this.mark=t,this.spec=i}
76static create(e,t,r,n){let i=n.nodeViews[t.type.name],s=i&&i(t,n,r);return s&&s.dom||(s=ed.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new rE(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,r){let n=rE.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;t<s&&(i=rF(i,t,s,r)),e>0&&(i=rF(i,0,e,r));for(let e=0;e<i.length;e++)i[e].parent=n;return n.children=i,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class rT extends rS{constructor(e,t,r,n,i,s,o,a,l){super(e,[],i,s),this.node=t,this.outerDeco=r,this.innerDeco=n,this.nodeDOM=o}static create(e,t,r,n,i,s){let o=i.nodeViews[t.type.name],a,l=o&&o(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s,r,n),h=l&&l.dom,c=l&&l.contentDOM;if(t.isText)if(h){if(3!=h.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else h=document.createTextNode(t.text);else if(!h){let e=ed.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:h,contentDOM:c}=e)}c||t.isText||"BR"==h.nodeName||(h.hasAttribute("contenteditable")||(h.contentEditable="false"),t.type.spec.draggable&&(h.draggable=!0));let u=h;return(h=rj(h,r,t),l)?a=new rN(e,t,r,n,h,c||null,u,l,i,s+1):t.isText?new rM(e,t,r,n,h,u,i):new rT(e,t,r,n,h,c||null,u,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,r){return 0==this.dirty&&e.eq(this.node)&&rL(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let r=this.node.inlineContent,n=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,a=new r$(this,s&&s.node,e);(function(e,t,r,n){let i=t.locals(e),s=0;if(0==i.length){for(let r=0;r<e.childCount;r++){let o=e.child(r);n(o,i,t.forChild(s,o),r),s+=o.nodeSize}return}let o=0,a=[],l=null;for(let h=0;;){let c,u,d,f;for(;o<i.length&&i[o].to==s;){let e=i[o++];e.widget&&(c?(u||(u=[c])).push(e):c=e)}if(c)if(u){u.sort(rz);for(let e=0;e<u.length;e++)r(u[e],h,!!l)}else r(c,h,!!l);if(l)f=-1,d=l,l=null;else if(h<e.childCount)f=h,d=e.child(h++);else break;for(let e=0;e<a.length;e++)a[e].to<=s&&a.splice(e--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let e=p;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<p&&(l=d.cut(e-s),d=d.cut(0,e-s),p=e,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=d.isInline&&!d.isLeaf?a.filter(e=>!e.inline):a.slice();n(d,m,t.forChild(s,d),f),s=p}})(this.node,this.innerDeco,(t,i,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,r,e,i):t.type.side>=0&&!s&&a.syncToMarks(i==this.node.childCount?A.none:this.node.child(i).marks,r,e,i),a.placeWidget(t,e,n)},(t,s,l,h)=>{let c;a.syncToMarks(t.marks,r,e,h),a.findNodeMatch(t,s,l,h)||o&&e.state.selection.from>n&&e.state.selection.to<n+t.nodeSize&&(c=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,s,l,c,e)||a.updateNextNode(t,s,l,e,h,n)||a.addNode(t,s,l,e,n),n+=t.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),function e(t,r,n){let i=t.firstChild,s=!1;for(let o=0;o<r.length;o++){let a=r[o],l=a.dom;if(l.parentNode==t){for(;l!=i;)i=rB(i),s=!0;i=i.nextSibling}else s=!0,t.insertBefore(l,i);if(a instanceof rE){let r=i?i.previousSibling:t.lastChild;e(a.contentDOM,a.children,n),i=r?r.nextSibling:t.firstChild}}for(;i;)i=rB(i),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}(this.contentDOM,this.children,e),re&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:r,to:n}=e.state.selection;if(!(e.state.selection instanceof e4)||r<t||n>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,s=function(e,t,r,n){for(let i=0,s=0;i<e.childCount&&s<=n;){let o=e.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<e.childCount;){let t=e.child(i++);if(s+=t.nodeSize,!t.isText)break;l+=t.text}if(s>=r){if(s>=n&&l.slice(n-t.length-a,n-a)==t)return n-t.length;let e=a<n?l.lastIndexOf(t,n-a-1):-1;if(e>=0&&e+t.length+a>=r)return a+e;if(r==n&&l.length>=n+t.length-a&&l.slice(n-a,n-a+t.length)==t)return n}}return -1}(this.node.content,e,r-t,n-t);return s<0?null:{node:i,pos:s,text:e}}}protectLocalComposition(e,{node:t,pos:r,text:n}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new rA(this,i,t,n);e.input.compositionNodes.push(s),this.children=rF(this.children,r,r+n.length,e,s)}update(e,t,r,n){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,r,n),!0)}updateInner(e,t,r,n){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(rL(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,r=this.dom;this.dom=rI(this.dom,this.nodeDOM,rD(this.outerDeco,this.node,t),rD(e,this.node,t)),this.dom!=r&&(r.pmVie
76wDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function rO(e,t,r,n,i){rj(n,t,e);let s=new rT(void 0,e,t,r,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class rM extends rT{constructor(e,t,r,n,i,s,o){super(e,t,r,n,i,null,s,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,n){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,r){let n=this.node.cut(e,t),i=document.createTextNode(n.text);return new rM(this.parent,n,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class rR extends rS{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class rN extends rT{constructor(e,t,r,n,i,s,o,a,l,h){super(e,t,r,n,i,s,o,l,h),this.spec=a}update(e,t,r,n){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,n),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,r,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,n){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,n)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let rP=function(e){e&&(this.nodeName=e)};rP.prototype=Object.create(null);let r_=[new rP];function rD(e,t,r){if(0==e.length)return r_;let n=r?r_[0]:new rP,i=[n];for(let s=0;s<e.length;s++){let o=e[s].type.attrs;if(o)for(let e in o.nodeName&&i.push(n=new rP(o.nodeName)),o){let s=o[e];null!=s&&(r&&1==i.length&&i.push(n=new rP(t.isInline?"span":"div")),"class"==e?n.class=(n.class?n.class+" ":"")+s:"style"==e?n.style=(n.style?n.style+";":"")+s:"nodeName"!=e&&(n[e]=s))}}return i}function rI(e,t,r,n){if(r==r_&&n==r_)return t;let i=t;for(let t=0;t<n.length;t++){let s=n[t],o=r[t];if(t){let t;o&&o.nodeName==s.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==s.nodeName||((t=document.createElement(s.nodeName)).pmIsDeco=!0,t.appendChild(i),o=r_[0]),i=t}!function(e,t,r){for(let n in t)"class"==n||"style"==n||"nodeName"==n||n in r||e.removeAttribute(n);for(let n in r)"class"!=n&&"style"!=n&&"nodeName"!=n&&r[n]!=t[n]&&e.setAttribute(n,r[n]);if(t.class!=r.class){let n=t.class?t.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let t=0;t<n.length;t++)-1==i.indexOf(n[t])&&e.classList.remove(n[t]);for(let t=0;t<i.length;t++)-1==n.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=r.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,n;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}r.style&&(e.style.cssText+=r.style)}}(i,o||r_[0],s)}return i}function rj(e,t,r){return rI(e,e,r_,rD(t,r,1!=e.nodeType))}function rL(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].type.eq(t[r].type))return!1;return!0}function rB(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class r${constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let r=t,n=r.children.length,i=e.childCount,s=new Map,o=[];o:for(;i>0;){let a;for(;;)if(n){let e=r.children[n-1];if(e instanceof rE)r=e,n=e.children.length;else{a=e,n--;break}}else if(r==t)break o;else n=r.parent.children.indexOf(r),r=r.parent;let l=a.node;if(l){if(l!=e.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,n){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;n<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let r=this.top.children[t];if(r.matchesMark(e[s])&&!this.isLocked(r.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let n=rE.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,n),this.top=n,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,n){let i=-1,s;if(n>=this.preMatch.index&&(s=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let n=this.index,s=Math.min(this.top.children.length,n+5);n<s;n++){let s=this.top.children[n];if(s.matchesNode(e,t,r)&&!this.preMatch.matched.has(s)){i=n;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,n,i){let s=this.top.children[n];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(e,t,r,i
76)&&(this.destroyBetween(this.index,n),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,r,n,i,s){for(let o=this.index;o<this.top.children.length;o++){let a=this.top.children[o];if(a instanceof rT){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let h=a.dom,c,u=this.isLocked(h)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&rL(t,a.outerDeco));if(!u&&a.update(e,t,r,n))return this.destroyBetween(this.index,o),a.dom!=h&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(a,e,t,r,n,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(n,s+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,n,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!rL(r,e.outerDeco)||!n.eq(e.innerDeco))return null;let o=rT.create(this.top,t,r,n,i,s);if(o.contentDOM)for(let t of(o.children=e.children,e.children=[],o.children))t.parent=o;return e.destroy(),o}addNode(e,t,r,n,i){let s=rT.create(this.top,e,t,r,n,i);s.contentDOM&&s.updateChildren(n,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(n&&n.matchesWidget(e)&&(e==n.widget||!n.widget.type.toDOM.parentNode))this.index++;else{let n=new rC(this.top,e,t,r);this.top.children.splice(this.index++,0,n),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof rE;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof rM)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((t7||t8)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);"IMG"==e&&(r.className="ProseMirror-separator",r.alt=""),"BR"==e&&(r.className="ProseMirror-trailingBreak");let n=new rR(this.top,[],r,null);t!=this.top?t.children.push(n):t.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function rz(e,t){return e.type.side-t.type.side}function rF(e,t,r,n,i){let s=[];for(let o=0,a=0;o<e.length;o++){let l=e[o],h=a,c=a+=l.size;h>=r||c<=t?s.push(l):(h<t&&s.push(l.slice(0,t-h,n)),i&&(s.push(i),i=void 0),c>r&&s.push(l.slice(r-h,l.size,n)))}return s}function rH(e,t=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),s=i&&0==i.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let a=n.resolve(o),l,h;if(tG(r)){for(l=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&e8.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,r){for(let n=0==t,i=t==tK(e);n||i;){if(e==r)return!0;let t=t$(e);if(!(e=e.parentNode))return!1;n=n&&0==t,i=i&&t==tK(e)}}(r.focusNode,r.focusOffset,i.dom))){let e=i.posBefore;h=new e8(o==e?a:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let t=o,i=o;for(let n=0;n<r.rangeCount;n++){let s=r.getRangeAt(n);t=Math.min(t,e.docView.posFromDOM(s.startContainer,s.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(t<0)return null;[l,o]=i==e.state.selection.anchor?[i,t]:[t,i],a=n.resolve(o)}else l=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}let c=n.resolve(l);if(!h){let r="pointer"==t||e.state.selection.head<a.pos&&!s?1:-1;h=rX(e,c,a,r)}return h}function rW(e){return e.editable?e.hasFocus():rZ(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function rU(e,t=!1){let r=e.state.selection;if(rG(e,r),!rW(e))return;let n=e.input.mouseDown;if(!t&&t8&&n){let t=e.domSelectionRange(),r=e.domObserver.currentSelection;if(t.anchorNode&&r.anchorNode&&tU(t.anchorNode,t.anchorOffset,r.anchorNode,r.anchorOffset)&&n.delaySelUpdate())return void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let r=e.cursorWrapper.dom,n="IMG"==r.nodeName;n?t.collapse(r.parentNode,t$(r)+1):t.collapse(r,0),!n&&!e.state.selection.visible&&t3&&t5<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var i;
76let n,s,o,a,{anchor:l,head:h}=r,c,u;rV&&!(r instanceof e4)&&(r.$from.parent.inlineContent||(c=rq(e,r.from)),r.empty||r.$from.parent.inlineContent||(u=rq(e,r.to))),e.docView.setSelection(l,h,e,t),rV&&(c&&rJ(c),u&&rJ(u)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((n=(i=e).dom.ownerDocument).removeEventListener("selectionchange",i.input.hideSelectionGuard),o=(s=i.domSelectionRange()).anchorNode,a=s.anchorOffset,n.addEventListener("selectionchange",i.input.hideSelectionGuard=()=>{(s.anchorNode!=o||s.anchorOffset!=a)&&(n.removeEventListener("selectionchange",i.input.hideSelectionGuard),setTimeout(()=>{(!rW(i)||i.state.selection.visible)&&i.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}let rV=t7||t8&&t9<63;function rq(e,t){let{node:r,offset:n}=e.docView.domFromPos(t,0),i=n<r.childNodes.length?r.childNodes[n]:null,s=n?r.childNodes[n-1]:null;if(t7&&i&&"false"==i.contentEditable)return rK(i);if((!i||"false"==i.contentEditable)&&(!s||"false"==s.contentEditable)){if(i)return rK(i);else if(s)return rK(s)}}function rK(e){return e.contentEditable="true",t7&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function rJ(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function rG(e,t){if(t instanceof e8){let r=e.docView.descAt(t.from);r!=e.lastSelectedViewDesc&&(rY(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else rY(e)}function rY(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function rX(e,t,r,n){return e.someProp("createSelectionBetween",n=>n(e,t,r))||e4.between(t,r,n)}function rQ(e){return(!e.editable||!!e.hasFocus())&&rZ(e)}function rZ(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function r0(e,t){let{$anchor:r,$head:n}=e.selection,i=t>0?r.max(n):r.min(n),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&e1.findFrom(s,t)}function r1(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function r2(e,t,r){let n=e.state.selection;if(n instanceof e4){if(r.indexOf("s")>-1){let{$head:r}=n,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(r.pos+i.nodeSize*(t<0?-1:1));return r1(e,new e4(n.$anchor,s))}else if(!n.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let r=r0(e.state,t);return!!r&&r instanceof e8&&r1(e,r)}else if(!(rt&&r.indexOf("m")>-1)){let r=n.$head,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let o=t<0?r.pos-i.nodeSize:r.pos;return!!(i.isAtom||(s=e.docView.descAt(o))&&!s.contentDOM)&&(e8.isSelectable(i)?r1(e,new e8(t<0?e.state.doc.resolve(r.pos-i.nodeSize):r)):!!ri&&r1(e,new e4(e.state.doc.resolve(t<0?o:o+i.nodeSize))))}}else{if(n instanceof e8&&n.node.isInline)return r1(e,new e4(t>0?n.$to:n.$from));let r=r0(e.state,t);return!!r&&r1(e,r)}}function r3(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function r5(e,t){let r=e.pmViewDesc;return r&&0==r.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function r4(e,t){return t<0?function(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i,s,o=!1;for(t4&&1==r.nodeType&&n<r3(r)&&r5(r.childNodes[n],-1)&&(o=!0);;)if(n>0)if(1!=r.nodeType)break;else{let e=r.childNodes[n-1];if(r5(e,-1))i=r,s=--n;else if(3==e.nodeType)n=(r=e).nodeValue.length;else break}else if(r6(r))break;else{let t=r.previousSibling;for(;t&&r5(t,-1);)i=r.parentNode,s=t$(t),t=t.previousSibling;if(t)n=r3(r=t);else{if((r=r.parentNode)==e.dom)break;n=0}}o?r8(e,r,n):i&&r8(e,i,s)}(e):function(e){let t,r,n=e.domSelectionRange(),i=n.focusNode,s=n.focusOffset;if(!i)return;let o=r3(i);for(;;)if(s<o){if(1!=i.nodeType)break;if(r5(i.childNodes[s],1))t=i,r=++s;else break}else if(r6(i))break;else{let n=i.nextSibling;for(;n&&r5(n,1);)t=n.parentNode,r=t$(n)+1,n=n.nextSibling;if(n)s=0,o=r3(i=n);else{if((i=i.parentNode)==e.dom)break;s=o=0}}t&&r8(e,t,r)}(e)}function r6(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function r8(e,t,r){if(3!=t.nodeType){let e,n;(n=function(e,t){for(;e&&t==e.childNodes.length&&!tJ(e);)t=t$(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let r=e.childNodes[t];
vendor: 5,122 bytes, line 76
76if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;e=r,t=0}}(t,r))?(t=n,r=0):(e=function(e,t){for(;e&&!t&&!tJ(e);)t=t$(e),e=e.parentNode;for(;e&&t;){let r=e.childNodes[t-1];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;t=(e=r).childNodes.length}}(t,r))&&(t=e,r=e.nodeValue.length)}let n=e.domSelection();if(!n)return;if(tG(n)){let e=document.createRange();e.setEnd(t,r),e.setStart(t,r),n.removeAllRanges(),n.addRange(e)}else n.extend&&n.extend(t,r);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&rU(e)},50)}function r9(e,t){let r=e.state.doc.resolve(t);if(!(t8||rr)&&r.parent.inlineContent){let n=e.coordsAtPos(t);if(t>r.start()){let r=e.coordsAtPos(t-1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left<n.left?"ltr":"rtl"}if(t<r.end()){let r=e.coordsAtPos(t+1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function r7(e,t,r){let n=e.state.selection;if(n instanceof e4&&!n.empty||r.indexOf("s")>-1||rt&&r.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let r=r0(e.state,t);if(r&&r instanceof e8)return r1(e,r)}if(!i.parent.inlineContent){let r=t<0?i:s,o=n instanceof e7?e1.near(r,t):e1.findFrom(r,t);return!!o&&r1(e,o)}return!1}function ne(e,t){if(!(e.state.selection instanceof e4))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){let n=e.state.tr;return t<0?n.delete(r.pos-s.nodeSize,r.pos):n.delete(r.pos,r.pos+s.nodeSize),e.dispatch(n),!0}return!1}function nt(e,t,r){e.domObserver.stop(),t.contentEditable=r,e.domObserver.start()}function nr(e,t){e.someProp("transformCopied",r=>{t=r(t,e)});let r=[],{content:n,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==n.childCount&&1==n.firstChild.childCount;){i--,s--;let e=n.firstChild;r.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),n=e.content}let o=e.someProp("clipboardSerializer")||ed.fromSchema(e.state.schema),a=nc(),l=a.createElement("div");l.appendChild(o.serializeFragment(n,{document:a}));let h=l.firstChild,c,u=0;for(;h&&1==h.nodeType&&(c=nl[h.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}h=l.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(r)}`),{dom:l,text:e.someProp("clipboardTextSerializer",r=>r(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function nn(e,t,r,n,i){let s,o,a=i.parent.type.spec.code;if(!r&&!t)return null;let l=!!t&&(n||a||!r);if(l){if(e.someProp("transformPastedText",r=>{t=r(t,a||n,e)}),a)return o=new T(x.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{o=t(o,e,!0)}),o;let r=e.someProp("clipboardTextParser",r=>r(t,i,n,e));if(r)o=r;else{let r=i.marks(),{schema:n}=e.state,o=ed.fromSchema(n);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(o.serializeNode(n.text(e,r)))})}}else e.someProp("transformPastedHTML",t=>{r=t(r,e)}),s=function(e){var t;let r,n=/^(\s*<meta [^>]*>)*/.exec(e);n&&(e=e.slice(n[0].length));let i=nc().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),o;if((o=s&&nl[s[1].toLowerCase()])&&(e=o.map(e=>"<"+e+">").join("")+e+o.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(r=window.trustedTypes)?(nu||(nu=r.defaultPolicy||r.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),nu.createHTML(t)):t),o)for(let e=0;e<o.length;e++)i=i.querySelector(o[e])||i;return i}(r),ri&&function(e){let t=e.querySelectorAll(t8?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<t.length;r++){let n=t[r];1==n.childNodes.length&&" "==n.textContent&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}(s);let h=s&&s.querySelector("[data-pm-slice]"),c=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let e=+c[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(o||(o=(e.someProp("clipboardParser")||e.someProp("domParser")||en.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ni.test(e.parentNode.nodeName)?null:{ignore:!0}})),c)o=function(e,t){if(!e.size)return e;let r=e.content.firstChild.type.schema,n;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:o}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;i=x.from(t.create(n[e+1],i)),s++,o++}return new T(i,s,o)}(na(o,+c[1],+c[2]),c[4]);else if((o=T.maxOpen(function(e,t){if(e.childCount<2)return e;for(let r=t.depth;r>=0;r--){let n=t.node(r).contentMatchAt(t.index(r)),i,s=[];
76if(e.forEach(e=>{if(!s)return;let t=n.findWrapping(e.type),r;if(!t)return s=null;if(r=s.length&&i.length&&function e(t,r,n,i,s){if(s<t.length&&s<r.length&&t[s]==r[s]){let o=e(t,r,n,i.lastChild,s+1);if(o)return i.copy(i.content.replaceChild(i.childCount-1,o));if(i.contentMatchAt(i.childCount).matchType(s==t.length-1?n.type:t[s+1]))return i.copy(i.content.append(x.from(ns(n,t,s+1))))}}(t,i,e,s[s.length-1],0))s[s.length-1]=r;else{s.length&&(s[s.length-1]=function e(t,r){if(0==r)return t;let n=t.content.replaceChild(t.childCount-1,e(t.lastChild,r-1)),i=t.contentMatchAt(t.childCount).fillBefore(x.empty,!0);return t.copy(n.append(i))}(s[s.length-1],i.length));let r=ns(e,t);s.push(r),n=n.matchType(r.type),i=t}}),s)return x.from(s)}return e}(o.content,i),!0)).openStart||o.openEnd){let e=0,t=0;for(let t=o.content.firstChild;e<o.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=o.content.lastChild;t<o.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);o=na(o,e,t)}return e.someProp("transformPasted",t=>{o=t(o,e,l)}),o}let ni=/^(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 ns(e,t,r=0){for(let n=t.length-1;n>=r;n--)e=t[n].create(null,x.from(e));return e}function no(e,t,r,n,i,s){let o=t<0?e.firstChild:e.lastChild,a=o.content;return e.childCount>1&&(s=0),i<n-1&&(a=no(a,t,r,n,i+1,s)),i>=r&&(a=t<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(x.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(a))}function na(e,t,r){return t<e.openStart&&(e=new T(no(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),r<e.openEnd&&(e=new T(no(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}let nl={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nh=null;function nc(){return nh||(nh=document.implementation.createHTMLDocument("title"))}let nu=null,nd={},nf={},np={touchstart:!0,touchmove:!0};class nm{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ng(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ny(e){e.someProp("handleDOMEvents",t=>{for(let r in t)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=t=>nv(e,t))})}function nv(e,t){return e.someProp("handleDOMEvents",r=>{let n=r[t.type];return!!n&&(n(e,t)||t.defaultPrevented)})}function nb(e){return{left:e.clientX,top:e.clientY}}function nw(e,t,r,n,i){if(-1==n)return!1;let s=e.state.doc.resolve(n);for(let n=s.depth+1;n>0;n--)if(e.someProp(t,t=>n>s.depth?t(e,r,s.nodeAfter,s.before(n),i,!0):t(e,r,s.node(n),s.before(n),i,!1)))return!0;return!1}function nx(e,t,r){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);"pointer"==r&&n.setMeta("pointer",!0),e.dispatch(n)}function nk(e,t,r){let n=e.state.doc;if(-1==t)return n.inlineContent?e4.create(n,0,n.content.size):null;let i=n.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),s=i.before(e);if(t.inlineContent)return e4.create(n,s+1,s+1+t.content.size);if(r&&e8.isSelectable(t))return e8.create(n,s)}return null}nf.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!nT(e))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!rn||!t8||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!re||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",r=>r(e,t))||function(e,t){let r,n=t.keyCode,i=(r="",t.ctrlKey&&(r+="c"),t.metaKey&&(r+="m"),t.altKey&&
76(r+="a"),t.shiftKey&&(r+="s"),r);if(8==n||rt&&72==n&&"c"==i)return ne(e,-1)||r4(e,-1);if(46==n&&!t.shiftKey||rt&&68==n&&"c"==i)return ne(e,1)||r4(e,1);if(13==n||27==n)return!0;if(37==n||rt&&66==n&&"c"==i){let t=37==n?"ltr"==r9(e,e.state.selection.from)?-1:1:-1;return r2(e,t,i)||r4(e,t)}if(39==n||rt&&70==n&&"c"==i){let t=39==n?"ltr"==r9(e,e.state.selection.from)?1:-1:1;return r2(e,t,i)||r4(e,t)}else if(38==n||rt&&80==n&&"c"==i)return r7(e,-1,i)||r4(e,-1);else if(40==n||rt&&78==n&&"c"==i)return function(e){if(!t7||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(t&&1==t.nodeType&&0==r&&t.firstChild&&"false"==t.firstChild.contentEditable){let r=t.firstChild;nt(e,r,"true"),setTimeout(()=>nt(e,r,"false"),20)}return!1}(e)||r7(e,1,i)||r4(e,1);else if(i==(rt?"m":"c")&&(66==n||73==n||89==n||90==n))return!0;return!1}(e,t)?t.preventDefault():ng(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,tY(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},nf.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},nf.keypress=(e,t)=>{if(nT(e)||!t.charCode||t.ctrlKey&&!t.altKey||rt&&t.metaKey)return;if(e.someProp("handleKeyPress",r=>r(e,t)))return void t.preventDefault();let r=e.state.selection;if(!(r instanceof e4)||!r.$from.sameParent(r.$to)){let n=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(n).scrollIntoView();/[\r\n]/.test(n)||e.someProp("handleTextInput",t=>t(e,r.$from.pos,r.$to.pos,n,i))||e.dispatch(i()),t.preventDefault()}};let nS=rt?"metaKey":"ctrlKey";nd.mousedown=(e,t)=>{var r;let n,i;e.input.shiftKey=t.shiftKey;let s=nN(e),o=Date.now(),a="singleClick";o-e.input.lastClick.time<500&&(n=(r=e.input.lastClick).x-t.clientX)*n+(i=r.y-t.clientY)*i<100&&!t[nS]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:a,button:t.button},e.input.mouseDown&&e.input.mouseDown.done();let l=e.posAtCoords(nb(t));l&&("singleClick"==a?e.input.mouseDown=new nA(e,l,t,!!s):("doubleClick"==a?function(e,t,r,n){return nw(e,"handleDoubleClickOn",t,r,n)||e.someProp("handleDoubleClick",r=>r(e,t,n))}:function(e,t,r,n){return nw(e,"handleTripleClickOn",t,r,n)||e.someProp("handleTripleClick",r=>r(e,t,n))||function(e,t,r){if(0!=r.button)return!1;let n=nk(e,t,!0),i=e.state.doc;return!!n&&(nx(e,n,"pointer"),n instanceof e4&&i.eq(e.state.doc)&&(e.input.mouseDown=new nE(e,n)),!0)}(e,r,n)})(e,l.pos,l.inside,t)?t.preventDefault():ng(e,"pointer"))};class nC{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){0==e.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class nA extends nC{constructor(e,t,r,n){let i,s;if(super(e),this.pos=t,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[nS],this.allowDefault=r.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let r=e.state.doc.resolve(t.pos);i=r.parent,s=r.depth?r.before():0}const o=n?null:r.target,a=o?e.docView.nearestDesc(o,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==r.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof e8&&l.from<=s&&l.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&t4&&!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()),ng(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||rU(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nb(e))),this.updateAllowDefault(e),this.allowDefault||!t)ng(this.view,"pointer");else{var r,n,i,s;(r=this.view,n=t.pos,i=t.inside,s=this.selectNode,nw(r,"handleClickOn",n,i,e)||r.someProp("handleClick",t=>t(r,n,e))||(s?function(e,t){if(-1==t)return!1;let r=e.state.selection,n,i;r instanceof e8&&(n=r.node);let s=e.state.doc.resolve(t);for(let e=s.depth+1;e>0;e--){let t=e>s.depth?s.nodeAfter:s.node(e);if(e8.isSelectable(t)){i=n&&r.$from.depth>0&&e>=r.$from.depth&&s.before(r.$from.depth+1)==r.$from.pos?s.before(r.$from.depth):s.before(e);break}}
76return null!=i&&(nx(e,e8.create(e.state.doc,i),"pointer"),!0)}(r,i):function(e,t){if(-1==t)return!1;let r=e.state.doc.resolve(t),n=r.nodeAfter;return!!(n&&n.isAtom&&e8.isSelectable(n))&&(nx(e,new e8(r),"pointer"),!0)}(r,i)))?e.preventDefault():0==e.button&&(this.flushed||t7&&this.mightDrag&&!this.mightDrag.node.isAtom||t8&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(nx(this.view,e1.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):ng(this.view,"pointer")}}move(e){this.updateAllowDefault(e),ng(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class nE extends nC{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(0==e.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();e.preventDefault(),ng(this.view,"pointer");let t=this.view.posAtCoords(nb(e)),r=t&&nk(this.view,t.inside,!1);if(!r)return;let{doc:n}=this.view.state,i=this.startSelection,[s,o]=r.from<i.from?[i.to,r.from]:[i.from,r.to];nx(this.view,e4.create(n,s,o),"pointer")}}function nT(e,t){return!!e.composing||!!(t7&&500>Math.abs(Date.now()-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}nd.touchstart=e=>{e.input.lastTouch=Date.now(),nN(e),ng(e,"pointer")},nd.touchmove=e=>{e.input.lastTouch=Date.now(),ng(e,"pointer")},nd.contextmenu=e=>nN(e);let nO=rn?5e3:-1;function nM(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>nN(e),t))}function nR(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function nN(e,t=!1){if(!rn||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),nR(e),t||e.docView&&e.docView.dirty){let r=rH(e),n=e.state.selection;return r&&!r.eq(n)?e.dispatch(e.state.tr.setSelection(r)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}nf.compositionstart=nf.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,r=t.selection.$to;if(t.selection instanceof e4&&(t.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||t8&&rr&&function(e){let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(!t||1!=t.nodeType||r>=t.childNodes.length)return!1;let n=t.childNodes[r];return 1==n.nodeType&&"false"==n.contentEditable}(e)))e.markCursor=e.state.storedMarks||r.marks(),nN(e,!0),e.markCursor=null;else if(nN(e,!t.selection.empty),t4&&t.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let t=e.domSelectionRange();for(let r=t.focusNode,n=t.focusOffset;r&&1==r.nodeType&&0!=n;){let t=n<0?r.lastChild:r.childNodes[n-1];if(!t)break;if(3==t.nodeType){let r=e.domSelection();r&&r.collapse(t,t.nodeValue.length);break}r=t,n=-1}}e.input.composing=!0}nM(e,nO)},nf.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,nM(e,20))};let nP=t3&&t5<15||re&&rs<604;function n_(e,t,r,n,i){let s=nn(e,t,r,n,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,s||T.empty)))return!0;if(!s)return!1;let o=0==s.openStart&&0==s.openEnd&&1==s.content.childCount?s.content.firstChild:null,a=o?e.state.tr.replaceSelectionWith(o,n):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nD(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;
vendor: 16,516 bytes, line 76
76let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}nd.copy=nf.cut=(e,t)=>{let r=e.state.selection,n="cut"==t.type;if(r.empty)return;let i=nP?null:t.clipboardData,{dom:s,text:o}=nr(e,r.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",s.innerHTML),i.setData("text/plain",o)):function(e,t){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(t),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()},50)}(e,s),n&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},nf.paste=(e,t)=>{if(e.composing&&!rn)return;let r=nP?null:t.clipboardData,n=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&n_(e,nD(r),r.getData("text/html"),n,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?n_(e,n.value,null,i,t):n_(e,n.textContent,n.innerHTML,i,t)},50)}(e,t)};class nI{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}let nj=rt?"altKey":"ctrlKey";function nL(e,t){let r;return e.someProp("dragCopies",e=>{r=r||e(t)}),null!=r?!r:!t[nj]}for(let e in nd.dragstart=(e,t)=>{let r,n=e.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(nb(t));if(s&&s.pos>=i.from&&s.pos<=(i instanceof e8?i.to-1:i.to));else if(n&&n.mightDrag)r=e8.create(e.state.doc,n.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let n=e.docView.nearestDesc(t.target,!0);n&&n.node.type.spec.draggable&&n!=e.docView&&(r=e8.create(e.state.doc,n.posBefore))}let o=(r||e.state.selection).content(),{dom:a,text:l,slice:h}=nr(e,o);t.dataTransfer.files.length&&t8&&!(t9>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(nP?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",nP||t.dataTransfer.setData("text/plain",l),e.dragging=new nI(h,nL(e,t),r)},nd.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},nf.dragover=nf.dragenter=(e,t)=>t.preventDefault(),nf.drop=(e,t)=>{try{!function(e,t,r){if(!t.dataTransfer)return;let n=e.posAtCoords(nb(t));if(!n)return;let i=e.state.doc.resolve(n.pos),s=r&&r.slice;s?e.someProp("transformPasted",t=>{s=t(s,e,!1)}):s=nn(e,nD(t.dataTransfer),nP?null:t.dataTransfer.getData("text/html"),!1,i);let o=!!(r&&nL(e,t));if(e.someProp("handleDrop",r=>r(e,t,s||T.empty,o)))return t.preventDefault();if(!s)return;t.preventDefault();let a=s?eF(e.state.doc,i.pos,s):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(o){let{node:e}=r;e?e.replace(l):l.deleteSelection()}let h=l.mapping.map(a),c=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,u=l.doc;if(c?l.replaceRangeWith(h,h,s.content.firstChild):l.replaceRange(h,h,s),l.doc.eq(u))return;let d=l.doc.resolve(h);if(c&&e8.isSelectable(s.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new e8(d));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,r,n,i)=>t=i),l.setSelection(rX(e,d,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},nd.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())&&rU(e)},20))},nd.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},nd.beforeinput=(e,t)=>{if(t8&&rn&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,tY(8,"Backspace")))))return;let{$cursor:r}=e.state.selection;r&&r.pos>0&&e.dispatch(e.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}},nf)nd[e]=nf[e];function nB(e,t){if(e==t)return!0;for(let r in e)if(e[r]!==t[r])return!1;for(let r in t)if(!(r in e))return!1;return!0}class n${constructor(e,t){this.toDOM=e,this.spec=t||nU,this.side=this.spec.side||0}map(e,t,r,n){let{pos:i,deleted:s}=e.mapResult(t.from+n,this.side<0?-1:1);return s?null:new nH(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n$&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&nB(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class nz{constructor(e,t){this.attrs=e,this.spec=t||nU}map(e,t,r,n){let i=e.map(t.from+n,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+n,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new nH(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof nz&&nB(this.attrs,e.attrs)&&nB(this.spec,e.spec)}static is(e){return e.type instanceof nz}destroy(){}}class nF{constructor(e,t){this.attrs=e,this.spec=t||nU}map(e,t,r,n){let i=e.mapResult(t.from+n,1);if(i.deleted)return null;let s=e.mapResult(t.to+n,-1);return s.deleted||s.pos<=i.pos?null:new nH(i.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:n}=e.content.findIndex(t.from),i;return n==t.from&&!(i=e.child(r)).isText&&n+i.nodeSize==t.to}eq(e){return this==e||e instanceof nF&&nB(this.attrs,e.attrs)&&nB(this.spec,e.spec)}destroy(){}}class nH{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new nH(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new nH(e,e,new n$(t,r))}static inline(e,t,r,n){return new nH(e,t,new nz(r,n))}static node(e,t,r,n){return new nH(e,t,new nF(r,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof nz}get widget(){return this.type instanceof n$}}let nW=[],nU={};class nV{constructor(e,t){this.local=e.length?e:nW,this.children=t.length?t:nW}static create(e,t){return t.length?nX(t,e,0,nU):nq}find(e,t,r){let n=[];return this.findInner(null==e?0:e,null==t?1e9:t,n,0,r),n}findInner(e,t,r,n,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+n,o.to+n))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,t-o,r,n+o,i)}}map(e,t,r){return this==nq||0==e.maps.length?this:this.mapInner(e,t,0,0,r||nU)}mapInner(e,t,r,n,i){let s;for(let o=0;o<this.local.length;o++){let a=this.local[o].map(e,r,n);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,t,r,n,i,s,o){let a=e.slice();for(let e=0,t=s;e<r.maps.length;e++){let n=0;r.maps[e].forEach((e,r,i,s)=>{let o=s-i-(r-e);for(let i=0;i<a.length;i+=3){let s=a[i+1];if(s<0||e>s+t-n)continue;let l=a[i]+t-n;r>=l?a[i+1]=e<=l?-2:-1:e>=t&&o&&(a[i]+=o,a[i+1]+=o)}n+=o}),t=r.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let h=r.map(e[t]+s),c=h-i;if(c<0||c>=n.content.size){l=!0;continue}let u=r.map(e[t+1]+s,-1)-i,{index:d,offset:f}=n.content.findIndex(c),p=n.maybeChild(d);if(p&&f==c&&f+p.nodeSize==u){let n=a[t+2].mapInner(r,p,h+1,e[t]+s+1,o);n!=nq?(a[t]=c,a[t+1]=u,a[t+2]=n):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=nX(function(e,t,r,n,i,s,o){for(let a=0;a<e.length;a+=3)-1==e[a+1]&&function e(t,s){for(let e=0;e<t.local.length;e++){let a=t.local[e].map(n,i,s);a?r.push(a):o.onRemove&&o.onRemove(t.local[e].spec)}for(let r=0;r<t.children.length;r+=3)e(t.children[r+2],t.children[r]+s+1)}(e[a+2],t[a]+s+1);return r}(a,e,t,r,i,s,o),n,0,o);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let r=l.children[e];for(;t<a.length&&a[t]<r;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new nV(t.sort(nQ),a)}(this.children,s||[],e,t,r,n,i):s?new nV(s.sort(nQ),nW):nq}add(e,t){return t.length?this==nq?nV.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let n,i=0;e.forEach((e,s)=>{let o=s+r,a;if(a=nG(t,e,o)){for(n||(n=this.children.slice());i<n.length&&n[i]<s;)i+=3;n[i]==s?n[i+2]=n[i+2].addInner(e,a,o+1):n.splice(i,0,s,s+e.nodeSize,nX(a,e,o+1,nU)),i+=3}});let s=nJ(i?nY(t):t,-r);for(let t=0;t<s.length;t++)s[t].type.valid(e,s[t])||s.splice(t--,1);return new nV(s.length?this.local.concat(s).sort(nQ):this.local,n||this.children)}remove(e){return 0==e.length||this==nq?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,n=this.local;for(let n=0;n<r.length;n+=3){let i,s=r[n]+t,o=r[n+1]+t;for(let t=0,r;t<e.length;t++)(r=e[t])&&r.from>s&&r.to<o&&(e[t]=null,(i||(i=[])).push(r));if(!i)continue;r==this.children&&(r=this.children.slice());let a=r[n+2].removeInner(i,s+1);a!=nq?r[n+2]=a:(r.splice(n,3),n-=3)}if(n.length){for(let r=0,i;r<e.length;r++)if(i=e[r])for(let e=0;e<n.length;e++)n[e].eq(i,t)&&(n==this.local&&(n=this.local.slice()),n.splice(e--,1))}return r==this.children&&n==this.local?this:n.length||r.length?new nV(n,r):nq}forChild(e,t){let r,n;if(this==nq)return this;if(t.isLeaf)return nV.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(r=this.children[t+2]);break}let i=e+1,s=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<s&&t.to>i&&t.type instanceof nz){let e=Math.max(i,t.from)-i,r=Math.min(s,t.to)-i;e<r&&(n||(n=[])).push(t.copy(e,r))}}if(n){let e=new nV(n.sort(nQ),nW);return r?new nK([e,r]):e}return r||nq}eq(e){if(this==e)return!0;if(!(e instanceof nV)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return nZ(this.localsInner(e))}localsInner(e){if(this==nq)return nW;if(e.inlineContent||!this.local.some(nz.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof nz||t.push(this.local[e]);return t}forEachSet(e){e(this)}}nV.empty=new nV([],[]),nV.removeOverlap=nZ;let nq=nV.empty;class nK{constructor(e){this.members=e}map(e,t){let r=this.members.map(r=>r.map(e,t,nU));return nK.from(r)}forChild(e,t){if(t.isLeaf)return nV.empty;let r=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(e,t);i!=nq&&(i instanceof nK?r=r.concat(i.members):r.push(i))}return nK.from(r)}eq(e){if(!(e instanceof nK)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(e);if(i.length)if(t){r&&(t=t.slice(),r=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?nZ(r?t:t.sort(nQ)):nW}static from(e){switch(e.length){case 0:return nq;case 1:return e[0];default:return new nK(e.every(e=>e instanceof nV)?e:e.reduce((e,t)=>e.concat(t instanceof nV?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function nJ(e,t){if(!t||!e.length)return e;let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(new nH(i.from+t,i.to+t,i.type))}return r}function nG(e,t,r){if(t.isLeaf)return null;let n=r+t.nodeSize,i=null;for(let t=0,s;t<e.length;t++)(s=e[t])&&s.from>r&&s.to<n&&((i||(i=[])).push(s),e[t]=null);return i}function nY(e){let t=[];for(let r=0;r<e.length;r++)null!=e[r]&&t.push(e[r]);return t}function nX(e,t,r,n){let i=[],s=!1;t.forEach((t,o)=>{let a=nG(e,t,o+r);if(a){s=!0;let e=nX(a,t,r+o+1,n);e!=nq&&i.push(o,o+t.nodeSize,e)}});let o=nJ(s?nY(e):e,-r).sort(nQ);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(n.onRemove&&n.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new nV(o,i):nq}function nQ(e,t){return e.from-t.from||e.to-t.to}function nZ(e){let t=e;for(let r=0;r<t.length-1;r++){let n=t[r];if(n.from!=n.to)for(let i=r+1;i<t.length;i++){let s=t[i];if(s.from==n.from){s.to!=n.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,n.to),n0(t,i+1,s.copy(n.to,s.to)));continue}s.from<n.to&&(t==e&&(t=e.slice()),t[r]=n.copy(n.from,s.from),n0(t,i,n.copy(s.from,n.to)));break}}return t}function n0(e,t,r){for(;t<e.length&&nQ(r,e[t])>0;)t++;e.splice(t,0,r)}function n1(e){let t=[];return e.someProp("decorations",r=>{let n=r(e.state);n&&n!=nq&&t.push(n)}),e.cursorWrapper&&t.push(nV.create(e.state.doc,[e.cursorWrapper.deco])),nK.from(t)}let n2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},n3=t3&&t5<=11;class n5{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class n4{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new n5,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);t3&&t5<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():t7&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),n3&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,n2)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);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(rQ(this.view)){if(this.suppressingSelectionUpdates)return rU(this.view);if(t3&&t5<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tU(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let r=e.focusNode;r;r=tz(r))t.add(r);for(let n=e.anchorNode;n;n=tz(n))if(t.has(n)){r=n;break}let n=r&&this.view.docView.nearestDesc(r);if(n&&n.ignoreMutation({type:"selection",target:3==r.nodeType?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&rQ(t)&&!this.ignoreSelectionChange(n),s=-1,o=-1,a=!1,l=[];
76if(t.editable)for(let e=0;e<r.length;e++){let t=this.registerMutation(r[e],l);t&&(s=s<0?t.from:Math.min(t.from,s),o=o<0?t.to:Math.max(t.to,o),t.typeOver&&(a=!0))}if(l.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||t8&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&r.some(e=>"childList"==e.type&&e.removedNodes.length))){for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(t4&&l.length){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,r]=e;t.parentNode&&t.parentNode.parentNode==r.parentNode?r.remove():t.remove()}else{let{focusNode:r}=this.currentSelection;for(let n of e){let e=n.parentNode;e&&"LI"==e.nodeName&&(!r||function(e,t){for(let r=t.parentNode;r&&r!=e.dom;r=r.parentNode){let t=e.docView.nearestDesc(r,!0);if(t&&t.node.isBlock)return r}return null}(t,r)!=e)&&n.remove()}}}let h=null;s<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&tG(n)&&(h=rH(t))&&h.eq(e1.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,rU(t),this.currentSelection.set(n),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,o),e=t,!n6.has(e)&&(n6.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=t4,n8||(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."),n8=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var r;let{focusNode:n,focusOffset:i}=e.domSelectionRange();for(let s of t)if((null==(r=s.parentNode)?void 0:r.nodeName)=="TR"){let t=s.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let r=t;for(;;){let e=r.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;r=e}r.insertBefore(s,r.firstChild),n==s&&e.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}(t,l)),this.handleDOMChange(s,o,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||rU(t),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(r==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if("childList"==e.type){for(let r=0;r<e.addedNodes.length;r++){let n=e.addedNodes[r];t.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let n=e.previousSibling,i=e.nextSibling;if(t3&&t5<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:r,nextSibling:s}=e.addedNodes[t];(!r||0>Array.prototype.indexOf.call(e.addedNodes,r))&&(n=r),(!s||0>Array.prototype.indexOf.call(e.addedNodes,s))&&(i=s)}let s=n&&n.parentNode==e.target?t$(n)+1:0,o=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?t$(i):e.target.childNodes.length;return{from:o,to:r.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:r.posAtStart-r.border,to:r.posAt
76End+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let n6=new WeakMap,n8=!1;function n9(e,t){let r=t.startContainer,n=t.startOffset,i=t.endContainer,s=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return tU(o.node,o.offset,i,s)&&([r,n,i,s]=[i,s,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:s}}function n7(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(t7&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||t7&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let ie=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function it(e,t,r){return Math.max(r.anchor,r.head)>t.content.size?null:rX(e,t.resolve(r.anchor),t.resolve(r.head))}function ir(e,t,r){let n=e.depth,i=t?e.end():e.pos;for(;n>0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,i++,t=!1;if(r){let t=e.node(n).maybeChild(e.indexAfter(n));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}class ii{constructor(e,t){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 nm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ih),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ia(this),io(this),this.nodeViews=il(this),this.docView=rO(this.state.doc,is(this),n1(this),this.dom,this),this.domObserver=new n4(this,(e,t,r,n)=>(function(e,t,r,n,i){let s,o,a,l=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,r=rH(e,t);if(r&&!e.state.selection.eq(r)){if(t8&&rn&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,tY(13,"Enter"))))return;let n=e.state.tr.setSelection(r);"pointer"==t?n.setMeta("pointer",!0):"key"==t&&n.scrollIntoView(),l&&n.setMeta("composition",l),e.dispatch(n)}return}let h=e.state.doc.resolve(t),c=h.sharedDepth(r);t=h.before(c+1),r=e.state.doc.resolve(r).after(c+1);let u=e.state.selection,d=function(e,t,r){let n,{node:i,fromOffset:s,toOffset:o,from:a,to:l}=e.docView.parseRange(t,r),h=e.domSelectionRange(),c=h.anchorNode;if(c&&e.dom.contains(1==c.nodeType?c:c.parentNode)&&(n=[{node:c,offset:h.anchorOffset}],tG(h)||n.push({node:h.focusNode,offset:h.focusOffset})),t8&&8===e.input.lastKeyCode)for(let e=o;e>s;e--){let t=i.childNodes[e-1],r=t.pmViewDesc;if("BR"==t.nodeName&&!r){o=e;break}if(!r||r.size)break}let u=e.state.doc,d=e.someProp("domParser")||en.fromSchema(e.state.schema),f=u.resolve(a),p=null,m=d.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:o,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:n,ruleFromNode:n7,context:f});if(n&&null!=n[0].pos){let e=n[0].pos,t=n[1]&&n[1].pos;null==t&&(t=e),p={anchor:e+a,head:t+a}}return{doc:m,sel:p,from:a,to:l}}(e,t,r),f=e.state.doc,p=f.slice(d.from,d.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,o="end"):(s=e.state.selection.from,o="start"),e.input.lastKeyCode=null;let m=function(e,t,r,n,i){let s=e.findDiffStart(t,r),o=r+e.size,a=r+t.size;if(null==s)return null;let{a:l,b:h}=e.findDiffEnd(t,o,a);if("end"==i){let e=Math.max(0,s-Math.min(l,h));n-=l+e-s}if(l<s&&o<a){let e=n<=s&&n>=l?s-n:0;s-=e,h=s+(h-l),l=s}else if(h<s){let e=n<=s&&n>=h?s-n:0;s-=e,l=s+(l-h),h=s}return{start:s,endA:l,endB:h}}(p.content,d.doc.content,d.from,s,o);if(m&&e.input.domChangeCount++,(re&&e.input.lastIOSEnter>Date.now()-225||rn)&&i.some(e=>1==e.nodeType&&!ie.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,tY(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(n&&u instanceof e4&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(d.sel&&d.sel.anchor!=d.sel.head)
vendor: 5,098 bytes, line 76
76)m={start:u.from,endA:u.to,endB:u.to};else{if(d.sel){let t=it(e,e.state.doc,d.sel);if(t&&!t.eq(e.state.selection)){let r=e.state.tr.setSelection(t);l&&r.setMeta("composition",l),e.dispatch(r)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof e4&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),t3&&t5<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&"  "==d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),v=f.resolve(m.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=m.endA;if((re&&e.input.lastIOSEnter>Date.now()-225&&(!b||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,tY(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,r,n,i){if(r-t<=i.pos-n.pos||ir(n,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(!n.parent.isTextblock){let e=s.nodeAfter;return null!=e&&r==t+e.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=e.resolve(ir(s,!0,!0));return!(!o.parent.isTextblock||o.pos>r||ir(o,!0,!1)<r)&&n.parent.content.cut(n.parentOffset).eq(o.parent.content)}(f,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",t=>t(e,tY(8,"Backspace")))){rn&&t8&&e.domObserver.suppressSelectionUpdates();return}t8&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),rn&&!b&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,tY(13,"Enter"))})},20));let w=m.start,k=m.endA,S=t=>{let r=t||e.state.tr.replace(w,k,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let t=it(e,r.doc,d.sel);t&&!(t8&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==r.mapping.map(k)-1)||t3&&t.empty&&t.head==w)&&r.setSelection(t)}return l&&r.setMeta("composition",l),r.scrollIntoView()};if(b)if(g.pos==y.pos){t3&&t5<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>rU(e),20));let t=S(e.state.tr.delete(w,k)),r=f.resolve(m.start).marksAcross(f.resolve(m.endA));r&&t.ensureMarks(r),e.dispatch(t)}else if(m.endA==m.endB&&(a=function(e,t){let r=e.firstChild.marks,n=t.firstChild.marks,i=r,s=n,o,a,l;for(let e=0;e<n.length;e++)i=n[e].removeFromSet(i);for(let e=0;e<r.length;e++)s=r[e].removeFromSet(s);if(1==i.length&&0==s.length)a=i[0],o="add",l=e=>e.mark(a.addToSet(e.marks));else{if(0!=i.length||1!=s.length)return null;a=s[0],o="remove",l=e=>e.mark(a.removeFromSet(e.marks))}let h=[];for(let e=0;e<t.childCount;e++)h.push(l(t.child(e)));if(x.from(h).eq(e))return{mark:a,type:o}}(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let t=S(e.state.tr);"add"==a.type?t.addMark(w,k,a.mark):t.removeMark(w,k,a.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-!y.textOffset){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),r=()=>S(e.state.tr.insertText(t,w,k));e.someProp("handleTextInput",n=>n(e,w,k,t,r))||e.dispatch(r())}else e.dispatch(S());else e.dispatch(S())})(this,e,t,r,n)),this.domObserver.start(),function(e){for(let t in nd){let r=nd[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let r=t.target;r!=e.dom;r=r.parentNode)if(!r||11==r.nodeType||r.pmViewDesc&&r.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||nv(e,t)||!e.editable&&t.type in nf||r(e,t)},np[t]?{passive:!0}:void 0)}t7&&e.dom.addEventListener("input",()=>null),ny(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ny(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ih),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let r in t.state=this.state,e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r,n,i;let s=this.state,o=!1,a=!1;e.storedMarks&&this.composing&&(nR(this),a=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=il(this);(function(e,t){let r=0,n=0;for(let n in e){if(e[n]!=t[n])return!0;r++}for(let e in t)n++;return r!=n}
76)(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ny(this),this.editable=ia(this),io(this);let h=n1(this),c=is(this),u=s.plugins==e.plugins||s.doc.eq(e.doc)?e.scrollToSelection>s.scrollToSelection?"to selection":"preserve":"reset",d=o||!this.docView.matchesNode(e.doc,c,h);(d||!e.selection.eq(s.selection))&&(a=!0);let f="preserve"==u&&a&&null==this.dom.style.overflowAnchor&&function(e){let t,r,n=e.dom.getBoundingClientRect(),i=Math.max(0,n.top);for(let s=(n.left+n.right)/2,o=i+1;o<Math.min(innerHeight,n.bottom);o+=5){let n=e.root.elementFromPoint(s,o);if(!n||n==e.dom||!e.dom.contains(n))continue;let a=n.getBoundingClientRect();if(a.top>=i-20){t=n,r=a.top;break}}return{refDOM:t,refTop:r,stack:rl(e.dom)}}(this);if(a){let t,r,a;this.domObserver.stop();let l=d&&(t3||t8)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&(n=s.selection,i=e.selection,a=Math.min(n.$anchor.sharedDepth(n.head),i.$anchor.sharedDepth(i.head)),n.$anchor.start(a)!=i.$anchor.start(a));if(d){let t=t8?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let r=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=tK(e=e.childNodes[t-1])}else{if(!e.parentNode||tJ(e))return null;t=t$(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),n=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||tJ(e))return null;t=t$(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(r&&n&&r!=n){let t=n.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(r==i||n==i)return i;if(!t||!t.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let e=r.pmViewDesc;if(!(!e||!e.isText(r.nodeValue)))return n}}return r||n}(this)),(o||!this.docView.update(e.doc,c,h,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=rO(e.doc,c,h,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(l=!0)}let u=this.input.mouseDown;l||!(u&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),r=this.domSelectionRange(),tU(t.node,t.offset,r.anchorNode,r.anchorOffset))&&u.delaySelUpdate())?rU(this,l):(rG(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),(null==(r=this.dragging)?void 0:r.node)&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():f&&function({refDOM:e,refTop:t,stack:r}){let n=e?e.getBoundingClientRect().top:0;rh(r,0==n?0:n-t)}(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof e8){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&ra(this,t.getBoundingClientRect(),e)}else ra(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let r=e.node,n=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let e=r.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==r.node&&(n=e)}this.dragging=new nI(e.slice,e.move,n<0?void 0:e8.create(this.state.doc,n))}someProp(e,t){let r=this._props&&this._props[e],n;if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let i=this.directPlugins[r].props[e];if(null!=i&&(n=t?t(i):i))return n}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let s=i[r].props[e];if(null!=s&&(n=t?t(s):s))return n}}hasFocus(){if(t3){let e=this.root.activeElement;if(e==this.dom)return!0;
76if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(rc)return e.focus(rc);let t=rl(e);e.focus(null==rc?{get preventScroll(){return rc={preventScroll:!0},!0}}:void 0),rc||(rc=!1,rh(t,0))}(this.dom),rU(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var r;let n,i,s=e.dom.ownerDocument,o,a=0,l=function(e,t,r){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(t,r);if(n)return{node:n.offsetNode,offset:Math.min(tK(n.offsetNode),n.offset)}}catch(e){}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(t,r);if(n)return{node:n.startContainer,offset:Math.min(tK(n.startContainer),n.startOffset)}}}(s,t.left,t.top);l&&({node:o,offset:a}=l);let h=(e.root.elementFromPoint?e.root:s).elementFromPoint(t.left,t.top);if(!h||!e.dom.contains(1!=h.nodeType?h.parentNode:h)){let r=e.dom.getBoundingClientRect();if(!ru(t,r)||!(h=function e(t,r,n){let i=t.childNodes.length;if(i&&n.top<n.bottom)for(let s=Math.max(0,Math.min(i-1,Math.floor(i*(r.top-n.top)/(n.bottom-n.top))-2)),o=s;;){let n=t.childNodes[o];if(1==n.nodeType){let t=n.getClientRects();for(let i=0;i<t.length;i++){let s=t[i];if(ru(r,s))return e(n,r,s)}}if((o=(o+1)%i)==s)break}return t}(e.dom,t,r)))return null}if(t7)for(let e=h;o&&e;e=tz(e))e.draggable&&(o=void 0);if(h=(n=(r=h).parentNode)&&/^li$/i.test(n.nodeName)&&t.left<r.getBoundingClientRect().left?n:r,o){let r;if(t4&&1==o.nodeType&&(a=Math.min(a,o.childNodes.length))<o.childNodes.length){let e=o.childNodes[a],r;"IMG"==e.nodeName&&(r=e.getBoundingClientRect()).right<=t.left&&r.bottom>t.top&&a++}ri&&a&&1==o.nodeType&&1==(r=o.childNodes[a-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&a--,o==e.dom&&a==o.childNodes.length-1&&1==o.lastChild.nodeType&&t.top>o.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==a||1!=o.nodeType||"BR"!=o.childNodes[a-1].nodeName)&&(i=function(e,t,r,n){let i=-1;for(let r=t,s=!1;r!=e.dom;){let t=e.docView.nearestDesc(r,!0),o;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!s&&o.left>n.left||o.top>n.top?i=t.posBefore:(!s&&o.right<n.left||o.bottom<n.top)&&(i=t.posAfter),s=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?n.top<(o.top+o.bottom)/2:n.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;r=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,r,-1)}(e,o,a,t))}null==i&&(i=function(e,t,r){let{node:n,offset:i}=function e(t,r){let n,i,s,o=2e8,a,l=0,h=r.top,c=r.top;for(let e=t.firstChild,u=0;e;e=e.nextSibling,u++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=tH(e).getClientRects()}for(let d=0;d<t.length;d++){let f=t[d];if(f.top<=h&&f.bottom>=c){h=Math.max(f.bottom,h),c=Math.min(f.top,c);let t=f.left>r.left?f.left-r.left:f.right<r.left?r.left-f.right:0;if(t<o){s=e,o=t,a=t&&3==s.nodeType?{left:f.right<r.left?f.right:f.left,top:r.top}:r,1==e.nodeType&&t&&(l=u+ +(r.left>=(f.left+f.right)/2));continue}}else f.top>r.top&&!n&&f.left<=r.left&&f.right>=r.left&&(n=e,i={left:Math.max(f.left,Math.min(f.right,r.left)),top:f.top});!s&&(r.left>=f.right&&r.top>=f.top||r.left>=f.left&&r.top>=f.bottom)&&(l=u+1)}}return(!s&&n&&(s=n,a=i,o=0),s&&3==s.nodeType)?function(e,t){let r=e.nodeValue.length,n=document.createRange(),i;for(let s=0;s<r;s++){n.setEnd(e,s+1),n.setStart(e,s);let r=rf(n,1);if(r.top!=r.bottom&&ru(t,r)){i={node:e,offset:s+ +(t.left>=(r.left+r.right)/2)};break}}return n.detach(),i||{node:e,offset:0}}(s,a):!s||o&&1==s.nodeType?{node:t,offset:l}:e(s,a)}(t,r),s=-1;
76if(1==n.nodeType&&!n.firstChild){let e=n.getBoundingClientRect();s=e.left!=e.right&&r.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(n,i,s)}(e,h,t));let c=e.docView.nearestDesc(h,!0);return{pos:i,inside:c?c.posAtStart-c.border:-1}}(this,e)}coordsAtPos(e,t=1){return rm(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let n=this.docView.posFromDOM(e,t,r);if(null==n)throw RangeError("DOM position not inside the editor");return n}endOfTextblock(e,t){return function(e,t,r){let n,i;return rw==t&&rx==r?rk:(rw=t,rx=r,rk="up"==r||"down"==r?(n=t.selection,i="up"==r?n.$from:n.$to,rv(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==r?-1:1);for(;;){let r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}let n=rm(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=tH(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==r?n.top-i.top>(i.bottom-n.top)*2:i.bottom-n.bottom>(n.bottom-i.top)*2))return!1}}return!0})):function(e,t,r){let{$head:n}=t.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=i==n.parent.content.size,o=e.domSelection();return o?rb.test(n.parent.textContent)&&o.modify?rv(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:s,anchorOffset:a}=e.domSelectionRange(),l=o.caretBidiLevel;o.modify("move",r,"character");let h=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:c,focusOffset:u}=e.domSelectionRange(),d=c&&!h.contains(1==c.nodeType?c:c.parentNode)||t==c&&i==u;try{o.collapse(s,a),t&&(t!=s||i!=a)&&o.extend&&o.extend(t,i)}catch(e){}return null!=l&&(o.caretBidiLevel=l),d}):"left"==r||"backward"==r?!i:s:n.pos==n.start()||n.pos==n.end()}(e,t,r))}(this,t||this.state,e)}pasteHTML(e,t){return n_(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return n_(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return nr(this,e)}destroy(){if(this.docView){for(let e in this.input.mouseDown&&this.input.mouseDown.done(),this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],n1(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tW()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!nv(this,e)&&nd[e.type]&&(this.editable||!(e.type in nf))&&nd[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?t7&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let r;if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return n9(e,r)}function n(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0),r?n9(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function is(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",r=>{if("function"==typeof r&&(r=r(e.state)),r)for(let e in r)"class"==e?t.class+=" "+r[e]:"style"==e?t.style=(t.style?t.style+";":"")+r[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(r[e]))}),t.translate||(t.translate="no"),[nH.node(0,e.state.doc.content.size,t)]}function io(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:nH.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}
76function ia(e){return!e.someProp("editable",t=>!1===t(e.state))}function il(e){let t=Object.create(null);function r(e){for(let r in e)Object.prototype.hasOwnProperty.call(t,r)||(t[r]=e[r])}return e.someProp("nodeViews",r),e.someProp("markViews",r),t}function ih(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}ii.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};var ic=e.i(31989);let iu="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),id="u">typeof navigator&&/Win/.test(navigator.platform);function ip(e,t,r=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),r&&t.shiftKey&&(e="Shift-"+e),e}function im(e){let t=function(e){let t=Object.create(null);for(let r in e)t[function(e){let t,r,n,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"==o&&(o=" ");for(let e=0;e<s.length-1;e++){let o=s[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else if(/^mod$/i.test(o))iu?i=!0:r=!0;else throw Error("Unrecognized modifier name: "+o)}return t&&(o="Alt-"+o),r&&(o="Ctrl-"+o),i&&(o="Meta-"+o),n&&(o="Shift-"+o),o}(r)]=e[r];return t}(e);return function(e,r){let n=(0,ic.keyName)(r),i,s=t[ip(n,r)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==n.length&&" "!=n){if(r.shiftKey){let i=t[ip(n,r,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(id&&r.ctrlKey&&r.altKey)&&(i=ic.base[r.keyCode])&&i!=n){let n=t[ip(i,r)];if(n&&n(e.state,e.dispatch,e))return!0}}return!1}}var ig=Object.defineProperty,iy=(e,t)=>{for(var r in t)ig(e,r,{get:t[r],enumerable:!0})};function iv(e){let{state:t,transaction:r}=e,{selection:n}=r,{doc:i}=r,{storedMarks:s}=r;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=r.selection,i=r.doc,s=r.storedMarks,r}}}var ib=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:n}=t,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let r=t(...e)(s);return i.getMeta("preventDispatch")||this.hasCustomState||n.dispatch(i),r}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:r,editor:n,state:i}=this,{view:s}=n,o=[],a=!!e,l=e||i.tr,h=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(l),o.every(e=>!0===e)),c={...Object.fromEntries(Object.entries(r).map(([e,r])=>[e,(...e)=>{let n=this.buildProps(l,t),i=r(...e)(n);return o.push(i),c}])),run:h};return c}createCan(e){let{rawCommands:t,state:r}=this,n=e||r.tr,i=this.buildProps(n,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(n,!1)}}buildProps(e,t=!0){let{rawCommands:r,editor:n,state:i}=this,{view:s}=n,o={tr:e,editor:n,view:s,state:iv({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},iw={};iy(iw,{blur:()=>ix,clearContent:()=>ik,clearNodes:()=>iS,command:()=>iC,createParagraphNear:()=>iA,cut:()=>iE,deleteCurrentNode:()=>iT,deleteNode:()=>iM,deleteRange:()=>iR,deleteSelection:()=>iP,enter:()=>i_,exitCode:()=>iD,extendMarkRange:()=>iF,first:()=>iH,focus:()=>iJ,forEach:()=>iG,insertContent:()=>iY,insertContentAt:()=>i0,joinBackward:()=>i3,joinDown:()=>i2,joinForward:()=>i5,joinItemBackward:()=>i4,joinItemForward:()=>i6,joinTextblockBackward:()=>i8,joinTextblockForward:()=>i9,joinUp:()=>i1,keyboardShortcut:()=>se,lift:()=>sr,liftEmptyBlock:()=>sn,liftListItem:()=>si,newlineInCode:()=>ss,resetAttributes:()=>sl,scrollIntoView:()=>sh,selectAll:()=>sc,selectNodeBackward:()=>su,selectNodeForward:()=>sd,selectParentNode:()=>sf,selectTextblockEnd:()=>sp,selectTextblockStart:()=>sm,setContent:()=>sy,setMark:()=>sX,setMeta:()=>sQ,setNode:()=>sZ,setNodeSelection:()=>s0,setTextDirection:()=>s1,setTextSelection:()=>s2,sinkListItem:()=>s3,splitBlock:()=>s4,splitListItem:()=>s6,toggleList:()=>
76oe,toggleMark:()=>ot,toggleNode:()=>or,toggleWrap:()=>on,undoInputRule:()=>oi,unsetAllMarks:()=>oo,unsetMark:()=>oa,unsetTextDirection:()=>ol,updateAttributes:()=>oh,wrapIn:()=>oc,wrapInList:()=>ou});var ix=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var r;e.isDestroyed||(t.dom.blur(),null==(r=null==window?void 0:window.getSelection())||r.removeAllRanges())}),!0),ik=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),iS=()=>({state:e,tr:t,dispatch:r})=>{let{selection:n}=t,{ranges:i}=n;return!r||(i.forEach(({$from:r,$to:n})=>{e.doc.nodesBetween(r.pos,n.pos,(e,r)=>{if(e.type.isText)return;let{doc:n,mapping:i}=t,s=n.resolve(i.map(r)),o=n.resolve(i.map(r+e.nodeSize)),a=s.blockRange(o);if(!a)return;let l=eP(a);if(e.type.isTextblock){let{defaultType:e}=s.parent.contentMatchAt(s.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},iC=e=>t=>e(t),iA=()=>({state:e,dispatch:t})=>tT(e,t),iE=(e,t)=>({editor:r,tr:n})=>{let{state:i}=r,s=i.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);let o=n.mapping.map(t);return n.insert(o,s.content),n.setSelection(new e4(n.doc.resolve(Math.max(o-1,0)))),!0},iT=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return!1;let i=e.selection.$anchor;for(let r=i.depth;r>0;r-=1)if(i.node(r).type===n.type){if(t){let t=i.before(r),n=i.after(r);e.delete(t,n).scrollIntoView()}return!0}return!1};function iO(e,t){if("string"==typeof e){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}var iM=e=>({tr:t,state:r,dispatch:n})=>{let i=iO(e,r.schema),s=t.selection.$anchor;for(let e=s.depth;e>0;e-=1)if(s.node(e).type===i){if(n){let r=s.before(e),n=s.after(e);t.delete(r,n).scrollIntoView()}return!0}return!1},iR=e=>({tr:t,dispatch:r})=>{let{from:n,to:i}=e;return r&&t.delete(n,i),!0},iN=(e,t,r)=>{var n;return!e.parent.isInline||"left"===r&&e.pos>e.start()||"right"===r&&e.pos<e.end()?e.pos:(n=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(n.content)?"left"===r?e.start()-1:e.end()+1:e.pos},iP=()=>({state:e,dispatch:t})=>{var r;let{$from:n,$to:i}=e.selection;if(e.selection.empty)return!1;let{from:s,to:o}={from:iN(n,r=e.schema,"left"),to:iN(i,r,"right")};return t&&(e.tr.deleteRange(s,o).scrollIntoView(),t(e.tr)),!0},i_=()=>({commands:e})=>e.keyboardShortcut("Enter"),iD=()=>({state:e,dispatch:t})=>tE(e,t);function iI(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function ij(e,t,r={strict:!0}){let n=Object.keys(t);return!n.length||n.every(n=>r.strict?t[n]===e[n]:iI(t[n])?t[n].test(e[n]):t[n]===e[n])}function iL(e,t,r={}){return e.find(e=>e.type===t&&ij(Object.fromEntries(Object.keys(r).map(t=>[t,e.attrs[t]])),r))}function iB(e,t,r={}){return!!iL(e,t,r)}function i$(e,t,r){if(!e||!t)return;let n=e.parent.childAfter(e.parentOffset);if(n.node&&n.node.marks.some(e=>e.type===t)||(n=e.parent.childBefore(e.parentOffset)),!n.node||!n.node.marks.some(e=>e.type===t))return;if(!r){let e=n.node.marks.find(e=>e.type===t);e&&(r=e.attrs)}if(!iL([...n.node.marks],t,r))return;let i=n.index,s=e.start()+n.offset,o=i+1,a=s+n.node.nodeSize;for(;i>0&&iB([...e.parent.child(i-1).marks],t,r);)i-=1,s-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&iB([...e.parent.child(o).marks],t,r);)a+=e.parent.child(o).nodeSize,o+=1;return{from:s,to:a}}function iz(e,t){if("string"==typeof e){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}var iF=(e,t)=>({tr:r,state:n,dispatch:i})=>{let s=iz(e,n.schema),{doc:o,selection:a}=r,{$from:l,from:h,to:c}=a;if(i){let e=i$(l,s,t);if(e&&e.from<=h&&e.to>=c){let t=e4.create(o,e.from,e.to);r.setSelection(t)}}return!0},iH=e=>t=>{let r="function"==typeof e?e(t):e;for(let e=0;e<r.length;e+=1)if(r[e](t))return!0;return!1};function iW(e){return e instanceof e4}function iU(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}function iV(e,t=null){if(!t)return null;let r=e1.atStart(e),n=e1.atEnd(e);if("start"===t||!0===t)return r;if("end"===t)return n;let i=r.from,s=n.to;return"all"===t?e4.create(e,iU(0,i,s),iU(e.content.size,i,s)):e4.create(e,iU(t,i,s),iU(t,i,s))}function iq(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function iK(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var iJ=(e=null,t={})=>({editor:r,view:n,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};let o=()=>{(iK()||iq())&&n.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!iK()&&!iq()&&n.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!r.isDestroyed&&(n.focus(),(null==t?void 0:t.scrollIntoView)&&r.commands.scrollIntoView())})};try{if(n.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(s&&null===e&&!iW(r.state.selection))return o(),!0;let a=iV(i.doc,e)||r.state.selection,l=r.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},iG=(e,t)=>
76r=>e.every((e,n)=>t(e,{...r,index:n})),iY=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t),iX=e=>{let t=e.childNodes;for(let r=t.length-1;r>=0;r-=1){let n=t[r];3===n.nodeType&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):1===n.nodeType&&iX(n)}return e};function iQ(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return iX(new window.DOMParser().parseFromString(t,"text/html").body)}function iZ(e,t,r){if(e instanceof z||e instanceof x)return e;r={slice:!0,parseOptions:{},...r};let n="object"==typeof e&&null!==e,i="string"==typeof e;if(n)try{if(Array.isArray(e)&&e.length>0)return x.fromArray(e.map(e=>t.nodeFromJSON(e)));let n=t.nodeFromJSON(e);return r.errorOnInvalidContent&&n.check(),n}catch(n){if(r.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:n});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),iZ("",t,r)}if(i){if(r.errorOnInvalidContent){let n=!1,i="",s=new et({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(n=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(r.slice?en.fromSchema(s).parseSlice(iQ(e),r.parseOptions):en.fromSchema(s).parse(iQ(e),r.parseOptions),r.errorOnInvalidContent&&n)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let n=en.fromSchema(t);return r.slice?n.parseSlice(iQ(e),r.parseOptions).content:n.parse(iQ(e),r.parseOptions)}return iZ("",t,r)}var i0=(e,t,r)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){let i,a;r={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};let l=e=>{s.emit("contentError",{editor:s,error:e,disableCollaboration:()=>{"collaboration"in s.storage&&"object"==typeof s.storage.collaboration&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{iZ(t,s.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(e){l(e)}try{i=iZ(t,s.schema,{parseOptions:h,errorOnInvalidContent:null!=(o=r.errorOnInvalidContent)?o:s.options.enableContentCheck})}catch(e){return l(e),!1}let{from:c,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},d=!0,f=!0;if((!("type"in i)?i:[i]).forEach(e=>{e.check(),d=!!d&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),c===u&&f){let{parent:e}=n.doc.resolve(c);!e.isTextblock||e.type.spec.code||e.childCount||(c-=1,u+=1)}if(d){if(Array.isArray(t))a=t.map(e=>e.text||"").join("");else if(t instanceof x){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),a=e}else a="object"==typeof t&&t&&t.text?t.text:t;n.insertText(a,c,u)}else{a=i;let e=n.doc.resolve(c),t=e.node(),r=0===e.parentOffset,s=t.isText||t.isTextblock,o=t.content.size>0;r&&s&&o&&f&&(c=Math.max(0,c-1)),n.replaceWith(c,u,a)}r.updateSelection&&function(e,t){let r=e.steps.length-1;if(r<t)return;let n=e.steps[r];if(!(n instanceof eO||n instanceof eM))return;let i=e.mapping.maps[r],s=0;i.forEach((e,t,r,n)=>{0===s&&(s=n)}),e.setSelection(e1.near(e.doc.resolve(s),-1))}(n,n.steps.length-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:c,text:a}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:c,text:a})}return!0},i1=()=>({state:e,dispatch:t})=>((e,t)=>{let r=e.selection,n=r instanceof e8,i;if(n){if(r.node.isTextblock||!eB(e.doc,r.from))return!1;i=r.from}else if(null==(i=ez(e.doc,r.from,-1)))return!1;if(t){let r=e.tr.join(i);n&&r.setSelection(e8.create(r.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),i2=()=>({state:e,dispatch:t})=>((e,t)=>{let r=e.selection,n;if(r instanceof e8){if(r.node.isTextblock||!eB(e.doc,r.to))return!1;n=r.to}else if(null==(n=ez(e.doc,r.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),i3=()=>({state:e,dispatch:t})=>tm(e,t),i5=()=>({state:e,dispatch:t})=>tx(e,t),i4=()=>({state:e,dispatch:t,tr:r})=>{try{let n=ez(e.doc,e.selection.$from.pos,-1);if(null==n)return!1;return r.join(n,2),t&&t(r),!0}catch{return!1}},i6=()=>({state:e,dispatch:t,tr:r})=>{try{let n=ez(e.doc,e.selection.$from.pos,1);if(null==n)return!1;return r.join(n,2),t&&t(r),!0}catch{return!1}},i8=()=>({state:e,dispatch:t})=>((e,t,r)=>{let n=tp(e,r);if(!n)return!1;let i=tb(n);return!!i&&tg(e,i,t)})(e,t),i9=()=>({state:e,dispatch:t})=>((e,t,r)=>{let n=tw(e,r);if(!n)return!1;let i=tS(n);return!!i&&tg(e,i,t)})(e,t);function i7(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var se=e=>({editor:t,view:r,tr:n,dispatch:i})=>{let s=(function(e){let t,r,n,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"===o&&(o=" ");for(let e=0;e<s.length-1;e+=1){let o=s[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else if(/^mod$/i.test(o))iK()||i7()?i=!0:r=!0;else throw Error(`Unrecognized modifier name: ${o}`)}return t&&(o=`Alt-${o}`),r&&(o=`Ctrl-${o}`),i&&(o=`Meta-${o}`),n&&(o=`Shift-${o}`),o})(e).split(/-(?!$)/),o=s.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"
76===o?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{r.someProp("handleKeyDown",e=>e(r,a))});return null==l||l.steps.forEach(e=>{let t=e.map(n.mapping);t&&i&&n.maybeStep(t)}),!0};function st(e,t,r={}){let{from:n,to:i,empty:s}=e.selection,o=t?iO(t,e.schema):null,a=[];e.doc.nodesBetween(n,i,(e,t)=>{if(e.isText)return;let r=Math.max(n,t),s=Math.min(i,t+e.nodeSize);a.push({node:e,from:r,to:s})});let l=i-n,h=a.filter(e=>!o||o.name===e.node.type.name).filter(e=>ij(e.node.attrs,r,{strict:!1}));return s?!!h.length:h.reduce((e,t)=>e+t.to-t.from,0)>=l}var sr=(e,t={})=>({state:r,dispatch:n})=>{let i=iO(e,r.schema);return!!st(r,i,t)&&((e,t)=>{let{$from:r,$to:n}=e.selection,i=r.blockRange(n),s=i&&eP(i);return null!=s&&(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)})(r,n)},sn=()=>({state:e,dispatch:t})=>tO(e,t),si=e=>({state:t,dispatch:r})=>{var n;return(n=iO(e,t.schema),function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==n);return!!s&&(!t||(r.node(s.depth-1).type==n?function(e,t,r,n){let i=e.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new eM(s-1,o,s,o,new T(x.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new B(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));let a=eP(n);if(null==a)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return eB(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}(e,t,n,s):function(e,t,r){let n=e.tr,i=r.parent;for(let e=r.end,t=r.endIndex-1,s=r.startIndex;t>s;t--)e-=i.child(t).nodeSize,n.delete(e-1,e+1);let s=n.doc.resolve(r.start),o=s.nodeAfter;if(n.mapping.map(r.end)!=r.start+s.nodeAfter.nodeSize)return!1;let a=0==r.startIndex,l=r.endIndex==i.childCount,h=s.node(-1),c=s.index(-1);if(!h.canReplace(c+ +!a,c+1,o.content.append(l?x.empty:x.from(i))))return!1;let u=s.pos,d=u+o.nodeSize;return n.step(new eM(u-!!a,d+ +!!l,u+1,d-1,new T((a?x.empty:x.from(i.copy(x.empty))).append(l?x.empty:x.from(i.copy(x.empty))),+!a,+!l),+!a)),t(n.scrollIntoView()),!0}(e,t,s)))})(t,r)},ss=()=>({state:e,dispatch:t})=>tC(e,t);function so(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function sa(e,t){let r="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,n)=>(r.includes(n)||(t[n]=e[n]),t),{})}var sl=(e,t)=>({tr:r,state:n,dispatch:i})=>{let s=null,o=null,a=so("string"==typeof e?e:e.name,n.schema);if(!a)return!1;"node"===a&&(s=iO(e,n.schema)),"mark"===a&&(o=iz(e,n.schema));let l=!1;return r.selection.ranges.forEach(e=>{n.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,n)=>{s&&s===e.type&&(l=!0,i&&r.setNodeMarkup(n,void 0,sa(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(s=>{o===s.type&&(l=!0,i&&r.addMark(n,n+e.nodeSize,o.create(sa(s.attrs,t))))})})}),l},sh=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),sc=()=>({tr:e,dispatch:t})=>{if(t){let t=new e7(e.doc);e.setSelection(t)}return!0},su=()=>({state:e,dispatch:t})=>tv(e,t),sd=()=>({state:e,dispatch:t})=>tk(e,t),sf=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:r,to:n}=e.selection,i,s=r.sharedDepth(n);return 0!=s&&(i=r.before(s),t&&t(e.tr.setSelection(e8.create(e.doc,i))),!0)})(e,t),sp=()=>({state:e,dispatch:t})=>tP(e,t),sm=()=>({state:e,dispatch:t})=>tN(e,t);function sg(e,t,r={},n={}){return iZ(e,t,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var sy=(e,{errorOnInvalidContent:t,emitUpdate:r=!0,parseOptions:n={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{let{doc:l}=s;if("full"!==n.preserveWhitespace){let a=sg(e,i.schema,n,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!r),!0}return o&&s.setMeta("preventUpdate",!r),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:n,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function sv(e,t){let r=iz(t,e.schema),{from:n,to:i,empty:s}=e.selection,o=[];s?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,i,e=>{o.push(...e.marks)});let a=o.find(e=>
76e.type.name===r.name);return a?{...a.attrs}:{}}function sb(e,t){let r=new eZ(e);return t.forEach(e=>{e.steps.forEach(e=>{r.step(e)})}),r}function sw(e){return t=>(function(e,t){for(let r=e.depth;r>0;r-=1){let n=e.node(r);if(t(n))return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}})(t.$from,e)}function sx(e,t,r){return void 0===e.config[t]&&e.parent?sx(e.parent,t,r):"function"==typeof e.config[t]?e.config[t].bind({...r,parent:e.parent?sx(e.parent,t,r):null}):e.config[t]}function sk(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},r=sx(e,"addExtensions",t);return r?[e,...sk(r())]:e}).flat(10)}function sS(e,t){let r=ed.fromSchema(t).serializeFragment(e),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(r),n.innerHTML}function sC(e){return"function"==typeof e}function sA(e,t,...r){return sC(e)?t?e.bind(t)(...r):e(...r):e}function sE(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function sT(e){let t=[],{nodeExtensions:r,markExtensions:n}=sE(e),i=[...r,...n],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=r.filter(e=>"text"!==e.name).map(e=>e.name),a=n.map(e=>e.name),l=[...o,...a];return e.forEach(e=>{let r={name:e.name,options:e.options,storage:e.storage,extensions:i},n=sx(e,"addGlobalAttributes",r);n&&n().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?o:"marks"===e.types?a:[]).forEach(r=>{Object.entries(e.attributes).forEach(([e,n])=>{t.push({type:r,name:e,attribute:{...s,...n}})})})})}
76),i.forEach(e=>{let r={name:e.name,options:e.options,storage:e.storage},n=sx(e,"addAttributes",r);n&&Object.entries(n()).forEach(([r,n])=>{let i={...s,...n};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:r,attribute:i})})}),t}function sO(e){let t=[],r=function(e){let t=[],r="",n=!1,i=!1,s=0,o=e.length;for(let a=0;a<o;a+=1){let o=e[a];if("'"===o&&!i){n=!n,r+=o;continue}if('"'===o&&!n){i=!i,r+=o;continue}if(!n&&!i){if("("===o){s+=1,r+=o;continue}if(")"===o&&s>0){s-=1,r+=o;continue}if(";"===o&&0===s){t.push(r),r="";continue}}r+=o}return r&&t.push(r),t}(e||""),n=r.length;for(let e=0;e<n;e+=1){let n=r[e],i=n.indexOf(":");if(-1===i)continue;let s=n.slice(0,i).trim(),o=n.slice(i+1).trim();s&&o&&t.push([s,o])}return t}function sM(...e){return e.filter(e=>!!e).reduce((e,t)=>{let r={...e};return Object.entries(t).forEach(([e,t])=>{if(!r[e]){r[e]=t;return}if("class"===e){let n=t?String(t).split(" "):[],i=r[e]?r[e].split(" "):[],s=n.filter(e=>!i.includes(e));r[e]=[...i,...s].join(" ")}else if("style"===e){let n=new Map([...sO(r[e]),...sO(t)]);r[e]=Array.from(n.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else r[e]=t}),r},{})}function sR(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>sM(e,t),{})}function sN(e,t){return"style"in e?e:{...e,getAttrs:r=>{let n=e.getAttrs?e.getAttrs(r):e.attrs;if(!1===n)return!1;let i=t.reduce((e,t)=>{var n;let i=t.attribute.parseHTML?t.attribute.parseHTML(r):"string"!=typeof(n=r.getAttribute(t.name))?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):"true"===n||"false"!==n&&n;return null==i?e:{...e,[t.name]:i}},{});return{...n,...i}}}}function sP(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function s_(e){var t,r;let n={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(n.default=e.attribute.default),(null==(r=null==e?void 0:e.attribute)?void 0:r.validate)!==void 0&&(n.validate=e.attribute.validate),[e.name,n]}function sD(e){return e.sort((e,t)=>{let r=sx(e,"priority")||100,n=sx(t,"priority")||100;return r>n?-1:+(r<n)})}function sI(e){var t;let r=sD(sk(e)),n=Array.from(new Set((t=r.map(e=>e.name)).filter((e,r)=>t.indexOf(e)!==r)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),r}function sj(e,t,r){let{from:n,to:i}=t,{blockSeparator:s="\n\n",textSerializers:o={}}=r||{},a="";return e.nodesBetween(n,i,(e,r,l,h)=>{var c;e.isBlock&&r>n&&(a+=s);let u=null==o?void 0:o[e.type.name];if(u)return l&&(a+=u({node:e,pos:r,parent:l,index:h,range:t})),!1;e.isText&&(a+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(n,r)-r,i-r))}),a}function sL(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function sB(e,t){let r=so("string"==typeof t?t:t.name,e.schema);return"node"===r?function(e,t){let r=iO(t,e.schema),{from:n,to:i}=e.selection,s=[];e.doc.nodesBetween(n,i,e=>{s.push(e)});let o=s.reverse().find(e=>e.type.name===r.name);return o?{...o.attrs}:{}}(e,t):"mark"===r?sv(e,t):{}}function s$(e){let t,{mapping:r,steps:n}=e,i=[];return r.maps.forEach((e,t)=>{let s=[];if(e.ranges.length)e.forEach((e,t)=>{s.push({from:e,to:t})});else{let{from:e,to:r}=n[t];if(void 0===e||void 0===r)return;s.push({from:e,to:r})}s.forEach(({from:e,to:n})=>{let s=r.slice(t).map(e,-1),o=r.slice(t).map(n),a=r.invert().map(s,-1),l=r.invert().map(o);i.push({oldRange:{from:a,to:l},newRange:{from:s,to:o}})})}),1===(t=function(e,t=JSON.stringify){let r={};return e.filter(e=>{let n=t(e);return!Object.prototype.hasOwnProperty.call(r,n)&&(r[n]=!0)})}(i)).length?t:t.filter((e,r)=>!t.filter((e,t)=>t!==r).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function sz(e,t,r){let n=[];
76return e===t?r.resolve(e).marks().forEach(t=>{let i=i$(r.resolve(e),t.type);i&&n.push({mark:t,...i})}):r.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&n.push(...e.marks.map(r=>({from:t,to:t+e.nodeSize,mark:r})))}),n}function sF(e,t){return t.nodes[e]||t.marks[e]||null}function sH(e,t,r){return Object.fromEntries(Object.entries(r).filter(([r])=>{let n=e.find(e=>e.type===t&&e.name===r);return!!n&&n.attribute.keepOnSplit}))}function sW(e,t,r={}){let{empty:n,ranges:i}=e.selection,s=t?iz(t,e.schema):null;if(n)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!s||s.name===e.type.name).find(e=>ij(e.attrs,r,{strict:!1}));let o=0,a=[];if(i.forEach(({$from:t,$to:r})=>{let n=t.pos,i=r.pos;e.doc.nodesBetween(n,i,(e,t)=>{if(s&&e.inlineContent&&!e.type.allowsMarkType(s))return!1;if(!e.isText&&!e.marks.length)return;let r=Math.max(n,t),l=Math.min(i,t+e.nodeSize);o+=l-r,a.push(...e.marks.map(e=>({mark:e,from:r,to:l})))})}),0===o)return!1;let l=a.filter(e=>!s||s.name===e.mark.type.name).filter(e=>ij(e.mark.attrs,r,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),h=a.filter(e=>!s||e.mark.type!==s&&e.mark.type.excludes(s)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+h:l)>=o}function sU(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function sV(e,t){let{nodeExtensions:r}=sE(t),n=r.find(t=>t.name===e);if(!n)return!1;let i={name:n.name,options:n.options,storage:n.storage},s=sA(sx(n,"group",i));return"string"==typeof s&&s.split(" ").includes("list")}function sq(e,{checkChildren:t=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(n=e.text)?n:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let n=!0;return e.content.forEach(e=>{!1!==n&&(sq(e,{ignoreWhitespace:r,checkChildren:t})||(n=!1))}),n}return!1}function sK(e){return e instanceof e8}var sJ=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function sG(e,t){let r=t.mapping.mapResult(e.position);return{position:new sJ(r.pos),mapResult:r}}function sY(e){return new sJ(e)}var sX=(e,t={})=>({tr:r,state:n,dispatch:i})=>{let{selection:s}=r,{empty:o,ranges:a}=s,l=iz(e,n.schema);if(i)if(o){let e=sv(n,l);r.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,s=e.$to.pos;n.doc.nodesBetween(i,s,(e,n)=>{let o=Math.max(n,i),a=Math.min(n+e.nodeSize,s);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&r.addMark(o,a,l.create({...e.attrs,...t}))}):r.addMark(o,a,l.create(t))})});return function(e,t,r){var n;let{selection:i}=t,s=null;if(iW(i)&&(s=i.$cursor),s){let t=null!=(n=e.storedMarks)?n:s.marks();return s.parent.type.allowsMarkType(r)&&(!!r.isInSet(t)||!t.some(e=>e.type.excludes(r)))}let{ranges:o}=i;return o.some(({$from:t,$to:n})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(r);return e.doc.nodesBetween(t.pos,n.pos,(e,t,n)=>{if(i)return!1;if(e.isInline){let t=!n||n.type.allowsMarkType(r),s=!!r.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(r));i=t&&s}return!i}),i})}(n,r,l)},sQ=(e,t)=>({tr:r})=>(r.setMeta(e,t),!0),sZ=(e,t={})=>({state:r,dispatch:n,chain:i})=>{let s,o=iO(e,r.schema);return(r.selection.$anchor.sameParent(r.selection.$head)&&(s=r.selection.$anchor.parent.attrs),o.isTextblock)?i().command(({commands:e})=>!!t_(o,{...s,...t})(r)||e.clearNodes()).command(({state:e})=>t_(o,{...s,...t})(e,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},s0=e=>({tr:t,dispatch:r})=>{if(r){let{doc:r}=t,n=iU(e,0,r.content.size),i=e8.create(r,n);t.setSelection(i)}return!0},s1=(e,t)=>({tr:r,state:n,dispatch:i})=>{let s,o,{selection:a}=n;return"number"==typeof t?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=a.from,o=a.to),i&&r.doc.nodesBetween(s,o,(t,n)=>{t.isText||r.setNodeMarkup(n,void 0,{...t.attrs,dir:e})}),!0},s2=e=>({tr:t,dispatch:r})=>{if(r){let{doc:r}=t,{from:n,to:i}="number"==typeof e?{from:e,to:e}:e,s=e4.atStart(r).from,o=e4.atEnd(r).to,a=iU(n,s,o),l=iU(i,s,o),h=e4.create(r,a,l);t.setSelection(h)}return!0},s3=e=>({state:t,dispatch:r})=>{var n;return(n=iO(e,t.schema),function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(0==o)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let r=l.lastChild&&l.lastChild.type==a.type,i=x.from(r?n.create():null),o=new T(x.from(n.create(null,x.from(a.type.create(null,i)))),r?3:1,0),h=s.start,c=s.end;t(e.tr.step(new eM(h-(r?3:1),c,h,c,o,1,!0)).scrollIntoView())}return!0})(t,r)};function s5(e,t){let r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){let n=r.filter(e=>
76null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(n)}}var s4=({keepMarks:e=!0}={})=>({tr:t,state:r,dispatch:n,editor:i})=>{let{selection:s,doc:o}=t,{$from:a,$to:l}=s,h=sH(i.extensionManager.attributes,a.node().type.name,a.node().attrs);if(s instanceof e8&&s.node.isBlock)return!!a.parentOffset&&!!eL(o,a.pos)&&(n&&(e&&s5(r,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;let c=l.parentOffset===l.parent.content.size,u=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1))),d=c&&u?[{type:u,attrs:h}]:void 0,f=eL(t.doc,t.mapping.map(a.pos),1,d);if(!d&&!f&&eL(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)&&(f=!0,d=u?[{type:u,attrs:h}]:void 0),n){if(f&&(s instanceof e4&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,d),u&&!c&&!a.parentOffset&&a.parent.type!==u)){let e=t.mapping.map(a.before()),r=t.doc.resolve(e);a.node(-1).canReplaceWith(r.index(),r.index()+1,u)&&t.setNodeMarkup(t.mapping.map(a.before()),u)}e&&s5(r,i.extensionManager.splittableMarks),t.scrollIntoView()}return f},s6=(e,t={})=>({tr:r,state:n,dispatch:i,editor:s})=>{var o;let a=iO(e,n.schema),{$from:l,$to:h}=n.selection,c=n.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(h))return!1;let u=l.node(-1);if(u.type!==a)return!1;let d=s.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=x.empty,n=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-n;t>=l.depth-3;t-=1)e=x.from(l.node(t).copy(e));let i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,s={...sH(d,l.node().type.name,l.node().attrs),...t},h=(null==(o=a.contentMatch.defaultType)?void 0:o.createAndFill(s))||void 0;e=e.append(x.from(a.createAndFill(null,h)||void 0));let c=l.before(l.depth-(n-1));r.replace(c,l.after(-i),new T(e,4-n,0));let u=-1;r.doc.nodesBetween(c,r.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=t+1)}),u>-1&&r.setSelection(e4.near(r.doc.resolve(u))),r.scrollIntoView()}return!0}let f=h.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...sH(d,u.type.name,u.attrs),...t},m={...sH(d,l.node().type.name,l.node().attrs),...t};r.delete(l.pos,h.pos);let g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!eL(r.doc,l.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=n,{splittableMarks:o}=s.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(r.split(l.pos,2,g).scrollIntoView(),!a||!i)return!0;let h=a.filter(e=>o.includes(e.type.name));r.ensureMarks(h)}return!0};function s8(e){return e&&"1"!==e?e:null}var s9=(e,t)=>{var r,n;let i=sw(e=>e.type===t)(e.selection);if(!i)return!0;let s=e.doc.resolve(Math.max(0,i.pos-1)).before(i.depth);if(void 0===s)return!0;let o=e.doc.nodeAt(s);return!(i.node.type===(null==o?void 0:o.type)&&eB(e.doc,i.pos))||(r=i.node.attrs.type,n=null==o?void 0:o.attrs.type,s8(r)!==s8(n)||(e.join(i.pos),!0))},s7=(e,t)=>{var r,n;let i=sw(e=>e.type===t)(e.selection);if(!i)return!0;let s=e.doc.resolve(i.start).after(i.depth);if(void 0===s)return!0;let o=e.doc.nodeAt(s);return!(i.node.type===(null==o?void 0:o.type)&&eB(e.doc,s))||(r=i.node.attrs.type,n=null==o?void 0:o.attrs.type,s8(r)!==s8(n)||(e.join(s),!0))},oe=(e,t,r,n={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:h,can:c})=>{let{extensions:u,splittableMarks:d}=i.extensionManager,f=iO(e,o.schema),p=iO(t,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:v}=m,b=y.blockRange(v),w=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;let x=sw(e=>sV(e.type.name,u))(m),k=0===m.from&&m.to===o.doc.content.size,S=o.doc.content.content,C=1===S.length?S[0]:null,A=k&&C&&sV(C.type.name,u)?{node:C,pos:0,depth:0}:null,E=null!=x?x:A,T=!!x&&b.depth>=1&&b.depth-x.depth<=1,O=!!A;if((T||O)&&E){if(E.node.type===f)return k&&O?l().command(({tr:e,dispatch:t})=>{let r=function(e){let t=e.doc,r=t.firstChild;if(!r)return null;let n=t.resolve(1),i=t.resolve(r.nodeSize-1);return e4.between(n,i)}(e);return!!r&&(e.setSelection(r),t&&t(e),!0)}).liftListItem(p).run():h.liftListItem(p);
76if(sV(E.node.type.name,u)&&f.validContent(E.node.content))return l().command(()=>(s.setNodeMarkup(E.pos,f),!0)).command(()=>s9(s,f)).command(()=>s7(s,f)).run()}return r&&w&&a?l().command(()=>{let e=c().wrapInList(f,n),t=w.filter(e=>d.includes(e.type.name));return s.ensureMarks(t),!!e||h.clearNodes()}).wrapInList(f,n).command(()=>s9(s,f)).command(()=>s7(s,f)).run():l().command(()=>!!c().wrapInList(f,n)||h.clearNodes()).wrapInList(f,n).command(()=>s9(s,f)).command(()=>s7(s,f)).run()},ot=(e,t={},r={})=>({state:n,commands:i})=>{let{extendEmptyMarkRange:s=!1}=r,o=iz(e,n.schema);return sW(n,o,t)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,t)},or=(e,t,r={})=>({state:n,commands:i})=>{let s,o=iO(e,n.schema),a=iO(t,n.schema),l=st(n,o,r);return(n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),l)?i.setNode(a,s):i.setNode(o,{...s,...r})},on=(e,t={})=>({state:r,commands:n})=>{let i=iO(e,r.schema);return st(r,i,t)?n.lift(i):n.wrapIn(i,t)},oi=()=>({state:e,dispatch:t})=>{let r=e.plugins;for(let n=0;n<r.length;n+=1){let i,s=r[n];if(s.spec.isInputRules&&(i=s.getState(e))){if(t){let t=e.tr,r=i.transform;for(let e=r.steps.length-1;e>=0;e-=1)t.step(r.steps[e].invert(r.docs[e]));if(i.text){let r=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,r))}else t.delete(i.from,i.to)}return!0}}return!1},oo=(e={})=>({tr:t,dispatch:r,editor:n})=>{let{ignoreClearable:i=!1}=e,{selection:s}=t,{empty:o,ranges:a}=s;if(o)return!0;let{nonClearableMarks:l}=n.extensionManager;if(r){let e=Object.values(n.schema.marks).filter(e=>i||!l.includes(e.name));a.forEach(r=>{for(let n of e)t.removeMark(r.$from.pos,r.$to.pos,n)})}return!0},oa=(e,t={})=>({tr:r,state:n,dispatch:i})=>{var s;let{extendEmptyMarkRange:o=!1}=t,{selection:a}=r,l=iz(e,n.schema),{$from:h,empty:c,ranges:u}=a;if(!i)return!0;if(c&&o){let{from:e,to:t}=a,n=null==(s=h.marks().find(e=>e.type===l))?void 0:s.attrs,i=i$(h,l,n);i&&(e=i.from,t=i.to),r.removeMark(e,t,l)}else u.forEach(e=>{r.removeMark(e.$from.pos,e.$to.pos,l)});return r.removeStoredMark(l),!0},ol=e=>({tr:t,state:r,dispatch:n})=>{let i,s,{selection:o}=r;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),n&&t.doc.nodesBetween(i,s,(e,r)=>{if(e.isText)return;let n={...e.attrs};delete n.dir,t.setNodeMarkup(r,void 0,n)}),!0},oh=(e,t={})=>({tr:r,state:n,dispatch:i})=>{let s=null,o=null,a=so("string"==typeof e?e:e.name,n.schema);if(!a)return!1;"node"===a&&(s=iO(e,n.schema)),"mark"===a&&(o=iz(e,n.schema));let l=!1;return r.selection.ranges.forEach(e=>{let a,h,c,u,d=e.$from.pos,f=e.$to.pos;r.selection.empty?n.doc.nodesBetween(d,f,(e,t)=>{s&&s===e.type&&(l=!0,c=Math.max(t,d),u=Math.min(t+e.nodeSize,f),a=t,h=e)}):n.doc.nodesBetween(d,f,(e,n)=>{n<d&&s&&s===e.type&&(l=!0,c=Math.max(n,d),u=Math.min(n+e.nodeSize,f),a=n,h=e),n>=d&&n<=f&&(s&&s===e.type&&(l=!0,i&&r.setNodeMarkup(n,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(s=>{if(o===s.type&&(l=!0,i)){let i=Math.max(n,d),a=Math.min(n+e.nodeSize,f);r.addMark(i,a,o.create({...s.attrs,...t}))}}))}),h&&(void 0!==a&&i&&r.setNodeMarkup(a,void 0,{...h.attrs,...t}),o&&h.marks.length&&h.marks.forEach(e=>{o===e.type&&i&&r.addMark(c,u,o.create({...e.attrs,...t}))}))}),l},oc=(e,t={})=>({state:r,dispatch:n})=>(function(e,t=null){return function(r,n){let{$from:i,$to:s}=r.selection,o=i.blockRange(s),a=o&&e_(o,e,t);return!!a&&(n&&n(r.tr.wrap(o,a).scrollIntoView()),!0)}})(iO(e,r.schema),t)(r,n),ou=(e,t={})=>({state:r,dispatch:n})=>(function(e,t=null){return function(r,n){let{$from:i,$to:s}=r.selection,o=i.blockRange(s);if(!o)return!1;let a=n?r.tr:null;return!!function(e,t,r,n=null){let i=!1,s=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(r)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=o.resolve(t.start-2);s=new B(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new B(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let a=e_(s,r,n,t);return!!a&&(e&&function(e,t,r,n,i){let s=x.empty;for(let e=r.length-1;e>=0;e--)s=x.from(r[e].type.create(r[e].attrs,s));e.step(new eM(t.start-2*!!n,t.end,t.start,t.end,new T(s,0,0),r.length,!0));let o=0;for(let e=0;e<r.length;e++)r[e].type==i&&(o=e+1);let a=r.length-o,l=t.start+r.length-2*!!n,h=t.parent;for(let r=t.startIndex,n=t.endIndex,i=!0;r<n;r++,i=!1)!i&&eL(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=h.child(r).nodeSize}(e,t,a,i,r),!0)}(a,o,e,t)&&(n&&n(a.scrollIntoView()),!0)}})(iO(e,r.schema),t)(r,n),od=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let r=this.callbacks[e];
76return r&&r.forEach(e=>e.apply(this,t)),this}off(e,t){let r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let r=(...n)=>{this.off(e,r),t.apply(this,n)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function of(e,t,r){let n=document.querySelector(`style[data-tiptap-style${r?`-${r}`:""}]`);if(null!==n)return n;let i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute(`data-tiptap-style${r?`-${r}`:""}`,""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}function op(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function om(e){if(!(null==e?void 0:e.trim()))return{};let t={},r=[],n=e.replace(/["']([^"']*)["']/g,e=>(r.push(e),`__QUOTED_${r.length-1}__`)),i=n.match(/(?:^|\s)\.([\w-]+)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let s=n.match(/(?:^|\s)#([\w-]+)/);s&&(t.id=s[1]),Array.from(n.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,n])=>{var i;let s=r[parseInt((null==(i=n.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];s&&(t[e]=s.slice(1,-1))});let o=n.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>
76{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function og(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,r])=>{"class"!==e&&"id"!==e&&(!0===r?t.push(e):!1!==r&&null!=r&&t.push(`${e}="${String(r)}"`))}),t.join(" ")}function oy(e){let{nodeName:t,name:r,parseAttributes:n=om,serializeAttributes:i=og,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=e,l=r||t;return{parseMarkdown:(e,r)=>{let n={...s,...e.attributes};return r.createNode(t,n,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let r=RegExp(`^:::${l}(?:\\s|$)`,"m"),n=null==(t=e.match(r))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,r,i){let s=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(s);if(!a)return;let h=n(a[1]||"");if(!o.find(e=>!(e in h)))return{type:t,raw:a[0],attributes:h}}},renderMarkdown:e=>{let t=i((e=>{if(!a)return e;let t={};return a.forEach(r=>{r in e&&(t[r]=e[r])}),t})(e.attrs||{})),r=t?` {${t}}`:"";return`:::${l}${r} :::`}}}function ov(e){let{nodeName:t,name:r,getContent:n,parseAttributes:i=om,serializeAttributes:s=og,defaultAttributes:o={},content:a="block",allowedAttributes:l}=e,h=r||t;return{parseMarkdown:(e,r)=>{let i;if(n){let t=n(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===a?r.parseChildren(e.tokens||[]):r.parseInline(e.tokens||[]);let s={...o,...e.attributes};return r.createNode(t,s,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let r=RegExp(`^:::${h}`,"m"),n=null==(t=e.match(r))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,r,n){var s;let o=RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(o);if(!l)return;let[c,u=""]=l,d=i(u),f=1,p=c.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(p);for(g.lastIndex=0;;){let r=g.exec(y);if(null===r)break;let i=r.index,o=r[1];if(null==(s=r[2])||!s.endsWith(":::")){if(o)f+=1;else if(0==(f-=1)){let s=y.slice(0,i);m=s.trim();let o=e.slice(0,p+i+r[0].length),l=[];if(m)if("block"===a)for((l=n.blockTokens(s)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=n.inlineTokens(e.text))});l.length>0;){let e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=n.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:l}}}}}},renderMarkdown:(e,t)=>{let r=s((e=>{if(!l)return e;let t={};return l.forEach(r=>{r in e&&(t[r]=e[r])}),t})(e.attrs||{})),n=r?` {${r}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${h}${n}
77
78${i}
79
80:::`}}}function ob(e){if(!e.trim())return{};let t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,n=r.exec(e);for(;null!==n;){let[,i,s,o]=n;t[i]=s||o,n=r.exec(e)}return t}function ow(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function ox(e){let{nodeName:t,name:r,getContent:n,parseAttributes:i=ob,serializeAttributes:s=ow,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=e,h=r||t,c=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,r)=>{let i={...o,...e.attributes};if(a)return r.createNode(t,i);let s=n?n(e):e.content||"";return s?r.createNode(t,i,[r.createTextNode(s)]):r.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=a?RegExp(`\\[${c}\\s*[^\\]]*\\]`):RegExp(`\\[${c}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${c}\\]`),r=e.match(t),n=null==r?void 0:r.index;return void 0!==n?n:-1},tokenize(e,r,n){let s=a?RegExp(`^\\[${c}\\s*([^\\]]*)\\]`):RegExp(`^\\[${c}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${c}\\]`),o=e.match(s);if(!o)return;let l="",h="";if(a){let[,e]=o;h=e}else{let[,e,t]=o;h=e,l=t||""}let u=i(h.trim());return{type:t,raw:o[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";n?t=n(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let r=s((e=>{if(!l)return e;let t={};return l.forEach(r=>{let n="string"==typeof r?r:r.name,i="string"==typeof r?void 0:r.skipIfDefault;if(n in e){let r=e[n];if(void 0!==i&&r===i)return;t[n]=r}}),t})(e.attrs||{})),i=r?` ${r}`:"";return a?`[${h}${i}]`:`[${h}${i}]${t}[/${h}]`}}}function ok(e,t,r){var n,i,s,o;let a=e.split("\n"),l=[],h="",c=0,u=t.baseIndentSize||2;for(;c<a.length;){let e,d=a[c],f=d.match(t.itemPattern);if(!f)if(l.length>0)break;else{if(""!==d.trim())return;c+=1,h=`${h}${d}
81`;continue}let p=t.extractItemData(f),{indentLevel:m,mainContent:g}=p;h=`${h}${d}
82`;let y=[g];for(c+=1;c<a.length;){let e=a[c];if(""===e.trim()){let t=a.slice(c+1).findIndex(e=>""!==e.trim());if(-1===t)break;
82if(((null==(i=null==(n=a[c+1+t].match(/^(\s*)/))?void 0:n[1])?void 0:i.length)||0)>m){y.push(e),h=`${h}${e}
83`,c+=1;continue}break}if(((null==(o=null==(s=e.match(/^(\s*)/))?void 0:s[1])?void 0:o.length)||0)>m)y.push(e),h=`${h}${e}
84`,c+=1;else break}let v=y.slice(1);if(v.length>0){let n=v.map(e=>e.slice(m+u)).join("\n");n.trim()&&(e=t.customNestedParser?t.customNestedParser(n):r.blockTokens(n))}let b=t.createToken(p,e);l.push(b)}if(0!==l.length)return{items:l,raw:h}}function oS(e,t,r,n){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof r?r(n):r,[s,...o]=e.content,a=t.renderChildren([s]),l=`${i}${a}`;return o&&o.length>0&&o.forEach((e,r)=>{var n,i;let s=null!=(i=null==(n=t.renderChild)?void 0:n.call(t,e,r+1))?i:t.renderChildren([e]);if(null!=s){let r=s.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?`
85
86${r}`:`
87${r}`}}),l}iy({},{createAtomBlockMarkdownSpec:()=>oy,createBlockMarkdownSpec:()=>ov,createInlineMarkdownSpec:()=>ox,parseAttributes:()=>om,parseIndentedBlocks:()=>ok,renderNestedMarkdownContent:()=>oS,serializeAttributes:()=>og});var oC=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function oA(e){var t;let{editor:r,from:n,to:i,text:s,rules:o,plugin:a}=e,{view:l}=r;if(l.composing)return!1;let h=l.state.doc.resolve(n);if(h.parent.type.spec.code||(null==(t=h.nodeBefore||h.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1,u=((e,t=500)=>{let r="",n=e.parentOffset;return e.parent.nodesBetween(Math.max(0,n-t),n,(e,t,i,s)=>{var o,a;let l=(null==(a=(o=e.type.spec).toText)?void 0:a.call(o,{node:e,pos:t,parent:i,index:s}))||e.textContent||"%leaf%";r+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,n-t))}),r})(h)+s;return o.forEach(e=>{if(c)return;let t=((e,t)=>{if(iI(t))return t.exec(e);let r=t(e);if(!r)return null;let n=[r.text];return n.index=r.index,n.input=e,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n})(u,e.find);if(!t)return;let o=l.state.tr,h=iv({state:l.state,transaction:o}),d={from:n-(t[0].length-s.length),to:i}
87,{commands:f,chain:p,can:m}=new ib({editor:r,state:h});null!==e.handler({state:h,range:d,match:t,commands:f,chain:p,can:m})&&o.steps.length&&(e.undoable&&o.setMeta(a,{transform:o,from:n,to:i,text:s}),l.dispatch(o),c=!0)}),c}var oE=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...sA(sx(this,"addOptions",{name:this.name}))}}get storage(){return{...sA(sx(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,r){let n={...t};return op(t)&&op(r)&&Object.keys(r).forEach(i=>{op(r[i])&&op(t[i])?n[i]=e(t[i],r[i]):n[i]=r[i]}),n})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},oT=class e extends oE{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:r}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){let i=n.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let s=i.find(e=>(null==e?void 0:e.type.name)===t.name);return s&&r.removeStoredMark(s),r.insertText(" ",n.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},oO=class{constructor(e){this.find=e.find,this.handler=e.handler}},oM=null,oR=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=sI(e),this.schema=function(e,t){var r;let n=sT(e),{nodeExtensions:i,markExtensions:s}=sE(e),o=null==(r=i.find(e=>sx(e,"topNode")))?void 0:r.name;return new et({topNode:o,nodes:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:t},o=sP({...e.reduce((e,t)=>{let n=sx(t,"extendNodeSchema",s);return{...e,...n?n(r):{}}},{}),content:sA(sx(r,"content",s)),marks:sA(sx(r,"marks",s)),group:sA(sx(r,"group",s)),inline:sA(sx(r,"inline",s)),atom:sA(sx(r,"atom",s)),selectable:sA(sx(r,"selectable",s)),draggable:sA(sx(r,"draggable",s)),code:sA(sx(r,"code",s)),whitespace:sA(sx(r,"whitespace",s)),linebreakReplacement:sA(sx(r,"linebreakReplacement",s)),defining:sA(sx(r,"defining",s)),isolating:sA(sx(r,"isolating",s)),attrs:Object.fromEntries(i.map(s_))}),a=sA(sx(r,"parseHTML",s));a&&(o.parseDOM=a.map(e=>sN(e,i)));let l=sx(r,"renderHTML",s);l&&(o.toDOM=e=>l({node:e,HTMLAttributes:sR(e,i)}));let h=sx(r,"renderText",s);return h&&(o.toText=h),[r.name,o]})),marks:Object.fromEntries(s.map(r=>{let i=n.filter(e=>e.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:t},o=sP({...e.reduce((e,t)=>{let n=sx(t,"extendMarkSchema",s);return{...e,...n?n(r):{}}},{}),inclusive:sA(sx(r,"inclusive",s)),excludes:sA(sx(r,"excludes",s)),group:sA(sx(r,"group",s)),spanning:sA(sx(r,"spanning",s)),code:sA(sx(r,"code",s)),attrs:Object.fromEntries(i.map(s_))}),a=sA(sx(r,"parseHTML",s));a&&(o.parseDOM=a.map(e=>sN(e,i)));let l=sx(r,"renderHTML",s);return l&&(o.toDOM=e=>l({mark:e,HTMLAttributes:sR(e,i)})),[r.name,o]}))})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:sF(t.name,this.schema)},n=sx(t,"addCommands",r);return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return sD([...this.extensions].reverse()).flatMap(t=>{let r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:sF(t.name,this.schema)},n=[],i=sx(t,"addKeyboardShortcuts",r),s={};if("mark"===t.type&&sx(t,"exitable",r)&&(s.ArrowRight=()=>oT.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,r])=>[t,()=>r({editor:e})]));s={...s,...t}}let o=new th({props:{handleKeyDown:im(s)}});n.push(o);let a=sx(t,"addInputRules",r);
87if(sU(t,e.options.enableInputRules)&&a){let t=a();if(t&&t.length){let r=function(e){let{editor:t,rules:r}=e,n=new th({state:{init:()=>null,apply(e,i,s){let o=e.getMeta(n);if(o)return o;let a=e.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=sS(x.from(e),s.schema));let{from:i}=a,o=i+e.length;oA({editor:t,from:i,to:o,text:e,rules:r,plugin:n})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,s,o)=>oA({editor:t,from:i,to:s,text:o,rules:r,plugin:n}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&oA({editor:t,from:i.pos,to:i.pos,text:"",rules:r,plugin:n})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:s}=e.state.selection;return!!s&&oA({editor:t,from:s.pos,to:s.pos,text:"\n",rules:r,plugin:n})}},isInputRules:!0});return n}({editor:e,rules:t}),i=Array.isArray(r)?r:[r];n.push(...i)}}let l=sx(t,"addPasteRules",r);if(sU(t,e.options.enablePasteRules)&&l){let t=l();if(t&&t.length){let r=function(e){let t,{editor:r,rules:n}=e,i=null,s=!1,o=!1,a="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let l=({state:e,from:n,to:i,rule:s,pasteEvt:o})=>{let l=e.tr;if(function(e){let{editor:t,state:r,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=e,{commands:l,chain:h,can:c}=new ib({editor:t,state:r}),u=[];return r.doc.nodesBetween(n,i,(e,t)=>{var d,f,p,m,g;if((null==(f=null==(d=e.type)?void 0:d.spec)?void 0:f.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(p=e.content)?void 0:p.size)?m:e.nodeSize)?g:0,v=Math.max(n,t),b=Math.min(i,t+y);v>=b||((e,t,r)=>{if(iI(t))return[...e.matchAll(t)];let n=t(e,r);return n?n.map(t=>{let r=[t.text];return r.index=t.index,r.input=e,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(t.replaceWith)),r}):[]})(e.isText?e.text||"":e.textBetween(v-t,b-t,void 0,""),s.find,o).forEach(e=>{if(void 0===e.index)return;let t=v+e.index+1,n=t+e[0].length,i={from:r.tr.mapping.map(t),to:r.tr.mapping.map(n)},d=s.handler({state:r,range:i,match:e,commands:l,chain:h,can:c,pasteEvent:o,dropEvent:a});u.push(d)})}),u.every(e=>null!==e)}({editor:r,state:iv({state:e,transaction:l}),from:Math.max(n-1,0),to:i.b-1,rule:s,pasteEvent:o,dropEvent:t})&&l.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return a="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new th({view(e){let t=t=>{var n;(i=(null==(n=e.dom.parentElement)?void 0:n.contains(t.target))?e.dom.parentElement:null)&&(oM=r)},n=()=>{oM&&(oM=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(e,r)=>{if(o=i===e.dom.parentElement,t=r,!o){let e=oM;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var r;let n=null==(r=t.clipboardData)?void 0:r.getData("text/html");return a=t,s=!!(null==n?void 0:n.includes("data-pm-slice")),!1}}},appendTransaction:(t,r,n)=>{let i=t[0],h="paste"===i.getMeta("uiEvent")&&!s,c="drop"===i.getMeta("uiEvent")&&!o,u=i.getMeta("applyPasteRules"),d=!!u;if(!h&&!c&&!d)return;if(d){var f,p;let t,{text:r}=u;"string"==typeof r||(r=sS(x.from(r),n.schema));let{from:i}=u,s=i+r.length;return l({rule:e,state:n,from:i,to:{b:s},pasteEvt:(f=r,null==(p=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||p.setData("text/html",f),t)})}let m=r.doc.content.findDiffStart(n.doc.content),g=r.doc.content.findDiffEnd(n.doc.content);if("number"==typeof m&&g&&m!==g.b)return l({rule:e,state:n,from:m,to:g,pasteEvt:a})}}))}({editor:e,rules:t});n.push(...r)}}let h=sx(t,"addProseMirrorPlugins",r);if(h){let e=h();n.push(...e)}return n})}get attributes(){return sT(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=sE(this.extensions);return Object.fromEntries(t.filter(e=>!!sx(e,"addNodeView")).map(t=>{let r=this.attributes.filter(e=>e.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:iO(t.name,this.schema)},i=sx(t,"addNodeView",n);if(!i)return[];let s=i();return s?[t.name,(n,i,o,a,l)=>{let h=sR(n,r);
87return s({node:n,view:i,getPos:o,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:h})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return sD([...this.extensions].reverse()).reduceRight((e,r)=>{let n={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:sF(r.name,this.schema)},i=sx(r,"dispatchTransaction",n);return i?t=>{i.call(n,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return sD([...this.extensions]).reduce((e,r)=>{let n={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:sF(r.name,this.schema)},i=sx(r,"transformPastedHTML",n);return i?(t,r)=>{let s=e(t,r);return i.call(n,s)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=sE(this.extensions);return Object.fromEntries(t.filter(e=>!!sx(e,"addMarkView")).map(t=>{let r=this.attributes.filter(e=>e.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:iz(t.name,this.schema)},i=sx(t,"addMarkView",n);return i?[t.name,(n,s,o)=>{let a=sR(n,r);return i()({mark:n,view:s,inline:o,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,r={}){let{state:n}=t,{doc:i,tr:s}=n;i.descendants((t,n)=>{let i=s.mapping.map(n),o=s.mapping.map(n)+t.nodeSize,a=null;if(t.marks.forEach(t=>{if(t!==e)return!1;a=t}),!a)return;let l=!1;if(Object.keys(r).forEach(e=>{r[e]!==a.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...r});s.removeMark(i,o,e.type),s.addMark(i,o,t)}}),s.docChanged&&t.view.dispatch(s)}(n,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t,r;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sF(e.name,this.schema)};"mark"===e.type&&((null==(t=sA(sx(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name),null==(r=sA(sx(e,"clearable",n)))||r||this.nonClearableMarks.push(e.name));let i=sx(e,"onBeforeCreate",n),s=sx(e,"onCreate",n),o=sx(e,"onUpdate",n),a=sx(e,"onSelectionUpdate",n),l=sx(e,"onTransaction",n),h=sx(e,"onFocus",n),c=sx(e,"onBlur",n),u=sx(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),h&&this.editor.on("focus",h),c&&this.editor.on("blur",c),u&&this.editor.on("destroy",u)})}};oR.resolve=sI,oR.sort=sD,oR.flatten=sk,iy({},{ClipboardTextSerializer:()=>oP,Commands:()=>o_,Delete:()=>oD,Drop:()=>oI,Editable:()=>oj,FocusEvents:()=>oB,Keymap:()=>o$,Paste:()=>oz,Tabindex:()=>oF,TextDirection:()=>oH,focusEventsPluginKey:()=>oL});var oN=class e extends oE{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},oP=oN.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new th({key:new td("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:r}=e,{doc:n,selection:i}=t,s=sL(r),{blockSeparator:o}=this.options,a={...void 0!==o?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>sj(n,{from:e.pos,to:t.pos},a)).join(null!=o?o:"\n\n")}}})]}}),o_=oN.create({name:"commands",addCommands:()=>({...iw})}),oD=oN.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var r,n,i;let s=()=>{var r,n,i,s;if(null!=(s=null==(i=null==(n=null==(r=this.editor.options.coreExtensionOptions)?void 0:r.delete)?void 0:n.filterTransaction)?void 0:i.call(n,e))?s:e.getMeta("y-sync$"))return;let o=sb(e.before,[e,...t]);s$(o).forEach(t=>{o.mapping.mapResult(t.oldRange.from).deletedAfter&&o.mapping.mapResult(t.oldRange.to).deletedBefore&&o.before.nodesBetween(t.oldRange.from,t.oldRange.to,(r,n)=>{let i=n+r.nodeSize-2,s=t.oldRange.from<=n&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:r,from:n,to:i,newFrom:o.mapping.map(n),newTo:o.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!s,editor:this.editor,transaction:e,combinedTransform:o})})});let a=o.mapping;o.steps.forEach((t,r)=>{var n,i;if(t instanceof eA){let s=a.slice(r).map(t.from,-1),l=a.slice(r).map(t.to),h=a.invert().map(s,-1),c=a.invert().map(l),u=s>0&&(null==(n=o.doc.nodeAt(s-1))?void 0:n.marks.some(e=>e.eq(t.mark))),d=null==(i=o.doc.nodeAt(l))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:h,to:c},newRange:{from:s,to:l},partial:!!(d||u),editor:this.editor,transaction:e,combinedTransform:o})}})};null==(i=null==(n=null==(r=this.editor.options.coreExtensionOptions)?void 0:r.delete)?void 0:n.async)||i?setTimeout(s,0):s()}}),oI=oN.create({name:"drop",addProseMirrorPlugins(){return[new th({key:new td("tiptapDrop"),props:{handleDrop:(e,t,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:r,moved:n})}}})]}}),oj=oN.create({name:"editable",addProseMirrorPlugins(){return[new th({key:new td("editable"),props:{editable:()=>this.editor.options.editable}})]}}),oL=new td("focusEvents"),oB=oN.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;
87return[new th({key:oL,props:{handleDOMEvents:{focus:(t,r)=>{e.isFocused=!0;let n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return t.dispatch(n),!1},blur:(t,r)=>{e.isFocused=!1;let n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return t.dispatch(n),!1}}}})]}}),o$=oN.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:r,doc:n}=t,{empty:i,$anchor:s}=r,{pos:o,parent:a}=s,l=s.parent.isTextblock&&o>0?t.doc.resolve(o-1):s,h=l.parent.type.spec.isolating,c=s.pos-s.parentOffset,u=h&&1===l.parent.childCount?c===s.pos:e1.atStart(n).from===o;return!!i&&!!a.type.isTextblock&&!a.textContent.length&&!!u&&(!u||"paragraph"!==s.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.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()},n={...r},i={...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 iK()||i7()?i:n},addProseMirrorPlugins(){return[new th({key:new td("clearDocument"),appendTransaction:(e,t,r)=>{if(e.some(e=>e.getMeta("composition")))return;let n=e.some(e=>e.docChanged)&&!t.doc.eq(r.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!n||i)return;let{empty:s,from:o,to:a}=t.selection,l=e1.atStart(t.doc).from,h=e1.atEnd(t.doc).to;if(s||o!==l||a!==h||!sq(r.doc))return;let c=r.tr,u=iv({state:r,transaction:c}),{commands:d}=new ib({editor:this.editor,state:u});if(d.clearNodes(),c.steps.length)return c}})]}}),oz=oN.create({name:"paste",addProseMirrorPlugins(){return[new th({key:new td("tiptapPaste"),props:{handlePaste:(e,t,r)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:r})}}})]}}),oF=oN.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new th({key:new td("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),oH=oN.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=sE(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new th({key:new td("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),oW=class e{constructor(e,t,r=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=n}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((r,n)=>{let i=r.isBlock&&!r.isTextblock,s=r.isAtom&&!r.isText,o=r.isInline,a=this.pos+n+ +!s;if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;let h=new e(l,this.editor,i,i||o?r:null);i&&(h.actualDepth=this.depth+1),t.push(h)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,n=this.parent;for(;n&&!r;
87){if(n.node.type.name===e)if(Object.keys(t).length>0){let e=n.node.attrs,r=Object.keys(t);for(let n=0;n<r.length;n+=1){let i=r[n];if(e[i]!==t[i])break}}else r=n;n=n.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let n=[];if(!this.children||0===this.children.length)return n;let i=Object.keys(t);return this.children.forEach(s=>{r&&n.length>0||(s.node.type.name===e&&i.every(e=>t[e]===s.node.attrs[e])&&n.push(s),r&&n.length>0||(n=n.concat(s.querySelectorAll(e,t,r))))}),n}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},oU=`.ProseMirror {
88  position: relative;
89}
90
91.ProseMirror {
92  word-wrap: break-word;
93  white-space: pre-wrap;
94  white-space: break-spaces;
95  -webkit-font-variant-ligatures: none;
96  font-variant-ligatures: none;
97  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
98}
99
100.ProseMirror [contenteditable="false"] {
101  white-space: normal;
102}
103
104.ProseMirror [contenteditable="false"] [contenteditable="true"] {
105  white-space: pre-wrap;
106}
107
108.ProseMirror pre {
109  white-space: pre-wrap;
110}
111
112img.ProseMirror-separator {
113  display: inline !important;
114  border: none !important;
115  margin: 0 !important;
116  width: 0 !important;
117  height: 0 !important;
118}
119
120.ProseMirror-gapcursor {
121  display: none;
122  pointer-events: none;
123  position: absolute;
124  margin: 0;
125}
126
127.ProseMirror-gapcursor:after {
128  content: "";
129  display: block;
130  position: absolute;
131  top: -2px;
132  width: 20px;
133  border-top: 1px solid black;
134  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
135}
136
137@keyframes ProseMirror-cursor-blink {
138  to {
139    visibility: hidden;
140  }
141}
142
143.ProseMirror-hideselection *::selection {
144  background: transparent;
145}
146
147.ProseMirror-hideselection *::-moz-selection {
148  background: transparent;
149}
150
151.ProseMirror-hideselection * {
152  caret-color: transparent;
153}
154
155.ProseMirror-focused .ProseMirror-gapcursor {
156  display: block;
157}`,oV=class extends od{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:sG,createMappablePosition:sY},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),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),this.on("drop",({event:e,slice:t,moved:r})=>this.options.onDrop(e,t,r)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=iV(t,this.options.autofocus);this.editorState=tl.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
157this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}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&&"u">typeof document&&(this.css=of(oU,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let r=sC(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,r=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;r=r.filter(e=>!e.key.startsWith(t))}),t.length===r.length)return;let n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var e,t,r,n;let i=[...this.options.enableCoreExtensions?[oj,oP.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),o_,oB,o$,oF.configure({value:null==(n=null==(r=this.options.coreExtensionOptions)?void 0:r.tabindex)?void 0:n.value}),oI,oz,oD,oH.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new oR(i,this)}createCommandManager(){this.commandManager=new ib({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=sg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=sg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:r}=this.options,n=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=r?this.extensionManager.dispatchTransaction(n):n,s=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new ii(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}
157e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:r}=this.state.applyTransaction(e),n=!this.state.selection.eq(t.selection),i=r.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=r.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==o?void 0:o.getMeta("focus"),l=null==o?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),e.getMeta("preventUpdate")||!r.some(e=>e.docChanged)||s.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return sB(this.state,e)}isActive(e,t){let r="string"==typeof e?e:null,n="string"==typeof e?t:e;return function(e,t,r={}){if(!t)return st(e,null,r)||sW(e,null,r);let n=so(t,e.schema);return"node"===n?st(e,t,r):"mark"===n&&sW(e,t,r)}(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return sS(this.state.doc.content,this.schema)}getText(e){var t,r;let n,{blockSeparator:i="\n\n",textSerializers:s={}}=e||{};return t=this.state.doc,r={blockSeparator:i,textSerializers:{...sL(this.schema),...s}},n={from:0,to:t.content.size},sj(t,n,r)}get isEmpty(){return sq(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var r;return(null==(r=this.$doc)?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return(null==(r=this.$doc)?void 0:r.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),r=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new oW(t,this,!1,r)}get $doc(){return this.$pos(0)}};function oq(e){return new oC({find:e.find,handler:({state:t,range:r,match:n})=>{let i=sA(e.getAttributes,void 0,n);if(!1===i||null===i)return null;let{tr:s}=t,o=n[n.length-1],a=n[0];if(o){let n=a.search(/\S/),l=r.from+a.indexOf(o),h=l+o.length;if(sz(r.from,r.to,t.doc).filter(t=>t.mark.type.excluded.find(r=>r===e.type&&r!==t.mark.type)).filter(e=>e.to>l).length)return null;h<r.to&&s.delete(h,r.to),l>r.from&&s.delete(r.from+n,l);let c=r.from+n+o.length;s.addMark(r.from+n,c,e.type.create(i||{})),s.removeStoredMark(e.type)}},undoable:e.undoable})}function oK(e){return new oC({find:e.find,handler:({state:t,range:r,match:n})=>{let i=sA(e.getAttributes,void 0,n)||{},{tr:s}=t,o=r.from,a=r.to,l=e.type.create(i);if(n[1]){let e=o+n[0].lastIndexOf(n[1]);e>a?e=a:a=e+n[1].length;let t=n[0][n[0].length-1];s.insertText(t,o+n[0].length-1),s.replaceWith(e,a,l)}else if(n[0]){let t=e.type.isInline?o:o-1;s.insert(t,e.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:e.undoable})}function oJ(e){return new oC({find:e.find,handler:({state:t,range:r,match:n})=>{let i=t.doc.resolve(r.from),s=sA(e.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(r.from,r.to).setBlockType(r.from,r.from,e.type,s)},undoable:e.undoable})}function oG(e){return new oC({find:e.find,handler:({state:t,range:r,match:n,chain:i})=>{let s=sA(e.getAttributes,void 0,n)||{},o=t.tr.delete(r.from,r.to),a=o.doc.resolve(r.from).blockRange(),l=a&&e_(a,e.type,s);if(!l)return null;if(o.wrap(a,l),e.keepMarks&&e.editor){let{selection:r,storedMarks:n}=t,{splittableMarks:i}=e.editor.extensionManager,s=n||r.$to.parentOffset&&r.$from.marks();if(s){let e=s.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,s).run()}let h=o.doc.resolve(r.from-1).nodeBefore;h&&h.type===e.type&&eB(o.doc,r.from-1)&&(!e.joinPredicate||e.joinPredicate(n,h))&&o.join(r.from-1)},undoable:e.undoable})}var oY=class{constructor(e){var t,r,n,i,s,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,r=e.clientY-this.startY;this.handleResize(t,r)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let r=t.clientX-this.startX,n=t.clientY-this.startY;this.handleResize(r,n)},this.handleMouseUp=()=>
157{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(r=e.options)?void 0:r.max)&&(this.maxSize=e.options.max),(null==(n=null==e?void 0:e.options)?void 0:n.directions)&&(this.directions=e.options.directions),(null==(i=e.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(s=e.options)?void 0:s.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(o=e.options)?void 0:o.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,r){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,r))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let r=t.includes("top"),n=t.includes("bottom"),i=t.includes("left"),s=t.includes("right");r&&(e.style.top="0"),n&&(e.style.bottom="0"),i&&(e.style.left="0"),s&&(e.style.right="0"),("top"===t||"bottom"===t)&&(e.style.left="0",e.style.right="0"),("left"===t||"right"===t)&&(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;(t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e))instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}
157removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let r=this.preserveAspectRatio||this.isShiftKeyPressed,{width:n,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),s=this.applyConstraints(n,i,r);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(e,t,r){let n=this.startWidth,i=this.startHeight,s=e.includes("right"),o=e.includes("left"),a=e.includes("bottom"),l=e.includes("top");return(s?n=this.startWidth+t:o&&(n=this.startWidth-t),a?i=this.startHeight+r:l&&(i=this.startHeight-r),("right"===e||"left"===e)&&(n=this.startWidth+(s?t:-t)),("top"===e||"bottom"===e)&&(i=this.startHeight+(a?r:-r)),this.preserveAspectRatio||this.isShiftKeyPressed)?this.applyAspectRatio(n,i,e):{width:n,height:i}}applyConstraints(e,t,r){var n,i,s,o;if(!r){let r=Math.max(this.minSize.width,e),s=Math.max(this.minSize.height,t);return(null==(n=this.maxSize)?void 0:n.width)&&(r=Math.min(this.maxSize.width,r)),(null==(i=this.maxSize)?void 0:i.height)&&(s=Math.min(this.maxSize.height,s)),{width:r,height:s}}let a=e,l=t;return a<this.minSize.width&&(l=(a=this.minSize.width)/this.aspectRatio),l<this.minSize.height&&(a=(l=this.minSize.height)*this.aspectRatio),(null==(s=this.maxSize)?void 0:s.width)&&a>this.maxSize.width&&(l=(a=this.maxSize.width)/this.aspectRatio),(null==(o=this.maxSize)?void 0:o.height)&&l>this.maxSize.height&&(a=(l=this.maxSize.height)*this.aspectRatio),{width:a,height:l}}applyAspectRatio(e,t,r){return"left"===r||"right"===r?{width:e,height:e/this.aspectRatio}:"top"===r||"bottom"===r?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},oX=class e extends oE{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},oQ=class{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,n,i,s,o,a;let{view:l}=this.editor,h=e.target,c=3===h.nodeType?null==(t=h.parentElement)?void 0:t.closest("[data-drag-handle]"):h.closest("[data-drag-handle]");if(!this.dom||(null==(r=this.contentDOM)?void 0:r.contains(h))||!c)return;let u=0,d=0;if(this.dom!==c){let t=this.dom.getBoundingClientRect(),r=c.getBoundingClientRect(),a=null!=(i=e.offsetX)?i:null==(n=e.nativeEvent)?void 0:n.offsetX,l=null!=(o=e.offsetY)?o:null==(s=e.nativeEvent)?void 0:s.offsetY;u=r.x-t.x+a,d=r.y-t.y+l}let f=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();f.style.width=`${Math.round(e.width)}px`,f.style.height=`${Math.round(e.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{(p=document.createElement("div")).style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),null==(a=e.dataTransfer)||a.setDragImage(f,u,d)}finally{p&&setTimeout(()=>{try{null==p||p.remove()}catch{}},0)}let m=this.getPos();if("number"!=typeof m)return;let g=e8.create(l.state.doc,m),y=l.state.tr.setSelection(g);l.dispatch(y)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let r=e.target;if(!(this.dom.contains(r)&&!(null==(t=this.contentDOM)?void 0:t.contains(r))))return!1;let n=e.type.startsWith("drag"),i="dragover"===e.type||"dragenter"===e.type,s="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!n)return!0;let{isEditable:o}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,h=e8.isSelectable(this.node),c="copy"===e.type,u="paste"===e.type,d="cut"===e.type,f="mousedown"===e.type;if(!l&&h&&n&&e.target===this.dom&&e.preventDefault(),l&&n&&!a&&e.target===this.dom)return e.preventDefault(),!1;if(l&&o&&!a&&f){let e=r.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(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!a&&!i&&!s&&!c&&!u&&!d&&(!f||!h)&&!0}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&(iK()||iq())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes
157)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let r=this.getPos();return"number"==typeof r&&(t.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if("number"!=typeof e)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function oZ(e){return new oO({find:e.find,handler:({state:t,range:r,match:n,pasteEvent:i})=>{let s=sA(e.getAttributes,void 0,n,i);if(!1===s||null===s)return null;let{tr:o}=t,a=n[n.length-1],l=n[0],h=r.to;if(a){let i=l.search(/\S/),c=r.from+l.indexOf(a),u=c+a.length;if(sz(r.from,r.to,t.doc).filter(t=>t.mark.type.excluded.find(r=>r===e.type&&r!==t.mark.type)).filter(e=>e.to>c).length)return null;u<r.to&&o.delete(u,r.to),c>r.from&&o.delete(r.from+i,c),h=r.from+i+a.length,o.addMark(r.from+i,h,e.type.create(s||{})),void 0!==n.index&&void 0!==n.input&&n.index+n[0].length>=n.input.length||o.removeStoredMark(e.type)}}})}let{getOwnPropertyNames:o0,getOwnPropertySymbols:o1}=Object,{hasOwnProperty:o2}=Object.prototype;function o3(e,t){return function(r,n,i){return e(r,n,i)&&t(r,n,i)}}function o5(e){return function(t,r,n){if(!t||!r||"object"!=typeof t||"object"!=typeof r)return e(t,r,n);let{cache:i}=n,s=i.get(t),o=i.get(r);if(s&&o)return s===r&&o===t;i.set(t,r),i.set(r,t);let a=e(t,r,n);return i.delete(t),i.delete(r),a}}function o4(e){return o0(e).concat(o1(e))}let o6=Object.hasOwn||((e,t)=>o2.call(e,t));function o8(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:o9,keys:o7}=Object;function ae(e,t){return e.byteLength===t.byteLength&&ad(new Uint8Array(e),new Uint8Array(t))}function at(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function ar(e,t){return e.byteLength===t.byteLength&&ad(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function an(e,t){return o8(e.getTime(),t.getTime())}function ai(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function as(e,t){return e===t}function ao(e,t,r){let n,i,s=e.size;if(s!==t.size)return!1;if(!s)return!0;let o=Array(s),a=e.entries(),l=0;for(;(n=a.next())&&!n.done;){let s=t.entries(),a=!1,h=0;for(;(i=s.next())&&!i.done;){if(o[h]){h++;continue}let s=n.value,c=i.value;if(r.equals(s[0],c[0],l,h,e,t,r)&&r.equals(s[1],c[1],s[0],c[0],e,t,r)){a=o[h]=!0;break}h++}if(!a)return!1;l++}return!0}function aa(e,t,r){let n=o7(e),i=n.length;if(o7(t).length!==i)return!1;for(;i-- >0;)if(!ap(e,t,r,n[i]))return!1;return!0}function al(e,t,r){let n,i,s,o=o4(e),a=o.length;if(o4(t).length!==a)return!1;for(;a-- >0;)if(!ap(e,t,r,n=o[a])||(i=o9(e,n),s=o9(t,n),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable)))return!1;return!0}function ah(e,t){return o8(e.valueOf(),t.valueOf())}function ac(e,t){return e.source===t.source&&e.flags===t.flags}function au(e,t,r){let n,i,s=e.size;if(s!==t.size)return!1;if(!s)return!0;let o=Array(s),a=e.values();for(;(n=a.next())&&!n.done;){let s=t.values(),a=!1,l=0;for(;(i=s.next())&&!i.done;){if(!o[l]&&r.equals(n.value,i.value,n.value,i.value,e,t,r)){a=o[l]=!0;break}l++}if(!a)return!1}return!0}function ad(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function af(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function ap(e,t,r,n){return("_owner"===n||"__o"===n||"__v"===n)&&(!!e.$$typeof||!!t.$$typeof)||o6(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}let am={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array
157]":!0},ag=Object.prototype.toString,ay=av();function av(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:i=!1}=e,s=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:h,areRegExpsEqual:c,areSetsEqual:u,areTypedArraysEqual:d,areUrlsEqual:f,unknownTagComparators:p}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let v=typeof m;if(v!==typeof g)return!1;if("object"!==v)return"number"===v?a(m,g,y):"function"===v&&s(m,g,y);let b=m.constructor;if(b!==g.constructor)return!1;if(b===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(b===Date)return n(m,g,y);if(b===RegExp)return c(m,g,y);if(b===Map)return o(m,g,y);if(b===Set)return u(m,g,y);let w=ag.call(m);if("[object Date]"===w)return n(m,g,y);if("[object RegExp]"===w)return c(m,g,y);if("[object Map]"===w)return o(m,g,y);if("[object Set]"===w)return u(m,g,y);if("[object Object]"===w)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===w)return f(m,g,y);if("[object Error]"===w)return i(m,g,y);if("[object Arguments]"===w)return l(m,g,y);if(am[w])return d(m,g,y);if("[object ArrayBuffer]"===w)return e(m,g,y);if("[object DataView]"===w)return r(m,g,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return h(m,g,y);if(p){let e=p[w];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=p[t])}if(e)return e(m,g,y)}return!1}}(function({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:ae,areArraysEqual:r?al:at,areDataViewsEqual:ar,areDatesEqual:an,areErrorsEqual:ai,areFunctionsEqual:as,areMapsEqual:r?o3(ao,al):ao,areNumbersEqual:o8,areObjectsEqual:r?al:aa,arePrimitiveWrappersEqual:ah,areRegExpsEqual:ac,areSetsEqual:r?o3(au,al):au,areTypedArraysEqual:r?o3(ad,al):ad,areUrlsEqual:af,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let e=o5(n.areArraysEqual),t=o5(n.areMapsEqual),r=o5(n.areObjectsEqual),i=o5(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:r,areSetsEqual:i})}return n}(e)),o=r?r(s):function(e,t,r,n,i,o,a){return s(e,t,a)};return function({circular:e,comparator:t,createState:r,equals:n,strict:i}){if(r)return function(s,o){let{cache:a=e?new WeakMap:void 0,meta:l}=r();return t(s,o,{cache:a,equals:n,meta:l,strict:i})};if(e)return function(e,r){return t(e,r,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};let s={cache:void 0,equals:n,meta:void 0,strict:i};return function(e,r){return t(e,r,s)}}({circular:t,comparator:s,createState:n,equals:o,strict:i})}av({strict:!0}),av({circular:!0}),av({circular:!0,strict:!0}),av({createInternalComparator:()=>o8}),av({strict:!0,createInternalComparator:()=>o8}),av({circular:!0,createInternalComparator:()=>o8}),av({circular:!0,createInternalComparator:()=>o8,strict:!0});var ab=e.i(30224),aw=({contentComponent:e})=>{let r=(0,y.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,t.jsx)(t.Fragment,{children:Object.values(r)})},ax=class extends m.default.Component{constructor(e){super(e),this.editorContentRef=m.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,r;if(t.contentComponent)return;let n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),e=new Set,r={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>r,getServerSnapshot:()=>r,setRenderer(t,n){r={...r,[t]:g.default.createPortal(n.reactElement,n.element,t)},e.forEach(e=>e())},removeRenderer(t){let n={...r};delete n[t],r=n,e.forEach(e=>e())}},t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let r=document.createElement("div");r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r})}catch{}}}render(){let{editor:e,innerRef:r,...n}=this.props;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{ref:((...e)=>t=>
157{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(r,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,t.jsx)(aw,{contentComponent:e.contentComponent})]})}},ak=(0,m.forwardRef)((e,t)=>{let r=m.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return m.default.createElement(ax,{key:r,innerRef:t,...e})}),aS=m.default.memo(ak),aC="u">typeof window?m.useLayoutEffect:m.useEffect,aA=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}},aE="u"<typeof window,aT=aE||!!("u">typeof window&&window.next),aO=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=null==e||e;return aE?t=!1:aT&&void 0===e&&(t=!1),t?this.createEditor():null}createEditor(){return new oV({...this.options.current,onBeforeCreate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onBeforeCreate)?void 0:r.call(t,...e)},onBlur:(...e)=>{var t,r;return null==(r=(t=this.options.current).onBlur)?void 0:r.call(t,...e)},onCreate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onCreate)?void 0:r.call(t,...e)},onDestroy:(...e)=>{var t,r;return null==(r=(t=this.options.current).onDestroy)?void 0:r.call(t,...e)},onFocus:(...e)=>{var t,r;return null==(r=(t=this.options.current).onFocus)?void 0:r.call(t,...e)},onSelectionUpdate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onSelectionUpdate)?void 0:r.call(t,...e)},onTransaction:(...e)=>{var t,r;return null==(r=(t=this.options.current).onTransaction)?void 0:r.call(t,...e)},onUpdate:(...e)=>{var t,r;return null==(r=(t=this.options.current).onUpdate)?void 0:r.call(t,...e)},onContentError:(...e)=>{var t,r;return null==(r=(t=this.options.current).onContentError)?void 0:r.call(t,...e)},onDrop:(...e)=>{var t,r;return null==(r=(t=this.options.current).onDrop)?void 0:r.call(t,...e)},onPaste:(...e)=>{var t,r;return null==(r=(t=this.options.current).onPaste)?void 0:r.call(t,...e)},onDelete:(...e)=>{var t,r;return null==(r=(t=this.options.current).onDelete)?void 0:r.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)||("extensions"===r&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,r)=>{var n;return e===(null==(n=t.extensions)?void 0:n[r])}):e[r]===t[r]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){
157if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,r)=>t===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}},aM=(0,m.createContext)({editor:null});aM.Consumer;var aR=(0,m.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});function aN(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function aP(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}m.default.forwardRef((e,r)=>{let{onDragStart:n}=(0,m.useContext)(aR),i=e.as||"div";return(0,t.jsx)(i,{...e,ref:r,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});var a_=class{constructor(e,{editor:t,props:r={},as:n="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(n),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?(0,g.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let r=this.component,n=this.props,i=this.editor,s=function(){try{if(m.version)return parseInt(m.version.split(".")[0],10)>=19}catch{}return!1}(),o=function(e){if(aN(e)||aP(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return aN(t)||aP(t)}return!1}(r),a={...n};a.ref&&!(s||o)&&delete a.ref,!a.ref&&(s||o)&&(a.ref=e=>{this.ref=e}),this.reactElement=(0,t.jsx)(r,{...a}),null==(e=null==i?void 0:i.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,r=Object.keys(e);for(let n=0;n<r.length;n+=1){let i=r[n];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==(e=null==t?void 0:t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};m.default.createContext({markViewContentRef:()=>{}});var aD=class extends oQ{constructor(e,t,r){if(super(e,t,r),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();"number"==typeof e&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),"function"==typeof this.options.attrs&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");if(!e)return;e.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(r,n,i){var s;return"storage"===n?null!=(s=e.storage[t.name])?s:{}:Reflect.get(r,n,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,m.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper"),e.appendChild(this.contentDOMElement))}},n=this.component,i=(0,m.memo)(e=>(0,t.jsx)(aR.Provider,{value:r,children:(0,m.createElement)(n,e)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);let{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new a_(i,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.n
157ame} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let e=this.currentPos;if("number"==typeof e)if(function({selection:e,pos:t,nodeSize:r,selectedOnTextSelection:n=!1}){let{from:i,to:s}=e;return!!(i<=t&&s>=t+r||n&&iW(e)&&i>t&&s<t+r)}({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,r){let n=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:r,updateProps:()=>n({node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=r,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=r,this.currentPos=i;let s={node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(s.getPos=()=>this.getPos()),n(s),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,r=sR(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function aI(e,t){return r=>r.editor.contentComponent?new aD(e,r,t):{}}var aj=(0,m.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function aL({editor:e,instance:r,children:n}){let i=null!=e?e:r;if(!i)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let s=(0,m.useMemo)(()=>({editor:i}),[i]),o=(0,m.useMemo)(()=>({editor:i}),[i]);return(0,t.jsx)(aM.Provider,{value:o,children:(0,t.jsx)(aj.Provider,{value:s,children:n})})}function aB({...e}){let{editor:r}=(0,m.useContext)(aj);return(0,t.jsx)(aS,{editor:r,...e})}aj.displayName="TiptapContext",aL.displayName="Tiptap",aB.displayName="Tiptap.Content",Object.assign(aL,{Content:aB}),e.s(["EditorContent",0,aS,"ReactNodeViewRenderer",0,aI,"useEditor",0,function(e={},t=[]){let r=(0,m.useRef)(e);r.current=e;let[n]=(0,m.useState)(()=>new aO(r)),i=(0,y.useSyncExternalStore)(n.subscribe,n.getEditor,n.getServerSnapshot);return(0,m.useDebugValue)(i),(0,m.useEffect)(n.onRender(t)),!function(e){var t;let[r]=(0,m.useState)(()=>new aA(e.editor)),n=(0,ab.useSyncExternalStoreWithSelector)(r.subscribe,r.getSnapshot,r.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:ay);aC(()=>r.watch(e.editor),[e.editor,r]),(0,m.useDebugValue)(n)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}],94499);var a$=(e,t)=>
157{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:r,...n}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,n,r]},az=class e{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,r,n=0,i){for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;if(l>e&&!1!==r(a,n+o,i||null,s)&&a.content.size){let i=o+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),r,n+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,n){let i="",s=!0;return this.nodesBetween(e,t,(o,a)=>{let l=o.isText?o.text.slice(Math.max(e,a)-a,t-a):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&r&&(s?s=!1:i+=r),i+=l},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let r=this.lastChild,n=t.firstChild,i=this.content.slice(),s=0;for(r.isText&&r.sameMarkup(n)&&(i[i.length-1]=r.withText(r.text+n.text),s=1);s<t.content.length;s++)i.push(t.content[s]);return new e(i,this.size+t.size)}cut(t,r=this.size){if(0==t&&r==this.size)return this;let n=[],i=0;if(r>t)for(let e=0,s=0;s<r;e++){let o=this.content[e],a=s+o.nodeSize;a>t&&((s<t||a>r)&&(o=o.isText?o.cut(Math.max(0,t-s),Math.min(o.text.length,r-s)):o.cut(Math.max(0,t-s-1),Math.min(o.content.size,r-s-1))),n.push(o),i+=o.nodeSize),s=a}return new e(n,i)}cutByIndex(t,r){return t==r?e.empty:0==t&&r==this.content.length?this:new e(this.content.slice(t,r))}replaceChild(t,r){let n=this.content[t];if(n==r)return this;let i=this.content.slice(),s=this.size+r.nodeSize-n.nodeSize;return i[t]=r,new e(i,s)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let n=this.content[t];e(n,r,t),r+=n.nodeSize}}findDiffStart(e,t=0){return function e(t,r,n){for(let i=0;;i++){if(i==t.childCount||i==r.childCount)return t.childCount==r.childCount?null:n;let s=t.child(i),o=r.child(i);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){for(let e=0;s.text[e]==o.text[e];e++)n++;return n}if(s.content.size||o.content.size){let t=e(s.content,o.content,n+1);if(null!=t)return t}n+=s.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return function e(t,r,n,i){for(let s=t.childCount,o=r.childCount;;
157){if(0==s||0==o)return s==o?null:{a:n,b:i};let a=t.child(--s),l=r.child(--o),h=a.nodeSize;if(a==l){n-=h,i-=h;continue}if(!a.sameMarkup(l))return{a:n,b:i};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,i--;return{a:n,b:i}}if(a.content.size||l.content.size){let t=e(a.content,l.content,n-1,i-1);if(t)return t}n-=h,i-=h}}(this,e,t,r)}findIndex(e){if(0==e)return aH(0,e);if(e==this.size)return aH(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let n=r+this.child(t).nodeSize;if(n>=e){if(n==e)return aH(t+1,n);return aH(t,r)}r=n}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,r){if(!r)return e.empty;if(!Array.isArray(r))throw RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(r.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let r,n=0;for(let e=0;e<t.length;e++){let i=t[e];n+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(r||(r=t.slice(0,e)),r[r.length-1]=i.withText(r[r.length-1].text+i.text)):r&&r.push(i)}return new e(r||t,n)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};az.empty=new az([],0);var aF={index:0,offset:0};function aH(e,t){return aF.index=e,aF.offset=t,aF}function aW(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!aW(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!aW(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}var aU=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,n));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,n)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&aW(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw RangeError(`There is no mark type ${t.type} in this schema`);let n=r.create(t.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];let r=t.slice();return r.sort((e,t)=>e.type.rank-t.type.rank),r}};aU.none=[];var aV=class extends Error{},aq=class e{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,r){let n=function e(t,r,n,i,s,o){let{index:a,offset:l}=t.findIndex(r),h=t.maybeChild(a);if(l==r||h.isText)return o&&i<=0&&s<=0&&!o.canReplace(a,a,n)?null:t.cut(0,r).append(n).append(t.cut(r));let c=e(h.content,r-l-1,n,0==a?i-1:0,a==t.childCount-1?s-1:0,h);return c&&t.replaceChild(a,h.copy(c))}(this.content,t+this.openStart,r,this.openStart+1,this.openEnd+1);return n&&new e(n,this.openStart,this.openEnd)}removeBetween(t,r){return new e(function e(t,r,n){let{index:i,offset:s}=t.findIndex(r),o=t.maybeChild(i),{index:a,offset:l}=t.findIndex(n);if(s==r||o.isText){if(l!=n&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,r).append(t.cut(n))}if(i!=a)throw RangeError("Removing non-flat range");return t.replaceChild(i,o.copy(e(o.content,r-s-1,n-s-1)))}(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,r){if(!r)return e.empty;let n=r.openStart||0,i=r.openEnd||0;if("number"!=typeof n||"number"!=typeof i)throw RangeError("Invalid input for Slice.fromJSON");return new e(az.fromJSON(t,r.content),n,i)}static maxOpen(t,r=!0){let n=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(r||!e.type.spec.isolating);e=e.firstChild)n++;for(let e=t.lastChild;e&&!e.isLeaf&&(r||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,n,i)}};function aK(e,t){if(!t.type.compatibleContent(e.type))throw new aV("Cannot join "+t.type.name+" onto "+e.type.n
vendor: 4,734 bytes, line 157
157ame)}function aJ(e,t,r){let n=e.node(r);return aK(n,t.node(r)),n}function aG(e,t){let r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function aY(e,t,r,n){let i=(t||e).node(r),s=0,o=t?t.index(r):i.childCount;e&&(s=e.index(r),e.depth>r?s++:e.textOffset&&(aG(e.nodeAfter,n),s++));for(let e=s;e<o;e++)aG(i.child(e),n);t&&t.depth==r&&t.textOffset&&aG(t.nodeBefore,n)}function aX(e,t){return e.type.checkContent(t),e.copy(t)}function aQ(e,t,r){let n=[];return aY(null,e,r,n),e.depth>r&&aG(aX(aJ(e,t,r+1),aQ(e,t,r+1)),n),aY(t,null,r,n),new az(n)}aq.empty=new aq(az.empty,0,0);var aZ=class e{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(t);return r?e.child(t).cut(r):n}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[3*t],n=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)n+=r.child(t).nodeSize;return n}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return aU.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),n=e.maybeChild(t);if(!r){let e=r;r=n,n=e}let i=r.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||n&&i[s].isInSet(n.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,n=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||n&&r[i].isInSet(n.marks)||(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new a3(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(t,r){if(!(r>=0&&r<=t.content.size))throw RangeError("Position "+r+" out of range");let n=[],i=0,s=r;for(let e=t;;){let{index:t,offset:r}=e.content.findIndex(s),o=s-r;if(n.push(e,t,i+r),!o||(e=e.child(t)).isText)break;s=o-1,i+=r+1}return new e(r,n,s)}static resolveCached(t,r){let n=a2.get(t);if(n)for(let e=0;e<n.elts.length;e++){let t=n.elts[e];if(t.pos==r)return t}else a2.set(t,n=new a0);let i=n.elts[n.i]=e.resolve(t,r);return n.i=(n.i+1)%a1,i}},a0=class{constructor(){this.elts=[],this.i=0}},a1=12,a2=new WeakMap,a3=class{constructor(e,t,r){this.$from=e,this.$to=t,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)}},a5=Object.create(null);(class e{constructor(e,t,r,n=aU.none){this.type=e,this.attrs=t,this.marks=n,this.content=r||az.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,n=0){this.content.nodesBetween(e,t,r,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}
157textBetween(e,t,r,n){return this.content.textBetween(e,t,r,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&aW(this.attrs,t||e.defaultAttrs||a5)&&aU.sameSet(this.marks,r||aU.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return aq.empty;let n=this.resolve(e),i=this.resolve(t),s=r?0:n.sharedDepth(t),o=n.start(s);return new aq(n.node(s).content.cut(n.pos-o,i.pos-o),n.depth-s,i.depth-s)}replace(e,t,r){var n=this.resolve(e),i=this.resolve(t);if(r.openStart>n.depth)throw new aV("Inserted content deeper than insertion position");if(n.depth-r.openStart!=i.depth-r.openEnd)throw new aV("Inconsistent open depths");return function e(t,r,n,i){let s=t.index(i),o=t.node(i);if(s==r.index(i)&&i<t.depth-n.openStart){let a=e(t,r,n,i+1);return o.copy(o.content.replaceChild(s,a))}if(!n.content.size)return aX(o,aQ(t,r,i));if(n.openStart||n.openEnd||t.depth!=i||r.depth!=i){let{start:e,end:s}=function(e,t){let r=t.depth-e.openStart,n=t.node(r).copy(e.content);for(let e=r-1;e>=0;e--)n=t.node(e).copy(az.from(n));return{start:n.resolveNoCache(e.openStart+r),end:n.resolveNoCache(n.content.size-e.openEnd-r)}}(n,t);return aX(o,function e(t,r,n,i,s){let o=t.depth>s&&aJ(t,r,s+1),a=i.depth>s&&aJ(n,i,s+1),l=[];return aY(null,t,s,l),o&&a&&r.index(s)==n.index(s)?(aK(o,a),aG(aX(o,e(t,r,n,i,s+1)),l)):(o&&aG(aX(o,aQ(t,r,s+1)),l),aY(r,n,s,l),a&&aG(aX(a,aQ(n,i,s+1)),l)),aY(i,null,s,l),new az(l)}(t,e,s,r,i))}{let e=t.parent,i=e.content;return aX(e,i.cut(0,t.parentOffset).append(n.content).append(i.cut(r.parentOffset)))}}(n,i,r,0)}nodeAt(e){for(let t=this;;){let{index:r,offset:n}=t.content.findIndex(e);if(!(t=t.maybeChild(r)))return null;if(n==e||t.isText)return t;e-=n+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let n=this.content.child(t-1);return{node:n,index:t-1,offset:r-n.nodeSize}}resolve(e){return aZ.resolveCached(this,e)}resolveNoCache(e){return aZ.resolve(this,e)}rangeHasMark(e,t,r){let n=!1;return t>e&&this.nodesBetween(e,t,e=>(r.isInSet(e.marks)&&(n=!0),!n)),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),function(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=az.empty,n=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,n,i),o=s&&s.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,t,r,n){if(n&&!this.type.allowsMarks(n))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return!!s&&s.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=aU.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!aU.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>
157e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let r;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,r)}let n=az.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,n,r);return i.type.checkAttrs(i.attrs),i}}).prototype.text=void 0;var a4=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,r){var n;let i,s=new a6(t,r);if(null==s.next)return e.empty;let o=function e(t){let r=[];do r.push(function(t){let r=[];do r.push(function(t){let r=function(t){if(t.eat("(")){let r=e(t);return t.eat(")")||t.err("Missing closing paren"),r}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let r=e.nodeTypes,n=r[t];if(n)return[n];let i=[];for(let e in r){let n=r[e];n.isInGroup(t)&&i.push(n)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))r={type:"plus",expr:r};else if(t.eat("*"))r={type:"star",expr:r};else if(t.eat("?"))r={type:"opt",expr:r};else if(t.eat("{"))r=function(e,t){let r=a8(e),n=r;return e.eat(",")&&(n="}"!=e.next?a8(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}(t,r);else break;return r}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==r.length?r[0]:{type:"seq",exprs:r}}(t));while(t.eat("|"))return 1==r.length?r[0]:{type:"choice",exprs:r}}(s);s.next&&s.err("Unexpected trailing text");let a=(n=function(e){let t=[[]];return i(function e(t,s){if("choice"==t.type)return t.exprs.reduce((t,r)=>t.concat(e(r,s)),[]);if("seq"==t.type)for(let n=0;;n++){let o=e(t.exprs[n],s);if(n==t.exprs.length-1)return o;i(o,s=r())}else if("star"==t.type){let o=r();return n(s,o),i(e(t.expr,o),o),[n(o)]}else if("plus"==t.type){let o=r();return i(e(t.expr,s),o),i(e(t.expr,o),o),[n(o)]}else if("opt"==t.type)return[n(s)].concat(e(t.expr,s));else if("range"==t.type){let o=s;for(let n=0;n<t.min;n++){let n=r();i(e(t.expr,o),n),o=n}if(-1==t.max)i(e(t.expr,o),o);else for(let s=t.min;s<t.max;s++){let s=r();n(o,s),i(e(t.expr,o),s),o=s}return[n(o)]}else if("name"==t.type)return[n(s,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),r()),t;function r(){return t.push([])-1}function n(e,r,n){let i={term:n,to:r};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(o),i=Object.create(null),function e(t){let r=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let i;if(e){for(let t=0;t<r.length;t++)r[t][0]==e&&(i=r[t][1]);a7(n,t).forEach(t=>{i||r.push([e,i=[]]),-1==i.indexOf(t)&&i.push(t)})}})});let s=i[t.join(",")]=new a4(t.indexOf(n.length-1)>-1);for(let t=0;t<r.length;t++){let n=r[t][1].sort(a9);s.next.push({type:r[t][0],next:i[n.join(",")]||e(n)})}return s}(a7(n,0)));return function(e,t){for(let r=0,n=[e];r<n.length;r++){let e=n[r],i=!e.validEnd,s=[];for(let t=0;t<e.next.length;t++){let{type:r,next:o}=e.next[t];s.push(r.name),i&&!(r.isText||r.hasRequiredAttrs())&&(i=!1),-1==n.indexOf(o)&&n.push(o)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(a,s),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let n=this;for(let i=t;n&&i<r;i++)n=n.matchType(e.child(i).type);return n}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let n=[this];return function i(s,o){let a=s.matchFragment(e,r);
157if(a&&(!t||a.validEnd))return az.from(o.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:r}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==n.indexOf(r)){n.push(r);let e=i(r,o.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),i=n.match;if(i.matchType(e)){let e=[];for(let t=n;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:s,next:o}=i.next[e];s.isLeaf||s.hasRequiredAttrs()||s.name in t||n.type&&!o.validEnd||(r.push({match:s.contentMatch,type:s,via:n}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&t(r.next[n].next)}(this),e.map((t,r)=>{let n=r+(t.validEnd?"*":" ")+" ";for(let r=0;r<t.next.length;r++)n+=(r?", ":"")+t.next[r].type.name+"->"+e.indexOf(t.next[r].next);return n}).join("\n")}};a4.empty=new a4(!0);var a6=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}};function a8(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function a9(e,t){return t-e}function a7(e,t){let r=[];return function t(n){let i=e[n];if(1==i.length&&!i[0].term)return t(i[0].to);r.push(n);for(let e=0;e<i.length;e++){let{term:n,to:s}=i[e];n||-1!=r.indexOf(s)||t(s)}}(t),r.sort(a9)}var le=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}},lt=class e{constructor(t,r=!1){if(this.ranges=t,this.inverted=r,!t.length&&e.empty)return e.empty}recover(e){let t=0,r=65535&e;if(!this.inverted)for(let e=0;e<r;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*r]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let n=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?n:0);if(a>e)break;let l=this.ranges[o+i],h=this.ranges[o+s],c=a+l;if(e<=c){let i=l?e==a?-1:e==c?1:t:t,s=a+n+(i<0?0:h);if(r)return s;let u=e==(t<0?a:c)?null:o/3+(e-a)*65536,d=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(d|=8),new le(s,d,u)}n+=h-l}return r?e+n:new le(e+n,0,null)}touches(e,t){let r=0,n=65535&t,i=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?r:0);if(o>e)break;let a=this.ranges[t+i];if(e<=o+a&&t==3*n)return!0;r+=this.ranges[t+s]-a}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let s=this.ranges[n],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),l=this.ranges[n+t],h=this.ranges[n+r];e(o,o+l,a,a+h),i+=h-l}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};lt.empty=new lt([]);var lr=Object.create(null),ln=class{getMap(){return lt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let r=lr[t.stepType];if(!r)throw RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in lr)throw RangeError("Duplicate use of step JSON ID "+e);return lr[e]=t,t.prototype.jsonID=e,t}},li=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,r,n,i){try{return e.ok(t.replace(r,n,i))}catch(t){if(t instanceof aV)return e.fail(t.message);throw t}}};function ls(e,t,r){let n=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(ls(s.content,t,s))),s.isInline&&(s=t(s,r,i)),n.push(s)}return az.fromArray(n)}var lo=class e extends ln{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),n=r.no
vendor: 8,493 bytes, line 157
157de(r.sharedDepth(this.to)),i=new aq(ls(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,n),t.openStart,t.openEnd);return li.fromReplace(e,this.from,this.to,i)}invert(){return new la(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,r){if("number"!=typeof r.from||"number"!=typeof r.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};ln.jsonID("addMark",lo);var la=class e extends ln{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new aq(ls(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return li.fromReplace(e,this.from,this.to,r)}invert(){return new lo(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,r){if("number"!=typeof r.from||"number"!=typeof r.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};ln.jsonID("removeMark",la);var ll=class e extends ln{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return li.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return li.fromReplace(e,this.pos,this.pos+1,new aq(az.from(r),0,+!t.isLeaf))}invert(t){let r=t.nodeAt(this.pos);if(r){let t=this.mark.addToSet(r.marks);if(t.length==r.marks.length){for(let n=0;n<r.marks.length;n++)if(!r.marks[n].isInSet(t))return new e(this.pos,r.marks[n]);return new e(this.pos,this.mark)}}return new lh(this.pos,this.mark)}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,r){if("number"!=typeof r.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new e(r.pos,t.markFromJSON(r.mark))}};ln.jsonID("addNodeMark",ll);var lh=class e extends ln{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return li.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return li.fromReplace(e,this.pos,this.pos+1,new aq(az.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ll(this.pos,this.mark):this}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,r){if("number"!=typeof r.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new e(r.pos,t.markFromJSON(r.mark))}};ln.jsonID("removeNodeMark",lh);var lc=class e extends ln{constructor(e,t,r,n=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=n}apply(e){return this.structure&&ld(e,this.from,this.to)?li.fail("Structure replace would overwrite content"):li.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new lt([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let r=t.mapResult(this.to,-1),n=this.from==this.to&&e.MAP_BIAS<0?r:t.mapResult(this.from,1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart)if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;else{let r=this.slice.size+t.slice.size==0?aq.empty:new aq(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,r,this.structure)}{let r=this.slice.size+t.slice.size==0?aq.empty:new aq(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,r){if("number"!=typeof r.from||"number"!=typeof r.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new e(r.from,r.to,aq.fromJSON(t,r.slice),!!r.structure)}};lc.MAP_BIAS=1,ln.jsonID("replace",lc);var lu=class e extends ln{constructor(e,t,r,n,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(ld(e,this.from,this.gapFrom)||ld(e,this.gapTo,this.to)))return li.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return li.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?li.fromReplace(e,this.from,this.to,r):li.fail("Content does not fit in gap")}getMap(){return new lt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let r=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+r,this.from+this.insert,this.from+this.insert+r,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),i=this.from==this.gapFrom?r.pos:t.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:t.map(this.gapTo,1);return r.deletedAcross&&n.deletedAcross||i<r.pos||s>n.pos?null:new e(r.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,r){if("number"!=typeof r.from||"number"!=typeof r.to||"number"!=typeof r.gapFrom||"number"!=typeof r.gapTo||"number"!=typeof r.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(r.from,r.to,r.gapFrom,r.gapTo,aq.fromJSON(t,r.slice),r.insert,!!r.structure)}};function ld(e,t,r){let n=e.resolve(t),i=r-t,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let e=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}ln.jsonID("replaceAround",lu);var lf=class e extends ln{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return li.fail("No node at attribute step's position");let r=Object.create(null);for(let e in t.attrs)r[e]=t.attrs[e];r[this.attr]=this.value;let n=t.type.create(r,null,t.marks);return li.fromReplace(e,this.pos,this.pos+1,new aq(az.from(n),0,+!t.isLeaf))}getMap(){return lt.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,r){if("number"!=typeof r.pos||"string"!=typeof r.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new e(r.pos,r.attr,r.value)}};ln.jsonID("attr",lf);var lp=class e extends ln{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return li.ok(r)}getMap(){return lt.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,r){if("string"!=typeof r.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new e(r.attr,r.value)}};ln.jsonID("docAttr",lp);
157var lm=class extends Error{};(lm=function e(t){let r=Error.call(this,t);return r.__proto__=e.prototype,r}).prototype=Object.create(Error.prototype),lm.prototype.constructor=lm,lm.prototype.name="TransformError";var lg=Object.create(null),ly=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new lv(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=aq.empty){let r=t.content.lastChild,n=null;for(let e=0;e<t.openEnd;e++)n=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],h=e.mapping.slice(i);e.replaceRange(h.map(a.pos),h.map(l.pos),o?aq.empty:t),0==o&&lO(e,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:s,$to:o}=n[i],a=e.mapping.slice(r),l=a.map(s.pos),h=a.map(o.pos);i?e.deleteRange(l,h):(e.replaceRangeWith(l,h,t),lO(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let n=e.parent.inlineContent?new lx(e):lT(e.node(0),e.parent,e.pos,e.index(),t,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let i=t<0?lT(e.node(0),e.node(n),e.before(n+1),e.index(n),t,r):lT(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,t,r);if(i)return i}return null}
vendor: 4,399 bytes, line 157
157static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new lA(e.node(0))}static atStart(e){return lT(e,e,0,0,1)||new lA(e)}static atEnd(e){return lT(e,e,e.content.size,e.childCount,-1)||new lA(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let r=lg[t.type];if(!r)throw RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in lg)throw RangeError("Duplicate use of selection JSON ID "+e);return lg[e]=t,t.prototype.jsonID=e,t}getBookmark(){return lx.between(this.$anchor,this.$head).getBookmark()}};ly.prototype.visible=!0;var lv=class{constructor(e,t){this.$from=e,this.$to=t}},lb=!1;function lw(e){lb||e.parent.inlineContent||(lb=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var lx=class e extends ly{constructor(e,t=e){lw(e),lw(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,r){let n=t.resolve(r.map(this.head));if(!n.parent.inlineContent)return ly.near(n);let i=t.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:n,n)}replace(e,t=aq.empty){if(super.replace(e,t),t==aq.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new lk(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,r){if("number"!=typeof r.anchor||"number"!=typeof r.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(r.anchor),t.resolve(r.head))}static create(e,t,r=t){let n=e.resolve(t);return new this(n,r==t?n:e.resolve(r))}static between(t,r,n){let i=t.pos-r.pos;if((!n||i)&&(n=i>=0?1:-1),!r.parent.inlineContent){let e=ly.findFrom(r,n,!0)||ly.findFrom(r,-n,!0);if(!e)return ly.near(r,n);r=e.$head}return t.parent.inlineContent||(0==i?t=r:(t=(ly.findFrom(t,-n,!0)||ly.findFrom(t,n,!0)).$anchor).pos<r.pos!=i<0&&(t=r)),new e(t,r)}};ly.jsonID("text",lx);var lk=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return lx.between(e.resolve(this.anchor),e.resolve(this.head))}},lS=class e extends ly{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(t,r){let{deleted:n,pos:i}=r.mapResult(this.anchor),s=t.resolve(i);return n?ly.near(s):new e(s)}content(){return new aq(az.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new lC(this.anchor)}static fromJSON(t,r){if("number"!=typeof r.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(r.anchor))}static create(t,r){return new e(t.resolve(r))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}};lS.prototype.visible=!1,ly.jsonID("node",lS);var lC=class e{constructor(e){this.anchor=e}map(t){let{deleted:r,pos:n}=t.mapResult(this.anchor);return r?new lk(n,n):new e(n)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&lS.isSelectable(r)?new lS(t):ly.near(t)}},lA=class e extends ly{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=aq.empty){if(t==aq.empty){e.delete(0,e.doc.content.size);let t=ly.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return lE}};ly.jsonID("all",lA);var lE={map(){return this},resolve:e=>new lA(e)};function lT(e,t,r,n,i,s=!1){if(t.inlineContent)return lx.create(e,r);for(let o=n-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let n=t.child(o);if(n.isAtom){if(!s&&lS.isSelectable(n))return lS.create(e,r-(i<0?n.nodeSize:0))}else{let t=lT(e,n,r+i,i<0?n.childCount:0,i,s);if(t)return t}r+=n.nodeSize*i}return null}function lO(e,t,r){let n,i=e.steps.length-1;if(i<t)return;let s=e.steps[i];(s instanceof lc||s instanceof lu)&&(e.mapping.maps[i].forEach((e,t,r,i)=>{null==n&&(n=i)}),e.setSelection(ly.near(e.doc.resolve(n),r)))}function lM(e,t){return t&&e?e.bind(t):e}var lR=class{constructor(e,t,r){this.name=e,this.init=lM(t.init,r),this.apply=lM(t.apply,r)}};new lR("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new lR("selection",{init:(e,t)=>
157e.selection||ly.atStart(t.doc),apply:e=>e.selection}),new lR("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,r,n)=>n.selection.$cursor?e.storedMarks:null}),new lR("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t});var lN=/^\s*>\s$/,lP=oX.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return a$("blockquote",{...sM(this.options.HTMLAttributes,e),children:a$("slot",{})})},parseMarkdown:(e,t)=>{var r;let n=null!=(r=t.parseBlockChildren)?r:t.parseChildren;return t.createNode("blockquote",void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let r=[];return e.content.forEach((e,n)=>{var i,s;let o=(null!=(s=null==(i=t.renderChild)?void 0:i.call(t,e,n))?s:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);r.push(o.join("\n"))}),r.join(`
158>
159`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>((e,t)=>{var r;let{state:n,view:i}=e,{selection:s}=n;if(!s.empty)return!1;let{$from:o}=s;if(0!==o.parentOffset)return!1;let a=o.depth-1,l=o.node(a),h=o.index(a);if(0===h)return!1;if(l.type===t)return e.commands.lift(t.name);let c=l.child(h-1);if(c.type!==t||!(null==(r=c.lastChild)?void 0:r.isTextblock))return!1;let u=o.before(),d=u-1-1,{tr:f}=n;return f.delete(u,o.after()).insert(d,o.parent.content),f.setSelection(lx.create(f.doc,d)),i.dispatch(f.scrollIntoView()),!0})(this.editor,this.type)}}
159,addInputRules(){return[oG({find:lN,type:this.type})]}}),l_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,lD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,lI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,lj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,lL=oT.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return a$("strong",{...sM(this.options.HTMLAttributes,e),children:a$("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,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[oq({find:l_,type:this.type}
159),oq({find:lI,type:this.type})]},addPasteRules(){return[oZ({find:lD,type:this.type}),oZ({find:lj,type:this.type})]}}),lB=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&"`"===e[t.index-1]?null:{index:t.index,text:t[0],replaceWith:t[1]}},l$=e=>{let t,r=/`([^`]+)`(?!`)/g,n=[];for(;null!==(t=r.exec(e));)t.index>0&&"`"===e[t.index-1]||n.push({index:t.index,text:t[0],replaceWith:t[1]});return n},lz=oT.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",sM(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}}
159,addInputRules(){return[oq({find:lB,type:this.type})]},addPasteRules(){return[oZ({find:l$,type:this.type})]}}),lF=/^```([a-z]+)?[\s\n]$/,lH=/^~~~([a-z]+)?[\s\n]$/,lW=oX.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:r}=this.options;if(!r)return null;let n=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(r)).map(e=>e.replace(r,""))[0];return n||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",sM(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var r,n;return(null==(r=e.raw)?void 0:r.startsWith("```"))===!1&&(null==(n=e.raw)?void 0:n.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var r;let n=(null==(r=e.attrs)?void 0:r.language)||"";return e.content?[`\`\`\`${n}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${n}
160
161\`\`\``},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:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,r=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!r||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let r=null!=(t=this.options.tabSize)?t:4,{state:n}=e,{selection:i}=n,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;let a=" ".repeat(r);return o?e.commands.insertContent(a):e.commands.command(({tr:e})=>{let{from:t,to:r}=i,s=n.doc.textBetween(t,r,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,r,n.schema.text(s)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let r=null!=(t=this.options.tabSize)?t:4,{state:n}=e,{selection:i}=n,{$from:s,empty:o}=i;return s.parent.type===this.type&&(o?e.commands.command(({tr:e})=>{var t;let{pos:i}=s,o=s.start(),a=s.end(),l=n.doc.textBetween(o,a,"\n","\n").split("\n"),h=0,c=0,u=i-o;for(let e=0;e<l.length;e+=1){if(c+l[e].length>=u){h=e;break}c+=l[e].length+1}let d=Math.min(((null==(t=l[h].match(/^ */))?void 0:t[0])||"").length,r);if(0===d)return!0;let f=o;for(let e=0;e<h;e+=1)f+=l[e].length+1;return e.delete(f,f+d),i-f<=d&&e.setSelection(e4.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:s}=i,o=n.doc.textBetween(t,s,"\n","\n").split("\n").map(e=>{var t;let n=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,r);return e.slice(n)}).join("\n");return e.replaceWith(t,s,n.schema.text(o)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:r}=t,{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type)return!1;let s=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith("\n\n");return!!s&&!!o&&e.chain().command(({tr:e})=>(e.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:r,doc:n}=t,{$from:i,empty:s}=r;if(!s||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return void 0!==o&&(n.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(e1.near(n.resolve(o))),!0)):e.commands.exitCode())}}}
161,addInputRules(){return[oJ({find:lF,type:this.type,getAttributes:e=>({language:e[1]})}),oJ({find:lH,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new th({key:new td("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let r=t.clipboardData.getData("text/plain"),n=t.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,s=null==i?void 0:i.mode;if(!r||!s)return!1;let{tr:o,schema:a}=e.state,l=a.text(r.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(e4.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),lU=oX.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),lV=oX.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",sM(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>`  
162`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:r,editor:n})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=r;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:o}=n.extensionManager,a=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&s){let t=a.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),lq=oX.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){let r=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${r}`,sM(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var r;let n=(null==(r=e.attrs)?void 0:r.level)?parseInt(e.attrs.level,10):1,i="#".repeat(n);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},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=>oJ({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}}
162)\\s$`),type:this.type,getAttributes:{level:e}}))}}),lK=oX.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",sM(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){let{selection:r}=e,{$from:n}=r;if(r instanceof e8){let e=n.index();return n.parent.canReplaceWith(e,e+1,t)}let i=n.depth;for(;i>=0;){let e=n.index(i);if(n.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}(t,t.schema.nodes[this.name]))return!1;let{selection:r}=t,{$to:n}=r,i=e();return sK(r)?i.insertContentAt(n.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:r})=>{if(r){let{$to:r}=t.selection,n=r.end();if(r.nodeAfter)r.nodeAfter.isTextblock?t.setSelection(e4.create(t.doc,r.pos+1)):r.nodeAfter.isBlock?t.setSelection(e8.create(t.doc,r.pos)):t.setSelection(e4.create(t.doc,r.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||r.parent.type.contentMatch.defaultType,s=null==i?void 0:i.create();s&&(t.insert(n,s),t.setSelection(e4.create(t.doc,n+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[oK({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
162ype})]}}),lJ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,lG=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,lY=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,lX=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,lQ=oT.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",sM(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)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[oq({find:lJ,type:this.type}),oq({find:lY,type:this.type})]},addPasteRules(){return[oZ({find:lG,type:this.type}
162),oZ({find:lX,type:this.type})]}});let lZ="numeric",l0="ascii",l1="alpha",l2="asciinumeric",l3="alphanumeric",l5="domain",l4="emoji",l6="whitespace";function l8(e,t,r){for(let n in t[lZ]&&(t[l2]=!0,t[l3]=!0),t[l0]&&(t[l2]=!0,t[l1]=!0),t[l2]&&(t[l3]=!0),t[l1]&&(t[l3]=!0),t[l3]&&(t[l5]=!0),t[l4]&&(t[l5]=!0),t){let t=(n in r||(r[n]=[]),r[n]);0>t.indexOf(e)&&t.push(e)}}function l9(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}l9.groups={},l9.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let r=this.jr[t][0],n=this.jr[t][1];if(n&&r.test(e))return n}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,r,n){for(let i=0;i<e.length;i++)this.tt(e[i],t,r,n)},tr(e,t,r,n){let i;return n=n||l9.groups,t&&t.j?i=t:(i=new l9(t),r&&n&&l8(t,r,n)),this.jr.push([e,i]),i},ts(e,t,r,n){let i=this,s=e.length;if(!s)return i;for(let t=0;t<s-1;t++)i=i.tt(e[t]);return i.tt(e[s-1],t,r,n)},tt(e,t,r,n){if(n=n||l9.groups,t&&t.j)return this.j[e]=t,t;let i,s=this.go(e);return s?(Object.assign((i=new l9).j,s.j),i.jr.push.apply(i.jr,s.jr),i.jd=s.jd,i.t=s.t):i=new l9,t&&(n&&(i.t&&"string"==typeof i.t?l8(t,Object.assign(function(e,t){let r={};for(let n in t)t[n].indexOf(e)>=0&&(r[n]=!0);return r}(i.t,n),r),n):r&&l8(t,r,n)),i.t=t),this.j[e]=i,i}};let l7=(e,t,r,n,i)=>e.ta(t,r,n,i),he=(e,t,r,n,i)=>e.tr(t,r,n,i),ht=(e,t,r,n,i)=>e.ts(t,r,n,i),hr=(e,t,r,n,i)=>e.tt(t,r,n,i),hn="WORD",hi="UWORD",hs="ASCIINUMERICAL",ho="ALPHANUMERICAL",ha="LOCALHOST",hl="UTLD",hh="SCHEME",hc="SLASH_SCHEME",hu="OPENBRACE",hd="CLOSEBRACE",hf="OPENBRACKET",hp="CLOSEBRACKET",hm="OPENPAREN",hg="CLOSEPAREN",hy="OPENANGLEBRACKET",hv="CLOSEANGLEBRACKET",hb="FULLWIDTHLEFTPAREN",hw="FULLWIDTHRIGHTPAREN",hx="LEFTCORNERBRACKET",hk="RIGHTCORNERBRACKET",hS="LEFTWHITECORNERBRACKET",hC="RIGHTWHITECORNERBRACKET",hA="FULLWIDTHLESSTHAN",hE="FULLWIDTHGREATERTHAN",hT="AMPERSAND",hO="APOSTROPHE",hM="ASTERISK",hR="BACKSLASH",hN="BACKTICK",hP="CARET",h_="COLON",hD="COMMA",hI="DOLLAR",hj="EQUALS",hL="EXCLAMATION",hB="HYPHEN",h$="PERCENT",hz="PIPE",hF="PLUS",hH="POUND",hW="QUERY",hU="QUOTE",hV="FULLWIDTHMIDDLEDOT",hq="SEMI",hK="SLASH",hJ="TILDE",hG="UNDERSCORE",hY="EMOJI";var hX=Object.freeze({__proto__:null,ALPHANUMERICAL:ho,AMPERSAND:hT,APOSTROPHE:hO,ASCIINUMERICAL:hs,ASTERISK:hM,AT:"AT",BACKSLASH:hR,BACKTICK:hN,CARET:hP,CLOSEANGLEBRACKET:hv,CLOSEBRACE:hd,CLOSEBRACKET:hp,CLOSEPAREN:hg,COLON:h_,COMMA:hD,DOLLAR:hI,DOT:"DOT",EMOJI:hY,EQUALS:hj,EXCLAMATION:hL,FULLWIDTHGREATERTHAN:hE,FULLWIDTHLEFTPAREN:hb,FULLWIDTHLESSTHAN:hA,FULLWIDTHMIDDLEDOT:hV,FULLWIDTHRIGHTPAREN:hw,HYPHEN:hB,LEFTCORNERBRACKET:hx,LEFTWHITECORNERBRACKET:hS,LOCALHOST:ha,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:hy,OPENBRACE:hu,OPENBRACKET:hf,OPENPAREN:hm,PERCENT:h$,PIPE:hz,PLUS:hF,POUND:hH,QUERY:hW,QUOTE:hU,RIGHTCORNERBRACKET:hk,RIGHTWHITECORNERBRACKET:hC,SCHEME:hh,SEMI:hq,SLASH:hK,SLASH_SCHEME:hc,SYM:"SYM",TILDE:hJ,TLD:"TLD",UNDERSCORE:hG,UTLD:hl,UWORD:hi,WORD:hn,WS:"WS"});let hQ=/[a-z]/,hZ=/\p{L}/u,h0=/\p{Emoji}/u,h1=/\d/,h2=/\s/,h3=null,h5=null;function h4(e,t){let r=function(e){let t=[],r=e.length,n=0;for(;n<r;){let i,s=e.charCodeAt(n),o=s<55296||s>56319||n+1===r||(i=e.charCodeAt(n+1))<56320||i>57343?e[n]:e.slice(n,n+2);t.push(o),n+=o.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),n=r.length,i=[],s=0,o=0;for(;o<n;){let a=e,l=null,h=0,c=null,u=-1,d=-1;for(;o<n&&(l=a.go(r[o]));)(a=l).accepts()?(u=0,d=0,c=a):u>=0&&(u+=r[o].length,d++),h+=r[o].length,s+=r[o].length,o++;s-=u,o-=d,h-=u,i.push({t:c.t,v:t.slice(s-h,s),s:s-h,e:s})}return i}function h6(e,t,r,n,i){let s,o=t.length;for(let r=0;r<o-1;r++){let o=t[r];e.j[o]?s=e.j[o]:((s=new l9(n)).jr=i.slice(),e.j[o]=s),e=s}return(s=new l9(r)).jr=i.slice(),e.j[t[o-1]]=s,s}function h8(e){let t=[],r=[],n=0;for(;n<e.length;){let i=0;for(;"0123456789".indexOf(e[n+i])>=0;)i++;if(i>0){t.push(r.join(""));for(let t=parseInt(e.substring(n,n+i),10);t>0;t--)r.pop();n+=i}else r.push(e[n]),n++}return t}let h9={defaultProtocol:"http",events:null,format:ce,formatHref:ce,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function h7(e,t=null){let r=Object.assign({},h9);e&&(r=Object.assign(r,e instanceof h7?e.o:e));let n=r.ignoreTags,i=[];for(let e=0;e<n.length;e++)i.push(n[e].toUpperCase());this.o=r,t&&(this.defaultRender=t),this.ignoreTags=i}function ce(e){return e}function ct(e,t){this.t="token",this.v=e,this.tk=t}function cr(e,t){class r extends ct{constructor(t,r){super(t,r),this.t=e}}
162for(let e in t)r.prototype[e]=t[e];return r.t=e,r}h7.prototype={o:h9,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,r){let n=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=r.t in i?i[r.t]:h9[e])&&n&&(i=i(t,r)):"function"==typeof i&&n&&(i=i(t,r.t,r))),i},getObj(e,t,r){let n=this.o[e];return"function"==typeof n&&null!=t&&(n=n(t,r.t,r)),n},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},ct.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),r=e.get("truncate",t,this),n=e.get("format",t,this);return r&&n.length>r?n.substring(0,r)+"…":n},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=h9.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",t,this),n=e.get("tagName",t,this),i=this.toFormattedString(e),s={},o=e.get("className",t,this),a=e.get("target",t,this),l=e.get("rel",t,this),h=e.getObj("attributes",t,this),c=e.getObj("events",t,this);return s.href=r,o&&(s.class=o),a&&(s.target=a),l&&(s.rel=l),h&&Object.assign(s,h),{tagName:n,attributes:s,content:i,eventListeners:c}}};let cn=cr("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ci=cr("text"),cs=cr("nl"),co=cr("url",{isLink:!0,toHref(e=h9.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==ha&&e[1].t===h_}}),ca=e=>new l9(e);function cl(e,t,r){let n=r[0].s,i=r[r.length-1].e;return new e(t.slice(n,i),r)}let ch="u">typeof console&&console&&console.warn||(()=>{}),cc={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function cu(e,t=!1){if(cc.initialized&&ch(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
1631. Must only contain digits, lowercase ASCII letters or "-"
1642. Cannot start or end with "-"
1653. "-" cannot repeat`);cc.customSchemes.push([e,t])}function cd(e){return cc.initialized||function(){cc.scanner=function(e=[]){let t={};l9.groups=t;let r=new l9;null==h3&&(h3=h8("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
165ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==h5&&(h5=h8("ελ1υ2бг1ел3дети4ею2католик6ом3мÐ
165ºÐ´2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3Õ°Õ¡Õµ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1ì»´2삼성2한국2")),hr(r,"'",hO),hr(r,"{",hu),hr(r,"}",hd),hr(r,"[",hf),hr(r,"]",hp),hr(r,"(",hm),hr(r,")",hg),hr(r,"<",hy),hr(r,">",hv),hr(r,"(",hb),hr(r,")",hw),hr(r,"「",hx),hr(r,"」",hk),hr(r,"『",hS),hr(r,"』",hC),hr(r,"<",hA),hr(r,">",hE),hr(r,"&",hT),hr(r,"*",hM),hr(r,"@","AT"),hr(r,"`",hN),hr(r,"^",hP),hr(r,":",h_),hr(r,",",hD),hr(r,"$",hI),hr(r,".","DOT"),hr(r,"=",hj),hr(r,"!",hL),hr(r,"-",hB),hr(r,"%",h$),hr(r,"|",hz),hr(r,"+",hF),hr(r,"#",hH),hr(r,"?",hW),hr(r,'"',hU),hr(r,"/",hK),hr(r,";",hq),hr(r,"~",hJ),hr(r,"_",hG),hr(r,"\\",hR),hr(r,"・",hV);let n=he(r,h1,"NUM",{[lZ]:!0});he(n,h1,n);let i=he(n,hQ,hs,{[l2]:!0}),s=he(n,hZ,ho,{[l3]:!0}),o=he(r,hQ,hn,{[l0]:!0});he(o,h1,i),he(o,hQ,o),he(i,h1,i),he(i,hQ,i);let a=he(r,hZ,hi,{[l1]:!0});he(a,hQ),he(a,h1,s),he(a,hZ,a),he(s,h1,s),he(s,hQ),he(s,hZ,s);let l=hr(r,"\n","NL",{[l6]:!0}),h=hr(r,"\r","WS",{[l6]:!0}),c=he(r,h2,"WS",{[l6]:!0});hr(r,"",c),hr(h,"\n",l),hr(h,"",c),he(h,h2,c),hr(c,"\r"),hr(c,"\n"),he(c,h2,c),hr(c,"",c);let u=he(r,h0,hY,{[l4]:!0});hr(u,"#"),he(u,h0,u),hr(u,"️",u);let d=hr(u,"‍");hr(d,"#"),he(d,h0,u);let f=[[hQ,o],[h1,i]],p=[[hQ,null],[hZ,a],[h1,s]];for(let e=0;e<h3.length;e++)h6(r,h3[e],"TLD",hn,f);for(let e=0;e<h5.length;e++)h6(r,h5[e],hl,hi,p);l8("TLD",{tld:!0,ascii:!0},t),l8(hl,{utld:!0,alpha:!0},t),h6(r,"file",hh,hn,f),h6(r,"mailto",hh,hn,f),h6(r,"http",hc,hn,f),h6(r,"https",hc,hn,f),h6(r,"ftp",hc,hn,f),h6(r,"ftps",hc,hn,f),l8(hh,{scheme:!0,ascii:!0},t),l8(hc,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let n=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};n.indexOf("-")>=0?i[l5]=!0:hQ.test(n)?h1.test(n)?i[l2]=!0:i[l0]=!0:i[lZ]=!0,ht(r,n,n,i)}return ht(r,"localhost",ha,{ascii:!0}),r.jd=new l9("SYM"),{start:r,tokens:Object.assign({groups:t},hX)}}(cc.customSchemes);for(let e=0;e<cc.tokenQueue.length;e++)cc.tokenQueue[e][1]({scanner:cc.scanner});cc.parser=function({groups:e}){let t=e.domain.concat([hT,hM,"AT",hR,hN,hP,hI,hj,hB,"NUM",h$,hz,hF,hH,hK,"SYM",hJ,hG]),r=[hO,h_,hD,"DOT",hL,h$,hW,hU,hq,hy,hv,hu,hd,hp,hf,hm,hg,hb,hw,hx,hk,hS,hC,hA,hE],n=[hT,hO,hM,hR,hN,hP,hI,hj,hB,hu,hd,h$,hz,hF,hH,hW,hK,"SYM",hJ,hG],i=ca(),s=hr(i,hJ);l7(s,n,s),l7(s,e.domain,s);let o=ca(),a=ca(),l=ca();l7(i,e.domain,o),l7(i,e.scheme,a),l7(i,e.slashscheme,l),l7(o,n,s),l7(o,e.domain,o);let h=hr(o,"AT");hr(s,"AT",h),hr(a,"AT",h),hr(l,"AT",h);let c=hr(s,"DOT");l7(c,n,s),l7(c,e.domain,s);let u=ca();l7(h,e.domain,u),l7(u,e.domain,u);let d=hr(u,"DOT");l7(d,e.domain,u);let f=ca(cn);l7(d,e.tld,f),l7(d,e.utld,f),hr(h,ha,f);let p=hr(u,hB);hr(p,hB,p),l7(p,e.domain,u),l7(f,e.domain,u),hr(f,"DOT",d),hr(f,hB,p);let m=hr(o,hB),g=hr(o,"DOT");hr(m,hB,m),l7(m,e.domain,o),l7(g,n,s),l7(g,e.domain,o);let y=ca(co);l7(g,e.tld,y),l7(g,e.utld,y),l7(y,e.domain,o),l7(y,n,s),hr(y,"DOT",g),hr(y,hB,m),hr(y,"AT",h);let v=hr(y,h_),b=ca(co);l7(v,e.numeric,b);let w=ca(co),x=ca();l7(w,t,w),l7(w,r,x),l7(x,t,w),l7(x,r,x),hr(y,hK,w),hr(b,hK,w);let k=hr(a,h_),S=hr(l,h_),C=hr(S,hK),A=hr(C,hK);l7(a,e.domain,o),hr(a,"DOT",g),hr(a,hB,m),l7(l,e.domain,o),hr(l,"DOT",g),hr(l,hB,m),l7(k,e.domain,w),hr(k,hK,w),hr(k,hW,w),l7(A,e.domain,w),l7(A,t,w),hr(A,hK,w);let E=[[hu,hd],[hf,hp],[hm,hg],[hy,hv],[hb,hw],[hx,hk],[hS,hC],[hA,hE]];for(let e=0;e<E.length;e++){let[n,i]=E[e],s=hr(w,n);hr(x,n,s);let o=ca(co);l7(s,t,o);let a=ca();l7(s,r,a),hr(s,i,w),l7(o,t,o),l7(o,r,a),l7(a,t,o),l7(a,r,a),hr(o,i,w),hr(a,i,w)}return hr(i,ha,y),hr(i,"NL",cs),{start:i,tokens:hX}}(cc.scanner.tokens);for(let e=0;e<cc.pluginQueue.length;e++)cc.pluginQueue[e][1]({scanner:cc.scanner,parser:cc.parser});cc.initialized=!0}(),function(e,t,r){let n=r.length,i=0,s=[],o=[];for(;i<n;){let a=e,l=null,h=null,c=0,u=null,d=-1;for(;i<n&&!(l=a.go(r[i].t));)o.push(r[i++]);for(;i<n&&(h=l||a.go(r[i].t));)l=null,(a=h).accepts()?(d=0,u=a):d>=0&&d++,i++,c++;if(d<0)(i-=c)<n&&(o.push(r[i]),i++);else{o.length>0&&(s.push(cl(ci,t,o)),o=[]),i-=d,c-=d;let e=u.t,n=r.slice(i-c,i);s.push(cl(e,t,n))}}return o.length>0&&s.push(cl(ci,t,o)),s}(cc.parser.start,e,h4(cc.scanner.start,e))}function cf(e,t=null,r=null){if(t&&"object"==typeof t){if(r)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);r=t,t=null}let n=new h7(r),i=cd(e),s=[];for(let e=0;e<i.length;e++){let r=i[e];r.isLink&&(!t||r.t===t)&&n.check(r)&&s.push(r.toFormattedObject(n))}return s}cd.scan=h4;var cp="[\0-   ᠎ -\u2029  ]",cm=new RegExp(cp),cg=RegExp(`${cp}$`),cy=RegExp(cp,"g");function cv(e,t){let r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];
165return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&r.push(t)}),!e||e.replace(cy,"").match(RegExp(`^(?:(?:${r.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var cb=oT.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?cu(e):cu(e.scheme,e.optionalSlashes)})},onDestroy(){l9.groups={},cc.scanner=null,cc.parser=null,cc.tokenQueue=[],cc.pluginQueue=[],cc.customSchemes=[],cc.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!cv(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),r=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||r&&!e.includes("@"))return!0;let n=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(n)&&!!/\./.test(n)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!cv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!cv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",sM(this.options.HTMLAttributes,e),0]:["a",sM(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var r,n,i,s;let o=null!=(n=null==(r=e.attrs)?void 0:r.href)?n:"",a=null!=(s=null==(i=e.attrs)?void 0:i.title)?s:"",l=t.renderChildren(e);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:r}=e;return!!this.options.isAllowedUri(r,{defaultValidate:e=>!!cv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:r}=e||{};return(!r||!!this.options.isAllowedUri(r,{defaultValidate:e=>!!cv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[oZ({find:e=>{let t=[];if(e){let{protocols:r,defaultProtocol:n}=this.options,i=cf(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!cv(e,r),protocols:r,defaultProtocol:n}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t}
165,type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,r;let n=[],{protocols:i,defaultProtocol:s}=this.options;return this.options.autolink&&n.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!cv(e,i),protocols:i,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink},new th({key:new td("autolink"),appendTransaction:(t,r,n)=>{let i=t.some(e=>e.docChanged)&&!r.doc.eq(n.doc),s=t.some(e=>e.getMeta("preventAutolink"));if(!i||s)return;let{tr:o}=n;if(s$(sb(r.doc,[...t])).forEach(({newRange:t})=>{var r,i;let s,a,l,h=(r=n.doc,i=e=>e.isTextblock,l=[],r.nodesBetween(t.from,t.to,(e,t)=>{i(e)&&l.push({node:e,pos:t})}),l);if(h.length>1)s=h[0],a=n.doc.textBetween(s.pos,s.pos+s.node.nodeSize,void 0," ");else if(h.length){let e=n.doc.textBetween(t.from,t.to," "," ");if(!cg.test(e))return;s=h[0],a=n.doc.textBetween(s.pos,t.to,void 0," ")}if(s&&a){let t=a.split(cm).filter(Boolean);if(t.length<=0)return!1;let r=t[t.length-1],i=s.pos+a.lastIndexOf(r);if(!r)return!1;let l=cd(r).map(t=>t.toObject(e.defaultProtocol));if(!(1===l.length?l[0].isLink:3===l.length&&!!l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;l.filter(e=>e.isLink).map(e=>({...e,from:i+e.start+1,to:i+e.end+1})).filter(e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{sz(t.from,t.to,n.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}}))),n.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new th({key:new td("handleClickLink"),props:{handleClick:(e,r,n)=>{var i,s;if(0!==n.button||!e.editable)return!1;let o=null;if(n.target instanceof HTMLAnchorElement)o=n.target;else{let e=n.target;if(!e)return!1;let r=t.editor.view.dom;(o=e.closest("a"))&&!r.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let r=sB(e.state,t.type.name),n=null!=(i=o.href)?i:r.href,l=null!=(s=o.target)?s:r.target;n&&(window.open(n,l),a=!0)}return a}}}))),this.options.linkOnPaste&&n.push((r={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new th({key:new td("handlePasteLink"),props:{handlePaste:(e,t,n)=>{let{shouldAutoLink:i}=r,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";n.content.forEach(e=>{l+=e.textContent});let h=cf(l,{defaultProtocol:r.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!!l&&!!h&&(void 0===i||!!i(h.value))&&r.editor.commands.setMark(r.type,{href:h.href})}}}))),n}});e.s(["Link",0,cb,"default",0,cb],63612);var cw=Object.defineProperty,cx="textStyle",ck=/^\s*([-+*])\s$/,cS=oX.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",sM(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(cx)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}}
165,addInputRules(){let e=oG({find:ck,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oG({find:ck,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(cx),editor:this.editor})),[e]}}),cC=(e,t)=>oN.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let r=()=>{let r;return r=this.editor,((e,t,r,n)=>{let i=((e,t,r)=>{let{selection:n}=e;if(!n.empty)return null;let{$from:i}=n;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let e=i.depth;e>0;e-=1)if(i.node(e).type.name===t){s=e;break}if(s<0)return null;let o=i.node(s),a=i.index(s);if(a+1>=o.childCount)return null;let l=o.child(a+1);if(!r.includes(l.type.name))return null;let h=e.schema.nodes[t],c=!1;if(l.forEach(e=>{e.type===h&&e.childCount>1&&(c=!0)}),!c)return null;let u=e.doc.resolve(i.after()).nodeAfter;if(!u||!r.includes(u.type.name))return null;let d=[];return(u.forEach(e=>{d.push(e)}),0===d.length)?null:{listItemDepth:s,nestedList:u,nestedListPos:i.after(),insertPos:i.after(s),items:d}})(e,r,n);if(!i)return!1;let{selection:s}=e,{nestedList:o,nestedListPos:a,insertPos:l,items:h}=i,c=e.tr;c.delete(a,a+o.nodeSize);let u=c.mapping.map(l);return c.insert(u,x.from(h)),c.setSelection(s.map(c.doc,c.mapping)),t&&t(c),!0})(r.state,r.view.dispatch,e,t)};return{Delete:r,"Mod-Delete":r}}}),cA=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],cE="abcdefghijklmnopqrstuvwxyz",cT=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function cO(e){let t=e,r="";for(let[e,n]of cA)for(;t>=e;)r+=n,t-=e;return r}function cM(e){return cO(e).toUpperCase()}function cR(e){let t=e.toLowerCase(),r=0,n=0;for(;r<t.length;){let e=!1;for(let[i,s]of cA)if(t.startsWith(s,r)){n+=i,r+=s.length,e=!0;break}if(!e)return 0}return n}function cN(e){if(e<=26)return cE[e-1];let t=Math.floor((e-1)/26)-1,r=(e-1)%26;return t<0?cE[r]:cE[t]+cE[r]}function cP(e){if(!(!e||/^\d+$/.test(e))){if(function(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=cR(e);return!(t<=0)&&(e===e.toLowerCase()?cO(t):cM(t))===e}(e))return e===e.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(e))return"a";if(/^[A-Z]{1,2}$/.test(e))return"A"}}function c_(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=cP(e);if("i"===t||"I"===t)return cR(e);if("a"===t||"A"===t){let t,r=1===(t=e.toLowerCase()).length?t.charCodeAt(0)-97+1:2===t.length?(t.charCodeAt(0)-97+1)*26+(t.charCodeAt(1)-97)+1:0;return r>0?r:1}let r=parseInt(e,10);return Number.isNaN(r)?1:r}var cD=oX.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",sM(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var r,n,i,s;if("list_item"!==e.type)return[];let o=null!=(r=t.parseBlockChildren)?r:t.parseChildren,a=[];if(e.tokens&&e.tokens.length>0){let r;if(r=null==(n=e.tokens)?void 0:n[0],e.text&&(null==(i=e.tokens)?void 0:i.length)===1&&(null==r?void 0:r.type)==="list"&&r.ordered&&r.raw===e.text)return{type:"listItem",content:[{type:"paragraph",content:(s=e.text||"",t.tokenizeInline?t.parseInline(t.tokenizeInline(s)):t.parseInline([{type:"text",raw:s,text:s}]))}]};if(e.tokens.some(e=>"paragraph"===e.type))a=o(e.tokens);else{let r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(a=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){let t=o(e.tokens.slice(1));a.push(...t)}}else a=o(e.tokens)}}return 0===a.length&&(a=[{type:"paragraph",content:[]}]),{type:"listItem",content:a}},renderMarkdown:(e,t,r)=>oS(e,t,e=>{var t,r,n,i;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let s=(null==(r=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:r.start)||1;return function(e,t,r=". "){let n=t+1;if(!e||"1"===e)return`${n}${r}`;switch(e){case"a":return`${cN(n)}${r}`;case"A":return`${cN(n).toUpperCase()}${r}`;case"i":return`${cO(n)}${r}`;case"I":return`${cM(n)}${r}`;default:return`${n}${r}`}}(null==(i=null==(n=e.meta)?void 0:n.parentAttrs)?void 0:i.type,s-1+(e.index||0),". ")}return"- "},r),addExtensions(){return[cC(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),cI={},cj={findListItemPos:()=>cB,getNextListDepth:()=>c$,handleBackspace:()=>cF,handleDelete:()=>cU,hasListBefore:()=>cz,hasListItemAfter:()=>cV,hasListItemBefore:()=>cq,listItemHasSubList:()=>cK,nextListIsDeeper:()=>cH,nextListIsHigher:()=>cW};for(var cL in cj)cw(cI,cL,{get:cj[cL],enumerable:!0});var cB=(e,t)=>{let{$from:r}=t.selection,n=iO(e,t.schema),i=r.depth,s=r.pos,o=null;for(;i>0&&null===o;)r.node(i).type===n?o=i:(i-=1,s-=1);return null===o?null:{$pos:t.doc.resolve(s),depth:o}},c$=(e,t)=>
165{let r=cB(e,t);if(!r)return!1;let[,n]=((e,t,r,n=20)=>{let i=e.doc.resolve(r),s=n,o=null;for(;s>0&&null===o;){let e=i.node(s);(null==e?void 0:e.type.name)===t?o=e:s-=1}return[o,s]})(t,e,r.$pos.pos+4);return n},cz=(e,t,r)=>{let{$anchor:n}=e.selection,i=Math.max(0,n.pos-2),s=e.doc.resolve(i).node();return!!s&&!!r.includes(s.type.name)},cF=(e,t,r)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!st(e.state,t)&&cz(e.state,t,r)){let{$anchor:r}=e.state.selection,n=e.state.doc.resolve(r.before()-1),i=[];n.node().descendants((e,r)=>{e.type.name===t&&i.push({node:e,pos:r})});let s=i.at(-1);if(!s)return!1;let o=e.state.doc.resolve(n.start()+s.pos+1);return e.chain().cut({from:r.start()-1,to:r.end()+1},o.end()).joinForward().run()}return!!st(e.state,t)&&!!(e=>{let{$from:t,$to:r}=e.selection;return!(t.parentOffset>0)&&t.pos===r.pos})(e.state)&&e.chain().liftListItem(t).run()},cH=(e,t)=>{let r=c$(e,t),n=cB(e,t);return!!n&&!!r&&r>n.depth},cW=(e,t)=>{let r=c$(e,t),n=cB(e,t);return!!n&&!!r&&r<n.depth},cU=(e,t)=>{if(!st(e.state,t)||!((e,t)=>{let{$from:r,$to:n,$anchor:i}=e.selection;if(t){let r=sw(e=>e.type.name===t)(e.selection);if(!r)return!1;let n=e.doc.resolve(r.pos+1);return i.pos+1===n.end()}return!(n.parentOffset<n.parent.nodeSize-2)&&r.pos===n.pos})(e.state,t))return!1;let{selection:r}=e.state,{$from:n,$to:i}=r;return!(!r.empty&&n.sameParent(i))&&(cH(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():cW(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},cV=(e,t)=>{var r;let{$anchor:n}=t.selection,i=t.doc.resolve(n.pos-n.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(r=i.nodeAfter)?void 0:r.type.name)===e},cq=(e,t)=>{var r;let{$anchor:n}=t.selection,i=t.doc.resolve(n.pos-2);return 0!==i.index()&&(null==(r=i.nodeBefore)?void 0:r.type.name)===e},cK=(e,t,r)=>{if(!r)return!1;let n=iO(e,t.schema),i=!1;return r.descendants(e=>{e.type===n&&(i=!0)}),i},cJ=oN.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r})=>{void 0!==e.state.schema.nodes[r]&&cU(e,r)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r})=>{void 0!==e.state.schema.nodes[r]&&cU(e,r)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{void 0!==e.state.schema.nodes[r]&&cF(e,r,n)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{void 0!==e.state.schema.nodes[r]&&cF(e,r,n)&&(t=!0)}),t}}}}),cG=RegExp(`^(\\s*)(${cT})([.)])\\s+(.*)$`),cY=RegExp(`^(\\s*)(${cT})([.)])\\s+`),cX=/^\s/,cQ=RegExp(`^(${cT})([.)])\\s+(.+)$`),cZ="textStyle",c0=/^(\d+)\.\s$/;function c1(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var c2=oX.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute("type");if(t)return t;let r=e.getAttribute("style");if(r){let e=c1(r);if(e)return e}let n=e.querySelector("li");if(n){let e=n.getAttribute("style");if(e){let t=c1(e);if(t)return t}}return null}}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,type:r,...n}=e,i=sM(this.options.HTMLAttributes,n);return 1!==t&&(i.start=t),r&&"1"!==r&&(i.type=r),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var r;if("list"!==e.type||!e.ordered)return[];let n=e.start||1,i=e.typeMarker,s=e.items?(r=e.items,r.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let r=[];return e.tokens&&e.tokens.length>
1650&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)r.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let n=t.parseChildren([e]);r.push({type:"paragraph",content:n})}else{let n=t.parseChildren([e]);n.length>0&&r.push(...n)}}),{type:"listItem",content:r}})):[],o={};return(1!==n&&(o.start=n),i&&(o.type=i),Object.keys(o).length>0)?{type:"orderedList",attrs:o,content:s}:{type:"orderedList",content:s}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let t=e.match(cY),r=null==t?void 0:t.index;return void 0!==r?r:-1},tokenize:(e,t,r)=>{var n,i;let s=e.split("\n"),[o,a]=function(e){let t=[],r=0,n=0;for(;r<e.length;){let i=e[r],s=i.match(cG);if(!s)break;let[,o,a,l,h]=s,c=o.length,u=parseInt(a,10),d=isNaN(u)?cP(a):void 0,f=isNaN(u)?c_(a):u,p=[h],m=r+1,g=[i],y=!1;for(;m<e.length;){let t=e[m];if(t.match(cG))break;if(""===t.trim())g.push(t),p.push(""),y=!0,m+=1;else if(t.match(cX)){let e=t.length-t.trimStart().length,r=c+a.length+1;g.push(t),p.push(t.slice(Math.min(e,r))),m+=1}else{if(y)break;g.push(t),p.push(t),m+=1}}t.push({indent:c,number:f,type:d,content:p.join("\n").trim(),contentLines:p,raw:g.join("\n")}),n=m,r=m}return[t,n]}(s);if(0===o.length)return;let l=function e(t,r,n){let i=[],s=0;for(;s<t.length;){let o=t[s];if(o.indent===r){let{paragraphLines:a,blockLines:l}=function(e){let t=[],r=[],n=!1;return e.forEach(e=>{let i;if(n)return void r.push(e);if(""===e.trim()||t.length>0&&(i=e.trimStart(),/^[-+*]\s+/.test(i)||cG.test(i.trimStart())||/^>\s?/.test(i)||/^```/.test(i)||/^~~~/.test(i))){n=!0,r.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:r}}(o.contentLines),h=a.join("\n").trim(),c=[];h&&c.push({type:"paragraph",raw:h,tokens:n.inlineTokens(h)});let u=l.join("\n").trim();if(u){let e=n.blockTokens(u);c.push(...e)}let d=s+1,f=[];for(;d<t.length&&t[d].indent>r;)f.push(t[d]),d+=1;if(f.length>0){let t=Math.min(...f.map(e=>e.indent)),r=e(f,t,n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:r,raw:f.map(e=>e.raw).join("\n")})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=d}else s+=1}return i}(o,0,r);if(0!==l.length)return{type:"list",ordered:!0,start:(null==(n=o[0])?void 0:n.number)||1,typeMarker:null==(i=o[0])?void 0:i.type,items:l,raw:s.slice(0,a).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(cZ)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins:()=>[new th({props:{handlePaste:(e,t)=>
165{var r,n;let i=null==(r=t.clipboardData)?void 0:r.getData("text/html");if(null==i?void 0:i.trim())return!1;let s=null==(n=t.clipboardData)?void 0:n.getData("text/plain");if(!s)return!1;let o=function(e){let t=e.split("\n").filter(e=>e.trim().length>0);if(0===t.length)return null;let r=[];for(let e of t){let t=e.trim().match(cQ);if(!t)return null;r.push({marker:t[1],content:t[3]})}return!function(e){var t;if(0===e.length)return!1;let r=null!=(t=cP(e[0]))?t:"numeric",n=c_(e[0]);if(n<1)return!1;for(let t=0;t<e.length;t++){let i=function(e,t){if("numeric"===e)return String(t);switch(e){case"a":return cN(t);case"A":return cN(t).toUpperCase();case"i":return cO(t);case"I":return cM(t);default:return String(t)}}(r,n+t);if(e[t]!==i)return!1}return!0}(r.map(e=>e.marker))?null:{type:"orderedList",attrs:function(e){let{type:t,start:r}={type:cP(e),start:c_(e)},n={};return t&&(n.type=t),1!==r&&(n.start=r),n}(r[0].marker),content:r.map(e=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:e.content}]}]}))}}(s);if(!o)return!1;try{let t=e.state.schema.nodeFromJSON(o),r=e.state.tr.replaceSelectionWith(t);return e.dispatch(r),!0}catch{return!1}}}})],addInputRules(){let e=(e,t)=>(!t.attrs.type||"1"===t.attrs.type)&&t.childCount+t.attrs.start===+e[1],t=oG({find:c0,type:this.t
165ype,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=oG({find:c0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(cZ)}),joinPredicate:e,editor:this.editor})),[t]}}),c3=/^\s*(\[([( |x])?\])\s$/,c5=oX.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",sM(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let r=[];if(e.tokens&&e.tokens.length>0?r.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?r.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):r.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let n=t.parseChildren(e.nestedTokens);r.push(...n)}return t.createNode("taskItem",{checked:e.checked||!1},r)},renderMarkdown:(e,t)=>{var r;let n=(null==(r=e.attrs)?void 0:r.checked)?"x":" ";return oS(e,t,`- [${n}] `)},addExtensions(){return this.options.nested?[cC(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:r,editor:n})=>{let i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),h=e=>{var t,r;a.ariaLabel=(null==(r=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:r.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};h(e),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:i}=t.target;n.isEditable&&"function"==typeof r&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=r();if("number"!=typeof t)return!1;let n=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==n?void 0:n.attrs,checked:i}),!0}).run(),n.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(a.checked=!a.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let c=new Set(Object.keys(t));return{dom:i,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,h(e);let t=sR(e,n.extensionManager.attributes),r=new Set(Object.keys(t)),s=this.options.HTMLAttributes;return c.forEach(e=>{r.has(e)||(e in s?i.setAttribute(e,s[e]):i.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in s?i.setAttribute(e,s[e]):i.removeAttribute(e):i.setAttribute(e,t)}),c=r,!0}}}},addInputRules(){return[oG({find:c3,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),c4=oX.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",sM(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let r=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==r?r:-1}
165,tokenize(e,t,r){let n=e=>{let t=ok(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:r.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:n},r);return t?[{type:"taskList",raw:t.raw,items:t.items}]:r.blockTokens(e)},i=ok(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:r.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:n},r);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});oN.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(cS.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(cD.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(cJ.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(c2.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(c5.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(c4.configure(this.options.taskList)),e}});var c6="&nbsp;",c8=oX.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",sM(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let r=e.tokens||[];if(1===r.length&&"image"===r[0].type)return t.parseChildren([r[0]]);let n=t.parseInline(r);return 1===r.length&&"text"===r[0].type&&(r[0].raw===c6||r[0].text===c6||" "===r[0].raw||" "===r[0].text)&&1===n.length&&"text"===n[0].type&&(n[0].text===c6||" "===n[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,n)},renderMarkdown:(e,t,r)=>{var n,i;if(!e)return"";let s=Array.isArray(e.content)?e.content:[];if(0===s.length){let e=Array.isArray(null==(n=null==r?void 0:r.previousNode)?void 0:n.content)?r.previousNode.content:[];return(null==(i=null==r?void 0:r.previousNode)?void 0:i.type)==="paragraph"&&0===e.length?c6:""}return t.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),c9=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,c7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,ue=oT.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",sM(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[oq({find:c9,type:this.type})]}
165,addPasteRules(){return[oZ({find:c7,type:this.type})]}}),ut=oX.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),ur=oT.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",sM(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,r){let n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!n)return;let i=n[2].trim();return{type:"underline",raw:n[0],text:i,tokens:r.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});e.s(["Underline",0,ur,"default",0,ur],76399);class un{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(r=t.width)?r:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let r=e=>{this[t](e)};return e.dom.addEventListener(t,r),{name:t,handler:r}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,r=this.editorView.state.doc.resolve(this.cursorPos),n=!r.parent.inlineContent,i,s=this.editorView.dom,o=s.getBoundingClientRect(),a=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(n){let e=r.nodeBefore,t=r.nodeAfter;if(e||t){let r=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(r){let n=r.getBoundingClientRect(),s=e?n.bottom:n.top;e&&t&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let o=this.width/2*l;i={left:n.left,right:n.right,top:s-o,bottom:s+o}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let h=this.editorView.dom.offsetParent;if(!this.element&&(this.element=h.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),h&&(h!=document.body||"static"!=getComputedStyle(h).position)){let r=h.getBoundingClientRect(),n=r.width/h.offsetWidth,i=r.height/h.offsetHeight;e=r.left-h.scrollLeft*n,t=r.top-h.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/a+"px",this.element.style.top=(i.top-t)/l+"px",this.element.style.width=(i.right-i.left)/a+"px",this.element.style.height=(i.bottom-i.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),n=r&&r.type.spec.disableDropCursor,i="function"==typeof n?n(this.editorView,t,e):n;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=eF(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ui extends e1{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ui.valid(r)?new ui(r):e1.near(r)}content(){return T.empty}eq(e){return e instanceof ui&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new ui(e.resolve(t.pos))}getBookmark(){return new us(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let r=e.index(t),n=e.node(t);if(0==r){if(n.type.spec.isolating)return!0;continue}for(let e=n.child(r-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||uo(e.type))return!0;
165if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let r=e.indexAfter(t),n=e.node(t);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let e=n.child(r);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||uo(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let r=t.type.spec.allowGapCursor;if(null!=r)return r;let n=t.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,t,r=!1){l:for(;;){if(!r&&ui.valid(e))return e;let n=e.pos,i=null;for(let r=e.depth;;r--){let s=e.node(r);if(t>0?e.indexAfter(r)<s.childCount:e.index(r)>0){i=s.child(t>0?e.indexAfter(r):e.index(r)-1);break}if(0==r)return null;n+=t;let o=e.doc.resolve(n);if(ui.valid(o))return o}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!e8.isSelectable(i)){e=e.doc.resolve(n+i.nodeSize*t),r=!1;continue l}break}i=s,n+=t;let o=e.doc.resolve(n);if(ui.valid(o))return o}return null}}}ui.prototype.visible=!1,ui.findFrom=ui.findGapCursorFrom,e1.jsonID("gapcursor",ui);class us{constructor(e){this.pos=e}map(e){return new us(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ui.valid(t)?new ui(t):e1.near(t)}}function uo(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let ua=im({ArrowLeft:ul("horiz",-1),ArrowRight:ul("horiz",1),ArrowUp:ul("vert",-1),ArrowDown:ul("vert",1)});function ul(e,t){let r="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,n,i){let s=e.selection,o=t>0?s.$to:s.$from,a=s.empty;if(s instanceof e4){if(!i.endOfTextblock(r)||0==o.depth)return!1;a=!1,o=e.doc.resolve(t>0?o.after():o.before())}let l=ui.findGapCursorFrom(o,t,a);return!!l&&(n&&n(e.tr.setSelection(new ui(l))),!0)}}function uh(e,t,r){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(t);if(!ui.valid(n))return!1;let i=e.posAtCoords({left:r.clientX,top:r.clientY});return!(i&&i.inside>-1&&e8.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new ui(n))),!0)}function uc(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof ui))return!1;let{$from:r}=e.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let i=x.empty;for(let e=n.length-1;e>=0;e--)i=x.from(n[e].createAndFill(null,i));let s=e.state.tr.replace(r.pos,r.pos,new T(i,0,0));return s.setSelection(e4.near(s.doc.resolve(r.pos+1))),e.dispatch(s),!1}function uu(e){if(!(e.selection instanceof ui))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",nV.create(e.doc,[nH.widget(e.selection.head,t,{key:"gapcursor"})])}var ud=function(){};ud.prototype.append=function(e){return e.length?(e=ud.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},ud.prototype.prepend=function(e){return e.length?ud.from(e).append(this):this},ud.prototype.appendInner=function(e){return new up(this,e)},ud.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?ud.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},ud.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},ud.prototype.forEach=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},ud.prototype.map=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=this.length);var n=[];return this.forEach(function(t,r){return n.push(e(t,r))},t,r),n},ud.from=function(e){return e instanceof ud?e:e&&e.length?new uf(e):ud.empty};var uf=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,r){return 0==e&&r==this.length?this:new t(this.values.slice(e,r))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,r,n){for(var i=t;i<r;i++)if(!1===e(this.values[i],n+i))return!1},t.prototype.forEachInvertedInner=function(e,t,r,n){for(var i=t-1;i>=r;i--)if(!1===e(this.values[i],n+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(t.prototype,r),t}(ud);ud.empty=new uf([]);var up=function(e){function t(t,r){e.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return 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(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,r,n){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(r,i),n)||r>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,r)-i,n+i))return!1},t.prototype.forEachInvertedInner=function(e,t,r,n){var i=this.left.length;if(t>
165i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(r,i)-i,n+i)||r<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),r,n))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var r=this.left.length;return t<=r?this.left.slice(e,t):e>=r?this.right.slice(e-r,t-r):this.left.slice(e,r).append(this.right.slice(0,t-r))},t.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new t(r,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(ud);class um{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let r,n,i,s;if(0==this.eventCount)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=(r=this.remapping(o,this.items.length)).maps.length);let a=e.tr,l=[],h=[];return this.items.forEach((e,t)=>{if(!e.step){r||(n=(r=this.remapping(o,t+1)).maps.length),n--,h.push(e);return}
165if(r){h.push(new ug(e.map));let t=e.step.map(r.slice(n)),i;t&&a.maybeStep(t).doc&&(i=a.mapping.maps[a.mapping.maps.length-1],l.push(new ug(i,void 0,void 0,l.length+h.length))),n--,i&&r.appendMap(i,n)}else a.maybeStep(e.step);if(e.selection)return i=r?e.selection.map(r.slice(n)):e.selection,s=new um(this.items.slice(0,o).append(h.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,r,n){var i,s;let o,a=[],l=this.eventCount,h=this.items,c=!n&&h.length?h.get(h.length-1):null;for(let r=0;r<e.steps.length;r++){let i=e.steps[r].invert(e.docs[r]),s=new ug(e.mapping.maps[r],i,t),o;(o=c&&c.merge(s))&&(s=o,r?a.pop():h=h.slice(0,h.length-1)),a.push(s),t&&(l++,t=void 0),n||(c=s)}let u=l-r.depth;return u>uv&&(i=h,s=u,i.forEach((e,t)=>{if(e.selection&&0==s--)return o=t,!1}),h=i.slice(o),l-=u),new um(h.append(a),l)}remapping(e,t){let r=new eb;return this.items.forEach((t,n)=>{let i=null!=t.mirrorOffset&&n-t.mirrorOffset>=e?r.maps.length-t.mirrorOffset:void 0;r.appendMap(t.map,i)},e,t),r}addMaps(e){return 0==this.eventCount?this:new um(this.items.append(e.map(e=>new ug(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(e=>{e.selection&&o--},n);let a=t;this.items.forEach(t=>{let n=i.getMirror(--a);if(null==n)return;s=Math.min(s,n);let l=i.maps[n];if(t.step){let s=e.steps[n].invert(e.docs[n]),h=t.selection&&t.selection.map(i.slice(a+1,n));h&&o++,r.push(new ug(l,s,h))}else r.push(new ug(l))},n);let l=[];for(let e=t;e<s;e++)l.push(new ug(i.maps[e]));let h=new um(this.items.slice(0,n).append(l).append(r),o);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,n=[],i=0;return this.items.forEach((s,o)=>{if(o>=e)n.push(s),s.selection&&i++;else if(s.step){let e=s.step.map(t.slice(r)),o=e&&e.getMap();if(r--,o&&t.appendMap(o,r),e){let a=s.selection&&s.selection.map(t.slice(r));a&&i++;let l=new ug(o.invert(),e,a),h,c=n.length-1;(h=n.length&&n[c].merge(l))?n[c]=h:n.push(l)}}else s.map&&r--},this.items.length,0),new um(ud.from(n.reverse()),i)}}um.empty=new um(ud.empty,0);class ug{constructor(e,t,r,n){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ug(t.getMap().invert(),t,this.selection)}}}class uy{constructor(e,t,r,n,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=n,this.prevComposition=i}}let uv=20;function ub(e){let t=[];for(let r=e.length-1;r>=0&&0==t.length;r--)e[r].forEach((e,r,n,i)=>t.push(n,i));return t}function uw(e,t){if(!e)return null;let r=[];for(let n=0;n<e.length;n+=2){let i=t.map(e[n],1),s=t.map(e[n+1],-1);i<=s&&r.push(i,s)}return r}let ux=!1,uk=null;function uS(e){let t=e.plugins;if(uk!=t){ux=!1,uk=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){ux=!0;break}}return ux}let uC=new td("history"),uA=new td("closeHistory");function uE(e,t){return(r,n)=>{let i=uC.getState(r);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(n){let s=function(e,t,r){let n=uS(t),i=uC.get(t).spec.config,s=(r?e.undone:e.done).popEvent(t,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(r?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,n),l=new uy(r?a:s.remaining,r?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(uC,{redo:r,historyState:l})}(i,r,e);s&&n(t?s.scrollIntoView():s)}return!0}}let uT=uE(!1,!0),uO=uE(!0,!0);uE(!1,!1),uE(!0,!1),oN.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,r=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(r)}},addProseMirrorPlugins(){let e=!1;return[new th({key:new td("characterCount"),appendTransaction:(t,r,n)=>{if(e)return;let i=this.options.limit,s=this.options.autoTrim;if(null==i||0===i||!1===s){e=!0;return}let o=this.storage.characters({node:n.doc});if(o>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=n.tr.deleteRange(0,o-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let r=this.options.limit;if(!e.docChanged||0===r||null==r)return!0;let n=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||n>r&&i>r&&i<=n)return!0;
165if(n>r&&i>r&&i>n||!e.getMeta("paste"))return!1;let s=e.selection.$head.pos;return e.deleteRange(s-(i-r),s),!(this.storage.characters({node:e.doc})>r)}})]}});var uM=oN.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new th({view:t=>new un(t,e)})}(this.options)]}});oN.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new th({key:new td("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:r,isFocused:n}=this.editor,{anchor:i}=t,s=[];if(!r||!n)return nV.create(e,[]);let o=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let a=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((a+=1,"deepest"===this.options.mode&&o-a>0||"shallowest"===this.options.mode&&a>1)?"deepest"===this.options.mode:void s.push(nH.node(t,t+e.nodeSize,{class:this.options.className})))),nV.create(e,s)}}})]}});var uR=oN.create({name:"gapCursor",addProseMirrorPlugins:()=>[new th({props:{decorations:uu,createSelectionBetween:(e,t,r)=>t.pos==r.pos&&ui.valid(r)?new ui(r):null,handleClick:uh,handleKeyDown:ua,handleDOMEvents:{beforeinput
165:uc}}})],extendNodeSchema(e){var t;let r={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=sA(sx(e,"allowGapCursor",r)))?t:null}}}),uN="placeholder",uP=new td("tiptap__placeholder");function u_(e){let{editor:t,placeholder:r,dataAttribute:n,pos:i,node:s,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:h}}=e,c=[l];return o&&c.push(h),nH.node(i,i+s.nodeSize,{class:c.join(" "),[n]:"function"==typeof r?r({editor:t,node:s,pos:i,hasAnchor:a}):r})}function uD(e,t){return"function"==typeof e?e(t):e}var uI={init:()=>({topPos:null,bottomPos:null}),apply(e,t){let r=e.getMeta(uP);return(null==r?void 0:r.positions)?{topPos:r.positions.top,bottomPos:r.positions.bottom}:e.docChanged?{topPos:null!==t.topPos?e.mapping.map(t.topPos):null,bottomPos:null!==t.bottomPos?e.mapping.map(t.bottomPos):null}:t}};function uj(e){let t=function(e){let t=e;for(;t;){if(function(e){let t=getComputedStyle(e),r=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(r)}(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}break}t=e}return window}(e.dom),r=()=>{let r=function({view:e,scrollContainer:t}){let r=e.dom.getBoundingClientRect();if(r.width<=0||r.height<=0)return null;let n=t?t===window?{top:0,bottom:window.innerHeight}:t.getBoundingClientRect():{top:0,bottom:window.innerHeight},i=Math.max(r.top,n.top)-200,s=Math.min(r.bottom,n.bottom)+200;if(i>=s)return null;let o=r.left+1,a=r.right-1;if(o>a)return null;let l=Math.min(Math.max("rtl"===getComputedStyle(e.dom).direction?r.right-2:r.left+2,o),a),h=Math.max(i+2,r.top+1),c=Math.min(s-2,r.bottom-1);if(h>c)return null;let u=e.posAtCoords({left:l,top:h}),d=e.posAtCoords({left:l,top:c});return u&&d?{top:u.pos,bottom:d.pos}:null}({view:e,scrollContainer:t});if(null===r)return;let n=uP.getState(e.state);if((null==n?void 0:n.topPos)===r.top&&(null==n?void 0:n.bottomPos)===r.bottom)return;let i=e.state.tr.setMeta(uP,{positions:r});e.dispatch(i)},n=null,i=0,s=()=>{null===n&&(n=requestAnimationFrame(()=>{n=null;let e=performance.now();e-i>=150?(i=e,r()):s()}))};t.addEventListener("scroll",s,{passive:!0});let o="u">typeof ResizeObserver?new ResizeObserver(s):null;null==o||o.observe(e.dom);let a="u">typeof IntersectionObserver?new IntersectionObserver(s):null;return null==a||a.observe(e.dom),e.dom.addEventListener("focus",s),r(),{update(t,r){e.state.doc.content.size!==r.doc.content.size&&s()},destroy:()=>{null!==n&&cancelAnimationFrame(n),t.removeEventListener("scroll",s),null==o||o.disconnect(),null==a||a.disconnect(),e.dom.removeEventListener("focus",s)}}}var uL=oN.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:uN,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[function({editor:e,options:t}){let r=t.dataAttribute?`data-${t.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${uN}`;return new th({key:uP,state:uI,view:uj,props:{decorations:({doc:n,selection:i})=>(function({editor:e,options:t,dataAttribute:r,doc:n,selection:i}){var s,o;if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,l=[],h=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=n.resolve(a),s=i.depth>0?i.node(1):i.nodeAfter,o=i.depth>0?i.before(1):a;if(s&&s.type.isTextblock&&sq(s)){let n=a>=o&&a<=o+s.nodeSize;l.push(u_({editor:e,isEmptyDoc:h,dataAttribute:r,hasAnchor:n,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:uD(t.emptyNodeClass,{editor:e,node:s,pos:o,hasAnchor:n})},node:s,pos:o}))}}else{let i=uP.getState(e.state),c=null!=(s=null==i?void 0:i.topPos)?s:0,u=null!=(o=null==i?void 0:i.bottomPos)?o:n.content.size;n.nodesBetween(c,u,(n,i)=>{let s=a>=i&&a<=i+n.nodeSize,o=!n.isLeaf&&sq(n);return n.type.isTextblock&&(s||!t.showOnlyCurrent)&&o&&l.push(u_({editor:e,isEmptyDoc:h,dataAttribute:r,hasAnchor:s,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:uD(t.emptyNodeClass,{editor:e,node:n,pos:i,hasAnchor:s})},node:n,pos:i})),t.includeChildren})}return nV.create(n,l)})({editor:e,options:t,dataAttribute:r,doc:n,selection:i})}})}({editor:this.editor,options:this.options})]}}),uB=`.ProseMirror:not(.ProseMirror-focused) *::selection {
166  background: transparent;
167}
168
169.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
170  background: transparent;
171}`;function u$({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}oN.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&"u">typeof document&&of(uB,e.options.injectNonce,"selection"),[new th({key:new td("selection"),props:{decorations:r=>r.selection.empty||e.isFocused||!e.isEditable||sK(r.selection)||e.view.dragging?null:nV.create(r.doc,[nH.inline(r.selection.from,r.selection.to,{class:t.className})])}})]}});var uz=oN.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new td(this.name),r=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(r).includes(e.name));return[new th({key:t,appendTransaction:(e,n,i)=>{let{doc:s,tr:o,schema:a}=i,l=t.getState(i),h=s.content.size,c=a.nodes[r];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&l)return o.insert(h,c.create())},state:{init:(e,t)=>
171!u$({node:t.tr.doc.lastChild,types:n}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!u$({node:e.doc.lastChild,types:n})}})]}}),uF=oN.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>uT(e,t),redo:()=>({state:e,dispatch:t})=>uO(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new th({key:uC,state:{init:()=>new uy(um.empty,um.empty,null,0,-1),apply:(t,r,n)=>(function(e,t,r,n){let i=r.getMeta(uC),s;if(i)return i.historyState;r.getMeta(uA)&&(e=new uy(e.done,e.undone,null,0,-1));let o=r.getMeta("appendedTransaction");if(0==r.steps.length)return e;if(o&&o.getMeta(uC))if(o.getMeta(uC).redo)return new uy(e.done.addTransform(r,void 0,n,uS(t)),e.undone,ub(r.mapping.maps),e.prevTime,e.prevComposition);else return new uy(e.done,e.undone.addTransform(r,void 0,n,uS(t)),null,e.prevTime,e.prevComposition);if(!1===r.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))if(s=r.getMeta("rebased"))return new uy(e.done.rebased(r,s),e.undone.rebased(r,s),uw(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);else return new uy(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),uw(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);{let i=r.getMeta("composition"),s=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(r.time||0)-n.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach((e,n)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&n>=t[i]&&(r=!0)}),r}(r,e.prevRanges)),a=o?uw(e.prevRanges,r.mapping):ub(r.mapping.maps);return new uy(e.done.addTransform(r,s?t.selection.getBookmark():void 0,n,uS(t)),um.empty,a,r.time,null==i?e.prevComposition:i)}})(r,n,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,n="historyUndo"==r?uT:"historyRedo"==r?uO:null;return!!n&&!!e.editable&&(t.preventDefault(),n(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),uH=oN.create({name:"starterKit",addExtensions(){var e,t,r,n;let i=[];return!1!==this.options.bold&&i.push(lL.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(lP.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(cS.configure(this.options.bulletList)),!1!==this.options.code&&i.push(lz.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(lW.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(lU.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(uM.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(uR.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(lV.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(lq.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(uF.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(lK.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(lQ.configure(this.options.italic)),!1!==this.options.listItem&&i.push(cD.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(cJ.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(cb.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(c2.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(c8.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(ue.configure(this.options.strike)),!1!==this.options.text&&i.push(ut.configure(this.options.text)),!1!==this.options.underline&&i.push(ur.configure(null==(r=this.options)?void 0:r.underline)),!1!==this.options.trailingNode&&i.push(uz.configure(null==(n=this.options)?void 0:n.trailingNode)),i}});e.s(["default",0,uH],56378),e.s(["default",0,uL],55841);let uW=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,uU=oX.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",sM(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,r,n,i,s,o;let a=null!=(t=null==(r=e.attrs)?void 0:r.src)?t:"",l=null!=(n=null==(i=e.attrs)?void 0:i.alt)?n:"",h=null!=(s=null==(o=e.attrs)?void 0:o.title)?s:"";return h?`![${l}](${a} "${h}")`:`![${l}](${a})`}
171,addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:e,minWidth:t,minHeight:r,alwaysPreserveAspectRatio:n}=this.options.resize,i=new Set(["src","width","height"]);return({node:s,getPos:o,HTMLAttributes:a,editor:l})=>{let h=document.createElement("img");h.draggable=!1;let c=sM(this.options.HTMLAttributes,a);Object.entries(c).forEach(([e,t])=>{if(null!=t)switch(e){case"src":case"width":case"height":break;default:h.setAttribute(e,t)}}),null!==c.src&&(h.src=c.src);let u={...a},d=e=>{if("string"==typeof e&&""!==e){h.getAttribute("src")!==e&&(h.src=e);return}h.hasAttribute("src")&&h.removeAttribute("src"),""!==h.src&&(h.src="")};d(a.src);let f=new oY({element:h,editor:l,node:s,getPos:o,onResize:(e,t)=>{h.style.width=`${e}px`,h.style.height=`${t}px`},onCommit:(e,t)=>{let r=o();void 0!==r&&this.editor.chain().setNodeSelection(r).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==s.type)return!1;let t=l.extensionManager.attributes.filter(t=>t.type===e.type.name),r=sR(e,t);return Object.keys(u).forEach(e=>{i.has(e)||e in r||h.removeAttribute(e)}),Object.entries(r).forEach(([e,t])=>{i.has(e)||(null!=t?h.setAttribute(e,t):h.removeAttribute(e))}),d(r.src),u=r,!0},options:{directions:e,min:{width:t,height:r},preserveAspectRatio:!0===n}}),p=f.dom,m=()=>{p.style.visibility="",p.style.pointerEvents=""};return p.style.visibility="hidden",p.style.pointerEvents="none",h.complete&&h.naturalWidth>0?m():(h.onload=m,h.onerror=m),f}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[oK({find:uW,type:this.type,getAttributes:e=>{let[,,t,r,n]=e;return{src:r,alt:t,title:n}}})]}});e.s(["default",0,uU],3869);var uV=oN.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(r=>t.updateAttributes(r,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:r})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?r.unsetTextAlign():r.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});e.s(["default",0,uV],97643);var uq=e.i(88227);let uK=oX.create({name:"video",group:"block",draggable:!0,addOptions:()=>({allowFullscreen:!0,controls:!0,HTMLAttributes:{class:"w-full h-auto rounded-md overflow-hidden"}}),addAttributes:()=>({src:{default:null}}),parseHTML:()=>[{tag:'div[data-type="video"]'},{tag:"video"}],renderHTML({HTMLAttributes:e}){return["div",sM(this.options.HTMLAttributes,e,{"data-type":"video"}),["video",{src:e.src}]]},addNodeView:()=>aI(({node:e})=>{let r=(0,uq.getVideoComponent)();return r?(0,t.jsx)(r,{...{url:e.attrs.src,mode:"inline",autoPlay:!1}}):(0,t.jsx)("video",{src:e.attrs.src,controls:!0,className:"w-full rounded-md"})}),addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}});e.s(["Video",0,uK],30152)},44844,42570,599,17399,94008,74323,e=>{"use strict";e.i(47167);var t=e.i(91536);let r="Hyperlink",n=null,i=()=>(n||(n=(0,t.createClient)()),n),s=async(e,t)=>{let n=i();try{let{data:i,error:s}=await n.storage.from(r).upload(t,e,{upsert:!0,cacheControl:"3600"});if(s)throw s;return i}catch(e){throw console.error("Error uploading file:",e),e}};e.s(["getPublicUrl",0,e=>{let{data:t}=i().storage.from(r).getPublicUrl(e);return t.publicUrl},"uploadFile",0,s],44844);var o=e.i(95187);let a=(0,o.createServerReference)("40ac0de142d7ea7e2007eac984a787618146e571b0",o.callServer,void 0,o.findSourceMapURL,"s
171aveFileAction");e.s(["saveFileAction",0,a],42570);let l=(0,o.createServerReference)("4054bc91c0d7a3b2266de152273f2a332f7d1af829",o.callServer,void 0,o.findSourceMapURL,"deleteFileAction");e.s(["deleteFileAction",0,l],599);let h=(0,o.createServerReference)("6097c8c865b654d825b8f66c9371d6de1cc68540fb",o.callServer,void 0,o.findSourceMapURL,"updateFileAltAction");e.s(["updateFileAltAction",0,h],17399);var c=e.i(75254);let u=(0,c.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);e.s(["File",0,u],94008);let d=(0,c.default)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);e.s(["PlusCircle",0,d],74323)},7649,e=>{"use strict";var t=e.i(6321);e.s(["CheckCircleIcon",()=>t.default])},35041,18702,80170,48308,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(94499),i=e.i(56378),s=e.i(63612),o=e.i(76399),a=e.i(55841),l=e.i(3869),h=e.i(97643),c=e.i(30152),u=e.i(38155);e.i(47167);var d=e.i(2003),f=e.i(72591),p=e.i(49231),m=e.i(57688),g=e.i(91536),y=e.i(44844),v=e.i(42570),b=e.i(599),w=e.i(17399),x=e.i(94008),k=e.i(74323),S=e.i(7649);function C({open:e,onOpenChange:n,value:i,onChange:s,onSave:o,allowedTypes:a,multi:l,onConfirm:h,initialSelectedSrcs:c}){let[A,E]=(0,r.useState)([]),[T,O]=(0,r.useState)(!1),[M,R]=(0,r.useState)(!1),[N,P]=(0,r.useState)([]),_=(0,r.useRef)(null),[D,I]=(0,r.useState)(null),[j,L]=(0,r.useState)(()=>({src:i.src,alt:i.alt,width:i.width??null,height:i.height??null})),[B,$]=(0,r.useState)({}),[z,F]=(0,r.useState)(!1),[H,W]=(0,r.useState)(!1),[U,V]=(0,r.useState)(!1),q=(0,r.useMemo)(()=>{if(!a||0===a.length)return"";let e=[];return a.includes("image")&&e.push("image/*"),a.includes("video")&&e.push("video/*"),a.includes("audio")&&e.push("audio/*"),a.includes("file")&&e.push("application/*","text/*",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".zip",".csv",".json",".md",".txt"),e.join(",")}
171,[a]);(0,r.useEffect)(()=>{if(e)if(O(!0),(async()=>{try{let e=(0,g.createClient)(),{data:t}=await e.from("files").select("id, src, alt, width, height, type, mime, size").eq("site_id","regattagrove").order("created_at",{ascending:!1}).limit(100),r=t||[];a&&a.length>0&&(r=r.filter(e=>a.includes(((e,t)=>{if(e?.startsWith("image/"))return"image";if(e?.startsWith("video/"))return"video";if(e?.startsWith("audio/"))return"audio";let r=t||"";return/\.(png|jpe?g|webp|gif|svg|avif)$/i.test(r)?"image":/\.(mp4|webm|mov|m4v|avi)$/i.test(r)?"video":/\.(mp3|wav|ogg|m4a|flac)$/i.test(r)?"audio":"file"})(e.mime||null,e.src)))),E(r)}catch{E([])}finally{O(!1)}})(),L({src:i.src,alt:i.alt,width:i.width??null,height:i.height??null}),l&&Array.isArray(c)&&c.length>0){let e={};c.forEach(t=>{e[t]={src:t,alt:"",width:null,height:null}}),$(e)}else $({})},[e]);let K=async e=>{let t=Array.from(e.target.files||[]);if(0===t.length)return;let r=t;if(a&&a.length>0&&(r=t.filter(e=>{let t=e.type?.split("/")?.[0];return a.includes("image"===t?"image":"video"===t?"video":"audio"===t?"audio":"file")})),0===r.length){_.current&&(_.current.value="");return}let n=r.map(e=>({id:Math.random().toString(36).substring(7),name:e.name,status:"uploading",file:e}));P(e=>[...n,...e]),R(!0),_.current&&(_.current.value="");try{await Promise.allSettled(n.map(async e=>{let r=e.file;try{let n,s,o,a,h={w:null,h:null};if(r.type?.startsWith("image/")){let e=URL.createObjectURL(r),t=new window.Image,n=await new Promise((r,n)=>{t.onload=()=>r({w:t.naturalWidth,h:t.naturalHeight}),t.onerror=n,t.src=e});URL.revokeObjectURL(e),h={w:n.w,h:n.h}}let c=(a=(((o=(s=(n=(r.name||"file").trim()).match(/(\.[a-zA-Z0-9]+)$/))?s[1].toLowerCase():"")?n.slice(0,-o.length):n).toLowerCase().replace(/[^a-z0-9._-]+/g,"_").replace(/_+/g,"_").replace(/^[_\.]+|[_\.]+$/g,"")||"file").slice(0,100),`${a}${o}`.slice(0,140)),u=`uploads/${Date.now()}_${c}`;await (0,y.uploadFile)(r,u);let d=(0,y.getPublicUrl)(u),f=new FormData;f.set("src",d);let p=1===t.length&&i.alt||"";f.set("alt",p),f.set("width",String(h.w||0)),f.set("height",String(h.h||0)),f.set("mime",r.type||""),f.set("size",String(r.size||0));let m=r.type?.startsWith("image/")?"image":r.type?.startsWith("video/")?"video":r.type?.startsWith("audio/")?"audio":"file";f.set("type",m),f.set("storage_path",u),f.set("bucket","Hyperlink"),f.set("path",window.location.pathname);let g=await (0,v.saveFileAction)(f);if(g?.ok){if(P(t=>t.filter(t=>t.id!==e.id)),E(e=>[{id:g.id,src:d,alt:p,width:h.w,height:h.h,type:m,mime:r.type||null,size:r.size||null},...e]),1===t.length){let e={src:d,alt:p,width:h.w||null,height:h.h||null};L(e),l&&$(t=>({...t,[e.src]:e}))}}else throw Error(g?.error||"Save action failed")}catch(r){console.error(r);let t=r instanceof Error?r.message:"Upload failed";P(r=>r.map(r=>r.id===e.id?{...r,status:"error",errorMessage:t}:r))}}))}finally{R(!1)}};return(0,t.jsx)(d.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(d.DialogContent,{className:"sm:max-w-4xl zero border-border bg-background text-foreground overflow-y-auto max-h-[85vh]",children:[(0,t.jsx)(d.DialogHeader,{children:(0,t.jsx)(d.DialogTitle,{children:"Edit Media"})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"relative w-full h-[220px] rounded-md overflow-hidden bg-muted",children:j.src?/\.(png|jpe?g|webp|gif|svg|avif)$/i.test(j.src||"")?(0,t.jsx)(m.default,{src:j.src,alt:j.alt||"preview",fill:!0,className:"object-contain"}):(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-foreground/80",children:[(0,t.jsx)(x.File,{className:"h-6 w-6"}),(0,t.jsx)("div",{className:"text-xs truncate max-w-[80%]",title:j.src,children:j.src.split("?")[0].split("#")[0].split("/").pop()||j.src}),(0,t.jsx)("a",{href:j.src,target:"_blank",rel:"noreferrer",className:"text-[11px] underline",children:"Open"})]}):null}),!!(j.width&&j.height)&&(0,t.jsxs)("div",{className:"text-[11px] text-muted-foreground",children:[Number(j.width)||0,"×",Number(j.height)||0,"px"]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(p.Label,{className:"text-xs",children:"Src URL"}),(0,t.jsx)(f.Input,{value:j.src,onChange:e=>L(t=>({...t,src:e.target.value})),placeholder:"https://...",disabled:!0,readOnly:!0})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(p.Label,{className:"text-xs",children:"Alt text"}),(0,t.jsx)(f.Input,{value:j.alt,onChange:e=>L(t=>({...t,alt:e.target.value})),placeholder:"Descriptive alt"})]})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(u.Button,{variant:"secondary",disabled:(()=>
171{if(!j.src||z)return!0;let e=A.find(e=>e.src===j.src);return!e||(j.alt||"")===(e.alt||"")})(),onClick:async()=>{let e=A.find(e=>e.src===j.src);if(e)try{F(!0),await (0,w.updateFileAltAction)(e.id,j.alt||""),E(t=>t.map(t=>t.id===e.id?{...t,alt:j.alt||""}:t)),l&&$(e=>e[j.src]?{...e,[j.src]:{...e[j.src],alt:j.alt||""}}:e)}finally{F(!1)}},children:z?"Updating…":"Update meta"})}),(0,t.jsx)("input",{ref:_,type:"file",multiple:!0,accept:q,className:"hidden",onChange:K})]}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:T?"Loading…":`${A.length} item${1===A.length?"":"s"}`})}),T?(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Loading…"}):(0,t.jsxs)("div",{className:"zero grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 overflow-y-auto max-h-[calc(85vh-220px-24rem)] pr-3",children:[(0,t.jsxs)("button",{className:"border rounded-md overflow-hidden text-left hover:border-primary flex flex-col items-center justify-center py-6 bg-muted/40",onClick:()=>_.current?.click(),disabled:M,children:[(0,t.jsx)(k.PlusCircle,{className:"h-8 w-8 text-primary mb-2"}),(0,t.jsx)("div",{className:"text-xs font-medium",children:M?"Uploading…":"Upload Media"})]}),N.map(e=>(0,t.jsxs)("div",{className:"relative border rounded-md overflow-hidden text-left border-dashed border-primary/50 flex flex-col items-center justify-center bg-muted/20 opacity-80",children:[(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 p-2",children:["uploading"===e.status?(0,t.jsx)("div",{className:"animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full"}):(0,t.jsx)("div",{className:"text-destructive font-bold text-xs",children:"Error"}),(0,t.jsx)("div",{className:"text-[10px] text-center w-full truncate px-1",children:e.name}),"error"===e.status&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"text-[10px] text-destructive/80 text-center max-w-[90%] break-words",children:e.errorMessage||"Upload failed"}),(0,t.jsx)("button",{className:"text-[10px] underline text-muted-foreground",onClick:t=>{t.stopPropagation(),P(t=>t.filter(t=>t.id!==e.id))},children:"Dismiss"})]})]}),(0,t.jsx)("div",{className:"w-full pt-[100%]"})]},e.id)),A.map(e=>{let r="image"===e.type||e.mime?.startsWith("image/")||/\.(png|jpe?g|webp|gif|svg)$/i.test(e.src||""),n=(e.src||"").split("?")[0].split("#")[0].split("/").pop()||"",i=n.length>30?`${n.slice(0,18)}…${n.slice(-11)}`:n,s=l?!!B[e.src||""]:j.src===e.src;return(0,t.jsxs)("div",{className:`relative border rounded-md overflow-hidden text-left hover:border-primary ${s?"border-primary ring-2 ring-primary":""}`,children:[(0,t.jsx)("button",{className:"absolute top-1 right-1 z-10 h-6 w-6 rounded-full bg-black/60 text-white text-xs flex items-center justify-center",title:"Delete",onClick:t=>{t.stopPropagation(),I(e.id)},children:"×"}),(0,t.jsxs)("button",{className:"w-full text-left",onClick:()=>{let t={src:e.src,alt:e.alt||"",width:e.width||null,height:e.height||null};l&&$(e=>{let r=t.src,n={...e};return n[r]?delete n[r]:n[r]=t,n}),L(t)},children:[(0,t.jsx)("div",{className:"relative w-full pt-[100%] bg-muted",children:r?e.src&&(0,t.jsx)(m.default,{src:e.src,alt:e.alt||"",fill:!0,className:"object-cover"}):(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 text-xs text-foreground/80",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(x.File,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"font-mono",children:"FILE"})]}),(0,t.jsx)("div",{className:"text-[10px] text-foreground/70 max-w-[88%] text-center break-words",children:i})]})}),(0,t.jsxs)("div",{className:"p-1",children:[(0,t.jsx)("div",{className:"text-xs truncate",title:e.alt||"",children:e.alt||e.src?.split("/").pop()||"(no label)"}),r?(0,t.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.width||0,"×",e.height||0,"px"]}):(0,t.jsx)("div",{className:"text-[10px] text-muted-foreground",children:(e=>{if(!e||e<=0)return"";let t=["B","KB","MB","GB"],r=0,n=e;for(;n>=1024&&r<t.length-1;)n/=1024,r++;let i=n>=100?0:n>=10?1:2;return`${n.toFixed(i)} ${t[r]}`})(e.size||null)})]})]})]},e.id)}),0===A.length&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"No media yet"})]})]}),(0,t.jsxs)(d.DialogFooter,{children:[U&&(0,t.jsxs)("div",{className:"text-primary flex items-center",children:[(0,t.jsx)(S.CheckCircleIcon,{className:"h-4 w-4 mr-1"}),(0,t.jsx)("span",{children:"Saved"})]}),(0,t.jsx)(u.Button,{onClick:async()=>
171{if(W(!0),l&&h){let e=Object.values(B);if(e.length>0){h(e),V(!0),setTimeout(()=>{V(!1),W(!1),n(!1)},800);return}}let e=A.find(e=>e.src===j.src);e&&(await (0,w.updateFileAltAction)(e.id,j.alt||""),E(t=>t.map(t=>t.id===e.id?{...t,alt:j.alt||""}:t))),s({src:j.src,alt:j.alt,width:j.width??null,height:j.height??null});let t=await o?.({src:j.src,alt:j.alt});t?.ok!==!1?(V(!0),setTimeout(()=>{V(!1),W(!1),n(!1)},800)):W(!1)},disabled:H,children:H?"Saving…":l?"Add Selected":"Save Changes"})]}),(0,t.jsx)(d.Dialog,{open:!!D,onOpenChange:e=>{e||I(null)},children:(0,t.jsxs)(d.DialogContent,{className:"sm:max-w-sm zero bg-background text-foreground overflow-y-auto max-h-[85vh]",children:[(0,t.jsx)(d.DialogHeader,{children:(0,t.jsx)(d.DialogTitle,{children:"Delete media?"})}),(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:"This will remove the item from the media library."}),(0,t.jsxs)("div",{className:"mt-4 flex justify-end gap-2",children:[(0,t.jsx)(u.Button,{variant:"ghost",onClick:()=>I(null),children:"Cancel"}),(0,t.jsx)(u.Button,{variant:"destructive",onClick:async()=>{if(!D)return;let e=A.find(e=>e.id===D),t=await (0,b.deleteFileAction)(D);t?.ok&&(E(e=>e.filter(e=>e.id!==D)),e&&i.src===e.src&&s({src:"",alt:"",width:null,height:null})),I(null)},children:"Delete"})]})]})})]})})}e.s(["default",0,C],18702),e.s(["default",0,function({value:e,onChange:m,className:g}){let y=(0,r.useRef)(e||""),[v,b]=(0,r.useState)(!1),[w,x]=(0,r.useState)(!1),[k,S]=(0,r.useState)(""),A=(0,n.useEditor)({extensions:[i.default,o.default,s.default.configure({openOnClick:!0,autolink:!0,protocols:["http","https","mailto","tel"]}),l.default,c.Video,a.default.configure({placeholder:"Start typing…"}),h.default.configure({types:["heading","paragraph"]})],content:e||"",immediatelyRender:!1,onUpdate:({editor:e})=>{let t=e.getHTML();t!==y.current&&(y.current=t,m(t))},editorProps:{attributes:{class:"prose min-h-[160px] p-3 outline-none"}}});(0,r.useEffect)(()=>{if(!A)return;let t=A.getHTML(),r=e||"";t!==r&&(A.commands.setContent(r,{emitUpdate:!1}),y.current=r)},[e,A]);let E=()=>{A&&(k?A.chain().focus().extendMarkRange("link").setLink({href:k}).run():A.chain().focus().extendMarkRange("link").unsetLink().run(),x(!1))};return(0,t.jsxs)("div",{className:["w-full flex flex-col gap-2",g||""].join(" "),children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1 rounded-md border border-border bg-card p-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleBold().run(),"aria-pressed":A?.isActive("bold"),children:"B"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleItalic().run(),"aria-pressed":A?.isActive("italic"),children:"I"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleUnderline().run(),"aria-pressed":A?.isActive("underline"),children:"U"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleStrike().run(),"aria-pressed":A?.isActive("strike"),children:"S"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleHeading({level:1}).run(),"aria-pressed":A?.isActive("heading",{level:1}),children:"H1"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleHeading({level:2}).run(),"aria-pressed":A?.isActive("heading",{level:2}),children:"H2"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleHeading({level:3}).run(),"aria-pressed":A?.isActive("heading",{level:3}),children:"H3"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleBulletList().run(),"aria-pressed":A?.isActive("bulletList"),children:"• List"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleOrderedList().run(),"aria-pressed":A?.isActive("orderedList"),children:"1. List"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A&&void(!A||(S(A.getAttributes("link").href||""),x(!0))),"aria-pressed":A?.isActive("link"),
171children:"Link"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleBlockquote().run(),"aria-pressed":A?.isActive("blockquote"),children:"❝"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().toggleCode().run(),"aria-pressed":A?.isActive("code"),children:"</>"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.commands.setTextAlign("left"),children:"⟸"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.commands.setTextAlign("center"),children:"⟂"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.commands.setTextAlign("right"),children:"⟹"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ml-auto",children:[(0,t.jsx)(u.Button,{variant:"outline",size:"sm",onClick:()=>b(!0),children:"Add media"}),(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>A?.chain().focus().unsetAllMarks().clearNodes().run(),children:"Clear"})]})]}),(0,t.jsx)("div",{className:"border border-border rounded-md overflow-hidden",children:(0,t.jsx)(n.EditorContent,{editor:A,className:"min-h-[160px]"})}),(0,t.jsx)(C,{open:v,onOpenChange:b,value:{src:"",alt:"",width:0,height:0},onChange:()=>{},allowedTypes:["image","video"],multi:!0,initialSelectedSrcs:[],onConfirm:e=>{var t;t=e.map(e=>({src:e.src,alt:e.alt})),A&&t.forEach(e=>{/\.(mp4|webm|ogg|mov)$/i.test(e.src)?A.commands.setVideo({src:e.src}):A.commands.setImage({src:e.src,alt:e.alt||""})})}}),(0,t.jsx)(d.Dialog,{open:w,onOpenChange:x,children:(0,t.jsxs)(d.DialogContent,{children:[(0,t.jsx)(d.DialogHeader,{children:(0,t.jsx)(d.DialogTitle,{children:"Insert Link"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-2 py-4",children:[(0,t.jsx)(p.Label,{htmlFor:"link-url",children:"URL"}),(0,t.jsx)(f.Input,{id:"link-url",value:k,onChange:e=>S(e.target.value),placeholder:"https://example.com",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E())}})]}),(0,t.jsxs)(d.DialogFooter,{children:[(0,t.jsx)(u.Button,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),(0,t.jsx)(u.Button,{onClick:E,children:"Save"})]})]})})]})}],35041);var A=e.i(75254);let E=(0,A.default)("file-headphone",[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]]);e.s(["FileAudio",0,E],80170);let T=(0,A.default)("file-play",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]]);e.s(["FileVideo",0,T],48308)},72908,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(65725),i=e.i(30774),s=e.i(12140),o=e.i(49989),a=e.i(29359),l=e.i(15080),h=e.i(72591),c=e.i(27389),u=e.i(49231),d=e.i(38155),f=e.i(19566),p=e.i(35041),m=e.i(37727),g=e.i(94008),y=e.i(80170),v=e.i(48308),b=e.i(85170),w=e.i(55900),x=e.i(64659);e.i(44844);var k=e.i(18702),S=e.i(35223),C=e.i(95187);let A=(0,C.createServerReference)("00397f71b5c856ac3632435e62f520fc36938e3980",C.callServer,void 0,C.findSourceMapURL,"fetchPickerProducts");function E({value:e,onChange:n}){let[i,s]=(0,r.useState)([]),[o,a]=(0,r.useState)(!0);return((0,r.useEffect)(()=>{A().then(e=>{s(e),a(!1)})},[]),o)?(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Loading products..."}):(0,t.jsxs)(f.Select,{value:e||void 0,onValueChange:n,children:[(0,t.jsx)(f.SelectTrigger,{className:"w-full text-xs",children:(0,t.jsx)(f.SelectValue,{placeholder:"Select a product"})}),(0,t.jsx)(f.SelectContent,{children:i.map(e=>(0,t.jsx)(f.SelectItem,{value:e.slug,className:"text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,t.jsx)("div",{className:"w-6 h-6 relative rounded overflow-hidden",children:(0,t.jsx)(S.LoadImage,{src:e.image,alt:e.name,width:24,height:24,className:"object-cover"})}),e.name]})},e.slug))})]})}let T=(0,C.createServerReference)("400b4edbed67334ef8a3749a615f15d22afd22790c",C.callServer,void 0,C.findSourceMapURL,"fetchPickerCpt");function O({type:e,value:n,onChange:i}){let[s,o]=(0,r.useState)([]),[a,l]=(0,r.useState)(!0);return((0,r.useEffect)(()=>{let t=!1;return l(!0),T(e).then(e=>{t||(o(e),l(!1))}),()=>{t=!0}},[e]),a)?(0,t.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Loading ",e,"…"]}):(0,t.jsxs)(f.Select,{value:n||void 0,onValueChange:i,children:[(0,t.jsx)(f.SelectTrigger,{className:"w-full text-xs",children:(0,t.jsx)(f.SelectValue,{placeholder:`Select ${e}`})}),(0,t.jsx)(f.SelectContent,{children:s.map(e=>(0,t.jsx)(f.SelectItem,{value:e.slug,className:"text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e.image?(0,t.jsx)("div",{className:"w-6 h-6 relative rounded overflow-hidden shrink-0",children:(0,t.jsx)(S.LoadImage,{src:e.image,alt:e.name,width:24,height:24,className:"object-cover"})}):null,e.name]})},e.slug))})]})}let M=(e,t,r)=>{if(0===t.length)return r;let[n,...i]=t,s=Array.isArray(e)?[...e]:{...e};return s[n]=M((e??{})[n],i,r),s},R=(e,t)=>{if(0===t.length)return e;let[r,...n]=t,i=Array.isArray(e)?[...e]:{...e};if(0===n.length){if(Array.isArray(i)){let e=Number(r);
171i.splice(e,1)}else delete i[r];return i}return i[r]=R((e??{})[r],n),i},N=(e,t,r,n)=>{let i=0===t.length?e:t.reduce((e,t)=>e?.[t],e);if(!Array.isArray(i))return e;let s=[...i],o=s.splice(r,1)[0];return(s.splice(n,0,o),0===t.length)?s:M(e,t,s)},P=e=>{if(Array.isArray(e))return[];if(null===e)return null;switch(typeof e){case"object":return{};case"number":return 0;case"boolean":return!1;default:return""}},_=e=>{if(Array.isArray(e))return[];if(null===e)return null;if("object"!=typeof e)return P(e);let t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,null===t||"object"!=typeof t||Array.isArray(t)?P(t):_(t)]));return et(e)?{src:"",alt:"",width:0,height:0,...t}:t},D=3,I=e=>"string"==typeof e&&/<\/?[a-z][\s\S]*>/i.test(e),j=/^(description|desc|answer|body|excerpt|content|contentHtml)$/i;function L(e,t,r){let n="string"==typeof r?.format?r.format.toLowerCase():"";if("html"===n||"richtext"===n)return!0;let i=r?.label??"";return!!(/\(html\)/i.test(i)||I(e)||t&&j.test(t))}let B=(e,t,r)=>e.some(([e])=>r[e]?.span||t[`_${e}_span`])?D:Math.min(D,Math.max(1,e.filter(([,e])=>(null===e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)&&!I(e)).length||1)),$=(e,t,r,n)=>e?1===t?`grid grid-cols-1 ${n}`:2===t?`grid grid-cols-2 ${n}`:`grid grid-cols-3 ${n}`:r,z=(e,t,r=!0)=>{let n=t<=2?"col-span-2":"col-span-3";return"full"===e||3===e||"3"===e?n:2===e||"2"===e?t>=2?"col-span-2":n:1===e||"1"===e?"col-span-1":r?n:""};function F({item:e,path:r,setDraft:n}){let i=(e,t)=>n(n=>M(n,[...r,e],t));return(0,t.jsxs)("div",{className:"flex flex-col gap-1.5 sm:flex-row",children:[(0,t.jsx)(h.Input,{className:"h-8 text-xs sm:flex-1",value:e.label??"",onChange:e=>i("label",e.target.value),placeholder:"Button text (e.g. Get Tickets)"}),(0,t.jsx)(h.Input,{className:"h-8 text-xs sm:flex-[1.4]",value:e.href??"",onChange:e=>i("href",e.target.value),placeholder:"https://..."})]})}function H({item:e,path:r,setDraft:n}){let i=(e,t)=>n(n=>M(n,[...r,e],t)),s="description"in e&&!("desc"in e)?"description":"desc";return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(h.Input,{className:"h-8 text-xs",value:e.name??"",onChange:e=>i("name",e.target.value),placeholder:"Name"}),"price"in e&&(0,t.jsx)(h.Input,{className:"h-8 w-24 shrink-0 text-xs",value:e.price??"",onChange:e=>i("price",e.target.value),placeholder:"Price"})]}),s in e&&(0,t.jsx)(c.Textarea,{className:"min-h-[52px] text-xs leading-relaxed",value:e[s]??"",onChange:e=>i(s,e.target.value),placeholder:"Description"})]})}let W=e=>{if(!e)return null;let t=e.match(/^cms_cpt_([a-z0-9]+)_(.+)$/i);return t?t[1].toLowerCase():null},U=e=>{let t,r;return e?((t=e).startsWith("cms_shopify_product_")&&(t=t.replace("cms_shopify_product_","")),(r=t.match(/^cms_cpt_[a-z0-9]+_(.+)$/i))&&(t=r[1]),t.startsWith("_")&&(t=t.slice(1)),t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_\-]+/g," ").trim().toLowerCase()).replace(/\b\w/g,e=>e.toUpperCase()):""},V=["wysiwyg","heading","gallery","split","video","slider","cta","image"],q={wysiwyg:{type:"wysiwyg",align:"center",html:"<p></p>"},heading:{type:"heading",text:""},gallery:{type:"gallery",images:[{src:"",alt:"",span:12,tone:"dark"}]},split:{type:"split",image_side:"left",image:{src:"",alt:"",tone:"light"},html:"<p></p>"},video:{type:"video",url:"",cover:{src:"",alt:""},size:"1/1",aspectRatio:"aspect-[16/9]",captions:""},slider:{type:"slider",slides:[{src:"",alt:""}]},cta:{type:"cta",label:"Start a Project",href:"/contact"},image:{type:"image",image:{src:"",alt:""},size:"1/1",aspectRatio:"aspect-[16/9]"}},K={type:[...V],align:["center","left"],image_side:["left","right"],tone:["light","dark","blush"],textAlign:["left","center","right","justify"],size:["1/1","1/2","1/3","1/4","1/5","1/6","2/3"],aspectRatio:["aspect-[16/9]","aspect-[16/10]","aspect-[16/8]","aspect-[16/6]","aspect-[16/5]","aspect-[16/4]","aspect-[16/12]","aspect-square","aspect-[4/3]","aspect-[3/2]","aspect-[2/1]","aspect-[3/4]","aspect-[9/16]"],category:["weekly","special","brunch","holiday","holidays"]},J=e=>String(e||"").replace(/<[^>]*>/g,"").trim(),G=(e,t)=>{if(!e)return null;let r=K[e];if(!r)return null;if("type"===e){let e=String(t??"");if(e&&!V.includes(e))return null}if("size"===e){let e=String(t??"");if(e&&!r.includes(e))return null}return r};function Y({value:e,options:r,onChange:n,onClear:i}){let s=e&&!r.includes(e)?[e,...r]:r;return(0,t.jsxs)("div",{className:"flex items-center gap-1 w-full",children:[(0,t.jsxs)(f.Select,{value:e||void 0,onValueChange:n,children:[(0,t.jsx)(f.SelectTrigger,{className:"h-10 text-xs",children:(0,t.jsx)(f.SelectValue,{placeholder:"Select…"})}),(0,t.jsx)(f.SelectContent,{children:s.map(e=>(0,t.jsx)(f.SelectItem,{value:e,className:"text-xs",children:e},e))})]}),(0,t.jsx)(d.Button,{variant:"ghost",size:"sm",tabIndex:-1,onClick:i,"aria-label":"Clear",children:(0,t.jsx)(m.X,{className:"h-3 w-3"})})]})}function X({children:e,decorations:r=!0}){return(0,t.jsxs)("div",{className:`flex w-full items-start rounded-md transition-colors group relative ${r?"py-1.5":"py-0"}`,children:[r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-[1px] bg-border group-hover:bg-primary"}),(0,t.jsx)("div",{className:"w-[7px] h-[7px] translate-x-[-3px] border-[3px] border-background bg-border group-hover:bg-primary rounded-full mt-2.5"}),(0,t.jsx)("div",{className:"w-3 h-[1px] transition translate-x-[-3px] bg-gradient-to-r from-border to-transparent group-hover:bg-primary mr-1.5 mt-[calc(.625rem+3px)]"})]}),(0,t.jsx)("div",{className:"flex-1",children:e})]})}let Q=e=>{if(!(e<2))return{backgroundColor:"var(--background)",backgroundImage:"linear-gradient(rgba(255,255,255,0.04), rgba(255,255,255,0.03))",borderColor:"rgba(255,255,255,0.09)"}};
171function Z({value:e,onChange:r,className:n,placeholder:i,type:s="text"}){return(0,t.jsx)(h.Input,{type:s,value:e,onChange:e=>r(e.target.value),className:n,placeholder:i})}function ee({value:e,onChange:r,onClear:n,placeholder:i}){let s="string"==typeof e&&!!e&&!!(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i.test(e)||/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i.test(e)),o=s?(e=>{if(!e)return null;if(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)){let t=e.replace("#","");if(3===t.length||4===t.length){let e=t[0],r=t[1],n=t[2];return`#${e}${e}${r}${r}${n}${n}`}return 8===t.length||6===t.length?`#${t.substring(0,6)}`:`#${t}`}if("u"<typeof document)return null;let t=document.createElement("div");t.style.color=e,document.body.appendChild(t);let r=getComputedStyle(t).color;document.body.removeChild(t);let n=r.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(!n)return null;let i=e=>e.toString(16).padStart(2,"0"),s=i(parseInt(n[1])),o=i(parseInt(n[2])),a=i(parseInt(n[3]));return`#${s}${o}${a}`})(e):null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,t.jsxs)("div",{className:"relative w-6 h-6",children:[(0,t.jsx)("div",{className:"w-6 h-6 rounded-full border border-border",style:{background:e},title:e}),(0,t.jsx)("input",{type:"color",value:o||"#000000",onChange:e=>r(e.target.value),className:"absolute inset-0 w-6 h-6 opacity-0 cursor-pointer"})]}),(0,t.jsx)(Z,{value:e,onChange:r,onClear:n,className:"text-xs",placeholder:i})]})}let et=e=>!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.src,er=e=>!!e&&/\.(png|jpe?g|gif|webp|avif|svg)$/i.test(e);function en({value:e,onChange:n,depth:i=0}){let{src:s}=e,[o,a]=(0,r.useState)(!1),l=s&&/\.(mp3|wav|ogg|m4a|flac)$/i.test(s)?y.FileAudio:s&&/\.(mp4|webm|mov|m4v|avi)$/i.test(s)?v.FileVideo:s&&/\.(pdf|docx?|pptx?|xlsx?|txt|md)$/i.test(s)?b.FileText:g.File,h="string"==typeof s?s.split("?")[0].split("#")[0].split("/").pop()||s:"";return(0,t.jsxs)("div",{className:"border rounded-md p-2 space-y-2",style:Q(i),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"relative w-20 h-20 rounded-md overflow-hidden bg-muted flex items-center justify-center text-muted-foreground",children:(0,t.jsx)(l,{className:"w-8 h-8"})}),(0,t.jsxs)("div",{className:"text-xs min-w-0",children:[(0,t.jsx)("div",{className:"font-medium truncate max-w-[240px]",title:h,children:h||"(no file)"}),(0,t.jsx)("div",{className:"text-muted-foreground truncate max-w-[240px]",title:s,children:s||""})]}),(0,t.jsxs)("div",{className:"ml-auto",children:[(0,t.jsx)(d.Button,{variant:"outline",size:"sm",onClick:()=>a(!0),children:"Add/Edit media"}),(0,t.jsx)(k.default,{open:o,onOpenChange:a,value:{src:e.src||"",alt:e.alt||"",width:Number(e.width)||0,height:Number(e.height)||0},onChange:t=>n({...e,src:t.src,alt:t.alt,width:Number(t.width)||0,height:Number(t.height)||0}),allowedTypes:(()=>{let t=e?.type;if(!t)return;let r=e=>"image"===e||"img"===e?"image":"video"===e?"video":"audio"===e||"music"===e?"audio":"file";return Array.isArray(t)?t.map(e=>r(String(e))).filter(Boolean):[r(String(t))]})()})]})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(Z,{value:s||"",onChange:t=>n({...e,src:t}),onClear:()=>n({...e,src:""}),className:"text-xs",placeholder:"https://.../file"})})]})}function ei({items:e,path:n,setDraft:i}){let[s,o]=(0,r.useState)(!1),a=(()=>{let t=e?.[0]?.type;if(!t)return;let r=e=>"image"===e||"img"===e?"image":"video"===e?"video":"audio"===e||"music"===e?"audio":"file";return Array.isArray(t)?t.map(e=>r(String(e))).filter(Boolean):[r(String(t))]})(),l=new Set(["src","alt","width","height","type"]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:e.map((e,r)=>{var s;let o,a;return(0,t.jsxs)("div",{className:"relative border rounded-md overflow-hidden bg-muted",draggable:!0,onDragStart:e=>{e.dataTransfer.setData("text/plain",String(r)),e.dataTransfer.effectAllowed="move"},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},onDrop:e=>{e.preventDefault();let t=Number(e.dataTransfer.getData("text/plain")||-1);Number.isNaN(t)||-1===t||t===r||i(e=>N(e,n,t,r))},children:[er(e?.src)?(0,t.jsx)("div",{className:"aspect-square",children:(0,t.jsx)(S.LoadImage,{src:e.src,alt:e.alt||"",width:300,height:300,className:"w-full h-full object-cover"})}):(0,t.jsxs)("div",{className:"aspect-square flex flex-col items-center justify-center text-xs text-foreground
171/80 px-1 text-center",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(g.File,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"font-mono",children:"FILE"})]}),(0,t.jsx)("div",{className:"text-[10px] text-foreground/70 mt-1 break-words max-w-[90%]",children:(s=e?.src||"",(o=(s||"")?.split("?")[0].split("#")[0].split("/").pop()||"").length>30?`${o.slice(0,18)}…${o.slice(-11)}`:o)})]}),0===(a=Object.keys(e||{}).filter(e=>!l.has(e))).length?null:(0,t.jsx)("div",{className:"p-2 bg-background/80 text-foreground space-y-1 border-t",children:a.map(s=>{let o=e[s],a=e=>i(t=>M(t,[...n,r,s],e));if("boolean"==typeof o)return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)(u.Label,{className:"text-[11px]",children:s}),(0,t.jsx)("button",{type:"button","aria-pressed":!!o,onClick:()=>a(!o),className:`relative inline-flex h-4 w-8 items-center rounded-full ${o?"bg-primary":"bg-muted"}`,children:(0,t.jsx)("span",{className:`inline-block h-3 w-3 transform bg-background rounded-full ${o?"translate-x-4":"translate-x-1"}`})})]},s);if("number"==typeof o)return(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsx)(u.Label,{className:"text-[11px]",children:s}),(0,t.jsx)(h.Input,{value:String(o),onChange:e=>a(Number(e.target.value||0)),className:"text-[11px] h-7"})]},s);if("string"==typeof o||null==o){let e=G(s,String(o??""));return(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsx)(u.Label,{className:"text-[11px]",children:s}),e?(0,t.jsxs)(f.Select,{value:String(o??"")||void 0,onValueChange:a,children:[(0,t.jsx)(f.SelectTrigger,{className:"h-7 text-[11px]",children:(0,t.jsx)(f.SelectValue,{placeholder:"Select…"})}),(0,t.jsx)(f.SelectContent,{children:e.map(e=>(0,t.jsx)(f.SelectItem,{value:e,className:"text-xs",children:e},e))})]}):(0,t.jsx)(h.Input,{value:String(o??""),onChange:e=>a(e.target.value),className:"text-[11px] h-7"})]},s)}return(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(u.Label,{className:"text-[11px]",children:s}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:Array.isArray(o)?"[array]":"[object]"})]},s)})}),(0,t.jsx)("button",{className:"absolute top-1 right-1 z-10 h-6 w-6 rounded-full bg-black/60 text-white text-xs flex items-center justify-center",title:"Remove",onClick:()=>i(e=>{let t=0===n.length?e:n.reduce((e,t)=>e?.[t],e);if(!Array.isArray(t))return e;if(t.length>1)return R(e,[...n,r]);let i=t[0]||{},s=Object.keys(i||{});return M(e,[...n,0],s.length>0?Object.fromEntries(s.map(e=>[e,P(i[e])])):{src:"",alt:"",width:0,height:0})}),children:"×"})]},r)})}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(d.Button,{variant:"outline",size:"sm",onClick:()=>o(!0),children:"Add/Edit media…"})}),(0,t.jsx)(k.default,{open:s,onOpenChange:o,value:{src:"",alt:"",width:0,height:0},onChange:()=>{},allowedTypes:a,multi:!0,initialSelectedSrcs:e.map(e=>e?.src).filter(Boolean),onConfirm:e=>{i(t=>{let r=0===n.length?t:n.reduce((e,t)=>e?.[t],t),i=Array.isArray(r)&&r.length>0?r[0]:{};return M(t,n,e.map((e,t)=>({...Object.fromEntries(Object.entries(Array.isArray(r)&&r[t]||i||{}).filter(([e])=>!l.has(e)).map(([e,n])=>{let i=Array.isArray(r)&&r[t]&&void 0!==r[t][e]?r[t][e]:P(n);return[e,i]})),src:e.src,alt:e.alt||"",width:Number(e.width)||0,height:Number(e.height)||0})))})}})]})}function es({value:e,onChange:n,allowedTypes:i,depth:s=0}){let[o,a]=(0,r.useState)(e),[l,h]=(0,r.useState)(!1),[c,u]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{a(e)},[e]),(0,t.jsxs)("div",{className:"border rounded-md p-2 space-y-2",style:Q(s),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Image"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Button,{variant:"outline",size:"sm",onClick:()=>u(!0),children:"Add/Edit media"}),(0,t.jsx)(k.default,{open:c,onOpenChange:u,value:{src:o.src,alt:o.alt,width:Number(o.width)||0,height:Number(o.height)||0},onChange:e=>{let t={src:e.src,width:Number(e.width)||0,height:Number(e.height)||0,alt:e.alt};a(e=>({...e,...t})),n(t)},allowedTypes:i})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"relative w-20 h-20 rounded-md overflow-hidden bg-muted",children:e.src&&(0,t.jsx)(S.LoadImage,{src:e.src,alt:e.alt||"",width:142,height:142,className:"absolute inset-0 object-cover"})}),(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"font-medium truncate max-w-[240px]",title:e.alt,children:e.alt||"(no alt)"}),(0,t.jsxs)("div",{className:"text-muted-foreground",children:[Number(e.width)||0,"×",Number(e.height)||0,"px"]})]})]})]})}function eo({data:e,path:r=[],fieldKey:n,setDraft:i,bottomRef:s,decorations:o,useColumns:a=!0,depth:l=0,placeholder:h,fieldLabel:c,fieldFormat:u}){if(Array.isArray(e))return(0,t.jsx)(el,{data:e,path:r,fieldKey:n,setDraft:i,bottomRef:s,decorations:o,useColumns:a,depth:l+1,placeholder:h,fieldLabel:c,fieldFormat:u});if(null!==e&&"object"==typeof e){let n=Object.keys(e).map(t=>[t,e[t]]),h=e._ui||e._meta||{},c=new Set(Array.isArray(h.omit)?h.omit.filter(e=>"string"==typeof e):[]),u=n.filter(([e])=>!e.startsWith("_")&&!c.has(e)),d=(n,c,u=D)=>{let d="string"==typeof c&&/<\/?[a-z][\s\S]*>/i.test(c),f=L(c,n,{format:h[n]?.format,label:h[n]?.label}),p=null===c||"string"==typeof c||"number"==typeof c||"boolean"==typeof c,m=h[n]?.span||e[`_${n}_span`],g="";a&&(g=m?z(m,u,!1):!p||d||f?z("full",u,!0):"");let y="string"==typeof h[n]?.label?h[n].label:void 0,v="string"==typeof h[n]?.format?h[n].format:void 0;return(0,t.jsx)("div",{className:`${g} min-w-0`,children:(0,t.jsx)(el,{data:c,path:[...r,n],fieldKey:n,setDraft:i,bottomRef:s,decorations:o,useColumns:a,depth:l+1,placeholder:h[n]?.placeholder,fieldLabel:y,fieldFormat:v})},n)},f=Array.isArray(h.sections)?h.sections:null;if(f?.length){let r=new Set(f.flatMap(e=>e.keys||[])),n=u.filter(([e])=>!r.has(e));return(0,t.jsxs)("div",{className:"space-y-6",children:[f.map(r=>{let n,i=(r.keys||[]).filter(t=>t in e&&!String(t).startsWith("_")).map(t=>[t,e[t]]),s=2===(n=r.columns)||"2"===n?2:1===n||"1"===n?1:3===n||"3"===n?3:B(i,e,h);return(0,t.jsxs)("div",{className:"space-y-3 rounded-lg border border-white/[0.07] bg-white/[0.035] p-3",children:[(0,t.jsx)("p",{className:"text-sm font-semibold tracking-tight",children:r.title}),(0,t.jsx)("div",{className:$(a,s,"space-y-3","gap-x-3"),children:(r.keys||[]).map(t=>t in e&&!String(t).startsWith("_")?d(t,e[t],s):null)})]},r.title)}),n.length>0&&(0,t.jsx)("div",{className:$(a,B(n,e,h),"space-y-3","gap-x-3"),children:n.map(([e,t])=>d(e,t))})]})}let p=u.some(([,e])=>Array.isArray(e));
171return(0,t.jsx)("div",{className:$(a,B(u,e,h),p?"space-y-3":"space-y-1",p?"gap-3":"gap-x-3"),children:u.map(([e,t])=>d(e,t))})}return(0,t.jsx)(el,{data:e,path:r,fieldKey:n,setDraft:i,bottomRef:s,decorations:o,useColumns:a,depth:l+1,placeholder:h,fieldLabel:c,fieldFormat:u})}function ea(e,t){return"string"==typeof t&&t.trim()?t.trim():e?U(e):void 0}function el({data:e,path:r,fieldKey:n,setDraft:i,bottomRef:s,decorations:o,useColumns:a=!0,depth:l=0,placeholder:f,fieldLabel:g,fieldFormat:y}){let v=n??(r.length?String(r[r.length-1]):void 0),b=ea(v,g);if(Array.isArray(e)){if(e.length>0&&e.every(e=>et(e)))return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-2",children:[b&&(0,t.jsx)(u.Label,{className:"text-xs font-medium",children:b}),(0,t.jsx)(ei,{items:e,path:r,setDraft:i})]})});let h=e=>{if(!e||"object"!=typeof e||Array.isArray(e)||et(e))return!1;let t=Object.entries(e).filter(([e])=>!e.startsWith("_")).map(([e,t])=>t);return t.length>0&&t.every(e=>(null===e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)&&!I(e))},c=e=>Object.entries(e).filter(([e])=>!e.startsWith("_")).map(([,e])=>e),p=e.filter(e=>{let t=c(e);return h(e)&&t.length<=2&&t.every(e=>"string"!=typeof e||e.length<=48)}).length,g=a&&e.length>=3&&p/e.length>=.7;return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-2",children:["items"!==n&&(0,t.jsxs)(t.Fragment,{children:[b?(0,t.jsx)(u.Label,{className:"text-xs font-medium text-foreground",children:b}):null,f?(0,t.jsx)("p",{className:"text-[11px] leading-snug text-muted-foreground",children:f}):null]}),(0,t.jsxs)("div",{className:g?"grid grid-cols-3 gap-2":"space-y-2",children:[e.map((o,u)=>{let f=h(o),p=n&&n.startsWith("cms_shopify_product_"),y=W(n);return(0,t.jsxs)("div",{className:`${g&&!f?"col-span-3":""} flex overflow-hidden rounded-lg border border-white/[0.07] bg-white/[0.03]`,children:[(0,t.jsxs)("div",{className:"flex w-7 shrink-0 flex-col self-stretch border-r border-white/[0.06] bg-black/20",children:[(0,t.jsx)("button",{type:"button",className:"flex min-h-0 flex-1 items-center justify-center text-muted-foreground/80 hover:bg-white/10 hover:text-foreground disabled:opacity-20",onClick:()=>i(e=>N(e,r,u,Math.max(0,u-1))),disabled:0===u,"aria-label":"Move up",children:(0,t.jsx)(w.ChevronUp,{className:"h-4 w-4"})}),(0,t.jsx)("button",{type:"button",className:"flex min-h-0 flex-1 items-center justify-center text-muted-foreground/80 hover:bg-white/10 hover:text-foreground disabled:opacity-20",onClick:()=>i(t=>N(t,r,u,Math.min(e.length-1,u+1))),disabled:u===e.length-1,"aria-label":"Move down",children:(0,t.jsx)(x.ChevronDown,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 p-2",children:p&&("string"==typeof o||null===o)?(0,t.jsx)(E,{value:String(o??""),onChange:e=>i(t=>M(t,[...r,u],e))}):y&&("string"==typeof o||null===o)?(0,t.jsx)(O,{type:y,value:String(o??""),onChange:e=>i(t=>M(t,[...r,u],e))}):(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.keys(e).filter(e=>!e.startsWith("_"));return t.length<=2&&t.includes("label")&&t.includes("href")})(o)?(0,t.jsx)(F,{item:o,path:[...r,u],setDraft:i}):(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.keys(e).filter(e=>!e.startsWith("_"));return!!t.includes("name")&&(!!t.includes("price")||!!t.includes("desc")||!!t.includes("description"))&&t.every(e=>"name"===e||"price"===e||"desc"===e||"description"===e)})(o)?(0,t.jsx)(H,{item:o,path:[...r,u],setDraft:i}):(0,t.jsx)(eo,{data:o,path:[...r,u],setDraft:i,bottomRef:s,decorations:!1,useColumns:a&&!(f&&c(o).length>=3)&&(!g||!f),depth:l+1})}),(0,t.jsx)(d.Button,{variant:"ghost",size:"sm",tabIndex:-1,className:"mt-2 mr-2 h-7 w-7 shrink-0 p-0",onClick:()=>i(e=>R(e,[...r,u])),"aria-label":"Remove",children:(0,t.jsx)(m.X,{className:"h-3 w-3"})})]},u)}),(0,t.jsx)(d.Button,{variant:"secondary",size:"sm",className:`${g?"col-span-3":""} w-full`,onClick:()=>{i(e=>{let t=0===r.length?e:r.reduce((e,t)=>e?.[t],e),i="blocks"===n||"blocks"===r[r.length-1],s=i?{...q.wysiwyg}:"";if(!i&&t&&t.length>0){let e=t[0];s=Array.isArray(e)?[]:null!==e&&"object"==typeof e?_(t.find(e=>e&&"object"==typeof e&&!Array.isArray(e))??{}):"number"==typeof e?0:"boolean"!=typeof e&&""}let o=[...t||[],s];return 0===r.length?o:M(e,r,o)})},children:`Add ${U(n)}`})]})]})})}if(null!==e&&"object"==typeof e){if(et(e))return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-2",children:[n&&(0,t.jsx)("div",{className:"text-xs font-medium",children:ea(n,g)??U(n)}),er(e.src)?(0,t.jsx)(es,{value:{src:e.src,width:Number(e.width)||0,height:Number(e.height)||0,alt:e.alt||""},onChange:e=>i(t=>M(t,r,e)),depth:l,allowedTypes:(()=>{let t=e?.type;if(!t)return;let r=e=>"image"===e||"img"===e?"image":"video"===e?"video":"audio"===e||"music"===e?"audio":"file";return Array.isArray(t)?t.map(e=>
171r(String(e))).filter(Boolean):[r(String(t))]})()}):(0,t.jsx)(en,{value:{src:e.src,alt:e.alt,width:Number(e.width)||0,height:Number(e.height)||0},onChange:e=>i(t=>M(t,r,e)),depth:l}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(d.Button,{variant:"ghost",size:"sm",tabIndex:-1,onClick:()=>i(e=>R(e,r)),children:"Remove"})})]})});let h=Object.keys(e).map(t=>[t,e[t]]).filter(([e])=>!e.startsWith("_")),c=e._ui||e._meta||{};return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-3 rounded-lg border border-white/[0.07] bg-white/[0.035] p-3",children:[n&&(0,t.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:U(n)}),(0,t.jsx)("div",{className:$(a,B(h,e,c),"space-y-3","gap-3"),children:h.map(([n,o])=>{let d="string"==typeof o&&/<\/?[a-z][\s\S]*>/i.test(o),f=null===o||"string"==typeof o||"number"==typeof o||"boolean"==typeof o,p=c[n]?.span||e[`_${n}_span`],m="";if(a){let t=B(h,e,c);m=p?z(p,t,!1):!f||d?z("full",t,!0):""}let g=c[n]?.label||U(n);return(0,t.jsxs)("div",{className:`${m} space-y-1 min-w-0`,children:[(0,t.jsx)(u.Label,{className:"text-xs",children:g}),(0,t.jsx)(eo,{data:o,path:[...r,n],setDraft:i,bottomRef:s,decorations:!1,useColumns:a,depth:l+1,placeholder:c[n]?.placeholder,fieldLabel:g,fieldFormat:"string"==typeof c[n]?.format?c[n].format:void 0})]},n)})})]})})}let k=!!b&&!/^\d+$/.test(v||""),S=e=>{"type"===v&&"type"===r[r.length-1]&&r.some((e,t)=>"blocks"===e&&"number"==typeof r[t+1])&&"string"==typeof e?i(t=>{let n,i;return n=r.slice(0,-1),!(i=n.reduce((e,t)=>e?.[t],t))||"object"!=typeof i||Array.isArray(i)?M(t,r,e):M(t,n,((e,t)=>{let r=q[t];if(!r)return{...e||{},type:t};let n={...r,type:t};for(let t of Object.keys(r))"type"!==t&&e?.[t]!==void 0&&(n[t]=e[t]);if("heading"!==t||n.text||(n.text=J(e?.html||e?.text||"")),("wysiwyg"===t||"split"===t)&&!J(n.html||"")){let t=J(e?.text||"");t&&(n.html=`<p>${t}</p>`)}return"video"===t&&!n.url&&e?.url&&(n.url=e.url),("image"===t||"split"===t)&&e?.image&&(n.image=e.image),"slider"===t&&Array.isArray(e?.slides)&&(n.slides=e.slides),"gallery"===t&&Array.isArray(e?.images)&&(n.images=e.images),"cta"===t&&(e?.label&&(n.label=e.label),e?.href&&(n.href=e.href)),n})(i,e))}):i(t=>M(t,r,e))},C=null===e?"null":typeof e;if("boolean"===C)return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-1",children:[k&&(0,t.jsx)(u.Label,{className:"text-xs",children:b}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button","aria-pressed":!!e,onClick:()=>S(!e),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${e?"bg-primary":"bg-muted"}`,children:(0,t.jsx)("span",{className:`inline-block h-4 w-4 transform bg-background rounded-full transition-transform ${e?"translate-x-4":"translate-x-1"}`})}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground select-none",children:e?"On":"Off"})]})]})});if("number"===C){let n="recurrenceDays"===(r.length>=2?String(r[r.length-2]):"")?"Day 0–6 (see legend above)":f;return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-1",children:[k&&(0,t.jsx)(u.Label,{className:"text-xs",children:b}),(0,t.jsx)(Z,{value:String(e),onChange:e=>S(Number(e||0)),className:"text-xs",type:"number",placeholder:n})]})})}if("null"===C){let e=G(v,"");return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-1",children:[k&&(0,t.jsx)(u.Label,{className:"text-xs",children:b}),e?(0,t.jsx)(Y,{value:"",options:e,onChange:S,onClear:()=>S(null)}):(0,t.jsx)(h.Input,{value:"",onChange:e=>S(e.target.value),className:"text-xs",placeholder:""})]})})}let A=v&&v.startsWith("cms_shopify_product_"),T=W(v),P=G(v,String(e??"")),D=L(e,v,{format:y,label:b}),j=!D&&/^(embed|mapsUrl)$/i.test(v||"");return(0,t.jsx)(X,{decorations:o,children:(0,t.jsxs)("div",{className:"w-full space-y-1",children:[k&&(0,t.jsx)(u.Label,{className:"text-xs",children:b}),A?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(E,{value:String(e??""),onChange:S}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(d.Button,{variant:"ghost",size:"sm",tabIndex:-1,onClick:()=>S(null),"aria-label":"Set null",children:(0,t.jsx)(m.X,{className:"h-3 w-3"})})})]}):T?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(O,{type:T,value:String(e??""),onChange:S}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(d.Button,{variant:"ghost",size:"sm",tabIndex:-1,onClick:()=>S(null),"aria-label":"Set null",children:(0,t.jsx)(m.X,{className:"h-3 w-3"})})})]}):D?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(p.default,{value:String(e??""),onChange:S}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(d.Button,{variant:"ghost",size:"sm",tabIndex:-1,onClick:()=>S(null),"aria-label":"Set null",children:(0,t.jsx)(m.X,{className:"h-3 w-3"})})})]}):P?(0,t.jsx)(Y,{value:String(e??""),options:P,onChange:S,onClear:()=>S(null)}):j?(0,t.jsx)(c.Textarea,{value:String(e??""),onChange:e=>S(e.target.value),placeholder:f,className:"min-h-[88px] text-xs leading-relaxed"}):(0,t.jsx)(ee,{value:String(e??""),onChange:S,placeholder:f})]})})}e.s(["JsonModeSwitch",0,function({mode:e,onChange:r,disabledBlock:n}){return(0,t.jsxs)("div",{className:"inline-flex items-center rounded-md p-0.5 border bg-card text-xs",children:[(0,t.jsx)("button",{type:"button","aria-pressed":"block"===e,disabled:n,onClick:()=>r("block"),className:`px-3 py-2 rounded-l-sm ${"block"===e?"bg-secondary text-secondary-foreground hover:bg-primary hover:text-primary-foreground":"bg-card text-foreground hover:bg-primary hover:text-primary-foreground"} ${n?"opacity-50 cursor-not-allowed":""}`,children:"Form"}),(0,t.jsx)("button",{type:"button","aria-pressed":"raw"===e,onClick:()=>r("raw"),className:`px-3 py-2 rounded-r-sm ${"raw"===e?"bg-secondary text-secondary-foreground hover:bg-primary hover:text-primary-foreground":"bg-card text-foreground hover:bg-primary hover:text-primary-foreground"}`,children:"Code"})]})}
171,"default",0,function({value:e,onChange:h,height:c=60,hideDecorations:u=!1,mode:d,onModeChange:f,hideModeTabs:p,fillHeight:m,useFormGrid:g=!1}){let[y,v]=(0,r.useState)("block"),b=d??y,w=f??v,[x,k]=(0,r.useState)(JSON.stringify(e??{},null,2)),[S,C]=(0,r.useState)(e??{}),A=(0,r.useRef)(null);(0,r.useEffect)(()=>{C(e??{}),"raw"!==b&&k(JSON.stringify(e??{},null,2))},[e,b]),(0,r.useEffect)(()=>{if("block"===b)try{let e=JSON.stringify(S,null,2);e!==x&&k(e),h(S)}catch{}},[S,b]),(0,r.useEffect)(()=>{if("raw"!==b)return;let e=setTimeout(()=>{try{let e=JSON.parse(x);C(e),h(e)}catch{}},120);return()=>clearTimeout(e)},[x,b]);let E=(0,r.useMemo)(()=>{try{return JSON.parse(x),!0}catch{return!1}},[x]);return(0,t.jsxs)(n.Tabs,{value:b,onValueChange:e=>w(e),className:m?"flex h-full w-full flex-col":"w-full",children:[!p&&(0,t.jsxs)(n.TabsList,{className:"grid grid-cols-2 w-full",children:[(0,t.jsx)(n.TabsTrigger,{value:"block",disabled:!E,children:"Form"}),(0,t.jsx)(n.TabsTrigger,{value:"raw",children:"Code"})]}),(0,t.jsx)(n.TabsContent,{value:"block",className:m?"mt-0 min-h-0 flex-1":"mt-0",children:E?(0,t.jsx)(i.ScrollArea,{className:m?"h-full":`h-[${c}vh]`,children:(0,t.jsxs)("div",{className:"space-y-3 p-1 pr-4",children:[(0,t.jsx)(eo,{data:S,setDraft:C,bottomRef:A,decorations:!u,useColumns:g}),(0,t.jsx)("div",{ref:A})]})}):(0,t.jsx)("div",{className:"text-xs text-red-500 mb-2",children:"Code is invalid. Fix it to use the form."})}),(0,t.jsxs)(n.TabsContent,{value:"raw",className:m?"relative mt-0 min-h-0 flex-1":"mt-4",children:[(0,t.jsx)(s.default,{value:x,height:m?"100%":"70vh",className:m?"h-full w-full":"w-full",style:{width:"100%",height:m?"100%":void 0},extensions:[(0,o.json)(),l.EditorView.lineWrapping],theme:a.oneDark,onChange:k}),!E&&(0,t.jsx)("div",{className:m?"absolute bottom-2 left-2 text-xs text-red-500":"text-xs text-red-500 mt-2",children:"Invalid JSON"})]})]})}],72908)},28196,e=>{"use strict";var t=e.i(61653);e.s(["AlertCircleIcon",()=>t.default])}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.